freeze_account
Prevent token transfers by freezing a Solana token account using freeze authority. Specify wallet, token mint, and account address to lock the account.
Instructions
Freeze a token account to prevent transfers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| walletName | Yes | Name of the wallet with freeze authority | |
| tokenMint | Yes | Token mint address | |
| accountAddress | Yes | Address of the token account to freeze |
Implementation Reference
- src/index.ts:1030-1056 (handler)The handler function that implements the core logic of the 'freeze_account' tool. It retrieves the wallet with freeze authority, constructs public keys, calls the SPL Token program's freezeAccount function, and returns the transaction signature and explorer URL.async function handleFreezeAccount(args: any) { const { walletName, tokenMint, accountAddress } = args; const wallet = wallets.get(walletName); if (!wallet) { throw new Error(`Wallet '${walletName}' not found`); } ensureConnection(); const tokenMintPubkey = new PublicKey(tokenMint); const accountPubkey = new PublicKey(accountAddress); const signature = await freezeAccount( connection, wallet.keypair, accountPubkey, tokenMintPubkey, wallet.keypair ); return { success: true, signature, accountAddress, explorerUrl: `https://explorer.solana.com/tx/${signature}?cluster=${currentNetwork}` }; }
- src/index.ts:374-393 (schema)The input schema definition for the 'freeze_account' tool, specifying parameters: walletName, tokenMint, and accountAddress.name: "freeze_account", description: "Freeze a token account to prevent transfers", inputSchema: { type: "object", properties: { walletName: { type: "string", description: "Name of the wallet with freeze authority" }, tokenMint: { type: "string", description: "Token mint address" }, accountAddress: { type: "string", description: "Address of the token account to freeze" } }, required: ["walletName", "tokenMint", "accountAddress"] }
- src/index.ts:1339-1341 (registration)The switch case in the main CallToolRequestSchema handler that registers and dispatches calls to the 'freeze_account' tool by invoking handleFreezeAccount.case "freeze_account": result = await handleFreezeAccount(args); break;
- src/index.ts:20-20 (helper)Import of the freezeAccount function from @solana/spl-token library, used as the core utility within the handler to perform the actual freezing operation.freezeAccount,