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.
Do you prefer video content?There is a video guide that covers the implementation in detail in the last section of this page.

Installation

Install the Base Account SDK:

Setup

Initialize the SDK

Import and create the Base Account SDK instance:
batchTransactions.tsx

Basic Batch Transaction

Simple Multiple Transfers

Send multiple ETH transfers in a single transaction:
batchTransactions.tsx

Contract Interactions

ERC-20 Approve and Mint an NFT (ERC-721)

A common pattern is to approve the NFT contract to move your ERC-20 and then mint an NFT (ERC-721):
batchTransactions.tsx

Advanced Features

Checking Wallet Capabilities

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

Non-Atomic Batching

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

Getting the Batch Transaction Result

wallet_getCallsStatus returns the execution status for a batch you previously submitted with wallet_sendCalls. Capture the callsId returned by wallet_sendCalls, then poll for the batch status until it is confirmed or fails.
batchTransactions.tsx
You can learn more about wallet_getCallsStatus in the reference documentation.
Need more control over gas?You can override the gas limit for individual calls in a batch using the gasLimitOverride capability. This is useful for calls with nondeterministic gas consumption, such as swaps. See the capabilities overview for the full list of supported capabilities.

Video Guide