azeth_deposit
Deposit ETH or ERC-20 tokens from your external wallet into your Azeth smart account to fund transfers, payments, and operations.
Instructions
Deposit ETH or ERC-20 tokens from your EOA wallet into your own Azeth smart account.
Use this when: Your smart account needs funding for transfers, x402 payments, or other operations.
SECURITY: This verifies ON-CHAIN that the target is a real Azeth smart account owned by you. You cannot deposit to someone else's smart account.
Returns: Transaction hash and deposit details.
Note: If no target account is specified, deposits to your first smart account. For ETH deposits, omit the token parameter. For ERC-20 tokens, provide the token contract address AND decimals. The amount is in human-readable units (e.g., "0.01" for 0.01 ETH, "100" for 100 USDC).
Example: { "amount": "0.01" } or { "amount": "50", "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "decimals": 6 }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet"). | |
| amount | Yes | Amount to deposit in human-readable units (e.g., "0.01" for 0.01 ETH). | |
| token | No | ERC-20 token contract address. Omit for native ETH deposit. | |
| decimals | No | Token decimals for ERC-20 deposits. REQUIRED when token is specified. Use 6 for USDC, 18 for WETH. | |
| smartAccount | No | Target smart account address, name, or "#N" (account index). If omitted, deposits to your first Azeth account. |
Implementation Reference
- src/tools/account.ts:417-501 (handler)The implementation of the azeth_deposit MCP tool, which enables depositing ETH or ERC-20 tokens into a smart account.
// azeth_deposit // ────────────────────────────────────────────── server.registerTool( 'azeth_deposit', { description: [ 'Deposit ETH or ERC-20 tokens from your EOA wallet into your own Azeth smart account.', '', 'Use this when: Your smart account needs funding for transfers, x402 payments, or other operations.', '', 'SECURITY: This verifies ON-CHAIN that the target is a real Azeth smart account owned by you.', 'You cannot deposit to someone else\'s smart account.', '', 'Returns: Transaction hash and deposit details.', '', 'Note: If no target account is specified, deposits to your first smart account.', 'For ETH deposits, omit the token parameter. For ERC-20 tokens, provide the token contract address AND decimals.', 'The amount is in human-readable units (e.g., "0.01" for 0.01 ETH, "100" for 100 USDC).', '', 'Example: { "amount": "0.01" } or { "amount": "50", "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "decimals": 6 }', ].join('\n'), inputSchema: z.object({ chain: z.string().optional().describe('Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").'), amount: z.string().describe('Amount to deposit in human-readable units (e.g., "0.01" for 0.01 ETH).'), token: z.string().optional().describe('ERC-20 token contract address. Omit for native ETH deposit.'), decimals: z.coerce.number().int().min(0).max(18).optional() .describe('Token decimals for ERC-20 deposits. REQUIRED when token is specified. Use 6 for USDC, 18 for WETH.'), smartAccount: z.string().optional() .describe('Target smart account address, name, or "#N" (account index). If omitted, deposits to your first Azeth account.'), }), }, async (args) => { if (args.token && !validateAddress(args.token)) { return error('INVALID_INPUT', `Invalid token address: "${args.token}".`, 'Must be 0x-prefixed followed by 40 hex characters.'); } if (args.token && args.decimals === undefined) { return error('INVALID_INPUT', 'decimals is required when token address is provided.', 'Use 6 for USDC, 18 for WETH.'); } let client; try { client = await createClient(args.chain); let target: `0x${string}`; if (args.smartAccount) { try { target = (await resolveSmartAccount(args.smartAccount, client))!; } catch (resolveErr) { return handleError(resolveErr); } } else { target = await client.resolveSmartAccount(); } const decimals = args.decimals ?? 18; let amount: bigint; try { amount = args.token ? parseUnits(args.amount, decimals) : parseEther(args.amount); } catch { return error('INVALID_INPUT', 'Invalid amount format — must be a valid decimal number.'); } const result = await client.deposit({ to: target, amount, token: args.token as `0x${string}` | undefined, }); return success( { txHash: result.txHash, from: result.from, to: result.to, amount: args.amount, token: result.token, }, { txHash: result.txHash }, ); } catch (err) { return handleError(err); } finally { try { await client?.destroy(); } catch (e) { process.stderr.write(`[azeth-mcp] destroy error: ${e instanceof Error ? e.message : String(e)}\n`); } } }, );