Skip to main content
With Base Account, you can send multiple onchain calls in a single transaction. Doing so improves the UX of multi-step interactions by reducing them to a single click. A common example of where you might want to leverage batch transactions is an ERC-20 approve followed by a swap. You can submit batch transactions by using the wallet_sendCalls RPC method, defined in EIP-5792.

Installation

Install the Base Account SDK:

Setup

Initialize the SDK

Import and create the Base Account SDK instance:

Basic Batch Transaction

Simple Multiple Transfers

Send multiple ETH transfers in a single transaction:

Contract Interactions

ERC-20 Approve and Transfer

A common pattern is to approve and then transfer ERC-20 tokens:

Advanced Features

Checking Wallet Capabilities

Before sending batch transactions, you can check if the wallet supports atomic batching:

Non-Atomic Batching

Sometimes you want calls to execute sequentially, even if some fail:

Error Handling

Handle common batch transaction errors: