burn_tokens
Burn tokens from a Solana wallet to permanently remove them from circulation, reducing token supply by specifying wallet name, token mint address, and amount.
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 mint 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:354-371 (schema)Input schema definition for the burn_tokens tool, specifying the required parameters: walletName, tokenMint, and amount.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:351-372 (registration)Tool registration in the `tools` array, which is returned by the ListToolsRequestHandler. Includes name, description, and input schema.{ 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-1337 (registration)Dispatch registration in the switch statement of the CallToolRequestHandler, routing burn_tokens calls to the handleBurnTokens function.case "burn_tokens": result = await handleBurnTokens(args);