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
Parameter | Type | Required | Description |
---|
name | string | Yes | Name of the token |
imageUrl | string | No | URL of the token image |
symbol | string | Yes | Token symbol |
decimals | number | No | Decimal places |
totalSupply | string | Yes | Total token supply |
fixedSupply | boolean | Yes | Whether the supply is fixed |
description | string | Yes | Token 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'"
// 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
- Name Selection
- Choose a unique and descriptive name.
- Initial Supply
- Consider token economics when determining supply.
- Ensure that supply * decimals remains below 1E28, the maximum value convertible to BigInt.
- Symbol Selection
- Use 2-5 characters.
- Uppercase letters are recommended.
- Security Considerations
- Secure private keys.
- Validate all input parameters.
- Use trusted RPC endpoints.