ERC-7836 · Draft · ERC · 2024-12-06
ERC-7836: Wallet Call Preparation API
Adds wallet_prepareCalls and wallet_sendPreparedCalls so an app holding a session key can ask the wallet what to sign for any smart account, sign it itself, and hand it back for execution.
What problem does it solve?
Apps increasingly act on a user's behalf with session keys or scoped permissions, for example an app that automates DEX trades without a wallet popup for every transaction. The catch: every smart contract account has its own execution interface and signing format. To sign a bundle of calls for an arbitrary account, the app would need to know how each account implementation builds and hashes its payload.
EIP-5792 wallet_sendCalls already lets a wallet bundle and sign calls, but the wallet does the signing. ERC-7836 adds a two-step flow where the wallet does the account-specific preparation and the app's key does the signing.
How it works
Two new JSON-RPC methods, both reached through an EIP-1193 provider:
1. wallet_prepareCalls takes the same shape as wallet_sendCalls (calls, capabilities, chainId, optional from, version) plus an optional key hint: the public key and its type (secp256k1, p256, webauthn-p256) and whether it prehashes. The wallet builds the account-specific payload and returns:
digest: the exact bytes the key must signcontext: opaque, wallet-specific data (e.g. an ERC-4337 UserOperation)capabilities,chainId,key,versionto forward unchanged
2. wallet_sendPreparedCalls takes that response (minus digest) plus the signature. The wallet submits the bundle and returns { id, capabilities }, the same as wallet_sendCalls, so existing status-polling code keeps working.
The wallet stays responsible for checking that the key is actually authorised on the account and that the requested capabilities fall within the key's permissions.
Sample code
Preparing, signing with a session key, and sending (TypeScript):
const provider = (window as any).ethereum;
const { digest, ...prepared } = await provider.request({
method: "wallet_prepareCalls",
params: [{
version: "1",
chainId: "0x1",
from: account,
calls: [{ to: target, data: calldata }],
key: { type: "p256", publicKey: sessionPublicKey, prehash: false },
}],
});
// Sign the wallet-provided digest with the app's session key
const signature: `0x${string}` = await signWithSessionKey(digest);
const { id } = await provider.request({
method: "wallet_sendPreparedCalls",
params: [{ ...prepared, signature }],
});
// Track it like any EIP-5792 bundle
const status = await provider.request({ method: "wallet_getCallsStatus", params: [id] });
Things to know
- Status: Draft. Method names and fields may still change.
- It does not modify or replace
wallet_sendCalls; wallets that only support EIP-5792 are unaffected. prehashmust be handled consistently. A mismatch (double hashing vs. prehashed input) silently produces invalid signatures.- Wallets should be able to recompute the
digestfrom what is sent back, and may enforce validity windows, to stop stale or replayed preparations. - Keep session keys non-extractable and scoped; never show the opaque
digestto users as something to approve. - For plain off-chain message signing, see the related ERC-7871
wallet_sign.