DEVELOPER EXAMPLES · FULL IMPLEMENTATIONS

SDK Integration Examples

Real-world code recipes demonstrating how to build DAO launchers, gaming token faucets, and custom DeFi frontends on Sui.

1. DAO Governance Token Creator

A self-contained React component allowing DAO founders to deploy verified governance coins directly from your UI.

import React, { useState } from 'react';
import { useCurrentAccount } from '@mysten/dapp-kit';
import { PumpSuiTokenCreatorSDK } from '@pumpsui/token-creator-sdk';

const sdk = new PumpSuiTokenCreatorSDK(
  process.env.NEXT_PUBLIC_PUMPSUI_API_KEY!,
  {
    developerWallet: process.env.NEXT_PUBLIC_DEV_WALLET!,
    developerFee: 2.5,
    network: 'mainnet'
  }
);

export function DAOTokenCreator() {
  const account = useCurrentAccount();
  const [daoName, setDaoName] = useState('');
  const [isDeploying, setIsDeploying] = useState(false);

  const handleCreate = async () => {
    if (!account) return alert('Connect wallet first');
    setIsDeploying(true);
    try {
      const result = await sdk.createNativeToken({
        name: `${daoName} Governance`,
        symbol: daoName.slice(0, 5).toUpperCase(),
        decimals: 9,
        totalSupply: 10_000_000,
        description: `Governance token for ${daoName} DAO members.`,
        userAddress: account.address,
      });
      alert(`Token Deployed! Digest: ${result.digest}`);
    } catch (e: any) {
      alert(`Error: ${e.message}`);
    } finally {
      setIsDeploying(false);
    }
  };

  return (
    <button
      onClick={handleCreate}
      disabled={isDeploying || !account}
      className="px-5 py-2.5 bg-gradient-to-r from-cyan-400 to-blue-500 text-slate-950 font-mono font-bold text-xs rounded-xl"
    >
      {isDeploying ? 'Deploying DAO Coin...' : 'Launch DAO Token'}
    </button>
  );
}

2. Web3 Game Currency Pipeline

Node.js backend or serverless handler to mint isolated in-game currency with decentralized Walrus icon storage.

import { PumpSuiTokenCreatorSDK } from '@pumpsui/token-creator-sdk';

const sdk = new PumpSuiTokenCreatorSDK(API_KEY, {
  developerWallet: GAME_STUDIO_WALLET,
  developerFee: 5.0,
  network: 'mainnet'
});

export async function createGameCurrency(userAddress: string, gameTitle: string) {
  // Validate and estimate fees
  const fees = sdk.estimateFees();
  console.log(`Estimated total: ${fees.total} SUI (Dev Fee: ${fees.developerFee} SUI)`);

  return await sdk.createNativeToken({
    name: `${gameTitle} Gold Coins`,
    symbol: 'GOLD',
    decimals: 6, // 6 decimals optimized for in-game micro-denominations
    totalSupply: 500_000_000,
    description: `Official in-game currency for ${gameTitle} players.`,
    userAddress,
    icon: 'https://blob.walrus.site/game-coin.png',
  });
}

Check API Key Status & Rate Limits

Inspect your live quota consumption, request count, and endpoint health status.