ERC-7715 · Draft · ERC · 2024-05-24
ERC-7715: Request Permissions from Wallets
Adds a wallet_requestExecutionPermissions JSON-RPC method so a dapp can ask a wallet for scoped, expiring permissions to act on the user's behalf without a prompt for every transaction.
What problem does it solve?
In the normal dapp flow every on-chain action needs the user to open their wallet and sign. That is tedious in interactive apps such as games, and it makes some products impossible: subscriptions, recurring buys or limit orders all need to act while the user is offline.
Smart accounts can already enforce fine-grained delegations, but there was no standard way for a dapp to ask for one. ERC-7715 defines that request so any dapp can talk to any wallet that supports it.
How it works
The dapp sends wallet_requestExecutionPermissions with an array of requests. Each request contains:
chainIdand optionallyfrom(the user's account).to: the dapp's session account that will use the permission.permission: a typed object, e.g.native-token-allowancewith anallowance, plusisAdjustmentAllowedto say whether the wallet may change the amount.rules: extra constraints, such as anexpirytimestamp.
Permission and rule types are not fixed by this ERC; new types are meant to be defined in their own ERCs.
The wallet shows the request to the user and, if approved, returns the request (possibly adjusted) plus:
context: an opaque blob identifying the grant.delegationManager: the contract that redeems it (ERC-7710).dependencies:factory/factoryDatapairs (ERC-4337 style) for any account that must be deployed first.
To use the permission, the session account calls the delegation manager's redeem function with the context and the encoded call it wants the user's account to make. Helper methods let a dapp list supported types (wallet_getSupportedExecutionPermissions), list granted ones (wallet_getGrantedExecutionPermissions) and revoke one (wallet_revokeExecutionPermission).
Sample code
Requesting a one-hour native-token allowance from an EIP-1193 provider:
const [grant] = await window.ethereum.request({
method: "wallet_requestExecutionPermissions",
params: [
{
chainId: "0x1",
to: sessionAccount.address, // key held by the dapp
permission: {
type: "native-token-allowance",
isAdjustmentAllowed: true,
data: { allowance: "0x0DE0B6B3A7640000" }, // 1 ETH in wei
},
rules: [
{ type: "expiry", data: { timestamp: Math.floor(Date.now() / 1000) + 3600 } },
],
},
],
});
// Keep these to redeem later via ERC-7710
const { context, delegationManager, dependencies } = grant;
Things to know
- Status: Draft. Field and method names may still change, and the spec's own examples are not fully consistent (for example
ruleTypesvsrulesTypes), so check a wallet's documentation before relying on exact field names. - The wallet, not this ERC, enforces the permission. Users must trust the wallet's implementation; the spec requires wallets to display permissions clearly and warn about dangerous ones.
- Dapps should request the narrowest permission with a short expiry. A leaked session key can use whatever was granted until it expires or is revoked.
- It complements ERC-5792 (batched calls with user approval) and is distinct from the older EIP-2255, which covers permissions for RPC methods rather than on-chain execution.