DEVELOPER TUTORIAL · TYPESCRIPT SDK

Token Creator SDK Tutorial

Integrate native Sui Move token deployment into your dApp, game, or DAO portal in less than 5 minutes.

What You'll Build

Users click "Create Token" on YOUR platform → fill out the token parameters → sign with their connected Sui wallet → the verified Move bytecode compiles and deploys on Sui Mainnet with sub-second finality. Your platform collects your custom developer fee automatically.

STEP 01

Install the SDK & Peer Dependencies

Add the package to your React or Next.js repository:

npm install @pumpsui/token-creator-sdk @mysten/sui @mysten/dapp-kit
STEP 02

Initialize SDK Singleton

Configure your API credentials in src/lib/tokenSDK.ts:

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

// Initialize SDK with developer revenue wallet
export const tokenSDK = new PumpSuiTokenCreatorSDK(
  process.env.NEXT_PUBLIC_PUMPSUI_API_KEY!, // Your authenticated API key
  {
    developerWallet: process.env.NEXT_PUBLIC_DEV_WALLET!, // Your SUI receiving address
    developerFee: 3.0, // 3 SUI fee charged per token creation
    network: 'mainnet',
  }
);
STEP 03

Create Token Component

Call tokenSDK.createNativeToken inside your UI:

import React, { useState } from 'react';
import { useCurrentAccount } from '@mysten/dapp-kit';
import { tokenSDK } from '@/lib/tokenSDK';

export function CreateTokenButton() {
  const account = useCurrentAccount();
  const [isCreating, setIsCreating] = useState(false);

  const handleCreateToken = async () => {
    if (!account) return alert('Please connect your Sui wallet');

    setIsCreating(true);
    try {
      const result = await tokenSDK.createNativeToken({
        name: 'Alpha Governance Token',
        symbol: 'ALPHA',
        decimals: 9,
        totalSupply: 1_000_000_000,
        description: 'Decentralized governance token on Sui Move',
        userAddress: account.address,
        icon: 'https://blob.walrus.site/...', // Walrus or IPFS url
      });

      console.log('PTB Transaction Digest:', result.digest);
      console.log('Token Package ID:', result.packageId);
      alert(`Token Deployed! Package: ${result.packageId}`);
    } catch (err: any) {
      alert(`Creation failed: ${err.message}`);
    } finally {
      setIsCreating(false);
    }
  };

  return (
    <button
      onClick={handleCreateToken}
      disabled={isCreating}
      className="px-6 py-3 bg-gradient-to-r from-cyan-400 to-blue-500 text-slate-950 font-mono font-bold text-xs rounded-xl"
    >
      {isCreating ? 'Deploying Move Bytecode...' : 'Create Token on Sui'}
    </button>
  );
}

Revenue Routing

When users create tokens through your SDK instance with developerFee: 3.0, they pay 5.015 SUI total: 2.0 SUI platform fee, 3.0 SUI directly into your wallet, and ~0.015 SUI network gas.

Explore the SDK Reference

Check method signatures, type interfaces, and error handling patterns.