burn_tokens
Remove tokens permanently from a Solana wallet by burning them, reducing total supply and managing token economics.
Instructions
Burn tokens from a wallet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| walletName | Yes | Name of the wallet to burn tokens from | |
| tokenMint | Yes | Token mint address | |
| amount | Yes | Amount of tokens to burn (in token units) |
Implementation Reference
- src/index.ts:993-1028 (handler)The handler function that executes the burn_tokens tool. It retrieves the wallet, calculates the raw token amount based on decimals, gets the associated token account, and calls the Solana SPL `burn` instruction to burn the specified amount of tokens.async function handleBurnTokens(args: any) { const { walletName, tokenMint, amount } = args; const wallet = wallets.get(walletName); if (!wallet) { throw new Error(`Wallet '${walletName}' not found`); } ensureConnection(); const tokenMintPubkey = new PublicKey(tokenMint); const mintInfo = await getMint(connection, tokenMintPubkey); const rawAmount = BigInt(Math.floor(amount * Math.pow(10, mintInfo.decimals))); const tokenAccount = await getAssociatedTokenAddress( tokenMintPubkey, wallet.keypair.publicKey ); const signature = await burn( connection, wallet.keypair, tokenAccount, tokenMintPubkey, wallet.keypair, rawAmount ); return { success: true, signature, amount, tokenMint: tokenMint, explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}` }; }
- src/index.ts:352-372 (schema)The input schema definition for the burn_tokens tool, specifying parameters: walletName, tokenMint, and amount.name: "burn_tokens", description: "Burn tokens from a wallet", inputSchema: { type: "object", properties: { walletName: { type: "string", description: "Name of the wallet to burn tokens from" }, tokenMint: { type: "string", description: "Token mint address" }, amount: { type: "number", description: "Amount of tokens to burn (in token units)" } }, required: ["walletName", "tokenMint", "amount"] } },
- src/index.ts:1336-1338 (registration)The registration/dispatch case in the main CallToolRequestSchema handler's switch statement that routes calls to the handleBurnTokens function.case "burn_tokens": result = await handleBurnTokens(args); break;