Skip to content

Wallet & Treasury API

The Wallet API gives agents and developers programmatic access to on-chain USDC balance, spending history, pool allocation, and limits — enabling autonomous financial management.

Overview

Your JarvisClaw wallet is backed by an HD (Hierarchical Deterministic) wallet with on-chain USDC on two networks:

NetworkAssetDescription
Base (EIP-155:8453)USDCPrimary settlement chain
SolanaUSDCAlternative chain

All payments are settled on-chain via x402 protocol. There is no platform quota or prepaid credits — your balance is always real USDC on-chain.

Check Balance

bash
curl https://api.jarvisclaw.ai/v1/wallet/balance \
  -H "Authorization: Bearer sk-YOUR-KEY"
python
from jarvisclaw import Agent

agent = Agent(api_key="sk-YOUR-KEY")
bal = agent.balance()
print(f"Total: ${bal['balance_usd']}")
print(f"Base: {bal['wallets']['base']['usdc']} USDC")
print(f"Solana: {bal['wallets']['solana']['usdc']} USDC")
go
bal, _ := c.WalletBalance(ctx)
fmt.Printf("Total: %s USD\n", bal.TotalUSD)
fmt.Printf("Base: %s USDC\n", bal.HDWallet.BaseUSDC)
fmt.Printf("Solana: %s USDC\n", bal.HDWallet.SolanaUSDC)

Response

json
{
  "balance_usd": "9.001396",
  "wallets": {
    "base": {
      "usdc": "9.001396",
      "address": "0xYourBaseDepositAddress"
    },
    "solana": {
      "usdc": "0.000000",
      "address": "YourSolanaDepositAddress"
    }
  }
}
  • balance_usd — total USDC balance across all chains
  • wallets.base.usdc — on-chain USDC on Base
  • wallets.solana.usdc — on-chain USDC on Solana

Pool Allocation (Treasury)

Your balance is logically split into pools for autonomous budget management:

PoolDefault %Purpose
Operations60%Day-to-day API calls
Insurance15%Retry buffer for upstream failures
Savings15%Reserved for expansion
Dividends10%Owner withdrawal
bash
curl https://api.jarvisclaw.ai/v1/wallet/pools \
  -H "Authorization: Bearer sk-YOUR-KEY"
json
{
  "allocation": {
    "operations": 0.60,
    "insurance": 0.15,
    "savings": 0.15,
    "dividends": 0.10
  },
  "pool_balances": {
    "operations": "10.4640",
    "insurance": "2.6160",
    "savings": "2.6160",
    "dividends": "1.7440"
  }
}

Spending Limits

Get and set autonomous spending limits:

bash
# Get current limits
curl https://api.jarvisclaw.ai/v1/wallet/limits \
  -H "Authorization: Bearer sk-YOUR-KEY"

# Update limits
curl -X PUT https://api.jarvisclaw.ai/v1/wallet/limits \
  -H "Authorization: Bearer sk-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "daily_max_usd": 30.0,
    "per_request_max_usd": 0.5,
    "monthly_max_usd": 200.0,
    "auto_pause_below_usd": 5.0
  }'

Transaction History

bash
curl "https://api.jarvisclaw.ai/v1/wallet/history?page=1&page_size=20" \
  -H "Authorization: Bearer sk-YOUR-KEY"
json
{
  "transactions": [
    {
      "id": 12345,
      "amount_quota": -300,
      "category": "inference",
      "model": "deepseek-chat",
      "use_time_seconds": 2,
      "created_at": 1718700000
    }
  ],
  "total": 1234,
  "page": 1
}

Treasury SDK (Go)

For agents that need full financial autonomy — multi-pool management, rule engines, circuit breakers:

bash
go get github.com/api-jarvisclaw/agent-treasury-go
go
import "github.com/api-jarvisclaw/agent-treasury-go/treasury"

provider := treasury.NewJarvisClawProvider("https://api.jarvisclaw.ai", "sk-YOUR-KEY")
t := treasury.New(treasury.Config{
    AgentID: "my-trading-bot",
    Allocation: treasury.PoolAllocation{
        Operations: 0.70,
        Insurance:  0.10,
        Savings:    0.10,
        Dividends:  0.10,
    },
}, provider)

// Check budget before spending
ok, _ := t.ApproveSpend(0.003, "inference")
if ok {
    // make the API call
    t.Spend(0.003, "inference", "deepseek-chat")
}

// Autopilot: circuit breaker pauses spending if success rate drops
snapshot := t.Snapshot()
fmt.Printf("Operations pool: $%.4f\n", snapshot.Pools["operations"])

API Reference

MethodPathAuthDescription
GET/v1/wallet/balanceRequiredOn-chain USDC balance (Base + Solana)
GET/v1/wallet/historyRequiredPaginated transaction log
GET/v1/wallet/limitsRequiredCurrent spending limits
PUT/v1/wallet/limitsRequiredUpdate spending limits
GET/v1/wallet/poolsRequiredPool allocation + balances