Skip to content

Commit abcac6d

Browse files
authored
Merge pull request #452 from reown-com/wallet-send-calls
Docs Update: Add more information to EIP-5792 docs
2 parents 7ef248b + 05affe6 commit abcac6d

File tree

12 files changed

+974
-188
lines changed

12 files changed

+974
-188
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
AppKit integrates with [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792) to interact with embedded Wallets (smart accounts) through wallet capabilities.
6+
EIP-5792 introduces a general mechanism for wallets to expose structured execution capabilities to dApps. AppKit currently focuses on key capabilities like atomic batch transactions, but the interface is extensible and can support future capabilities defined by the spec.
7+
AppKit uses the following primary methods defined in EIP-5792:
8+
9+
- wallet_getCapabilities
10+
11+
- wallet_sendCalls
12+
13+
- wallet_getCallsStatus
14+
15+
## wallet_getCapabilities
16+
This method queries the wallet for its supported execution capabilities. AppKit inspects the response to determine what features are supported by the wallet, including (but not limited to) atomic batch execution.
17+
Wallets should include the [EIP-5792 capabilities in CAIP-25](/walletkit/android/eip5792#wallet-response).
18+
19+
## wallet_sendCalls
20+
21+
Used to send one or more contract calls to the wallet for execution. The behavior depends on the specific capabilities returned by wallet_getCapabilities. For example:
22+
23+
- `atomic: "supported"` -> The wallet guarantees atomic and contiguous execution.
24+
- `atomic: "ready"` -> The wallet may support atomic execution pending user action.
25+
- `atomic: "unsupported"` -> The wallet does not guarantee atomic execution.
26+
27+
If a required capability is not supported, the dApp should fall back to legacy methods (e.g. eth_sendTransaction, eth_getTransactionReceipt).
28+
29+
Request Example
30+
```json
31+
{
32+
"from": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
33+
"chainId": "0x01",
34+
"atomicRequired": true,
35+
"calls": [
36+
{
37+
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
38+
"value": "0x9184e72a",
39+
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
40+
},
41+
{
42+
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
43+
"value": "0x182183",
44+
"data": "0xfbadbaf01"
45+
}
46+
]
47+
}
48+
```
49+
50+
- `atomicRequired` should be set to true only if the dApp requires atomic execution and the wallet has advertised support.
51+
52+
## wallet_getCallsStatus
53+
54+
This method returns the status and receipt(s) of a previously submitted batch.
55+
56+
- The `batchId` field, returned from the `wallet_sendCalls` will be used to identify the batch call.
57+
58+
- The `atomic` field specifies how the wallet handled the batch of calls, which affects the structure of the `receipts` field.
59+
60+
### Response Example
61+
62+
```json
63+
{
64+
"chainId": "0x01",
65+
"id": "0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
66+
"status": 200,
67+
"atomic": true,
68+
"receipts": [
69+
{
70+
"logs": [
71+
{
72+
"address": "0xa922b54716264130634d6ff183747a8ead91a40b",
73+
"topics": [
74+
"0x5a2a90727cc9d000dd060b1132a5c977c9702bb3a52afe360c9c22f0e9451a68"
75+
],
76+
"data": "0xabcd"
77+
}
78+
],
79+
"status": "0x1",
80+
"blockHash": "0xf19bbafd9fd0124ec110b848e8de4ab4f62bf60c189524e54213285e7f540d4a",
81+
"blockNumber": "0xabcd",
82+
"gasUsed": "0xdef",
83+
"transactionHash": "0x9b7bb827c2e5e3c1a0a44dc53e573aa0b3af3bd1f9f5ed03071b100bb039eaff"
84+
}
85+
]
86+
}
87+
```
88+
89+
- if `atomic` is true, the batch was executed atomically by a wallet
90+
91+
- if `atomic` is false, the batch was executed **non-atomically** by a wallet
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
import SmartAccount from "/snippets/appkit/shared/smart-accounts-interaction.mdx";
6+
7+
<SmartAccount />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
import SmartAccount from "/snippets/appkit/shared/smart-accounts-interaction.mdx";
6+
7+
<SmartAccount />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
import SmartAccount from "/snippets/appkit/shared/smart-accounts-interaction.mdx";
6+
7+
<SmartAccount />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
import SmartAccount from "/snippets/appkit/shared/smart-accounts-interaction.mdx";
6+
7+
<SmartAccount />

docs.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@
217217
"appkit/features/onramp",
218218
"appkit/features/multichain",
219219
"appkit/features/smart-accounts",
220+
"appkit/features/smart-accounts-interaction",
220221
"appkit/features/notifications",
221222
"appkit/features/telegram-mini-apps",
222223
"appkit/features/sponsored-transactions",
@@ -320,6 +321,7 @@
320321
"appkit/react/core/options",
321322
"appkit/react/core/components",
322323
"appkit/react/core/smart-accounts",
324+
"appkit/react/core/smart-accounts-interaction",
323325
"appkit/react/core/custom-connectors",
324326
"appkit/react/core/custom-networks",
325327
"appkit/react/core/multichain",
@@ -407,6 +409,7 @@
407409
"appkit/next/core/options",
408410
"appkit/next/core/components",
409411
"appkit/next/core/smart-accounts",
412+
"appkit/next/core/smart-accounts-interaction",
410413
"appkit/next/core/custom-connectors",
411414
"appkit/next/core/custom-networks",
412415
"appkit/next/core/multichain",
@@ -494,6 +497,7 @@
494497
"appkit/vue/core/options",
495498
"appkit/vue/core/components",
496499
"appkit/vue/core/smart-accounts",
500+
"appkit/vue/core/smart-accounts-interaction",
497501
"appkit/vue/core/custom-connectors",
498502
"appkit/vue/core/custom-networks",
499503
"appkit/vue/core/multichain",
@@ -580,6 +584,7 @@
580584
"appkit/javascript/core/options",
581585
"appkit/javascript/core/components",
582586
"appkit/javascript/core/smart-accounts",
587+
"appkit/javascript/core/smart-accounts-interaction",
583588
"appkit/javascript/core/custom-connectors",
584589
"appkit/javascript/core/custom-networks",
585590
"appkit/javascript/core/multichain",
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Embedded Wallets Interactions (EIP-5792)
3+
---
4+
5+
AppKit integrates with EIP-5792 to interact with embedded Wallets (smart accounts) through wallet capabilities. It focuses on three primary methods: `wallet_getCapabilities`, `wallet_sendCalls`, and `wallet_getCallsStatus`. It shows how to check if atomic batch transactions are supported and how to use them.
6+
7+
## wallet_getCapabilities
8+
9+
Appkit checks the `atomic` capability from `wallet_getCapabilities` of the wallet in order to know if a wallet required to handle the batch of calls atomically or not.
10+
Wallets should include the [EIP-5792 capabilities in CAIP-25](/walletkit/android/eip5792#wallet-response).
11+
12+
## wallet_sendCalls
13+
14+
Depending on the 3 different values from the `atomic` capability, AppKit will trigger the `wallet_sendCalls`:
15+
16+
- `supported` means that the wallet supports atomic batch transactions for the account and chain ID. The wallet executes calls atomically and contiguously
17+
- `ready` means that the wallet can upgrade to support atomic execution, pending user approval.
18+
- `unsupported` means that the wallet does not provide any atomicity or contiguity guarantees, and it will not suggest an upgrade to the user. The dApp should fallback to **`eth_sendTransaction`** instead of **`wallet_sendCalls`**, and **`eth_getTransactionReceipt`** instead of **`wallet_getCallsStatus`**
19+
20+
Request Example
21+
```json
22+
{
23+
"from": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
24+
"chainId": "0x01",
25+
"atomicRequired": true,
26+
"calls": [
27+
{
28+
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
29+
"value": "0x9184e72a",
30+
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
31+
},
32+
{
33+
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
34+
"value": "0x182183",
35+
"data": "0xfbadbaf01"
36+
}
37+
]
38+
}
39+
```
40+
41+
- `atomicRequired` -  can be set to either `true` or `false`.
42+
- If the `atomic` capability is not supported set to `false`
43+
- If the `atomic` capability is supported set to `true`
44+
45+
## wallet_getCallsStatus
46+
47+
Call this function to get the information about the batch execution.
48+
49+
- The `batchId` field, returned from the `wallet_sendCalls` will be used to identify the batch call.
50+
51+
- The `atomic` field specifies how the wallet handled the batch of calls, which affects the structure of the `receipts` field.
52+
53+
### Response Example
54+
55+
```json
56+
{
57+
"chainId": "0x01",
58+
"id": "0x00000000000000000000000000000000000000000000000000000000000000000e670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
59+
"status": 200,
60+
"atomic": true,
61+
"receipts": [
62+
{
63+
"logs": [
64+
{
65+
"address": "0xa922b54716264130634d6ff183747a8ead91a40b",
66+
"topics": [
67+
"0x5a2a90727cc9d000dd060b1132a5c977c9702bb3a52afe360c9c22f0e9451a68"
68+
],
69+
"data": "0xabcd"
70+
}
71+
],
72+
"status": "0x1",
73+
"blockHash": "0xf19bbafd9fd0124ec110b848e8de4ab4f62bf60c189524e54213285e7f540d4a",
74+
"blockNumber": "0xabcd",
75+
"gasUsed": "0xdef",
76+
"transactionHash": "0x9b7bb827c2e5e3c1a0a44dc53e573aa0b3af3bd1f9f5ed03071b100bb039eaff"
77+
}
78+
]
79+
}
80+
```
81+
82+
- if `atomic` is true, the batch was executed atomically by a wallet
83+
84+
- if `atomic` is false, the batch was executed **non-atomically** by a wallet

0 commit comments

Comments
 (0)