ERC-7795 Wallet-Invoked Token Prerequisites (Wallet Call Token Capabilities)
Draft · Accounts & wallets · created 2024-10-22
A standard for informing a wallet of the token conditions (balance, allowance, NFT ownership, etc.) required before a dApp sends a transaction. The wallet helps the user satisfy these conditions first.
Why it is needed
Most dApps run on only a single network (chain). However, a user's funds are often concentrated on only a few networks, so as the number of networks grows, the chance that where a dApp lives and where the user's money is overlap keeps shrinking. Until now, dApps had no way to convey their ultimate goal to the wallet, so they could only request the single final transaction the user needed to execute. The user had to figure out on their own what preparatory steps were required to execute that transaction, such as consolidating funds scattered across multiple networks into one place or swapping them into the asset the dApp accepts. This process was cumbersome and significantly degraded the user experience.
In depth
EIP-5792 Extension Structure
This standard does not create a new RPC method; instead it works by adding a new capability to EIP-5792's wallet_sendCalls and wallet_getCapabilities methods. A dApp checks the wallet_getCapabilities response to see which condition types the wallet supports (the supported and versions fields), and includes conditions in the capabilities field of a wallet_sendCalls request. If a dApp wants to handle condition fulfillment on its own, it MAY opt out of using this feature.
ERC-20 Conditions: erc20MinBalance and erc20MinAllowance
erc20MinBalance is a requirement that the owner address must hold at least minAmount of token's balance on chainId. Its fields are version, chainId, owner, token, and minAmount, with the chain ID and amount written as hex strings. erc20MinAllowance is a requirement that owner must set an allowance letting operator spend at least minAmount of token, adding an operator field. The original text specifies that an allowance condition does not mean the owner actually holds that balance.
ERC-721 Conditions: erc721Ownership and erc721Approval
erc721Ownership is a requirement that owner must own tokenId of the token contract on chainId. Its fields are version, chainId, owner, token, and tokenId. erc721Approval is a requirement that owner must approve operator to transfer that tokenId, adding an operator field. An approval condition likewise does not mean the owner holds the token.
ERC-1155 Conditions: erc1155MinBalance and erc1155MinAllowance
erc1155MinBalance is a requirement that owner must hold at least minAmount of a specific tokenId's balance on the token contract on chainId. Since ERC-1155 allows multiple token types in a single contract, tokenId and minAmount are specified together. erc1155MinAllowance is a requirement that owner must allow operator at least minAmount of that tokenId, and likewise does not imply balance ownership.
Obligation Level Wallets Must Meet
For each condition, the wallet MUST guarantee that the requirement is satisfied before executing the main transaction. Calculating a resolution method to satisfy the requirement is a SHOULD, and the method of requesting the user to sign preparatory transactions is left to the wallet's discretion (MAY). The smart contract wallet example explains that all transactions can be signed at once, executed in order, and the signed transactions sent to the bundler simultaneously so that the work completes even if the wallet connection drops.
Design Rationale: Why the Capabilities Were Split
The original text gives four reasons for extending EIP-5792: reuse of the existing capability discovery mechanism (consistency), composability with other EIP-5792 capabilities (composability), the ability to implement only the requirements a wallet supports (flexibility), and the ability to add new requirement types as capabilities (extensibility). The requirements were split into six capabilities rather than bundled into one to enable granular wallet support, clear confirmation of support, independent versioning per requirement type, and simple implementation for basic wallets.
Proposal status
This ERC is a Draft proposal created on October 22, 2024. It requires EIP-20, 721, 1155, and 5792. Being in Draft status, its content may change or progress may stall.
Things to watch out for
- Introduces No New Security Risks: The original text states that this standard introduces no new security risks or trust assumptions. Users already trust their wallet provider to construct, coordinate, and send transactions on their behalf, and this standard merely adds fields to the request that help the wallet better judge how to compose the transaction.