SDK Tutorial

Token Creator SDK - Quick Start

Integrate native SUI token creation into your dApp in 5 minutes

🎯 What Youll Build

Imagine you have a DAO platform and want members to create governance tokens directly from your interface. With the SDK, you can integrate token creation in just a few lines of code.

Result: Users click Create Token on YOUR platform → Fill form → Token created on SUI → You earn fees. All in your branded UI. 🚀

📋 Before You Start

3.React/Next.js project
4.Basic TypeScript knowledge
1

Install the SDK

Open your terminal in your React/Next.js project:

npm install @suilab/token-creator-sdk

Note: This installs the SDK and its dependencies (axios for API calls).

2

Initialize the SDK

Create a file src/lib/tokenSDK.ts:

import { SuiLabTokenCreatorSDK } from '@suilab/token-creator-sdk';

// Initialize SDK with your configuration
export const tokenSDK = new SuiLabTokenCreatorSDK(
  process.env.NEXT_PUBLIC_SUILAB_API_KEY!, // Your API key
  {
    developerWallet: process.env.NEXT_PUBLIC_DEV_WALLET!, // Your wallet
    developerFee: 3, // 3 SUI fee you charge users
    network: 'mainnet'
  }
);
3

Create Token Component

Create src/components/CreateTokenButton.tsx:

import { 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) {
      alert('Please connect your wallet');
      return;
    }

    setIsCreating(true);
    
    try {
      // Create token using SDK
      const result = await tokenSDK.createNativeToken({
        name: 'My DAO Token',
        symbol: 'DAO',
        decimals: 9,
        totalSupply: 10_000_000,
        description: 'Governance token for My DAO',
        userAddress: account.address,
        icon: 'https://example.com/icon.png' // optional
      });
      
      alert(`Token created! ID: ${result.tokenId}`);
      console.log('TX:', result.digest);
      
    } catch (error: any) {
      alert('Error: ' + error.message);
    } finally {
      setIsCreating(false);
    }
  };
  
  return (
    <button
      onClick={handleCreateToken}
      disabled={isCreating}
      className="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"
    >
      {isCreating ? 'Creating...' : 'Create Token'}
    </button>
  );
}
4

Use in Your Page

Add to any page:

import { CreateTokenButton } from '@/components/CreateTokenButton';

export default function DAOPage() {
  return (
    <div>
      <h1>Create Your DAO Token</h1>
      <CreateTokenButton />
    </div>
  );
}

Understanding Fees

When users create tokens, they pay:

Platform Fee: 2 SUI
Goes to SUILab (mandatory)
Developer Fee: Customizable
Goes to YOUR wallet (you set this)
Network Fee: ~0.05 SUI
Goes to SUI validators

Example: With developerFee: 3, users pay 5.05 SUI total (2 + 3 + 0.05)

🎁 What You Get

Quick Integration

Add to your dApp in minutes

💰

Revenue Stream

Earn fees from each creation

🎨

Your Branding

Keep users on your platform

🔒

Type Safe

Full TypeScript support

Ready for More?

Explore complete API reference and advanced examples

Need help? Contact us at support@suilab.fun