token_approvals
Check token approvals and security risks for a wallet's assets across multiple blockchain networks. Identify which contracts can spend your tokens and assess potential vulnerabilities.
Instructions
Commonly used to get a list of approvals across all token contracts categorized by spenders for a wallet's assets. Required: chainName (blockchain network, e.g. eth-mainnet or 1), walletAddress (wallet address, supports ENS, RNS, Lens Handle, or Unstoppable Domain). Returns a list of ERC20 token approvals and their associated security risk levels.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | Yes | The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet'). | |
| walletAddress | Yes | The wallet address to get token approvals for. Supports wallet addresses, ENS, RNS, Lens Handle, or Unstoppable Domain names. |
Implementation Reference
- src/services/SecurityService.ts:42-63 (handler)The handler function that executes the 'token_approvals' tool logic by calling the GoldRushClient's SecurityService.getApprovals method.
async (params) => { try { const response = await goldRushClient.SecurityService.getApprovals( params.chainName as Chain, params.walletAddress ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } } - src/services/SecurityService.ts:25-64 (registration)The tool registration block for 'token_approvals' within the SecurityService.
server.tool( "token_approvals", "Commonly used to get a list of approvals across all token contracts categorized by spenders for a wallet's assets.\n" + "Required: chainName (blockchain network, e.g. eth-mainnet or 1), walletAddress (wallet address, supports ENS, RNS, Lens Handle, or Unstoppable Domain).\n" + "Returns a list of ERC20 token approvals and their associated security risk levels.", { chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), walletAddress: z .string() .describe( "The wallet address to get token approvals for. Supports wallet addresses, ENS, RNS, Lens Handle, or Unstoppable Domain names." ), }, async (params) => { try { const response = await goldRushClient.SecurityService.getApprovals( params.chainName as Chain, params.walletAddress ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } } ); - Input schema definition for the 'token_approvals' tool using Zod.
{ chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), walletAddress: z .string() .describe( "The wallet address to get token approvals for. Supports wallet addresses, ENS, RNS, Lens Handle, or Unstoppable Domain names." ), },