@account-kit/wallet-client 0.1.0-alpha.9 → 4.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE +21 -0
  2. package/dist/esm/client/actions/formatSign.d.ts +30 -0
  3. package/dist/esm/client/actions/formatSign.js +32 -0
  4. package/dist/esm/client/actions/formatSign.js.map +1 -0
  5. package/dist/esm/client/actions/getCallsStatus.d.ts +6 -3
  6. package/dist/esm/client/actions/getCallsStatus.js +3 -0
  7. package/dist/esm/client/actions/getCallsStatus.js.map +1 -1
  8. package/dist/esm/client/actions/grantPermissions.d.ts +10 -11
  9. package/dist/esm/client/actions/grantPermissions.js +26 -12
  10. package/dist/esm/client/actions/grantPermissions.js.map +1 -1
  11. package/dist/esm/client/actions/listAccounts.d.ts +10 -3
  12. package/dist/esm/client/actions/listAccounts.js +14 -2
  13. package/dist/esm/client/actions/listAccounts.js.map +1 -1
  14. package/dist/esm/client/actions/prepareCalls.d.ts +6 -3
  15. package/dist/esm/client/actions/prepareCalls.js +12 -8
  16. package/dist/esm/client/actions/prepareCalls.js.map +1 -1
  17. package/dist/esm/client/actions/prepareSign.d.ts +28 -0
  18. package/dist/esm/client/actions/prepareSign.js +31 -0
  19. package/dist/esm/client/actions/prepareSign.js.map +1 -0
  20. package/dist/esm/client/actions/requestAccount.d.ts +3 -1
  21. package/dist/esm/client/actions/requestAccount.js +5 -3
  22. package/dist/esm/client/actions/requestAccount.js.map +1 -1
  23. package/dist/esm/client/actions/sendPreparedCalls.d.ts +3 -1
  24. package/dist/esm/client/actions/sendPreparedCalls.js +2 -0
  25. package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -1
  26. package/dist/esm/client/actions/signMessage.d.ts +5 -2
  27. package/dist/esm/client/actions/signMessage.js +5 -2
  28. package/dist/esm/client/actions/signMessage.js.map +1 -1
  29. package/dist/esm/client/actions/signPreparedCalls.d.ts +2 -2
  30. package/dist/esm/client/actions/signPreparedCalls.js +3 -3
  31. package/dist/esm/client/actions/signPreparedCalls.js.map +1 -1
  32. package/dist/esm/client/actions/signSignatureRequest.d.ts +6 -10
  33. package/dist/esm/client/actions/signSignatureRequest.js +4 -7
  34. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -1
  35. package/dist/esm/client/actions/signTypedData.d.ts +2 -0
  36. package/dist/esm/client/actions/signTypedData.js +2 -0
  37. package/dist/esm/client/actions/signTypedData.js.map +1 -1
  38. package/dist/esm/client/decorator.d.ts +0 -2
  39. package/dist/esm/client/decorator.js +1 -3
  40. package/dist/esm/client/decorator.js.map +1 -1
  41. package/dist/esm/client/index.d.ts +10 -6
  42. package/dist/esm/client/index.js +18 -21
  43. package/dist/esm/client/index.js.map +1 -1
  44. package/dist/esm/exports/index.d.ts +1 -5
  45. package/dist/esm/exports/index.js +1 -6
  46. package/dist/esm/exports/index.js.map +1 -1
  47. package/dist/esm/internal/account.d.ts +33 -0
  48. package/dist/esm/{isomorphic/utils/createAccount.js → internal/account.js} +25 -49
  49. package/dist/esm/internal/account.js.map +1 -0
  50. package/dist/esm/types.d.ts +5 -11
  51. package/dist/esm/types.js.map +1 -1
  52. package/dist/esm/utils.d.ts +13 -1
  53. package/dist/esm/utils.js +13 -1
  54. package/dist/esm/utils.js.map +1 -1
  55. package/dist/esm/version.d.ts +1 -0
  56. package/dist/esm/version.js +4 -0
  57. package/dist/esm/version.js.map +1 -0
  58. package/dist/types/client/actions/formatSign.d.ts +31 -0
  59. package/dist/types/client/actions/formatSign.d.ts.map +1 -0
  60. package/dist/types/client/actions/getCallsStatus.d.ts +6 -3
  61. package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -1
  62. package/dist/types/client/actions/grantPermissions.d.ts +10 -11
  63. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -1
  64. package/dist/types/client/actions/listAccounts.d.ts +10 -3
  65. package/dist/types/client/actions/listAccounts.d.ts.map +1 -1
  66. package/dist/types/client/actions/prepareCalls.d.ts +6 -3
  67. package/dist/types/client/actions/prepareCalls.d.ts.map +1 -1
  68. package/dist/types/client/actions/prepareSign.d.ts +29 -0
  69. package/dist/types/client/actions/prepareSign.d.ts.map +1 -0
  70. package/dist/types/client/actions/requestAccount.d.ts +3 -1
  71. package/dist/types/client/actions/requestAccount.d.ts.map +1 -1
  72. package/dist/types/client/actions/sendPreparedCalls.d.ts +3 -1
  73. package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -1
  74. package/dist/types/client/actions/signMessage.d.ts +5 -2
  75. package/dist/types/client/actions/signMessage.d.ts.map +1 -1
  76. package/dist/types/client/actions/signPreparedCalls.d.ts +2 -2
  77. package/dist/types/client/actions/signPreparedCalls.d.ts.map +1 -1
  78. package/dist/types/client/actions/signSignatureRequest.d.ts +6 -10
  79. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -1
  80. package/dist/types/client/actions/signTypedData.d.ts +2 -0
  81. package/dist/types/client/actions/signTypedData.d.ts.map +1 -1
  82. package/dist/types/client/decorator.d.ts +0 -2
  83. package/dist/types/client/decorator.d.ts.map +1 -1
  84. package/dist/types/client/index.d.ts +10 -6
  85. package/dist/types/client/index.d.ts.map +1 -1
  86. package/dist/types/exports/index.d.ts +1 -5
  87. package/dist/types/exports/index.d.ts.map +1 -1
  88. package/dist/types/internal/account.d.ts +34 -0
  89. package/dist/types/internal/account.d.ts.map +1 -0
  90. package/dist/types/types.d.ts +5 -11
  91. package/dist/types/types.d.ts.map +1 -1
  92. package/dist/types/utils.d.ts +13 -1
  93. package/dist/types/utils.d.ts.map +1 -1
  94. package/dist/types/version.d.ts +2 -0
  95. package/dist/types/version.d.ts.map +1 -0
  96. package/package.json +32 -28
  97. package/src/client/actions/formatSign.ts +55 -0
  98. package/src/client/actions/getCallsStatus.ts +10 -6
  99. package/src/client/actions/grantPermissions.ts +46 -18
  100. package/src/client/actions/listAccounts.ts +22 -5
  101. package/src/client/actions/prepareCalls.ts +22 -16
  102. package/src/client/actions/prepareSign.ts +51 -0
  103. package/src/client/actions/requestAccount.ts +6 -4
  104. package/src/client/actions/sendPreparedCalls.ts +3 -1
  105. package/src/client/actions/signMessage.ts +5 -2
  106. package/src/client/actions/signPreparedCalls.ts +8 -12
  107. package/src/client/actions/signSignatureRequest.ts +12 -15
  108. package/src/client/actions/signTypedData.ts +2 -0
  109. package/src/client/decorator.ts +1 -8
  110. package/src/client/index.ts +41 -33
  111. package/src/exports/index.ts +1 -13
  112. package/src/internal/account.ts +120 -0
  113. package/src/types.ts +7 -18
  114. package/src/utils.ts +13 -1
  115. package/src/version.ts +3 -0
  116. package/dist/esm/capabilities/eip7702Auth.d.ts +0 -4
  117. package/dist/esm/capabilities/eip7702Auth.js +0 -18
  118. package/dist/esm/capabilities/eip7702Auth.js.map +0 -1
  119. package/dist/esm/capabilities/index.d.ts +0 -41
  120. package/dist/esm/capabilities/index.js +0 -14
  121. package/dist/esm/capabilities/index.js.map +0 -1
  122. package/dist/esm/capabilities/multiDimensionalNonce.d.ts +0 -3
  123. package/dist/esm/capabilities/multiDimensionalNonce.js +0 -7
  124. package/dist/esm/capabilities/multiDimensionalNonce.js.map +0 -1
  125. package/dist/esm/capabilities/overrides.d.ts +0 -26
  126. package/dist/esm/capabilities/overrides.js +0 -14
  127. package/dist/esm/capabilities/overrides.js.map +0 -1
  128. package/dist/esm/capabilities/paymaster.d.ts +0 -3
  129. package/dist/esm/capabilities/paymaster.js +0 -5
  130. package/dist/esm/capabilities/paymaster.js.map +0 -1
  131. package/dist/esm/capabilities/permissions/index.d.ts +0 -145
  132. package/dist/esm/capabilities/permissions/index.js +0 -83
  133. package/dist/esm/capabilities/permissions/index.js.map +0 -1
  134. package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
  135. package/dist/esm/capabilities/permissions/mav2.js +0 -88
  136. package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
  137. package/dist/esm/client/actions/createAccount.d.ts +0 -35
  138. package/dist/esm/client/actions/createAccount.js +0 -32
  139. package/dist/esm/client/actions/createAccount.js.map +0 -1
  140. package/dist/esm/client/client.e2e-test.d.ts +0 -1
  141. package/dist/esm/client/client.e2e-test.js +0 -375
  142. package/dist/esm/client/client.e2e-test.js.map +0 -1
  143. package/dist/esm/exports/internal.d.ts +0 -14
  144. package/dist/esm/exports/internal.js +0 -16
  145. package/dist/esm/exports/internal.js.map +0 -1
  146. package/dist/esm/isomorphic/actions/createSession.d.ts +0 -14
  147. package/dist/esm/isomorphic/actions/createSession.js +0 -95
  148. package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
  149. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -21
  150. package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -113
  151. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
  152. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -8
  153. package/dist/esm/isomorphic/actions/prepareCalls.js +0 -116
  154. package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
  155. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
  156. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -157
  157. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
  158. package/dist/esm/isomorphic/client.d.ts +0 -239
  159. package/dist/esm/isomorphic/client.js +0 -37
  160. package/dist/esm/isomorphic/client.js.map +0 -1
  161. package/dist/esm/isomorphic/utils/7702.d.ts +0 -23
  162. package/dist/esm/isomorphic/utils/7702.js +0 -75
  163. package/dist/esm/isomorphic/utils/7702.js.map +0 -1
  164. package/dist/esm/isomorphic/utils/createAccount.d.ts +0 -24
  165. package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
  166. package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
  167. package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
  168. package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
  169. package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
  170. package/dist/esm/isomorphic/utils/decodeSignature.js +0 -13
  171. package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
  172. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
  173. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
  174. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
  175. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
  176. package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
  177. package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
  178. package/dist/esm/local/client.d.ts +0 -3
  179. package/dist/esm/local/client.js +0 -97
  180. package/dist/esm/local/client.js.map +0 -1
  181. package/dist/esm/remote/client.d.ts +0 -9
  182. package/dist/esm/remote/client.js +0 -41
  183. package/dist/esm/remote/client.js.map +0 -1
  184. package/dist/esm/rpc/examples.d.ts +0 -230
  185. package/dist/esm/rpc/examples.js +0 -314
  186. package/dist/esm/rpc/examples.js.map +0 -1
  187. package/dist/esm/rpc/request.d.ts +0 -755
  188. package/dist/esm/rpc/request.js +0 -214
  189. package/dist/esm/rpc/request.js.map +0 -1
  190. package/dist/esm/rpc/schema.d.ts +0 -703
  191. package/dist/esm/rpc/schema.js +0 -5
  192. package/dist/esm/rpc/schema.js.map +0 -1
  193. package/dist/esm/schemas.d.ts +0 -712
  194. package/dist/esm/schemas.js +0 -463
  195. package/dist/esm/schemas.js.map +0 -1
  196. package/dist/types/capabilities/eip7702Auth.d.ts +0 -5
  197. package/dist/types/capabilities/eip7702Auth.d.ts.map +0 -1
  198. package/dist/types/capabilities/index.d.ts +0 -42
  199. package/dist/types/capabilities/index.d.ts.map +0 -1
  200. package/dist/types/capabilities/multiDimensionalNonce.d.ts +0 -4
  201. package/dist/types/capabilities/multiDimensionalNonce.d.ts.map +0 -1
  202. package/dist/types/capabilities/overrides.d.ts +0 -27
  203. package/dist/types/capabilities/overrides.d.ts.map +0 -1
  204. package/dist/types/capabilities/paymaster.d.ts +0 -4
  205. package/dist/types/capabilities/paymaster.d.ts.map +0 -1
  206. package/dist/types/capabilities/permissions/index.d.ts +0 -146
  207. package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
  208. package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
  209. package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
  210. package/dist/types/client/actions/createAccount.d.ts +0 -36
  211. package/dist/types/client/actions/createAccount.d.ts.map +0 -1
  212. package/dist/types/client/client.e2e-test.d.ts +0 -2
  213. package/dist/types/client/client.e2e-test.d.ts.map +0 -1
  214. package/dist/types/exports/internal.d.ts +0 -15
  215. package/dist/types/exports/internal.d.ts.map +0 -1
  216. package/dist/types/isomorphic/actions/createSession.d.ts +0 -15
  217. package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
  218. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -22
  219. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
  220. package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -9
  221. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
  222. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -9
  223. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
  224. package/dist/types/isomorphic/client.d.ts +0 -240
  225. package/dist/types/isomorphic/client.d.ts.map +0 -1
  226. package/dist/types/isomorphic/utils/7702.d.ts +0 -24
  227. package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
  228. package/dist/types/isomorphic/utils/createAccount.d.ts +0 -25
  229. package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
  230. package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
  231. package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
  232. package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
  233. package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
  234. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
  235. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
  236. package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
  237. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
  238. package/dist/types/local/client.d.ts +0 -4
  239. package/dist/types/local/client.d.ts.map +0 -1
  240. package/dist/types/remote/client.d.ts +0 -10
  241. package/dist/types/remote/client.d.ts.map +0 -1
  242. package/dist/types/rpc/examples.d.ts +0 -231
  243. package/dist/types/rpc/examples.d.ts.map +0 -1
  244. package/dist/types/rpc/request.d.ts +0 -756
  245. package/dist/types/rpc/request.d.ts.map +0 -1
  246. package/dist/types/rpc/schema.d.ts +0 -704
  247. package/dist/types/rpc/schema.d.ts.map +0 -1
  248. package/dist/types/schemas.d.ts +0 -713
  249. package/dist/types/schemas.d.ts.map +0 -1
  250. package/src/capabilities/eip7702Auth.ts +0 -26
  251. package/src/capabilities/index.ts +0 -14
  252. package/src/capabilities/multiDimensionalNonce.ts +0 -7
  253. package/src/capabilities/overrides.ts +0 -35
  254. package/src/capabilities/paymaster.ts +0 -5
  255. package/src/capabilities/permissions/index.ts +0 -163
  256. package/src/capabilities/permissions/mav2.ts +0 -138
  257. package/src/client/actions/createAccount.ts +0 -53
  258. package/src/client/client.e2e-test.ts +0 -463
  259. package/src/exports/internal.ts +0 -17
  260. package/src/isomorphic/actions/createSession.ts +0 -159
  261. package/src/isomorphic/actions/getCallsStatus.ts +0 -170
  262. package/src/isomorphic/actions/prepareCalls.ts +0 -170
  263. package/src/isomorphic/actions/sendPreparedCalls.ts +0 -232
  264. package/src/isomorphic/client.ts +0 -94
  265. package/src/isomorphic/utils/7702.ts +0 -143
  266. package/src/isomorphic/utils/createAccount.ts +0 -170
  267. package/src/isomorphic/utils/createDummySigner.ts +0 -27
  268. package/src/isomorphic/utils/decodeSignature.ts +0 -18
  269. package/src/isomorphic/utils/parsePermissionsContext.ts +0 -49
  270. package/src/isomorphic/utils/supportsFeature.ts +0 -34
  271. package/src/local/client.ts +0 -136
  272. package/src/remote/client.ts +0 -67
  273. package/src/rpc/examples.ts +0 -342
  274. package/src/rpc/request.ts +0 -300
  275. package/src/rpc/schema.ts +0 -40
  276. package/src/schemas.ts +0 -657
@@ -1,342 +0,0 @@
1
- const PrepareCalls = [
2
- {
3
- name: "wallet_prepareCalls example",
4
- params: [
5
- {
6
- name: "Request",
7
- value: [
8
- {
9
- calls: [
10
- {
11
- to: "0x1234567890123456789012345678901234567890",
12
- data: "0x",
13
- },
14
- ],
15
- from: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
16
- chainId: "0x01",
17
- capabilities: {
18
- paymasterService: {
19
- policyId: "11111111-2222-3333-4444-555555555555",
20
- },
21
- },
22
- },
23
- ],
24
- },
25
- ],
26
- result: {
27
- name: "Response",
28
- value: {
29
- type: "user-operation-v070",
30
- data: {
31
- sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
32
- nonce: "0x10000000000000000",
33
- callData:
34
- "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
35
- paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048",
36
- paymasterData:
37
- "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c",
38
- paymasterPostOpGasLimit: "0x0",
39
- paymasterVerificationGasLimit: "0x74d3",
40
- maxPriorityFeePerGas: "0x60e4b0",
41
- maxFeePerGas: "0x1bf52290",
42
- callGasLimit: "0x2bb8",
43
- verificationGasLimit: "0xc845",
44
- preVerificationGas: "0x14b74",
45
- },
46
- chainId: "0x66eee",
47
- signatureRequest: {
48
- type: "personal_sign",
49
- data: {
50
- raw: "0xc69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392",
51
- },
52
- },
53
- },
54
- },
55
- },
56
- ] as const;
57
-
58
- const SendPreparedCalls = [
59
- {
60
- name: "wallet_sendPreparedCalls example",
61
- params: [
62
- {
63
- name: "Request",
64
- value: [
65
- {
66
- type: "user-operation-v070",
67
- data: {
68
- sender: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
69
- nonce: "0x10000000000000000",
70
- callData:
71
- "0x34fcd5be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
72
- paymaster: "0x3f222Df6aB18C1E10d0Ec136503c3B0dfd929048",
73
- paymasterData:
74
- "0x0000000000000000682d7e7c9fa6f71c28c31141a11ac9eb2bdbe898ddbd42a4f7085f8bb3380ba75dd9231a386e24fe5a84777217c907391e983b5b0f78a4a9d0fd1c8631dd22c10e106b461c",
75
- paymasterPostOpGasLimit: "0x0",
76
- paymasterVerificationGasLimit: "0x74d3",
77
- maxPriorityFeePerGas: "0x60e4b0",
78
- maxFeePerGas: "0x1bf52290",
79
- callGasLimit: "0x2bb8",
80
- verificationGasLimit: "0xc845",
81
- preVerificationGas: "0x14b74",
82
- },
83
- chainId: "0x66eee",
84
- signature: {
85
- type: "secp256k1",
86
- data: "0xb1a055089b1ba8387ed435f2bd0afe7ff69f22b928cdfdea1b5323c64d6af387164de3fa6febf031b544de46a84d6fb7f084b9798ddfaba820950c257139a7321b",
87
- },
88
- },
89
- ],
90
- },
91
- ],
92
- result: {
93
- name: "Response",
94
- value: {
95
- preparedCallIds: [
96
- "0x0000000000000000000000000000000000000000000000000000000000066eeec69e468aa6fafb5c7298c02841e76f976b433018266af39a5807bc29ea9ad392",
97
- ],
98
- },
99
- },
100
- },
101
- ] as const;
102
-
103
- const RequestAccount = [
104
- {
105
- name: "wallet_requestAccount example",
106
- params: [
107
- {
108
- name: "Request",
109
- value: [
110
- {
111
- signerAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
112
- },
113
- ],
114
- },
115
- ],
116
- result: {
117
- name: "Response",
118
- value: {
119
- accountAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
120
- id: "3061cc5f-1f96-48a9-ab45-41faad2dd23b",
121
- },
122
- },
123
- },
124
- ] as const;
125
-
126
- const CreateAccount = [
127
- {
128
- name: "wallet_createAccount example",
129
- params: [
130
- {
131
- name: "Request",
132
- value: [
133
- {
134
- signerAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
135
- creationOption: {
136
- salt: "0x10",
137
- },
138
- },
139
- ],
140
- },
141
- ],
142
- result: {
143
- name: "Response",
144
- value: {
145
- accountAddress: "0xa363219d7C0b8673df17529D469Db9eFF0f35D2A",
146
- id: "3061cc5f-1f96-48a9-ab45-41faad2dd23b",
147
- },
148
- },
149
- },
150
- ] as const;
151
-
152
- const ListAccounts = [
153
- {
154
- name: "wallet_listAccounts example",
155
- params: [
156
- {
157
- name: "Request",
158
- value: [
159
- {
160
- signerAddress: "0x6275B53E98D07c729108A177207634eA22F5A748",
161
- },
162
- ],
163
- },
164
- ],
165
- result: {
166
- name: "Response",
167
- value: {
168
- accounts: [
169
- {
170
- accountAddress: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2",
171
- id: "3d8b3315-4aa1-4c67-8c82-20221e8dbf16",
172
- },
173
- ],
174
- meta: {
175
- totalCount: 1,
176
- after: null,
177
- },
178
- },
179
- },
180
- },
181
- ] as const;
182
-
183
- const CreateSession = [
184
- {
185
- name: "wallet_createSession example",
186
- params: [
187
- {
188
- name: "Request",
189
- value: [
190
- {
191
- account: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2",
192
- chainId: "0x01",
193
- key: {
194
- publicKey: "0x647bbf38CD0E116d1672405aE17a775572a84e03",
195
- type: "secp256k1",
196
- },
197
- permissions: [
198
- {
199
- type: "root",
200
- },
201
- ],
202
- expirySec: 1747969653,
203
- },
204
- ],
205
- },
206
- ],
207
- result: {
208
- name: "Response",
209
- value: {
210
- sessionId: "0xcd8b2d07a6fa76f1e8a5eaa8f3a7883c",
211
- signatureRequest: {
212
- type: "eth_signTypedData_v4",
213
- data: {
214
- domain: {
215
- chainId: 1,
216
- verifyingContract: "0xafdABa1E09e82F780721963eba39bA9e6d9FE4d2",
217
- },
218
- types: {
219
- DeferredAction: [
220
- {
221
- name: "nonce",
222
- type: "uint256",
223
- },
224
- {
225
- name: "deadline",
226
- type: "uint48",
227
- },
228
- {
229
- name: "call",
230
- type: "bytes",
231
- },
232
- ],
233
- },
234
- primaryType: "DeferredAction",
235
- message: {
236
- nonce: "0x1030000000000000000",
237
- deadline: 1747969653,
238
- call: "0x1bbf564c00000000000099DE0BF6fA90dEB851E2A2df7d83000000010500000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000647bbf38cd0e116d1672405ae17a775572a84e0300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007900000000000082B8e2012be914dFA4f62A0573eA0000000101000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000682fe675000000000000000000000000000000000000000000000000000000000000000000000000000000",
239
- },
240
- },
241
- },
242
- },
243
- },
244
- },
245
- ] as const;
246
-
247
- const GetCallsStatus = [
248
- {
249
- name: "wallet_getCallsStatus example",
250
- params: [
251
- {
252
- name: "Request",
253
- value: [
254
- "0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477",
255
- ],
256
- },
257
- ],
258
- result: {
259
- name: "Response",
260
- value: {
261
- id: "0x0000000000000000000000000000000000000000000000000000000000066eee1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477",
262
- chainId: "0x66eee",
263
- atomic: true,
264
- status: 200,
265
- receipts: [
266
- {
267
- status: "0x1",
268
- blockHash:
269
- "0x7c6f2f548c0ad4434dfb64f49a810bc795dadcd4cbec948bf8d4ae81a10fed5e",
270
- blockNumber: "0x8ba5f79",
271
- gasUsed: "0x33c65",
272
- transactionHash:
273
- "0x8ec28074a461102e4dbe43cb4aa9fed3e8c1274f1f1b0d5f6a0919ce7e20f517",
274
- logs: [
275
- {
276
- address: "0x00000000000017c61b5bee81050ec8efc9c6fecd",
277
- data: "0x0000000000000000000000000000000000000000000000000000000000000000",
278
- topics: [
279
- "0xd32049610f0cd3babd266cf338d726cc8c34c8ff97356c0f33c13fa59962ac92",
280
- "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d",
281
- "0x0000000000000000000000003f3503e682bf27330f9e5065043d47207e609e7d",
282
- ],
283
- },
284
- {
285
- address: "0x0000000071727de22e5e9d8baf0edac6f37da032",
286
- data: "0x00000000000000000000000000000000000017c61b5bee81050ec8efc9c6fecd0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633",
287
- topics: [
288
- "0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d",
289
- "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477",
290
- "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d",
291
- ],
292
- },
293
- {
294
- address: "0x0000000071727de22e5e9d8baf0edac6f37da032",
295
- data: "0x",
296
- topics: [
297
- "0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972",
298
- ],
299
- },
300
- {
301
- address: "0x0000000071727de22e5e9d8baf0edac6f37da032",
302
- data: "0x00000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000014ba6c2cd4f0000000000000000000000000000000000000000000000000000000000003451d",
303
- topics: [
304
- "0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
305
- "0x1057eff9529142aa3b74adcaacfce5b99a09d80c9f2e38e35ea1f27535e61477",
306
- "0x000000000000000000000000f13223cca0ae9786dd91dffe1f4e834c71ccdc2d",
307
- "0x0000000000000000000000002cc0c7981d846b9f2a16276556f6e8cb52bfb633",
308
- ],
309
- },
310
- ],
311
- },
312
- ],
313
- },
314
- },
315
- },
316
- ] as const;
317
-
318
- type Example = readonly [
319
- {
320
- name: string;
321
- params: readonly [
322
- {
323
- name: "Request";
324
- value: readonly [unknown];
325
- },
326
- ];
327
- result: {
328
- name: "Response";
329
- value: unknown;
330
- };
331
- },
332
- ];
333
-
334
- export const Examples = {
335
- PrepareCalls,
336
- SendPreparedCalls,
337
- RequestAccount,
338
- CreateAccount,
339
- ListAccounts,
340
- CreateSession,
341
- GetCallsStatus,
342
- } satisfies Record<string, Example>;
@@ -1,300 +0,0 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { Capabilities } from "../capabilities/index.js";
3
- import {
4
- PermissionsContext,
5
- PermissionsData,
6
- RemotePermission,
7
- } from "../capabilities/permissions/index.js";
8
- import {
9
- TypeCallArray,
10
- TypePrepareCall_UserOpV060_Signed,
11
- TypePrepareCall_UserOpV070_Signed,
12
- PreparedCall_Authorization,
13
- PreparedCall_UserOpV060,
14
- PreparedCall_UserOpV070,
15
- TypeAddress,
16
- TypeBase64UrlEncodedString,
17
- TypeCreationOptions,
18
- TypeHex,
19
- TypeSerializedInitcode,
20
- TypeTypedDataSignatureRequest,
21
- TypeUuid,
22
- } from "../schemas.js";
23
- import { Examples } from "./examples.js";
24
-
25
- export const wallet_sendPreparedCalls = Type.Object(
26
- {
27
- Request: Type.Object({
28
- method: Type.Literal("wallet_sendPreparedCalls"),
29
- params: Type.Tuple([
30
- Type.Intersect([
31
- Type.Union([
32
- TypeCallArray,
33
- TypePrepareCall_UserOpV060_Signed,
34
- TypePrepareCall_UserOpV070_Signed,
35
- ]),
36
- Type.Object({
37
- capabilities: Type.Optional(
38
- Type.Object({
39
- permissions: Type.Optional(
40
- Type.Union([PermissionsContext, RemotePermission]),
41
- ),
42
- }),
43
- ),
44
- }),
45
- ]),
46
- ]),
47
- }),
48
- ReturnType: Type.Object({
49
- preparedCallIds: Type.Array(TypeHex()),
50
- }),
51
- },
52
- {
53
- description:
54
- "This method is used after signing the signatureRequest returned from prepareCalls to submit a user operation",
55
- examples: Examples.SendPreparedCalls,
56
- },
57
- );
58
-
59
- export const wallet_prepareCalls = Type.Object(
60
- {
61
- Request: Type.Object({
62
- method: Type.Literal("wallet_prepareCalls"),
63
- params: Type.Tuple([
64
- Type.Object({
65
- calls: Type.Array(
66
- Type.Object({
67
- to: TypeAddress,
68
- data: Type.Optional(TypeHex()),
69
- value: Type.Optional(TypeHex()),
70
- }),
71
- ),
72
- from: TypeAddress,
73
- chainId: TypeHex(),
74
- capabilities: Type.Optional(Capabilities),
75
- }),
76
- ]),
77
- }),
78
- ReturnType: Type.Union([
79
- Type.Object(
80
- {
81
- type: Type.Literal("array"),
82
- data: Type.Array(
83
- Type.Union([
84
- PreparedCall_UserOpV060,
85
- PreparedCall_UserOpV070,
86
- PreparedCall_Authorization,
87
- ]),
88
- ),
89
- },
90
- { description: "Array of prepared calls" },
91
- ),
92
- PreparedCall_UserOpV060,
93
- PreparedCall_UserOpV070,
94
- ]),
95
- },
96
- {
97
- description:
98
- "This method is used to prepare a user operation for submission. It will return a built user operation and a signature request which needs to be signed by the user before submitting to wallet_sendPreparedCalls",
99
- examples: Examples.PrepareCalls,
100
- },
101
- );
102
-
103
- export const wallet_requestAccount = Type.Object(
104
- {
105
- Request: Type.Object({
106
- method: Type.Literal("wallet_requestAccount"),
107
- params: Type.Tuple([
108
- Type.Union([
109
- Type.Object(
110
- {
111
- signerAddress: TypeAddress,
112
- id: Type.Optional(TypeUuid),
113
- creationHint: TypeCreationOptions,
114
- includeCounterfactualInfo: Type.Optional(
115
- Type.Boolean({ default: false }),
116
- ),
117
- },
118
- {
119
- description: "Using signer address",
120
- },
121
- ),
122
- Type.Object(
123
- {
124
- accountAddress: TypeAddress,
125
- includeCounterfactualInfo: Type.Optional(
126
- Type.Boolean({ default: false }),
127
- ),
128
- },
129
- {
130
- description: "Using smart contract account address",
131
- },
132
- ),
133
- ]),
134
- ]),
135
- }),
136
- ReturnType: Type.Object({
137
- accountAddress: TypeAddress,
138
- id: TypeUuid,
139
- counterfactualInfo: Type.Optional(TypeSerializedInitcode),
140
- delegation: Type.Optional(TypeAddress),
141
- }),
142
- },
143
- {
144
- description: `This method is used to get the smart account address and relevant info for a given signer. If an account does not already exist for a given signer, this method will create one before returning the counterfactual address.`,
145
- examples: Examples.RequestAccount,
146
- },
147
- );
148
-
149
- export const wallet_createAccount = Type.Object(
150
- {
151
- Request: Type.Object({
152
- method: Type.Literal("wallet_createAccount"),
153
- params: Type.Tuple([
154
- Type.Object({
155
- signerAddress: TypeAddress,
156
- id: Type.Optional(TypeUuid),
157
- creationOptions: TypeCreationOptions,
158
- }),
159
- ]),
160
- }),
161
- ReturnType: Type.Object({
162
- accountAddress: TypeAddress,
163
- id: TypeUuid,
164
- }),
165
- },
166
- {
167
- description: `This method is used to create a smart account for a given signer. This method is primarly used to import existing accounts. For most cases, you should use wallet_requestAccount instead.`,
168
- examples: Examples.CreateAccount,
169
- },
170
- );
171
-
172
- export const wallet_listAccounts = Type.Object(
173
- {
174
- Request: Type.Object({
175
- method: Type.Literal("wallet_listAccounts"),
176
- params: Type.Tuple([
177
- Type.Object({
178
- signerAddress: TypeAddress,
179
- limit: Type.Optional(
180
- Type.Number({ minimum: 1, maximum: 100, default: 100 }),
181
- ),
182
- after: Type.Optional(TypeBase64UrlEncodedString),
183
- }),
184
- ]),
185
- }),
186
- ReturnType: Type.Object({
187
- accounts: Type.Array(
188
- Type.Object({
189
- accountAddress: TypeAddress,
190
- id: TypeUuid,
191
- }),
192
- ),
193
- meta: Type.Object({
194
- totalCount: Type.Integer(),
195
- after: Type.Union([TypeBase64UrlEncodedString, Type.Null()]),
196
- }),
197
- }),
198
- },
199
- {
200
- description:
201
- "This method is used to list all smart accounts for a given signer.",
202
- examples: Examples.ListAccounts,
203
- },
204
- );
205
-
206
- export const wallet_createSession = Type.Object(
207
- {
208
- Request: Type.Object({
209
- method: Type.Literal("wallet_createSession"),
210
- params: Type.Tuple([
211
- Type.Intersect([
212
- PermissionsData,
213
- Type.Object({
214
- account: TypeAddress,
215
- }),
216
- ]),
217
- ]),
218
- }),
219
- ReturnType: Type.Object({
220
- sessionId: TypeHex(),
221
- chainId: TypeHex(),
222
- signatureRequest: TypeTypedDataSignatureRequest,
223
- }),
224
- },
225
- {
226
- description:
227
- "This method is used to create a session for a given address with specified permissions.",
228
- examples: Examples.CreateSession,
229
- },
230
- );
231
-
232
- export const wallet_getCallsStatus = Type.Object(
233
- {
234
- Request: Type.Object({
235
- method: Type.Literal("wallet_getCallsStatus"),
236
- params: Type.Tuple([
237
- TypeHex({
238
- description: "The call ID returned from wallet_sendPreparedCalls",
239
- }),
240
- ]),
241
- }),
242
- ReturnType: Type.Object({
243
- id: TypeHex(),
244
- chainId: TypeHex(),
245
- atomic: Type.Boolean(),
246
- status: Type.Union([
247
- Type.Literal(100, {
248
- title: "Pending",
249
- description:
250
- "Batch has been received by the wallet but has not completed execution onchain",
251
- }),
252
- Type.Literal(200, {
253
- title: "Confirmed",
254
- description:
255
- "Batch has been included onchain without reverts, receipts array contains info of all calls",
256
- }),
257
- Type.Literal(400, {
258
- title: "Offchain Failure",
259
- description:
260
- "Batch has not been included onchain and wallet will not retry",
261
- }),
262
- Type.Literal(500, {
263
- title: "Onchain Failure",
264
- description:
265
- "Batch reverted *completely* and only changes related to gas charge may have been included onchain",
266
- }),
267
- Type.Literal(600, {
268
- title: "Partial Onchain Failure",
269
- description:
270
- "Batch reverted *partially* and some changes related to batch calls may have been included onchain",
271
- }),
272
- ]),
273
- receipts: Type.Optional(
274
- Type.Array(
275
- Type.Object({
276
- logs: Type.Array(
277
- Type.Object({
278
- address: TypeAddress,
279
- data: TypeHex(),
280
- topics: Type.Array(TypeHex()),
281
- }),
282
- ),
283
- status: TypeHex({
284
- description: "0x1 for success, 0x0 for failure",
285
- }),
286
- blockHash: TypeHex(),
287
- blockNumber: TypeHex(),
288
- gasUsed: TypeHex(),
289
- transactionHash: TypeHex(),
290
- }),
291
- ),
292
- ),
293
- }),
294
- },
295
- {
296
- description:
297
- "This method is used to get the status of calls IDs returned from wallet_sendPreparedCalls.",
298
- examples: Examples.GetCallsStatus,
299
- },
300
- );
package/src/rpc/schema.ts DELETED
@@ -1,40 +0,0 @@
1
- import { type Static } from "@sinclair/typebox";
2
- import { RpcSchema } from "ox";
3
- import * as Requests from "./request.js";
4
-
5
- export const WalletServerRpcSchema = RpcSchema.from<
6
- | Static<typeof Requests.wallet_prepareCalls>
7
- | Static<typeof Requests.wallet_sendPreparedCalls>
8
- | Static<typeof Requests.wallet_createAccount>
9
- | Static<typeof Requests.wallet_requestAccount>
10
- | Static<typeof Requests.wallet_listAccounts>
11
- | Static<typeof Requests.wallet_createSession>
12
- | Static<typeof Requests.wallet_getCallsStatus>
13
- >();
14
-
15
- export type WalletServerRpcSchemaType = typeof WalletServerRpcSchema;
16
-
17
- type MethodToViemRpcSchema = {
18
- [K in WalletServerRpcSchemaType["Request"]["method"]]: {
19
- Method: K;
20
- Parameters: Extract<
21
- WalletServerRpcSchemaType["Request"],
22
- { method: K }
23
- >["params"];
24
- ReturnType: Extract<
25
- WalletServerRpcSchemaType,
26
- { Request: { method: K } }
27
- >["ReturnType"];
28
- };
29
- };
30
-
31
- // TODO: figure out how we can do this without manually listing all the methods
32
- export type WalletServerViemRpcSchema = [
33
- MethodToViemRpcSchema["wallet_createAccount"],
34
- MethodToViemRpcSchema["wallet_requestAccount"],
35
- MethodToViemRpcSchema["wallet_listAccounts"],
36
- MethodToViemRpcSchema["wallet_prepareCalls"],
37
- MethodToViemRpcSchema["wallet_sendPreparedCalls"],
38
- MethodToViemRpcSchema["wallet_getCallsStatus"],
39
- MethodToViemRpcSchema["wallet_createSession"],
40
- ];