EIP-5792 Transaction Batching
What is EIP-5792?
EIP-5792 is an Ethereum standard that lets wallets execute multiple calls in a single atomic operation using wallet_sendCalls. Instead of signing and submitting each transaction separately (approve → fee → swap), your users sign once and the wallet handles the rest.
The DeFi API natively supports this format — just add one field to your request and pass the response directly to the wallet.
New to the DeFi API?Start with the Getting Started guide to set up your API key and make your first request.
Prerequisites
Before using EIP-5792 batching, make sure:
- You have a valid API key. See Send Your First API Request.
- You're familiar with the base endpoint. This feature works on top of existing Executing Same Chain Swap and Executing Cross Chain Swap endpoints.
- The user's wallet supports EIP-5792. This is a wallet-level capability — your DApp must check for support before using it (see Wallet Compatibility below).
Quick Start
Add "batchOption": "eip5792" to any supported endpoint request body. That's it — no other changes needed.
{
"dexId": "1300",
"amountIn": "1000000000000000",
"from": "0x6305...1006",
"to": "0x6305...1006",
"path": ["0xC02a...6Cc2", "0x6B17...1d0F"],
"poolFees": "3000",
"enableFee": true,
"batchOption": "eip5792"
}Without batchOption, the API returns separate transaction objects (createFeeTxn, swapTxn). With it, the API merges everything into a single calls array you can pass straight to wallet_sendCalls.
Your Request (batchOption: "eip5792")
│
▼
API assembles all txns ── fee txn (if enableFee: true) + approval + main txn
│
▼
Formatted as EIP-5792 { calls: [...] }
│
▼
Pass directly to wallet_sendCalls ── user signs once
Supported Endpoints
| Domain | Endpoint | Calls (enableFee: true) | Calls (enableFee: false) |
|---|---|---|---|
| DEX | POST https://svc.blockdaemon.com/defi/v1/dex/swap | 2 (fee + swap) | 1 (swap) |
| DEX | POST https://svc.blockdaemon.com/defi/v1/dex/swap-with-approval | 3 (fee + approve + swap) | 2 (approve + swap) |
| DEX | POST https://svc.blockdaemon.com/defi/v1/dex/swaps | 2 per route (fee + swap) | 1 per route |
| Bridge | POST https://svc.blockdaemon.com/defi/v1/bridge/swap-with-approval | 3 (fee + approve + swap) | 2 (approve + swap) |
| Bridge | POST https://docs.blockdaemon.com/reference/defi-bridge-swap-aggregator | 2 per route (fee + swap) | 1 per route |
NoteThe
approvetransaction is only included when the sender has insufficient or no existing token allowance for the protocol. If the allowance already covers the swap amount, it is omitted — reducing the call count by 1.
Response Format
Default (without batchOption)
batchOption)The API returns separate named transaction objects that you submit individually:
{
"status": 200,
"msg": "success",
"data": {
"createFeeTxn": { "to": "0x...", "value": "0x...", "data": "0x...", "gas": "0x..." },
"swapTxn": { "to": "0x...", "value": "0x...", "data": "0x...", "gas": "0x..." }
}
}EIP-5792 (with batchOption: "eip5792")
batchOption: "eip5792")The API returns a single object with an ordered calls array:
{
"status": 200,
"msg": "success",
"data": {
"from": "0x<sender>",
"chainId": "1",
"dexName": "UniswapV3",
"amountsOut": ["1000000"],
"referenceId": "abc-123",
"methodUsed": "EIP-5792",
"calls": [
{ "to": "0x<fee recipient>", "value": "0x<fee>", "data": "0x" },
{ "to": "0x<dex router>", "value": "0x0", "data": "0x<swap calldata>" }
]
}
}Top-level Fields
| Field | Description |
|---|---|
from | Sender address (from the last transaction in the batch) |
chainId | Target chain as a decimal string (convert to hex before passing to the wallet) |
dexName / bridgeName | Protocol used (DEX or Bridge responses respectively) |
amountsOut | Expected output amounts |
referenceId | Unique ID for request tracking and debugging |
methodUsed | Always "EIP-5792" |
calls | Ordered array of calls to execute atomically |
Call Object Fields
| Field | Description |
|---|---|
to | Target contract |
value | ETH value in hex ("0x0" if none) |
data | ABI-encoded calldata ("0x" for plain ETH transfers) |
Ordering MattersThe
callsarray must be executed in sequence: fee payment first, then any token approval, then the main swap. Do not reorder.
Aggregator Endpoints
For aggregator endpoints (/dex/swaps, /bridge/swaps), the response data is an array — one EIP-5792 object per available route:
{
"status": 200,
"msg": "success",
"data": [
{
"bridgeName": "Stargate",
"amountsOut": ["999000"],
"methodUsed": "EIP-5792",
"calls": [...]
},
{
"bridgeName": "Across",
"amountsOut": ["998500"],
"methodUsed": "EIP-5792",
"calls": [...]
}
]
}Pick the route that best fits your criteria (best rate, preferred bridge, etc.) and pass its calls array to wallet_sendCalls.
TipSee the Quote Aggregator guide for route selection strategies.
End-to-End Examples
Example 1: DEX Swap with Fee
POST https://svc.blockdaemon.com/defi/v1/dex/swap
Content-Type: application/json
X-API-Key: <your-key>
{
"dexId": "1300",
"amountIn": "1000000000000000",
"amountOutMin": "0",
"path": [
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"0x6B175474E89094C44Da98b954EedeAC495271d0F"
],
"to": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"poolFees": "3000",
"from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"gas": "173376",
"batchOption": "eip5792"
}Response:
{
"status": 200,
"msg": "success",
"data": {
"from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
"chainId": "1",
"referenceId": "6106186031fb415bbeb3e45fd707ad18",
"methodUsed": "EIP-5792",
"calls": [
{
"to": "0x1234567890123456789012345678901234567890",
"value": "1000277923841",
"data": "0x"
},
{
"to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"value": "0",
"data": "0x04e4...0000"
}
]
}
}Example 2: Bridge Swap with Approval and Fee
POST https://svc.blockdaemon.com/defi/v1/bridge/swap-with-approval
Content-Type: application/json
X-API-Key: <your-blockdaemon-api-key>
{
"bridgeId": "600",
"srcChainId": "1",
"dstChainId": "1",
"srcTokenSymbol": "USDT",
"dstTokenSymbol": "ETH",
"amountIn": "10000",
"amountOutMin": "0",
"from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
"to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
"gasPriority": "low",
"srcChainSymbol": "ETH",
"enableFee": true,
"batchOption": "eip5792"
}Response:
{
"status": 200,
"msg": "success",
"data": {
"from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
"chainId": "1",
"referenceId": "6cf6ec2cd6f44276a8f999b2be3488d1",
"methodUsed": "EIP-5792",
"calls": [
{
"to": "0x1234567890123456789012345678901234567890",
"value": "24056756210184",
"data": "0x"
},
{
"to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"value": "0",
"data": "0x095...2710"
},
{
"to": "0xce16F69375520ab01377ce7B88f5BA8C48F8D666",
"value": "0",
"data": "0x5818...e73"
}
]
}
}Sending the Result to a Wallet
Once you have the EIP-5792 response, pass it to wallet_sendCalls:
// 1. Fetch the batched swap from the DeFi API
const result = await fetch("https://svc.blockdaemon.com/defi/v1/dex/swap", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_BLOCKDAEMON_API_KEY",
},
body: JSON.stringify({
dexId: "1300",
amountIn: "1000000000000000",
amountOutMin: "0",
path: ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0x6B175474E89094C44Da98b954EedeAC495271d0F"],
to: "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
poolFees: "3000",
from: "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
gas: "173376",
enableFee: true,
batchOption: "eip5792",
}),
}).then((r) => r.json());
const { from, chainId, calls } = result.data;
// 2. Convert chainId from decimal string to hex (required by wallet_sendCalls)
const chainIdHex = `0x${parseInt(chainId).toString(16)}`;
// 3. Submit to the wallet — user signs once for all calls
const batchId = await walletProvider.request({
method: "wallet_sendCalls",
params: [
{
version: "2.0.0",
chainId: chainIdHex,
from,
calls,
},
],
});
Note
chainIdin the API response is a decimal string (e.g."1"). You must convert it to hex (e.g."0x1") before passing towallet_sendCalls.
Wallet Compatibility
EIP-5792 is a wallet-level capability. Your DApp is responsible for checking whether the connected wallet supports it before using batched calls. Do not assume support — unsupported wallets will reject the request, causing the transaction to fail.
Which wallets support EIP-5792?
| Wallet Type | Typical Support |
|---|---|
| Smart contract wallets (e.g. Safe) | ✅ Usually supported |
| Account-abstraction wallets (ERC-4337) | ✅ Usually supported |
| EOA wallets with EIP-7702 delegation | ✅ Supported via delegation |
| Legacy EOA wallets (e.g. MetaMask classic) | ❌ Not supported |
What's the difference between EIP-5792 and EIP-7702?EIP-5792 is the interface — it defines how your DApp requests batched calls from the wallet.
EIP-7702 is the mechanism — it lets EOAs temporarily act as smart accounts to execute those batched calls on-chain.
They're complementary: the wallet uses 7702 under the hood to fulfill 5792 requests.
Checking wallet capabilities
Before calling wallet_sendCalls, query the wallet to confirm support:
try {
const capabilities = await walletProvider.request({
method: "wallet_getCapabilities",
});
const chainIdHex = "0x1"; // Ethereum mainnet
const supportsAtomicBatch = capabilities?.[chainIdHex]?.atomicBatch?.supported === true;
if (supportsAtomicBatch) {
// Safe to use batchOption: "eip5792"
} else {
// Fall back to individual transactions (see below)
}
} catch (err) {
// Wallet doesn't support wallet_getCapabilities — fall back
}Fallback: individual transactions
If the wallet does not support EIP-5792, omit batchOption from your request. The API will return separate transaction objects in the default format, and you submit them individually in order:
// Default response (no batchOption)
const { createFeeTxn, swapTxn } = result.data;
// Submit in order: fee first, then swap
await walletProvider.request({ method: "eth_sendTransaction", params: [createFeeTxn] });
await walletProvider.request({ method: "eth_sendTransaction", params: [swapTxn] });
ImportantWhen falling back to individual transactions, always submit them in the correct order (fee → approval → swap). See the DEX Swap docs for the expected transaction ordering per endpoint.
Related Resources
| Resource | Description |
|---|---|
| Getting Started | Set up your API key and make your first DeFi API call |
| DEX Swap Aggregator | Multi-route aggregator for best-rate swaps |
| Bridge Swap | Cross-chain bridge endpoint reference |
| Fee Configuration | Setting up basis points and collector addresses |
| Authentication | API key management and authentication |
| EIP-5792 Specification | Official EIP-5792 standard |
| EIP-7702 Specification | EOA code delegation (complements EIP-5792) |
| ERC-4337 Overview | Account abstraction standard |
Updated about 10 hours ago
