EIP-5792 · Final · Interface · 2022-10-17
EIP-5792: Wallet Call API
Adds wallet_sendCalls and companion RPC methods so a dApp can ask a wallet to send a batch of calls, optionally atomically, and use wallet features like paymasters.
What problem does it solve?
dApps talk to wallets mostly through eth_sendTransaction and eth_getTransactionReceipt. Those methods send exactly one transaction and know nothing about smart accounts. A simple "approve then swap" takes two pop-ups and two transactions, and an app cannot ask the wallet to use a paymaster (gas sponsorship) even if the wallet supports one.
EIP-5792 defines a new wallet_ API: the app hands over a list of calls, the wallet decides how to execute them (one batched transaction for a smart account, or several for a plain EOA), and the app can discover what extra features the wallet supports.
How it works
Four JSON-RPC methods:
wallet_sendCalls: takesversion,chainId, optionalfrom,atomicRequired, a list of{to, data, value}calls, and optionalcapabilities. Returns a batchid. Calls must run in order, on the given chain, from the given address.wallet_getCallsStatus(id): returns a numericstatus(100 pending, 200 confirmed, 400 off-chain failure, 500 fully reverted, 600 partially reverted), whether the batch ranatomically, and receipts with only the logs from your calls.wallet_showCallsStatus(id): asks the wallet to display the batch to the user.wallet_getCapabilities(address, chainIds?): returns supported capabilities per chain (hex chain ID keys;"0x0"means all chains).
Atomicity is a built-in capability with status supported, ready (can upgrade, for example an EOA via EIP-7702, after user approval) or unsupported. If atomicRequired: true, the wallet must execute all calls atomically and contiguously, or reject.
Capabilities are extensible. A capability the wallet doesn't know causes rejection (error 5700) unless the app marks it optional: true. Paymaster services for ERC-4337 accounts are the typical example. New capabilities are defined in separate ERCs.
Sample code
Approve and swap in one request, falling back if batching isn't available:
const [from] = await window.ethereum.request({ method: "eth_requestAccounts" });
const chainId = "0x1";
const caps = await window.ethereum.request({
method: "wallet_getCapabilities",
params: [from, [chainId]],
});
const atomic = caps?.[chainId]?.atomic?.status; // "supported" | "ready" | "unsupported"
const { id } = await window.ethereum.request({
method: "wallet_sendCalls",
params: [{
version: "2.0.0",
chainId,
from,
atomicRequired: atomic === "supported" || atomic === "ready",
calls: [
{ to: TOKEN, data: approveCalldata },
{ to: ROUTER, data: swapCalldata },
],
}],
});
const status = await window.ethereum.request({
method: "wallet_getCallsStatus",
params: [id],
});
if (status.status === 200) console.log(status.receipts);
Things to know
- Status: Final. Apps should still fall back to
eth_sendTransactionwhen a wallet does not implement these methods. - Without
atomicRequired, an EOA wallet may send the calls as separate transactions, so later calls can run after earlier ones failed. Checkatomicand the per-receipt status. - Wallets should keep batch status queryable for at least 24 hours after submission.
- Batch IDs must be unique per sender per app; reusing one is rejected (error 5720).
wallet_getCapabilitiesshould only answer for addresses already connected to the app, to limit fingerprinting. Wallets may also expose capabilities out-of-band (e.g. alongside EIP-6963 discovery).