Deploy SPL Token

Learn how to deploy SPL tokens with Metaplex metadata

Deploy fungible tokens on Solana with Metaplex metadata support. This guide covers token deployment with customizable parameters including name, symbol, decimals, and initial supply.

Copy

const result = await agent.methods.deployToken(
  "My Token",          // name
  "https://...",       // uri
  "MTK",              // symbol
  9,                  // decimals (optional)
  1000000            // initialSupply (optional)
);

console.log("Token Mint Address:", result.mint.toString());

Parameter
Type
Required
Default
Description

name

string

Yes

-

The name of your token

uri

string

Yes

-

Metadata URI containing token information

symbol

string

Yes

-

Trading symbol for your token

decimals

number

No

9

Number of decimal places

initialSupply

number

No

undefined

Initial amount to mint

Copy

Copy

The LangChain tool expects a JSON string input with these parameters. The tool will handle parsing and execute the deployment.

Here’s a complete example showing token deployment with metadata:

Copy

The metadata URI should point to a JSON file following this format:

Copy

The toolkit provides a LangChain tool for token deployment:

Copy

  • Uses Metaplex’s UMI for token creation

  • Supports fungible token standard

  • Creates token with zero seller fee basis points

  • Optional initial supply minting to deployer’s wallet

  • Confirms transaction with ‘finalized’ commitment

The function includes comprehensive error handling:

Copy

  1. Metadata Preparation

    • Host metadata JSON before deployment

    • Use permanent storage solutions (e.g., Arweave)

    • Include all required metadata fields

  2. Initial Supply

    • Consider token economics when setting supply

    • Account for decimal places in calculations

    • Can mint more later if needed

  3. Symbol Selection

    • Use 2-5 characters

    • Ensure uniqueness

    • Uppercase letters recommended

  4. Security Considerations

    • Secure private keys

    • Validate all input parameters

    • Use trusted RPC endpoints

Last updated