ERC-7836: Wallet Call Preparation API
Adds JSON-RPC methods for requesting unsigned EIP-5792 calls based on the wallet's implementation, and then sending those calls once signed.
Abstract
This proposal defines complementary JSON-RPC methods to EIP-5792's wallet_sendCalls
to enable an Application to sign over a call bundle (instead of the Wallet). Methods defined in this proposal are purposed for the Application to sign over calls
and submit them to the Wallet with an accompanying signature. This is in contrast to wallet_sendCalls
, where a Wallet itself signs over the call bundle.
Motivation
Applications are increasingly seeking to use session keys and scoped permissions to make transactions on a user's behalf, without the user having to approve and sign each transaction in their wallet's interface. One example is an application that automates a user's decentralised exchange trading. As Smart Contract Accounts (SCAs) contain arbitrary execution interfaces that lead to varying calldata formats, it is not possible for an Application to know how to sign over an action for any arbitrary Account implementation, without maintaining a mapping of Account implementations to their signing logic. Apps need a simple way to request the payload that their session keys should sign, given a call or set of calls they wish to make, and a way to execute the calls once signed.
Specification
In this specification, we define two new JSON-RPC methods: wallet_prepareCalls
and wallet_sendPreparedCalls
.
wallet_prepareCalls
Instructs a Wallet to prepare a call bundle according to the Account's implementation. It returns a digest
of the call bundle to sign over, as well as the parameters required to fulfil a wallet_sendPreparedCalls
request (ie. capabilities
, chainId
, context
, and version
).
After calling
wallet_prepareCalls
, consumers are expected to sign over thedigest
and submit thesignature
and prepared calls to the Wallet viawallet_sendPreparedCalls
.
Request
The request is identical to that of
wallet_sendCalls
.
Response
The response is intended to be forwarded to
wallet_sendPreparedCalls
(minus thedigest
).
Example
wallet_sendPreparedCalls
Instructs a Wallet to execute a prepared call bundle (response of wallet_prepareCalls
) with an accompanying signature
.
Parameters
The request is identical to the response of
wallet_prepareCalls
, except that it includes asignature
.
Response
The response is identical to that of
wallet_sendCalls
, except that it is a list.
Example
Rationale
These endpoints extend the interface established by EIP-5792, given the emergent needs of application developers.
Adding new endpoints for this specific use case is simpler than adding additional options to the wallet_sendCalls
endpoint.
Surfacing the prepared calls should be relatively simple for wallets, who already need to do preparation internally in order to support wallet_sendCalls
, and who then submit signed calls on chain.
Backwards Compatibility
TBD
Security Considerations
Needs discussion.
Copyright
Copyright and related rights waived via CC0.