Skip to content
Anon Wallet

Batch Transactions

Anon supports wallet_sendCalls from EIP-5792, enabling DApps to submit multiple calls in a single user approval — and optionally use Anon's private fund pool to fill the transaction.

Basic Usage

const result = await window.ethereum.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    chainId: "0x1",
    calls: [
      {
        to: "0xTokenAddress...",
        data: "0x095ea7b3...", // approve(spender, amount)
      },
      {
        to: "0xDexRouter...",
        data: "0x...",         // swap call
        value: "0x0",
      },
    ],
  }],
});

// result.id is a job ID for status polling

The user sees a single approval popup summarizing all the calls. If Anon's atomicBatch capability is supported, all calls execute in one transaction (reverts if any fail).

Checking Status

const status = await window.ethereum.request({
  method: "wallet_getCallsStatus",
  params: [result.id],
});

// status.status: "PENDING" | "CONFIRMED" | "FAILED"
// status.receipts: array of transaction receipts when confirmed

Poll this until status.status is no longer "PENDING".

Using Auxiliary Funds

If the connected origin has a stealth address with a shielded balance, Anon reports auxiliaryFunds as a capability. DApps can signal that they want to use these funds:

const result = await window.ethereum.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    chainId: "0x1",
    calls: [...],
    capabilities: {
      auxiliaryFunds: {
        // Optional: specify the asset and amount needed
        assets: [
          {
            address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
            amount: "0xDE0B6B3A7640000", // 1 WETH
          }
        ]
      }
    }
  }],
});

Anon will:

  1. Unshield the required amount from the user's private balance with a zk-proof; the destination and amount become public
  2. Fund the calls with the unshielded amount
  3. Execute the batch calls

The user approves a single combined popup showing both the unshield and the batch calls.

Paymaster Integration

To use gas sponsorship via Anon's paymaster in a wallet_sendCalls:

const result = await window.ethereum.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    chainId: "0x1",
    calls: [...],
    capabilities: {
      paymasterService: {
        url: "https://paymaster.anon.inc/v1",
      }
    }
  }],
});

The paymaster covers gas for the batch. The user's shielded balance is debited the paymaster fee in the configured fee token.

Stealth-Bound Origins

An origin is "stealth-bound" when the user has connected a stealth address (rather than their main public EOA) to the DApp. For stealth-bound origins:

  • auxiliaryFunds is enabled (shielded balance is available)
  • paymasterService is enabled (gas can be paid from shielded balance)
  • eth_getBalance returns the combined on-chain + private WETH balance + a gas buffer
  • eth_call for balanceOf returns the combined on-chain + private shielded balance

This allows DApps to see the user's full effective balance and act accordingly — while disclosing effective balance information to the connected DApp.

Compatibility Notes

  • wallet_sendCalls with atomicBatch is supported on chains where Anon has a deployed batch executor contract
  • auxiliaryFunds requires the user to have an active shielded balance of the requested token
  • For DApps that don't yet support EIP-5792, standard eth_sendTransaction continues to work as before