Deploy fungible tokens on Sui with customizable parameters, including name, symbol, decimals, image URL, description, and initial supply. This guide covers the entire deployment process.

Usage

const result = await agent.deployToken({
    "My Token",         // name
    "https://...",      // imageUrl
    "MTK",              // symbol
    9,                  // decimals (optional)
    "1000000",          // totalSupply
    true,               // fixedSupply
    "this is my token"  // description
  }
);

console.log("Transaction result:", result);

Parameters

ParameterTypeRequiredDescription
namestringYesName of the token
imageUrlstringNoURL of the token image
symbolstringYesToken symbol
decimalsnumberNoDecimal places
totalSupplystringYesTotal token supply
fixedSupplybooleanYesWhether the supply is fixed
descriptionstringYesToken description

Example Prompts

Natural Language Prompts

"Deploying a token with the name My Token (symbol: MTK), featuring an image at https://getnimbus.io/_next/image?url=%2Fstatic%2FlogoNimbusLight.webp&w=128&q=75. It has 9 decimals, a total supply of 100,000, a fixed supply, and the description: 'my token'"

LangChain Tool Prompts

// Basic token deployment
{
   "name": "Basic Token",
   "symbol": "BS",
   "totalSupply": 1000000,
   "fixedSupply": true,
   "description": "This is an basic token!"
}

// Token with custom decimals
{
   "name": "Gaming Credits",
   "symbol": "GCRED",
   "decimals": 6,
   "totalSupply": 1000000,
   "fixedSupply": true,
   "description": "This is an awesome token!"
}

// Token with custom imageUrl
{
   "name": "Reward Points",
   "symbol": "RWPT",
   "imageUrl": "https://arweave.net/reward-points.json",
   "decimals": 9,
   "totalSupply": 1000000,
   "description": "This is a reward token!"
}

The LangChain tool expects a JSON string as input with the required parameters. It will handle parsing and execute the deployment seamlessly.

Example Implementation

import { SuiAgentKit, ICreateTokenForm } from "@getnimbus/sui-agent-kit";

async function deployGamingToken(agent: SuiAgentKit) {
  const token_metadata = ICreateTokenForm{
    name: "Gaming Credits",
    symbol: "GCRED",
    imageUrl: "https://example.com/token-metadata.json",
    decimals: 6,
    totalSupply: "1000000",
    fixedSupply: true,
    description: "Gaming Credits are used to purchase in-game items.",
  };

  const result = await agent.deployToken(token_metadata);

  return result;
}

Implementation Details

  • Supports the fungible token standard
  • Creates a token with zero seller fee basis points
  • Optionally mints the initial supply to the deployer’s wallet

Error Handling

try {
  const result = await agent.deployToken(...);
} catch (error) {
  // Handle deployment failures
  console.error("Token deployment failed:", error.message);
}

Best Practices

  1. Name Selection
  • Choose a unique and descriptive name.
  1. Initial Supply
  • Consider token economics when determining supply.
  • Ensure that supply * decimals remains below 1E28, the maximum value convertible to BigInt.
  1. Symbol Selection
  • Use 2-5 characters.
  • Uppercase letters are recommended.
  1. Security Considerations
  • Secure private keys.
  • Validate all input parameters.
  • Use trusted RPC endpoints.