EIPs Explained

EIP-7867 · Stagnant · Interface · 2025-01-17

EIP-7867: Flow Control Wallet Call Capability

A flowControl capability for wallet_sendCalls that lets dapps relax atomicity (strict, loose, none) and choose per call whether a failure rolls back, halts or continues the batch.

What problem does it solve?

EIP-5792 gives dapps wallet_sendCalls, a way to ask a wallet to run a batch of calls, such as "approve, then swap". Its default is all-or-nothing: the calls run atomically, and if any fails, the whole batch rolls back.

That is perfect for smart contract wallets, but too strict for many cases:

  • A dapp may batch unrelated calls just to save clicks or gas, and would rather keep the ones that succeed.
  • A plain EOA cannot execute several calls atomically on its own, but could send them one after another, or get near-atomic inclusion through a block builder.

EIP-7867 adds a flowControl capability so a dapp can say exactly what it needs and a wallet can say exactly what it can offer.

How it works

Batch scope: atomicity

Value Guarantee
strict (default) Calls are contiguous and atomic: today's EIP-5792 behaviour
loose Same as strict unless there is a reorg; after a reorg, some calls may land separately, with other transactions in between
none Only that calls land in order; others may be interleaved, and the wallet may split them over several transactions

Call scope: onFailure

Value Meaning
rollback (default) Critical call: if it fails, the whole batch rolls back
halt Stop here; earlier successful calls stay
continue Ignore the failure and carry on

rollback is not allowed in a none batch. If any call uses flowControl, the batch must declare it too, or the wallet rejects with MISSING_CAP.

Wallets advertise what they support through wallet_getCapabilities, as a map of atomicity level to supported onFailure modes. wallet_getCallsStatus gains two new status codes, 102 (partially executed) and 207 (partial success: only continue calls failed), and clarifies when existing codes such as 500 and 600 apply.

Sample code

Check capabilities, then send a loose batch where the second call may fail without undoing the first:

const caps = await provider.request({ method: "wallet_getCapabilities", params: [account] });
// e.g. { "0x1": { "flowControl": { "loose": ["halt", "continue"], "strict": ["continue"] } } }

const { id } = await provider.request({
  method: "wallet_sendCalls",
  params: [{
    version: "1.0",
    from: account,
    chainId: "0x1",
    capabilities: { flowControl: { atomicity: "loose" } },
    calls: [
      { to: token, data: approveData },
      { to: router, data: swapData, capabilities: { flowControl: { onFailure: "continue" } } },
    ],
  }],
});

const status = await provider.request({ method: "wallet_getCallsStatus", params: [id] });
// status.status: 200 all ok, 207 partial success, 102 still in progress, ...

Note that approve above has no onFailure, so it is a critical (rollback) call: if it fails, nothing is kept.

Things to know

  • Status is Stagnant. Numeric values for the new error codes (INVALID_SCHEMA, MISSING_CAP, UNSUPPORTED_LEVEL, and others) are still TODO, so wallets cannot implement it interoperably yet.
  • Unless atomicity is strict, other people's transactions may land between your calls. Apps should put deadlines and slippage limits in the calls themselves, just as for separate transactions.
  • Even strict batches can flip between success and failure after a reorg, and with non-strict levels there is no time limit on when all calls land.
  • A wallet that only supports strict should quietly upgrade loose requests to strict, but must not advertise loose. An EOA upgraded via EIP-7702 can offer strict atomicity natively.

#wallet #json-rpc #batching #eip5792 #ux

Details

Authors
Sam Wilson (@SamWilsn) <[email protected]>
Status
Stagnant
Type
Standards Track / Interface
Created
2025-01-17
Requires

Machine-readable: Markdown · JSON