Skip to main content

Documentation Index

Fetch the complete documentation index at: https://suicamp.site/llms.txt

Use this file to discover all available pages before exploring further.

Setup Contracts

Configure the contract addresses and utility functions for interacting with USDC and NFT contracts.

Create Contracts Config

Update src/lib/contracts.ts:
export const CONTRACTS = {
  PACKAGE_ID: "0xa552a0057e4795edb5b6e5f0fbc9af98e69628a8dc96f11a363675c65eda17b1",
  USDC_TREASURY_CAP: "0xb172a6fb5da46b56ccaaf3374b9fcc0a5955653c6190f9073433a3f16e95db4e",
  NFT_TREASURY: "0x100ecbcc66d76ea44161940ecc0a637b26d8dcfc4903c1d355d7db946c13ae9a",
} as const;

// Token types for querying
export const USDC_TYPE = `${CONTRACTS.PACKAGE_ID}::usdc::USDC`;
export const NFT_TYPE = `${CONTRACTS.PACKAGE_ID}::psil_nft::PSILNFT`;

// Constants
export const USDC_DECIMALS = 6;
export const USDC_MINT_AMOUNT = 100;
export const NFT_MINT_PRICE = 100_000_000n; // 100 USDC

// Format USDC for display (100000000 -> "100.00")
export const formatUSDC = (amount: bigint | number): string => {
  const value = Number(amount) / 10 ** USDC_DECIMALS;
  return value.toLocaleString(undefined, {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
  });
};

// Parse USDC amount (100 -> 100000000n)
export const parseUSDC = (amount: number): bigint => {
  return BigInt(Math.floor(amount * 10 ** USDC_DECIMALS));
};

Understanding the Config

Contract Addresses

AddressDescription
PACKAGE_IDThe deployed Move package
USDC_TREASURY_CAPShared object for minting USDC
NFT_TREASURYShared object for NFT minting

Token Types

Token types are used to query balances and filter objects:
// Format: {package_id}::{module}::{type}
USDC_TYPE = "0x...::usdc::USDC"
NFT_TYPE = "0x...::psil_nft::PSILNFT"

Decimals

USDC uses 6 decimal places:
  • 100 USDC = 100_000_000 (raw value)
  • formatUSDC(100_000_000) returns "100.00"
  • parseUSDC(100) returns 100_000_000n

Next Steps

Create Hooks

Build custom hooks for blockchain interactions