Skip to main content

NFT Operations

Methods for working with reputation NFTs.

mintReputationNFT

Mints a reputation NFT for a user.
async mintReputationNFT(userAddress: Address): Promise<Hex>

Parameters

NameTypeDescription
userAddressAddressAddress of the user

Returns

Hex - Transaction hash of the minting.

Example

const txHash = await sdk.mintReputationNFT('0x1234...');
console.log('NFT minted:', txHash);

Requirements

  • User must be registered
  • User must not already have an NFT

hasReputationNFT

Checks if a user has minted their reputation NFT.
async hasReputationNFT(userAddress: Address): Promise<boolean>

Parameters

NameTypeDescription
userAddressAddressAddress of the user

Returns

boolean - True if the user has an NFT, false otherwise.

Example

const hasNFT = await sdk.hasReputationNFT('0x1234...');
console.log('Has NFT:', hasNFT);

getTokenIdByUser

Gets the token ID for a user’s reputation NFT.
async getTokenIdByUser(userAddress: Address): Promise<bigint>

Parameters

NameTypeDescription
userAddressAddressAddress of the user

Returns

bigint - Token ID of the user’s NFT.

Example

const tokenId = await sdk.getTokenIdByUser('0x1234...');
console.log('Token ID:', tokenId);

getNFTTokenURI

Gets the token URI for an NFT.
async getNFTTokenURI(tokenId: bigint): Promise<string>

Parameters

NameTypeDescription
tokenIdbigintToken ID

Returns

string - Token URI.

Example

const tokenId = await sdk.getTokenIdByUser('0x1234...');
const tokenURI = await sdk.getNFTTokenURI(tokenId);
console.log('Token URI:', tokenURI);

getReputationNFTData

Gets the metadata for a user’s reputation NFT.
async getReputationNFTData(userAddress: Address): Promise<ReputationNFTData>

Parameters

NameTypeDescription
userAddressAddressAddress of the user

Returns

ReputationNFTData object containing NFT details.

Example

const nftData = await sdk.getReputationNFTData('0x1234...');
console.log('NFT Tier:', nftData.tier);
console.log('NFT Referrals:', nftData.referrals);
console.log('NFT Earnings:', nftData.earnings);

getNFTTotalSupply

Gets the total supply of reputation NFTs.
async getNFTTotalSupply(): Promise<bigint>

Returns

bigint - Total supply of NFTs.

Example

const supply = await sdk.getNFTTotalSupply();
console.log('Total NFTs minted:', supply);

generateBadgeSVG

Generates an SVG badge for display.
generateBadgeSVG(tier: number, referrals: number, earnings: bigint, rank: number): string

Parameters

NameTypeDescription
tiernumberBadge tier
referralsnumberNumber of referrals
earningsbigintTotal earnings in wei
ranknumberUser’s rank

Returns

string - Data URI of the SVG badge.

Example

const svg = sdk.generateBadgeSVG(2, 25, 1000000000000000000n, 5);
// Use this SVG in your UI