Wallet Management

This guide covers the essentials of wallet operations on Starknet for AI agents. For complete API details and code examples, see the Wallet Skill documentation.

Overview

Starknet's native Account Abstraction means every wallet is a smart contract. This enables powerful features for AI agents:

FeatureDescription
Custom ValidationDefine spending rules, rate limits, and approval workflows
Session KeysGrant temporary, scoped permissions to agents
Paymaster SupportPay gas in any token or have it sponsored
Multi-callExecute multiple operations atomically

Core Operations

Check Balances

Query single or multiple token balances:

// Single token
const result = await mcpClient.callTool({
  name: "starknet_get_balance",
  arguments: {
    address: "0x...",
    token: "ETH", // ETH, STRK, USDC, USDT, or contract address
  }
});

// Multiple tokens (batch)
const result = await mcpClient.callTool({
  name: "starknet_get_balances",
  arguments: {
    address: "0x...",
    tokens: ["ETH", "STRK", "USDC"],
  }
});

Transfer Tokens

Send tokens with optional gasless mode:

const result = await mcpClient.callTool({
  name: "starknet_transfer",
  arguments: {
    recipient: "0x...",
    token: "STRK",
    amount: "10.5",
    gasfree: true,      // Optional: use paymaster
    gasToken: "USDC",   // Optional: pay gas in USDC
  }
});

Contract Interactions

Read state or execute transactions:

// Read (view function)
await mcpClient.callTool({
  name: "starknet_call_contract",
  arguments: {
    contractAddress: "0x...",
    entrypoint: "balanceOf",
    calldata: [accountAddress],
  }
});

// Write (transaction)
await mcpClient.callTool({
  name: "starknet_invoke_contract",
  arguments: {
    contractAddress: "0x...",
    entrypoint: "approve",
    calldata: [spenderAddress, ...amount],
  }
});

Session Keys for Agents

Session keys enable autonomous agent operation within defined guardrails:

  1. Owner creates session key with policies (allowed methods, spending limits, expiry)
  2. Agent operates using the session key
  3. Owner can revoke at any time

Reference Implementation

See Cartridge Controller for the production session key implementation on Starknet.

Token Addresses

TokenMainnet Address
ETH0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
STRK0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d
USDC0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8
USDT0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8

Next Steps