1
1
---
2
2
eip : 5792
3
3
title : Wallet Function Call API
4
- description : Adds JSON-RPC methods for sending multiple function calls from a wallet, and checking their status
4
+ description : Adds JSON-RPC methods for sending multiple function calls from the user's wallet, and checking their status
5
5
author : Moody Salem (@moodysalem)
6
6
discussions-to : https://ethereum-magicians.org/t/eip-5792-wallet-abstract-transaction-send-api/11374
7
7
status : Draft
@@ -13,41 +13,42 @@ created: 2022-10-17
13
13
## Abstract
14
14
15
15
Defines new JSON-RPC methods for dapps to send batches of function calls from a user's wallet, as well as check
16
- on the status of these calls. These new methods are more abstract than the existing transaction sending APIs
17
- to allow for differences between wallets in how function calls are sent on-chain, e.g. smart contract wallets
18
- utilizing [ EIP-4337] ( ./eip-4337.md ) or EOA wallets that support bundled transactions via [ EIP-3074] ( ./eip-3074.md ) .
19
- Dapps may use this more abstract interface to support different kinds of wallets, as well as provide a better UX for
20
- sending bundles of function calls (e.g. [ EIP-20] ( ./eip-20.md ) ` #approve ` followed by a contract call).
16
+ on the status of those calls. The new methods are more abstract in regard to the underlying transactions than the
17
+ existing transaction sending APIs to allow for differences between wallet implementations, e.g.
18
+ smart contract wallets utilizing [ EIP-4337] ( ./eip-4337.md ) or EOA wallets that support bundled transactions
19
+ via [ EIP-3074] ( ./eip-3074.md ) . Dapps may use this more abstract interface to support different kinds of wallets without
20
+ additional effort, as well as provide a better UX for sending bundles of function calls (
21
+ e.g. [ EIP-20] ( ./eip-20.md ) ` #approve ` followed by a contract call).
21
22
22
23
## Motivation
23
24
24
- The current methods to send transactions from the user wallet and check their status are ` eth_sendTransaction `
25
+ The current methods used to send transactions from the user wallet and check their status are ` eth_sendTransaction `
25
26
and ` eth_getTransactionReceipt ` .
26
27
27
- One problem with these methods is that they are keyed on the hash of the on-chain transaction,
28
- i.e. ` eth_sendTransaction ` returns an transaction hash computed from the transaction parameters,
29
- and ` eth_getTransactionReceipt ` takes as one argument the transaction hash. When the transaction hash changes, for
30
- example when a user speeds up the transaction in their wallet, the transaction hash that the dapp is aware of becomes
31
- irrelevant. There is no communication delivered to the dapp of the change in transaction hash, and no way to connect the
32
- old transaction hash to the new one, except by the user account and transaction nonce. It is not trivial for the dapp
33
- to find all signed transactions for a given nonce and account, especially for smart contract accounts which usually
34
- store the nonce in a contract storage slot. This happens more frequently with smart contract wallets, which usually use
35
- a third party relayer and automatically re-broadcast transactions with higher gas prices.
36
-
37
- Another problem with these methods is that they do not support sending multiple function calls related to a single
38
- action. For example, when swapping on Uniswap, the user must often call [ EIP-20] ( ./eip-20.md ) ` #approve `
39
- before calling the Uniswap router contract to swap. The dapp has to manage a complex multi-step asynchronous workflow to
40
- guide the user through sending a single swap. The ideal UX would be to bundle the approve call with the swap call, and
41
- abstract the underlying approve function call from the user.
42
-
43
- The interface also does not work well for account abstracted wallets (e.g. [ EIP-4337] ( ./eip-4337.md )
44
- or [ EIP-3074] ( ./eip-3074.md ) ), which often involve a third party relayer to sign the transaction that triggers the
45
- function calls from the user's wallet. In these cases the actual transaction hash may not be known at the time of user
46
- signing, but must still be returned by ` eth_sendTransaction ` . The transaction hash returned by ` eth_sendTransaction ` in
47
- these cases is unlikely to be relevant to the transaction hash of the included transaction. The existing interface also
48
- provides no way to delay the resolution of the transaction hash, since it is used as the key of the transaction tracked
49
- by the dapp. Dapps often link to the block explorer for the returned transaction hash, but in these cases the
50
- transaction hash is wrong and the link will not work.
28
+ These methods are keyed on the hash of the on-chain transaction, i.e. ` eth_sendTransaction ` returns an transaction hash
29
+ computed from the transaction parameters, and ` eth_getTransactionReceipt ` takes as one argument the transaction hash.
30
+ When the transaction hash changes, for example when a user speeds up the transaction in their wallet, the transaction
31
+ hash that the dapp is aware of becomes irrelevant. There is no communication delivered to the dapp of the change in
32
+ transaction hash, and no way to connect the old transaction hash to the new one, except by the user account and
33
+ transaction nonce. It is not trivial for the dapp to find all signed transactions for a given nonce and account,
34
+ especially for smart contract accounts which usually store the nonce in a contract storage slot. This happens more
35
+ frequently with smart contract wallets, which usually use a third party relaying service and automatically re-broadcast
36
+ transactions with higher gas prices.
37
+
38
+ These methods also do not support sending multiple function calls related to a single action. For example, when swapping
39
+ on Uniswap, the user must often call [ EIP-20] ( ./eip-20.md ) ` #approve ` before calling the Uniswap router contract to
40
+ swap. The dapp has to manage a complex multi-step asynchronous workflow to guide the user through sending a single swap.
41
+ The ideal UX would be to bundle the approve call with the swap call, and abstract the underlying approve function call
42
+ from the user.
43
+
44
+ The current interface also does not work well for account abstracted wallets (e.g. [ EIP-4337] ( ./eip-4337.md )
45
+ or [ EIP-3074] ( ./eip-3074.md ) ), which often involve a relaying service to sign and broadcast the transaction that
46
+ triggers the function calls from the user's wallet. In these cases the actual transaction hash may not be known at the
47
+ time of user signing, but must still be returned by ` eth_sendTransaction ` . The transaction hash returned
48
+ by ` eth_sendTransaction ` in these cases is unlikely to be relevant to the transaction hash of the included transaction.
49
+ The existing interface also provides no way to delay the resolution of the transaction hash, since it is used as the key
50
+ of the transaction tracked by the dapp. Dapps often link to the block explorer for the returned transaction hash, but in
51
+ these cases the transaction hash is wrong and the link will not work.
51
52
52
53
Dapps need a better interface for sending batches of function calls from the user's wallet so they can interact with
53
54
wallets without considering the differences between wallet implementations. These methods are backwards compatible with
@@ -64,16 +65,16 @@ to `eth_sendTransaction` and `eth_getTransactionReceipt` when they are not avail
64
65
65
66
Requests that the wallet deliver a group of function calls on-chain from the user's wallet.
66
67
67
- - The wallet MUST send these calls in the order specified in the request.
68
- - The wallet MAY send all the function calls as part of a single transaction, or multiple transactions .
69
- - Dapps MUST NOT rely on the calls being sent in an atomic transaction, i.e. other untrusted calls may be
70
- included between each of the requested function calls.
71
- - The wallet MUST attempt to deliver all calls if it returns a successful response to this method, and the wallet
72
- MUST NOT deliver any calls if it returns an error response.
73
- - The wallet MAY reject the request if the request chain ID does not match the currently selected chain ID .
74
- - The wallet MUST send the calls on the request chain ID.
75
- - The wallet MAY reject the request if the ` from ` address does not match the enabled account.
76
- - The wallet MAY reject the request if one or more calls in the bundle will fail.
68
+ The wallet:
69
+ - MUST send these calls in the order specified in the request .
70
+ - MUST send the calls on the request chain ID.
71
+ - MUST stop executing the calls if any call fails
72
+ - MUST NOT send any calls from the request if the user rejects the request
73
+ - MAY revert all calls if any call fails
74
+ - MAY send all the function calls as part of one transaction or multiple transactions, depending on wallet capability .
75
+ - MAY reject the request if the request chain ID does not match the currently selected chain ID.
76
+ - MAY reject the request if the ` from ` address does not match the enabled account.
77
+ - MAY reject the request if one or more calls in the bundle is expected to fail, when simulated sequentially
77
78
78
79
#### ` wallet_sendFunctionCallBundle ` OpenRPC Specification
79
80
@@ -127,10 +128,6 @@ Requests that the wallet deliver a group of function calls on-chain from the use
127
128
title : data
128
129
description : The data to send with the function call
129
130
$ref : ' #/components/schemas/bytes'
130
- optional :
131
- title : optional
132
- description : Whether the call must succeed for subsequent calls to be made
133
- type : boolean
134
131
result :
135
132
name : Bundle identifier
136
133
schema :
@@ -150,8 +147,7 @@ Requests that the wallet deliver a group of function calls on-chain from the use
150
147
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
151
148
"gas": "0x76c0",
152
149
"value": "0x9184e72a",
153
- "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
154
- "optional": true
150
+ "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
155
151
},
156
152
{
157
153
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
@@ -270,19 +266,25 @@ As with the return value of `wallet_sendFunctionCallBundle`, the bundle identifi
270
266
It may be the hash of the call bundle :
271
267
272
268
` ` ` json
273
- ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"]
269
+ [
270
+ "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
271
+ ]
274
272
` ` `
275
273
276
274
It may contain a numeric identifier as a hex string :
277
275
278
276
` ` ` json
279
- ["0x01"]
277
+ [
278
+ "0x01"
279
+ ]
280
280
` ` `
281
281
282
282
It may be a base64 encoded string :
283
283
284
284
` ` ` json
285
- ["aGVsbG8gd29ybGQ="]
285
+ [
286
+ "aGVsbG8gd29ybGQ="
287
+ ]
286
288
` ` `
287
289
288
290
# #### `wallet_getBundleStatus` Example Return Value
0 commit comments