@account-kit/wallet-client 0.1.0-alpha.8 → 4.50.0

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 (269) 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 +28 -39
  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} +33 -35
  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 +14 -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 +14 -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 +33 -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 +40 -45
  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/{isomorphic/utils/createAccount.ts → internal/account.ts} +37 -54
  113. package/src/types.ts +7 -18
  114. package/src/utils.ts +15 -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 -38
  120. package/dist/esm/capabilities/index.js +0 -12
  121. package/dist/esm/capabilities/index.js.map +0 -1
  122. package/dist/esm/capabilities/overrides.d.ts +0 -26
  123. package/dist/esm/capabilities/overrides.js +0 -14
  124. package/dist/esm/capabilities/overrides.js.map +0 -1
  125. package/dist/esm/capabilities/paymaster.d.ts +0 -3
  126. package/dist/esm/capabilities/paymaster.js +0 -5
  127. package/dist/esm/capabilities/paymaster.js.map +0 -1
  128. package/dist/esm/capabilities/permissions/index.d.ts +0 -145
  129. package/dist/esm/capabilities/permissions/index.js +0 -83
  130. package/dist/esm/capabilities/permissions/index.js.map +0 -1
  131. package/dist/esm/capabilities/permissions/mav2.d.ts +0 -36
  132. package/dist/esm/capabilities/permissions/mav2.js +0 -88
  133. package/dist/esm/capabilities/permissions/mav2.js.map +0 -1
  134. package/dist/esm/client/actions/createAccount.d.ts +0 -35
  135. package/dist/esm/client/actions/createAccount.js +0 -32
  136. package/dist/esm/client/actions/createAccount.js.map +0 -1
  137. package/dist/esm/client/client.e2e-test.d.ts +0 -1
  138. package/dist/esm/client/client.e2e-test.js +0 -375
  139. package/dist/esm/client/client.e2e-test.js.map +0 -1
  140. package/dist/esm/exports/internal.d.ts +0 -13
  141. package/dist/esm/exports/internal.js +0 -15
  142. package/dist/esm/exports/internal.js.map +0 -1
  143. package/dist/esm/isomorphic/actions/createSession.d.ts +0 -14
  144. package/dist/esm/isomorphic/actions/createSession.js +0 -89
  145. package/dist/esm/isomorphic/actions/createSession.js.map +0 -1
  146. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +0 -21
  147. package/dist/esm/isomorphic/actions/getCallsStatus.js +0 -113
  148. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +0 -1
  149. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +0 -8
  150. package/dist/esm/isomorphic/actions/prepareCalls.js +0 -101
  151. package/dist/esm/isomorphic/actions/prepareCalls.js.map +0 -1
  152. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +0 -8
  153. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +0 -148
  154. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +0 -1
  155. package/dist/esm/isomorphic/client.d.ts +0 -239
  156. package/dist/esm/isomorphic/client.js +0 -37
  157. package/dist/esm/isomorphic/client.js.map +0 -1
  158. package/dist/esm/isomorphic/utils/7702.d.ts +0 -18
  159. package/dist/esm/isomorphic/utils/7702.js +0 -74
  160. package/dist/esm/isomorphic/utils/7702.js.map +0 -1
  161. package/dist/esm/isomorphic/utils/createAccount.d.ts +0 -23
  162. package/dist/esm/isomorphic/utils/createAccount.js.map +0 -1
  163. package/dist/esm/isomorphic/utils/createDummySigner.d.ts +0 -3
  164. package/dist/esm/isomorphic/utils/createDummySigner.js +0 -17
  165. package/dist/esm/isomorphic/utils/createDummySigner.js.map +0 -1
  166. package/dist/esm/isomorphic/utils/decodeSignature.d.ts +0 -3
  167. package/dist/esm/isomorphic/utils/decodeSignature.js +0 -13
  168. package/dist/esm/isomorphic/utils/decodeSignature.js.map +0 -1
  169. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +0 -21
  170. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +0 -34
  171. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +0 -1
  172. package/dist/esm/isomorphic/utils/supportsFeature.d.ts +0 -4
  173. package/dist/esm/isomorphic/utils/supportsFeature.js +0 -21
  174. package/dist/esm/isomorphic/utils/supportsFeature.js.map +0 -1
  175. package/dist/esm/local/client.d.ts +0 -3
  176. package/dist/esm/local/client.js +0 -97
  177. package/dist/esm/local/client.js.map +0 -1
  178. package/dist/esm/remote/client.d.ts +0 -9
  179. package/dist/esm/remote/client.js +0 -41
  180. package/dist/esm/remote/client.js.map +0 -1
  181. package/dist/esm/rpc/examples.d.ts +0 -230
  182. package/dist/esm/rpc/examples.js +0 -314
  183. package/dist/esm/rpc/examples.js.map +0 -1
  184. package/dist/esm/rpc/request.d.ts +0 -711
  185. package/dist/esm/rpc/request.js +0 -213
  186. package/dist/esm/rpc/request.js.map +0 -1
  187. package/dist/esm/rpc/schema.d.ts +0 -659
  188. package/dist/esm/rpc/schema.js +0 -5
  189. package/dist/esm/rpc/schema.js.map +0 -1
  190. package/dist/esm/schemas.d.ts +0 -693
  191. package/dist/esm/schemas.js +0 -419
  192. package/dist/esm/schemas.js.map +0 -1
  193. package/dist/types/capabilities/eip7702Auth.d.ts +0 -5
  194. package/dist/types/capabilities/eip7702Auth.d.ts.map +0 -1
  195. package/dist/types/capabilities/index.d.ts +0 -39
  196. package/dist/types/capabilities/index.d.ts.map +0 -1
  197. package/dist/types/capabilities/overrides.d.ts +0 -27
  198. package/dist/types/capabilities/overrides.d.ts.map +0 -1
  199. package/dist/types/capabilities/paymaster.d.ts +0 -4
  200. package/dist/types/capabilities/paymaster.d.ts.map +0 -1
  201. package/dist/types/capabilities/permissions/index.d.ts +0 -146
  202. package/dist/types/capabilities/permissions/index.d.ts.map +0 -1
  203. package/dist/types/capabilities/permissions/mav2.d.ts +0 -37
  204. package/dist/types/capabilities/permissions/mav2.d.ts.map +0 -1
  205. package/dist/types/client/actions/createAccount.d.ts +0 -36
  206. package/dist/types/client/actions/createAccount.d.ts.map +0 -1
  207. package/dist/types/client/client.e2e-test.d.ts +0 -2
  208. package/dist/types/client/client.e2e-test.d.ts.map +0 -1
  209. package/dist/types/exports/internal.d.ts +0 -14
  210. package/dist/types/exports/internal.d.ts.map +0 -1
  211. package/dist/types/isomorphic/actions/createSession.d.ts +0 -15
  212. package/dist/types/isomorphic/actions/createSession.d.ts.map +0 -1
  213. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +0 -22
  214. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +0 -1
  215. package/dist/types/isomorphic/actions/prepareCalls.d.ts +0 -9
  216. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +0 -1
  217. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +0 -9
  218. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +0 -1
  219. package/dist/types/isomorphic/client.d.ts +0 -240
  220. package/dist/types/isomorphic/client.d.ts.map +0 -1
  221. package/dist/types/isomorphic/utils/7702.d.ts +0 -19
  222. package/dist/types/isomorphic/utils/7702.d.ts.map +0 -1
  223. package/dist/types/isomorphic/utils/createAccount.d.ts +0 -24
  224. package/dist/types/isomorphic/utils/createAccount.d.ts.map +0 -1
  225. package/dist/types/isomorphic/utils/createDummySigner.d.ts +0 -4
  226. package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +0 -1
  227. package/dist/types/isomorphic/utils/decodeSignature.d.ts +0 -4
  228. package/dist/types/isomorphic/utils/decodeSignature.d.ts.map +0 -1
  229. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +0 -22
  230. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +0 -1
  231. package/dist/types/isomorphic/utils/supportsFeature.d.ts +0 -5
  232. package/dist/types/isomorphic/utils/supportsFeature.d.ts.map +0 -1
  233. package/dist/types/local/client.d.ts +0 -4
  234. package/dist/types/local/client.d.ts.map +0 -1
  235. package/dist/types/remote/client.d.ts +0 -10
  236. package/dist/types/remote/client.d.ts.map +0 -1
  237. package/dist/types/rpc/examples.d.ts +0 -231
  238. package/dist/types/rpc/examples.d.ts.map +0 -1
  239. package/dist/types/rpc/request.d.ts +0 -712
  240. package/dist/types/rpc/request.d.ts.map +0 -1
  241. package/dist/types/rpc/schema.d.ts +0 -660
  242. package/dist/types/rpc/schema.d.ts.map +0 -1
  243. package/dist/types/schemas.d.ts +0 -694
  244. package/dist/types/schemas.d.ts.map +0 -1
  245. package/src/capabilities/eip7702Auth.ts +0 -26
  246. package/src/capabilities/index.ts +0 -12
  247. package/src/capabilities/overrides.ts +0 -35
  248. package/src/capabilities/paymaster.ts +0 -5
  249. package/src/capabilities/permissions/index.ts +0 -163
  250. package/src/capabilities/permissions/mav2.ts +0 -138
  251. package/src/client/actions/createAccount.ts +0 -53
  252. package/src/client/client.e2e-test.ts +0 -463
  253. package/src/exports/internal.ts +0 -16
  254. package/src/isomorphic/actions/createSession.ts +0 -151
  255. package/src/isomorphic/actions/getCallsStatus.ts +0 -170
  256. package/src/isomorphic/actions/prepareCalls.ts +0 -152
  257. package/src/isomorphic/actions/sendPreparedCalls.ts +0 -222
  258. package/src/isomorphic/client.ts +0 -94
  259. package/src/isomorphic/utils/7702.ts +0 -132
  260. package/src/isomorphic/utils/createDummySigner.ts +0 -27
  261. package/src/isomorphic/utils/decodeSignature.ts +0 -18
  262. package/src/isomorphic/utils/parsePermissionsContext.ts +0 -49
  263. package/src/isomorphic/utils/supportsFeature.ts +0 -34
  264. package/src/local/client.ts +0 -136
  265. package/src/remote/client.ts +0 -67
  266. package/src/rpc/examples.ts +0 -342
  267. package/src/rpc/request.ts +0 -299
  268. package/src/rpc/schema.ts +0 -40
  269. package/src/schemas.ts +0 -585
@@ -2,8 +2,8 @@ import {} from "@aa-sdk/core";
2
2
  import { Value } from "@sinclair/typebox/value";
3
3
  import deepEqual from "deep-equal";
4
4
  import { custom } from "viem";
5
- import { createAccount } from "../../isomorphic/utils/createAccount.js";
6
- import { TypeSerializedInitcode } from "../../schemas.js";
5
+ import { SerializedInitcode } from "@alchemy/wallet-api-types";
6
+ import { createAccount } from "../../internal/account.js";
7
7
  /**
8
8
  * Requests an account for the provided signer using the wallet API client.
9
9
  * If an account already exists for the signer, it will always return that account unless a new ID is specified.
@@ -17,9 +17,11 @@ import { TypeSerializedInitcode } from "../../schemas.js";
17
17
  * @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance
18
18
  *
19
19
  * @example
20
+ * ```ts
20
21
  * // Request an account with default parameters using a local signer
21
22
  * const signer = LocalAccountSigner.privateKeyToAccountSigner("0x...");
22
23
  * const account = await client.requestAccount(signer);
24
+ * ```
23
25
  */
24
26
  export async function requestAccount(client, signer, params) {
25
27
  const args = (client.account && !params) || params?.accountAddress
@@ -46,7 +48,7 @@ export async function requestAccount(client, signer, params) {
46
48
  const account = await createAccount({
47
49
  accountAddress,
48
50
  counterfactualInfo: counterfactualInfo
49
- ? Value.Parse(TypeSerializedInitcode, counterfactualInfo)
51
+ ? Value.Parse(SerializedInitcode, counterfactualInfo)
50
52
  : undefined,
51
53
  delegation,
52
54
  chain: client.chain,
@@ -1 +1 @@
1
- {"version":3,"file":"requestAccount.js","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAa1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA0B,EAC1B,MAA6B;IAE7B,MAAM,IAAI,GACR,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,cAAc;QACnD,CAAC,CAAC;YACE,cAAc,EAAE,MAAM,EAAE,cAAc,IAAI,MAAM,CAAC,OAAQ,CAAC,OAAO;YACjE,yBAAyB,EAAE,IAAI;SAChC;QACH,CAAC,CAAC;YACE,GAAG,MAAM;YACT,aAAa,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;YACxC,yBAAyB,EAAE,IAAI;SAChC,CAAC;IAER,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAEnD,IACE,aAAa;QACb,CAAC,CAAC,IAAI,CAAC,cAAc;YACnB,aAAa,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC;YACtD,SAAS,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EACjE,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,GACtD,MAAM,MAAM,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,CAAC,CAAC;IAEL,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC;QAClC,cAAc;QACd,kBAAkB,EAAE,kBAAkB;YACpC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;YACzD,CAAC,CAAC,SAAS;QACb,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport type { Address } from \"abitype\";\nimport deepEqual from \"deep-equal\";\nimport { custom } from \"viem\";\nimport { createAccount } from \"../../isomorphic/utils/createAccount.js\";\nimport type { wallet_requestAccount } from \"../../rpc/request.js\";\nimport { TypeSerializedInitcode } from \"../../schemas.js\";\nimport type { InnerWalletApiClient } from \"../../types.js\";\n\nexport type RequestAccountParams = Omit<\n Extract<\n Static<typeof wallet_requestAccount>[\"Request\"][\"params\"][0],\n { signerAddress: Address }\n >,\n \"signerAddress\" | \"includeCounterfactualInfo\"\n> & { accountAddress?: Address };\n\nexport type RequestAccountResult = SmartContractAccount;\n\n/**\n * Requests an account for the provided signer using the wallet API client.\n * If an account already exists for the signer, it will always return that account unless a new ID is specified.\n * If an account already exists, the creationHint will be ignored.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer that will be associated with the account\n * @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account\n * @param {string} [params.id] - Optional identifier for the account. If specified, a new account with this ID will be created even if one already exists for the signer\n * @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists\n * @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance\n *\n * @example\n * // Request an account with default parameters using a local signer\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(\"0x...\");\n * const account = await client.requestAccount(signer);\n */\nexport async function requestAccount(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params?: RequestAccountParams,\n): Promise<RequestAccountResult> {\n const args =\n (client.account && !params) || params?.accountAddress\n ? {\n accountAddress: params?.accountAddress ?? client.account!.address,\n includeCounterfactualInfo: true,\n }\n : {\n ...params,\n signerAddress: await signer.getAddress(),\n includeCounterfactualInfo: true,\n };\n\n const cachedAccount = client.internal.getAccount();\n\n if (\n cachedAccount &&\n ((args.accountAddress &&\n cachedAccount.account.address === args.accountAddress) ||\n deepEqual(cachedAccount.requestParams, args, { strict: true }))\n ) {\n return cachedAccount.account;\n }\n\n const { accountAddress, counterfactualInfo, delegation } =\n await client.request({\n method: \"wallet_requestAccount\",\n params: [args],\n });\n\n const account = await createAccount({\n accountAddress,\n counterfactualInfo: counterfactualInfo\n ? Value.Parse(TypeSerializedInitcode, counterfactualInfo)\n : undefined,\n delegation,\n chain: client.chain,\n transport: custom(client.transport),\n signer,\n });\n\n client.internal.setAccount({ account, requestParams: args });\n\n return account;\n}\n"]}
1
+ {"version":3,"file":"requestAccount.js","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAY1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA0B,EAC1B,MAA6B;IAE7B,MAAM,IAAI,GACR,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,cAAc;QACnD,CAAC,CAAC;YACE,cAAc,EAAE,MAAM,EAAE,cAAc,IAAI,MAAM,CAAC,OAAQ,CAAC,OAAO;YACjE,yBAAyB,EAAE,IAAI;SAChC;QACH,CAAC,CAAC;YACE,GAAG,MAAM;YACT,aAAa,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;YACxC,yBAAyB,EAAE,IAAI;SAChC,CAAC;IAER,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAEnD,IACE,aAAa;QACb,CAAC,CAAC,IAAI,CAAC,cAAc;YACnB,aAAa,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC;YACtD,SAAS,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EACjE,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,GACtD,MAAM,MAAM,CAAC,OAAO,CAAC;QACnB,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,CAAC,CAAC;IAEL,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC;QAClC,cAAc;QACd,kBAAkB,EAAE,kBAAkB;YACpC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;YACrD,CAAC,CAAC,SAAS;QACb,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport type { Address } from \"abitype\";\nimport deepEqual from \"deep-equal\";\nimport { custom } from \"viem\";\nimport type { wallet_requestAccount } from \"@alchemy/wallet-api-types/rpc\";\nimport { SerializedInitcode } from \"@alchemy/wallet-api-types\";\nimport type { InnerWalletApiClient } from \"../../types.js\";\nimport { createAccount } from \"../../internal/account.js\";\n\nexport type RequestAccountParams = Omit<\n Extract<\n Static<typeof wallet_requestAccount>[\"Request\"][\"params\"][0],\n { signerAddress: Address }\n >,\n \"signerAddress\" | \"includeCounterfactualInfo\"\n> & { accountAddress?: Address };\n\nexport type RequestAccountResult = SmartContractAccount;\n\n/**\n * Requests an account for the provided signer using the wallet API client.\n * If an account already exists for the signer, it will always return that account unless a new ID is specified.\n * If an account already exists, the creationHint will be ignored.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer that will be associated with the account\n * @param {RequestAccountParams} [params] - Optional parameters for requesting a specific account\n * @param {string} [params.id] - Optional identifier for the account. If specified, a new account with this ID will be created even if one already exists for the signer\n * @param {object} [params.creationHint] - Optional hints to guide account creation. These are ignored if an account already exists\n * @returns {Promise<RequestAccountResult>} A Promise that resolves to a SmartContractAccount instance\n *\n * @example\n * ```ts\n * // Request an account with default parameters using a local signer\n * const signer = LocalAccountSigner.privateKeyToAccountSigner(\"0x...\");\n * const account = await client.requestAccount(signer);\n * ```\n */\nexport async function requestAccount(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params?: RequestAccountParams,\n): Promise<RequestAccountResult> {\n const args =\n (client.account && !params) || params?.accountAddress\n ? {\n accountAddress: params?.accountAddress ?? client.account!.address,\n includeCounterfactualInfo: true,\n }\n : {\n ...params,\n signerAddress: await signer.getAddress(),\n includeCounterfactualInfo: true,\n };\n\n const cachedAccount = client.internal.getAccount();\n\n if (\n cachedAccount &&\n ((args.accountAddress &&\n cachedAccount.account.address === args.accountAddress) ||\n deepEqual(cachedAccount.requestParams, args, { strict: true }))\n ) {\n return cachedAccount.account;\n }\n\n const { accountAddress, counterfactualInfo, delegation } =\n await client.request({\n method: \"wallet_requestAccount\",\n params: [args],\n });\n\n const account = await createAccount({\n accountAddress,\n counterfactualInfo: counterfactualInfo\n ? Value.Parse(SerializedInitcode, counterfactualInfo)\n : undefined,\n delegation,\n chain: client.chain,\n transport: custom(client.transport),\n signer,\n });\n\n client.internal.setAccount({ account, requestParams: args });\n\n return account;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Static } from "@sinclair/typebox";
2
- import type { wallet_sendPreparedCalls } from "../../rpc/request.ts";
2
+ import type { wallet_sendPreparedCalls } from "@alchemy/wallet-api-types/rpc";
3
3
  import type { InnerWalletApiClient, WithoutChainId } from "../../types.ts";
4
4
  export type SendPreparedCallsParams = WithoutChainId<Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0]>;
5
5
  export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["ReturnType"];
@@ -12,6 +12,7 @@ export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["R
12
12
  * @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs
13
13
  *
14
14
  * @example
15
+ * ```ts
15
16
  * // First prepare the calls
16
17
  * const preparedCalls = await client.prepareCalls({
17
18
  * calls: [{
@@ -31,5 +32,6 @@ export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["R
31
32
  * const result = await client.sendPreparedCalls({
32
33
  * signedCalls,
33
34
  * });
35
+ * ```
34
36
  */
35
37
  export declare function sendPreparedCalls(client: InnerWalletApiClient, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
@@ -8,6 +8,7 @@ import { toHex } from "viem";
8
8
  * @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs
9
9
  *
10
10
  * @example
11
+ * ```ts
11
12
  * // First prepare the calls
12
13
  * const preparedCalls = await client.prepareCalls({
13
14
  * calls: [{
@@ -27,6 +28,7 @@ import { toHex } from "viem";
27
28
  * const result = await client.sendPreparedCalls({
28
29
  * signedCalls,
29
30
  * });
31
+ * ```
30
32
  */
31
33
  export async function sendPreparedCalls(client, params) {
32
34
  return client.request({
@@ -1 +1 @@
1
- {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAc7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAA+B;IAE/B,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE;YACN,MAAM,CAAC,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC;oBACE,GAAG,MAAM;oBACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;iBAChC;SACN;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport { toHex } from \"viem\";\nimport type { wallet_sendPreparedCalls } from \"../../rpc/request.ts\";\nimport type { InnerWalletApiClient, WithoutChainId } from \"../../types.ts\";\n\nexport type SendPreparedCallsParams = WithoutChainId<\n Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0]\n>;\n\nexport type SendPreparedCallsResult = Static<\n typeof wallet_sendPreparedCalls\n>[\"ReturnType\"];\n\n/**\n * Sends prepared calls by submitting a signed user operation.\n * This method is used after signing the signature request returned from prepareCalls.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SendPreparedCallsParams} params - Parameters for sending prepared calls\n * @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs\n *\n * @example\n * // First prepare the calls\n * const preparedCalls = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n *\n * // Then sign the calls\n * const signedCalls = await client.signPreparedCalls(preparedCalls);\n *\n * // Then send the prepared calls with the signature\n * const result = await client.sendPreparedCalls({\n * signedCalls,\n * });\n */\nexport async function sendPreparedCalls(\n client: InnerWalletApiClient,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n return client.request({\n method: \"wallet_sendPreparedCalls\",\n params: [\n params.type === \"array\"\n ? params\n : {\n ...params,\n chainId: toHex(client.chain.id),\n },\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAc7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAA+B;IAE/B,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE;YACN,MAAM,CAAC,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC;oBACE,GAAG,MAAM;oBACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;iBAChC;SACN;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport { toHex } from \"viem\";\nimport type { wallet_sendPreparedCalls } from \"@alchemy/wallet-api-types/rpc\";\nimport type { InnerWalletApiClient, WithoutChainId } from \"../../types.ts\";\n\nexport type SendPreparedCallsParams = WithoutChainId<\n Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n >[0]\n>;\n\nexport type SendPreparedCallsResult = Static<\n typeof wallet_sendPreparedCalls\n>[\"ReturnType\"];\n\n/**\n * Sends prepared calls by submitting a signed user operation.\n * This method is used after signing the signature request returned from prepareCalls.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SendPreparedCallsParams} params - Parameters for sending prepared calls\n * @returns {Promise<SendPreparedCallsResult>} A Promise that resolves to the result containing the prepared call IDs\n *\n * @example\n * ```ts\n * // First prepare the calls\n * const preparedCalls = await client.prepareCalls({\n * calls: [{\n * to: \"0x1234...\",\n * data: \"0xabcdef...\",\n * value: \"0x0\"\n * }],\n * capabilities: {\n * paymasterService: { policyId: \"your-policy-id\" }\n * }\n * });\n *\n * // Then sign the calls\n * const signedCalls = await client.signPreparedCalls(preparedCalls);\n *\n * // Then send the prepared calls with the signature\n * const result = await client.sendPreparedCalls({\n * signedCalls,\n * });\n * ```\n */\nexport async function sendPreparedCalls(\n client: InnerWalletApiClient,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n return client.request({\n method: \"wallet_sendPreparedCalls\",\n params: [\n params.type === \"array\"\n ? params\n : {\n ...params,\n chainId: toHex(client.chain.id),\n },\n ],\n });\n}\n"]}
@@ -12,15 +12,18 @@ export type SignMessageResult = Hex;
12
12
  *
13
13
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
14
14
  * @param {SmartAccountSigner} signer - The signer of the smart account
15
- * @param {SignableMessage} message - The message to sign
15
+ * @param {SignMessageParams} params - Parameters for signing the message
16
+ * @param {SignableMessage} params.message - The message to sign using EIP-191. Can be a string, or object with raw bytes.
17
+ * @param {Address} [params.account] - Optional account address to use for signing. If not provided, uses the client's current account.
16
18
  * @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string
17
19
  *
18
20
  * @example
21
+ * ```ts
19
22
  * // Sign a simple text message
20
23
  * const signature = await client.signMessage("Hello, world!");
21
24
  *
22
- * @example
23
25
  * // Sign a raw hex message
24
26
  * const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
27
+ * ```
25
28
  */
26
29
  export declare function signMessage(client: InnerWalletApiClient, signer: SmartAccountSigner, params: SignMessageParams): Promise<SignMessageResult>;
@@ -7,16 +7,19 @@ import { requestAccount } from "./requestAccount.js";
7
7
  *
8
8
  * @param {InnerWalletApiClient} client - The wallet API client to use for the request
9
9
  * @param {SmartAccountSigner} signer - The signer of the smart account
10
- * @param {SignableMessage} message - The message to sign
10
+ * @param {SignMessageParams} params - Parameters for signing the message
11
+ * @param {SignableMessage} params.message - The message to sign using EIP-191. Can be a string, or object with raw bytes.
12
+ * @param {Address} [params.account] - Optional account address to use for signing. If not provided, uses the client's current account.
11
13
  * @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string
12
14
  *
13
15
  * @example
16
+ * ```ts
14
17
  * // Sign a simple text message
15
18
  * const signature = await client.signMessage("Hello, world!");
16
19
  *
17
- * @example
18
20
  * // Sign a raw hex message
19
21
  * const signature = await client.signMessage({ raw: "0x48656c6c6f2c20776f726c6421" });
22
+ * ```
20
23
  */
21
24
  export async function signMessage(client, signer, params) {
22
25
  const account = await requestAccount(client, signer, {
@@ -1 +1 @@
1
- {"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AACvD,OAAO,EAAgD,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMrD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA4B,EAC5B,MAA0B,EAC1B,MAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Address, type Hex, type SignableMessage } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignMessageParams = { message: SignableMessage; account?: Address };\n\nexport type SignMessageResult = Hex;\n\n/**\n * Signs a message using the smart account.\n * This method requests the account associated with the signer and uses it to sign the message.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {SignableMessage} message - The message to sign\n * @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string\n *\n * @example\n * // Sign a simple text message\n * const signature = await client.signMessage(\"Hello, world!\");\n *\n * @example\n * // Sign a raw hex message\n * const signature = await client.signMessage({ raw: \"0x48656c6c6f2c20776f726c6421\" });\n */\nexport async function signMessage(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignMessageParams,\n): Promise<SignMessageResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signMessageWith6492({ message: params.message });\n}\n"]}
1
+ {"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,cAAc,CAAC;AACvD,OAAO,EAAgD,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA4B,EAC5B,MAA0B,EAC1B,MAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { type SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Address, type Hex, type SignableMessage } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignMessageParams = { message: SignableMessage; account?: Address };\n\nexport type SignMessageResult = Hex;\n\n/**\n * Signs a message using the smart account.\n * This method requests the account associated with the signer and uses it to sign the message.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {SignMessageParams} params - Parameters for signing the message\n * @param {SignableMessage} params.message - The message to sign using EIP-191. Can be a string, or object with raw bytes.\n * @param {Address} [params.account] - Optional account address to use for signing. If not provided, uses the client's current account.\n * @returns {Promise<SignMessageResult>} A Promise that resolves to the signed message as a hex string\n *\n * @example\n * ```ts\n * // Sign a simple text message\n * const signature = await client.signMessage(\"Hello, world!\");\n *\n * // Sign a raw hex message\n * const signature = await client.signMessage({ raw: \"0x48656c6c6f2c20776f726c6421\" });\n * ```\n */\nexport async function signMessage(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignMessageParams,\n): Promise<SignMessageResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signMessageWith6492({ message: params.message });\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { PrepareCallsResult } from "./prepareCalls.ts";
2
2
  import type { SmartAccountSigner } from "@aa-sdk/core";
3
3
  import type { Static } from "@sinclair/typebox";
4
- import { wallet_sendPreparedCalls } from "../../rpc/request.js";
4
+ import { wallet_sendPreparedCalls } from "@alchemy/wallet-api-types/rpc";
5
5
  export type SignPreparedCallsParams = PrepareCallsResult;
6
6
  export type SignPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["properties"]["Request"]["properties"]["params"]>[0];
7
7
  /**
@@ -10,5 +10,5 @@ export type SignPreparedCallsResult = Static<(typeof wallet_sendPreparedCalls)["
10
10
  * @param {SmartAccountSigner} signer - The signer to use
11
11
  * @param {SignPreparedCallsParams} params - The prepared calls with signature requests
12
12
  * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls
13
- **/
13
+ */
14
14
  export declare function signPreparedCalls(signer: SmartAccountSigner, params: SignPreparedCallsParams): Promise<SignPreparedCallsResult>;
@@ -1,54 +1,43 @@
1
1
  import { signSignatureRequest } from "./signSignatureRequest.js";
2
- import { wallet_sendPreparedCalls } from "../../rpc/request.js";
3
- import { assertNever } from "../../utils.js";
2
+ import { wallet_sendPreparedCalls } from "@alchemy/wallet-api-types/rpc";
3
+ import {} from "@alchemy/wallet-api-types";
4
4
  /**
5
5
  * Signs prepared calls using the provided signer.
6
6
  *
7
7
  * @param {SmartAccountSigner} signer - The signer to use
8
8
  * @param {SignPreparedCallsParams} params - The prepared calls with signature requests
9
9
  * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls
10
- **/
10
+ */
11
11
  export async function signPreparedCalls(signer, params) {
12
- if (params.type !== "array") {
13
- const { signatureRequest, ...call } = params;
12
+ const signAuthorizationCall = async (call) => {
13
+ const { signatureRequest: _signatureRequest, ...rest } = call;
14
+ const signature = await signSignatureRequest(signer, {
15
+ type: "eip7702Auth",
16
+ data: {
17
+ ...rest.data,
18
+ chainId: call.chainId,
19
+ },
20
+ });
21
+ return {
22
+ ...rest,
23
+ signature,
24
+ };
25
+ };
26
+ const signUserOperationCall = async (call) => {
27
+ const { signatureRequest, ...rest } = call;
14
28
  const signature = await signSignatureRequest(signer, signatureRequest);
15
29
  return {
16
- ...call,
30
+ ...rest,
17
31
  signature,
18
32
  };
19
- }
20
- return {
21
- type: "array",
22
- data: await Promise.all(params.data.map(async (call) => {
23
- switch (call.type) {
24
- case "authorization": {
25
- const { signatureRequest: _signatureRequest, ...rest } = call;
26
- const signature = await signSignatureRequest(signer, {
27
- type: "eip7702Auth",
28
- data: {
29
- ...call.data,
30
- chainId: call.chainId,
31
- },
32
- });
33
- return {
34
- ...rest,
35
- signature,
36
- };
37
- }
38
- case "user-operation-v060":
39
- case "user-operation-v070": {
40
- const { signatureRequest, ...rest } = call;
41
- const signature = await signSignatureRequest(signer, signatureRequest);
42
- return {
43
- ...rest,
44
- signature,
45
- };
46
- }
47
- default: {
48
- return assertNever(call, "Unexpected call type");
49
- }
50
- }
51
- })),
52
33
  };
34
+ return params.type === "array"
35
+ ? {
36
+ type: "array",
37
+ data: await Promise.all(params.data.map((call) => call.type === "authorization"
38
+ ? signAuthorizationCall(call)
39
+ : signUserOperationCall(call))),
40
+ }
41
+ : signUserOperationCall(params);
53
42
  }
54
43
  //# sourceMappingURL=signPreparedCalls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C;;;;;;IAMI;AACJ,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA0B,EAC1B,MAA+B;IAE/B,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,OAAgB;QACtB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CACrB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC7B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,eAAe,CAAC,CAAC,CAAC;oBACrB,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;oBAC9D,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE;wBACnD,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE;4BACJ,GAAG,IAAI,CAAC,IAAI;4BACZ,OAAO,EAAE,IAAI,CAAC,OAAO;yBACtB;qBACF,CAAC,CAAC;oBACH,OAAO;wBACL,GAAG,IAAI;wBACP,SAAS;qBACV,CAAC;gBACJ,CAAC;gBACD,KAAK,qBAAqB,CAAC;gBAC3B,KAAK,qBAAqB,CAAC,CAAC,CAAC;oBAC3B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;oBAC3C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAC1C,MAAM,EACN,gBAAgB,CACjB,CAAC;oBACF,OAAO;wBACL,GAAG,IAAI;wBACP,SAAS;qBACV,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACR,OAAO,WAAW,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CACH;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_sendPreparedCalls } from \"../../rpc/request.js\";\nimport { assertNever } from \"../../utils.js\";\n\nexport type SignPreparedCallsParams = PrepareCallsResult;\n\nexport type SignPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {SmartAccountSigner} signer - The signer to use\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n **/\nexport async function signPreparedCalls(\n signer: SmartAccountSigner,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n if (params.type !== \"array\") {\n const { signatureRequest, ...call } = params;\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n ...call,\n signature,\n };\n }\n\n return {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map(async (call) => {\n switch (call.type) {\n case \"authorization\": {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, {\n type: \"eip7702Auth\",\n data: {\n ...call.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n }\n case \"user-operation-v060\":\n case \"user-operation-v070\": {\n const { signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(\n signer,\n signatureRequest,\n );\n return {\n ...rest,\n signature,\n };\n }\n default: {\n return assertNever(call, \"Unexpected call type\");\n }\n }\n }),\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"signPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/signPreparedCalls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAIN,MAAM,2BAA2B,CAAC;AAQnC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA0B,EAC1B,MAA+B;IAE/B,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAgC,EAAE,EAAE;QACvE,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC9D,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE;YACnD,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE;gBACJ,GAAG,IAAI,CAAC,IAAI;gBACZ,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB;SACF,CAAC,CAAC;QACH,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,qBAAqB,GAAG,KAAK,EACjC,IAAuD,EACvD,EAAE;QACF,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC3C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;QACvE,OAAO;YACL,GAAG,IAAI;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO;QAC5B,CAAC,CAAC;YACE,IAAI,EAAE,OAAgB;YACtB,IAAI,EAAE,MAAM,OAAO,CAAC,GAAG,CACrB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACvB,IAAI,CAAC,IAAI,KAAK,eAAe;gBAC3B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC;gBAC7B,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAChC,CACF;SACF;QACH,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import type { PrepareCallsResult } from \"./prepareCalls.ts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { signSignatureRequest } from \"./signSignatureRequest.js\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { wallet_sendPreparedCalls } from \"@alchemy/wallet-api-types/rpc\";\nimport {\n type PreparedCall_Authorization,\n type PreparedCall_UserOpV060,\n type PreparedCall_UserOpV070,\n} from \"@alchemy/wallet-api-types\";\n\nexport type SignPreparedCallsParams = PrepareCallsResult;\n\nexport type SignPreparedCallsResult = Static<\n (typeof wallet_sendPreparedCalls)[\"properties\"][\"Request\"][\"properties\"][\"params\"]\n>[0];\n\n/**\n * Signs prepared calls using the provided signer.\n *\n * @param {SmartAccountSigner} signer - The signer to use\n * @param {SignPreparedCallsParams} params - The prepared calls with signature requests\n * @returns {Promise<SignPreparedCallsResult>} A Promise that resolves to the signed calls\n */\nexport async function signPreparedCalls(\n signer: SmartAccountSigner,\n params: SignPreparedCallsParams,\n): Promise<SignPreparedCallsResult> {\n const signAuthorizationCall = async (call: PreparedCall_Authorization) => {\n const { signatureRequest: _signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, {\n type: \"eip7702Auth\",\n data: {\n ...rest.data,\n chainId: call.chainId,\n },\n });\n return {\n ...rest,\n signature,\n };\n };\n\n const signUserOperationCall = async (\n call: PreparedCall_UserOpV060 | PreparedCall_UserOpV070,\n ) => {\n const { signatureRequest, ...rest } = call;\n const signature = await signSignatureRequest(signer, signatureRequest);\n return {\n ...rest,\n signature,\n };\n };\n\n return params.type === \"array\"\n ? {\n type: \"array\" as const,\n data: await Promise.all(\n params.data.map((call) =>\n call.type === \"authorization\"\n ? signAuthorizationCall(call)\n : signUserOperationCall(call),\n ),\n ),\n }\n : signUserOperationCall(params);\n}\n"]}
@@ -1,11 +1,9 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
- import type { Static } from "@sinclair/typebox";
3
2
  import { type Hex } from "viem";
4
- import { TypeAuthorizationSignatureRequest, TypePersonalSignSignatureRequest, TypeTypedDataSignatureRequest } from "../../schemas.js";
5
- import { TypeEip7702UnsignedAuth } from "../../schemas.js";
3
+ import { type PersonalSignSignatureRequest, type TypedDataSignatureRequest, type AuthorizationSignatureRequest, type Eip7702UnsignedAuth } from "@alchemy/wallet-api-types";
6
4
  import type { WithoutRawPayload } from "../../types.ts";
7
- export type SignSignatureRequestParams = WithoutRawPayload<Static<typeof TypePersonalSignSignatureRequest> | Static<typeof TypeTypedDataSignatureRequest> | (Static<typeof TypeAuthorizationSignatureRequest> & {
8
- data: Static<typeof TypeEip7702UnsignedAuth>;
5
+ export type SignSignatureRequestParams = WithoutRawPayload<PersonalSignSignatureRequest | TypedDataSignatureRequest | (AuthorizationSignatureRequest & {
6
+ data: Eip7702UnsignedAuth;
9
7
  })>;
10
8
  export type SignSignatureRequestResult = {
11
9
  type: "secp256k1";
@@ -18,20 +16,17 @@ export type SignSignatureRequestResult = {
18
16
  * @param {SmartAccountSigner} signer - The signer to use for signing the request
19
17
  * @param {SignSignatureRequestParams} params - The signature request parameters
20
18
  * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
21
- * @param {any} params.data - The data to sign, format depends on the signature type
19
+ * @param {SignSignatureRequestParams["data"]} params.data - The data to sign, format depends on the signature type
22
20
  * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
23
- * @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)
24
- * @returns {Hex} result.signature - The hex-encoded signature
25
- * @returns {Eip7702ExtendedFields["eip7702Auth"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable
26
21
  *
27
22
  * @example
23
+ * ```ts
28
24
  * // Sign a personal message
29
25
  * const result = await client.signSignatureRequest({
30
26
  * type: 'personal_sign',
31
27
  * data: 'Hello, world!'
32
28
  * });
33
29
  *
34
- * @example
35
30
  * // Sign typed data (EIP-712)
36
31
  * const result = await client.signSignatureRequest({
37
32
  * type: 'eth_signTypedData_v4',
@@ -42,5 +37,6 @@ export type SignSignatureRequestResult = {
42
37
  * message: { ... }
43
38
  * }
44
39
  * });
40
+ * ```
45
41
  */
46
42
  export declare function signSignatureRequest(signer: SmartAccountSigner, params: SignSignatureRequestParams): Promise<SignSignatureRequestResult>;
@@ -1,7 +1,6 @@
1
1
  import { hexToNumber, serializeSignature } from "viem";
2
2
  import { assertNever } from "../../utils.js";
3
- import { TypeAuthorizationSignatureRequest, TypePersonalSignSignatureRequest, TypeTypedDataSignatureRequest, } from "../../schemas.js";
4
- import { TypeEip7702UnsignedAuth } from "../../schemas.js";
3
+ import {} from "@alchemy/wallet-api-types";
5
4
  import { vToYParity } from "ox/Signature";
6
5
  /**
7
6
  * Signs a signature request using the provided signer.
@@ -10,20 +9,17 @@ import { vToYParity } from "ox/Signature";
10
9
  * @param {SmartAccountSigner} signer - The signer to use for signing the request
11
10
  * @param {SignSignatureRequestParams} params - The signature request parameters
12
11
  * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')
13
- * @param {any} params.data - The data to sign, format depends on the signature type
12
+ * @param {SignSignatureRequestParams["data"]} params.data - The data to sign, format depends on the signature type
14
13
  * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result
15
- * @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)
16
- * @returns {Hex} result.signature - The hex-encoded signature
17
- * @returns {Eip7702ExtendedFields["eip7702Auth"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable
18
14
  *
19
15
  * @example
16
+ * ```ts
20
17
  * // Sign a personal message
21
18
  * const result = await client.signSignatureRequest({
22
19
  * type: 'personal_sign',
23
20
  * data: 'Hello, world!'
24
21
  * });
25
22
  *
26
- * @example
27
23
  * // Sign typed data (EIP-712)
28
24
  * const result = await client.signSignatureRequest({
29
25
  * type: 'eth_signTypedData_v4',
@@ -34,6 +30,7 @@ import { vToYParity } from "ox/Signature";
34
30
  * message: { ... }
35
31
  * }
36
32
  * });
33
+ * ```
37
34
  */
38
35
  export async function signSignatureRequest(signer, params) {
39
36
  switch (params.type) {
@@ -1 +1 @@
1
- {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,WAAW,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC,CAAC,CAAC;YACrB,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;aAC5C,CAAC;QACJ,CAAC;QACD,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;aAC9C,CAAC;QACJ,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;gBAC1D,GAAG,MAAM,CAAC,IAAI;gBACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;gBACzC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACtC,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,kBAAkB,CAAC;oBACvB,CAAC;oBACD,CAAC;oBACD,OAAO,EAAE,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;iBAC1C,CAAC;aACH,CAAC;QACJ,CAAC;QACD;YACE,OAAO,WAAW,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { type Hex, hexToNumber, serializeSignature } from \"viem\";\nimport { assertNever } from \"../../utils.js\";\nimport {\n TypeAuthorizationSignatureRequest,\n TypePersonalSignSignatureRequest,\n TypeTypedDataSignatureRequest,\n} from \"../../schemas.js\";\nimport { TypeEip7702UnsignedAuth } from \"../../schemas.js\";\nimport { vToYParity } from \"ox/Signature\";\nimport type { WithoutRawPayload } from \"../../types.ts\";\n\nexport type SignSignatureRequestParams = WithoutRawPayload<\n | Static<typeof TypePersonalSignSignatureRequest>\n | Static<typeof TypeTypedDataSignatureRequest>\n | (Static<typeof TypeAuthorizationSignatureRequest> & {\n data: Static<typeof TypeEip7702UnsignedAuth>;\n })\n>;\n\nexport type SignSignatureRequestResult = {\n type: \"secp256k1\";\n data: Hex;\n};\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')\n * @param {any} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n * @returns {string} result.type - The signature type (currently only 'secp256k1' is supported)\n * @returns {Hex} result.signature - The hex-encoded signature\n * @returns {Eip7702ExtendedFields[\"eip7702Auth\"]} result.signedAuthorization - The signed EIP-7702 authorization, if applicable\n *\n * @example\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * @example\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n */\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n switch (params.type) {\n case \"personal_sign\": {\n return {\n type: \"secp256k1\",\n data: await signer.signMessage(params.data),\n };\n }\n case \"eth_signTypedData_v4\": {\n return {\n type: \"secp256k1\",\n data: await signer.signTypedData(params.data),\n };\n }\n case \"eip7702Auth\": {\n if (!signer.signAuthorization) {\n throw new Error(\"Signer does not implement signAuthorization\");\n }\n const { r, s, v, yParity } = await signer.signAuthorization({\n ...params.data,\n chainId: hexToNumber(params.data.chainId),\n nonce: hexToNumber(params.data.nonce),\n });\n\n return {\n type: \"secp256k1\",\n data: serializeSignature({\n r,\n s,\n yParity: yParity ?? vToYParity(Number(v)),\n }),\n };\n }\n default:\n return assertNever(params, `Unexpected signature request type.`);\n }\n}\n"]}
1
+ {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,WAAW,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAKN,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC,CAAC,CAAC;YACrB,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;aAC5C,CAAC;QACJ,CAAC;QACD,KAAK,sBAAsB,CAAC,CAAC,CAAC;YAC5B,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;aAC9C,CAAC;QACJ,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;gBAC1D,GAAG,MAAM,CAAC,IAAI;gBACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;gBACzC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACtC,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,kBAAkB,CAAC;oBACvB,CAAC;oBACD,CAAC;oBACD,OAAO,EAAE,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;iBAC1C,CAAC;aACH,CAAC;QACJ,CAAC;QACD;YACE,OAAO,WAAW,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Hex, hexToNumber, serializeSignature } from \"viem\";\nimport { assertNever } from \"../../utils.js\";\nimport {\n type PersonalSignSignatureRequest,\n type TypedDataSignatureRequest,\n type AuthorizationSignatureRequest,\n type Eip7702UnsignedAuth,\n} from \"@alchemy/wallet-api-types\";\nimport { vToYParity } from \"ox/Signature\";\nimport type { WithoutRawPayload } from \"../../types.ts\";\n\nexport type SignSignatureRequestParams = WithoutRawPayload<\n | PersonalSignSignatureRequest\n | TypedDataSignatureRequest\n | (AuthorizationSignatureRequest & {\n data: Eip7702UnsignedAuth;\n })\n>;\n\nexport type SignSignatureRequestResult = {\n type: \"secp256k1\";\n data: Hex;\n};\n\n/**\n * Signs a signature request using the provided signer.\n * This method handles different types of signature requests including personal_sign, eth_signTypedData_v4, and authorization.\n *\n * @param {SmartAccountSigner} signer - The signer to use for signing the request\n * @param {SignSignatureRequestParams} params - The signature request parameters\n * @param {string} params.type - The type of signature request ('personal_sign', 'eth_signTypedData_v4', or 'signature_with_authorization')\n * @param {SignSignatureRequestParams[\"data\"]} params.data - The data to sign, format depends on the signature type\n * @returns {Promise<SignSignatureRequestResult>} A Promise that resolves to the signature result\n *\n * @example\n * ```ts\n * // Sign a personal message\n * const result = await client.signSignatureRequest({\n * type: 'personal_sign',\n * data: 'Hello, world!'\n * });\n *\n * // Sign typed data (EIP-712)\n * const result = await client.signSignatureRequest({\n * type: 'eth_signTypedData_v4',\n * data: {\n * domain: { ... },\n * types: { ... },\n * primaryType: '...',\n * message: { ... }\n * }\n * });\n * ```\n */\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n switch (params.type) {\n case \"personal_sign\": {\n return {\n type: \"secp256k1\",\n data: await signer.signMessage(params.data),\n };\n }\n case \"eth_signTypedData_v4\": {\n return {\n type: \"secp256k1\",\n data: await signer.signTypedData(params.data),\n };\n }\n case \"eip7702Auth\": {\n if (!signer.signAuthorization) {\n throw new Error(\"Signer does not implement signAuthorization\");\n }\n const { r, s, v, yParity } = await signer.signAuthorization({\n ...params.data,\n chainId: hexToNumber(params.data.chainId),\n nonce: hexToNumber(params.data.nonce),\n });\n\n return {\n type: \"secp256k1\",\n data: serializeSignature({\n r,\n s,\n yParity: yParity ?? vToYParity(Number(v)),\n }),\n };\n }\n default:\n return assertNever(params, `Unexpected signature request type.`);\n }\n}\n"]}
@@ -15,6 +15,7 @@ export type SignTypedDataResult = Hex;
15
15
  * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
16
16
  *
17
17
  * @example
18
+ * ```ts
18
19
  * // Sign typed data
19
20
  * const signature = await client.signTypedData({
20
21
  * domain: {
@@ -35,5 +36,6 @@ export type SignTypedDataResult = Hex;
35
36
  * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'
36
37
  * }
37
38
  * });
39
+ * ```
38
40
  */
39
41
  export declare function signTypedData(client: InnerWalletApiClient, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
@@ -10,6 +10,7 @@ import { requestAccount } from "./requestAccount.js";
10
10
  * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string
11
11
  *
12
12
  * @example
13
+ * ```ts
13
14
  * // Sign typed data
14
15
  * const signature = await client.signTypedData({
15
16
  * domain: {
@@ -30,6 +31,7 @@ import { requestAccount } from "./requestAccount.js";
30
31
  * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'
31
32
  * }
32
33
  * });
34
+ * ```
33
35
  */
34
36
  export async function signTypedData(client, signer, params) {
35
37
  const account = await requestAccount(client, signer, {
@@ -1 +1 @@
1
- {"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Address, type Hex, type TypedDataDefinition } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n */\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
1
+ {"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE;QACnD,cAAc,EAAE,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO;KAC1D,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { type Address, type Hex, type TypedDataDefinition } from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types.ts\";\nimport { requestAccount } from \"./requestAccount.js\";\n\nexport type SignTypedDataParams = TypedDataDefinition & {\n account?: Address;\n};\n\nexport type SignTypedDataResult = Hex;\n\n/**\n * Signs typed data (EIP-712) using the smart account.\n * This method requests the account associated with the signer and uses it to sign the typed data.\n *\n * @param {InnerWalletApiClient} client - The wallet API client to use for the request\n * @param {SmartAccountSigner} signer - The signer of the smart account\n * @param {TypedDataDefinition} params - The typed data to sign, following EIP-712 format\n * @returns {Promise<SignTypedDataResult>} A Promise that resolves to the signature as a hex string\n *\n * @example\n * ```ts\n * // Sign typed data\n * const signature = await client.signTypedData({\n * domain: {\n * name: 'Example DApp',\n * version: '1',\n * chainId: 1,\n * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'\n * },\n * types: {\n * Person: [\n * { name: 'name', type: 'string' },\n * { name: 'wallet', type: 'address' }\n * ]\n * },\n * primaryType: 'Person',\n * message: {\n * name: 'John Doe',\n * wallet: '0xAaAaAaAaAaAaAaAaAaAAAAAAAAaaaAaAaAaaAaAa'\n * }\n * });\n * ```\n */\nexport async function signTypedData(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult> {\n const account = await requestAccount(client, signer, {\n accountAddress: params.account ?? client.account?.address,\n });\n\n return account.signTypedDataWith6492(params);\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
2
  import type { Address, Hex } from "viem";
3
3
  import type { InnerWalletApiClient } from "../types.ts";
4
- import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount.js";
5
4
  import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus.js";
6
5
  import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions.js";
7
6
  import { type ListAccountsParams, type ListAccountsResult } from "./actions/listAccounts.js";
@@ -16,7 +15,6 @@ export type SmartWalletActions<TAccount extends Address | undefined = Address |
16
15
  requestAccount: (params?: RequestAccountParams) => Promise<RequestAccountResult>;
17
16
  prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
18
17
  sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<SendPreparedCallsResult>;
19
- createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;
20
18
  listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
21
19
  getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
22
20
  signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
@@ -1,4 +1,3 @@
1
- import { createAccount, } from "./actions/createAccount.js";
2
1
  import { getCallsStatus, } from "./actions/getCallsStatus.js";
3
2
  import { grantPermissions, } from "./actions/grantPermissions.js";
4
3
  import { listAccounts, } from "./actions/listAccounts.js";
@@ -12,9 +11,8 @@ import { signPreparedCalls, } from "./actions/signPreparedCalls.js";
12
11
  export function smartWalletClientActions(client, signer) {
13
12
  return {
14
13
  requestAccount: (params) => requestAccount(client, signer, params),
15
- createAccount: (params) => createAccount(client, signer, params),
16
14
  prepareCalls: (params) => prepareCalls(client, params),
17
- listAccounts: (params) => listAccounts(client, params),
15
+ listAccounts: (params) => listAccounts(client, signer, params),
18
16
  sendPreparedCalls: (params) => sendPreparedCalls(client, params),
19
17
  getCallsStatus: (params) => getCallsStatus(client, params),
20
18
  signSignatureRequest: (params) => signSignatureRequest(signer, params),
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,GAGrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AAgCxC,MAAM,UAAU,wBAAwB,CAGtC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO;QACL,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAClE,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1D,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;QACtE,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Address, Hex } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount.js\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"./actions/sendPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"./actions/signPreparedCalls.js\";\n\nexport type SmartWalletActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signPreparedCalls: (\n params: SignPreparedCallsParams,\n ) => Promise<SignPreparedCallsResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount> {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n createAccount: (params) => createAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signPreparedCalls: (params) => signPreparedCalls(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,GAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAA0B,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,oBAAoB,GAGrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AA+BxC,MAAM,UAAU,wBAAwB,CAGtC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO;QACL,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAClE,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;QACtD,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC9D,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;QAC1D,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC;QACtE,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;QAChE,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Address, Hex } from \"viem\";\nimport type { InnerWalletApiClient } from \"../types.ts\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus.js\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions.js\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts.js\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls.js\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount.js\";\nimport {\n sendPreparedCalls,\n type SendPreparedCallsParams,\n type SendPreparedCallsResult,\n} from \"./actions/sendPreparedCalls.js\";\nimport { signMessage, type SignMessageParams } from \"./actions/signMessage.js\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest.js\";\nimport {\n signTypedData,\n type SignTypedDataParams,\n} from \"./actions/signTypedData.js\";\nimport {\n signPreparedCalls,\n type SignPreparedCallsParams,\n type SignPreparedCallsResult,\n} from \"./actions/signPreparedCalls.js\";\n\nexport type SmartWalletActions<\n TAccount extends Address | undefined = Address | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams,\n ) => Promise<RequestAccountResult>;\n prepareCalls: (\n params: PrepareCallsParams<TAccount>,\n ) => Promise<PrepareCallsResult>;\n sendPreparedCalls: (\n params: SendPreparedCallsParams,\n ) => Promise<SendPreparedCallsResult>;\n listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;\n getCallsStatus: (\n params: GetCallsStatusParams,\n ) => Promise<GetCallsStatusResult>;\n signSignatureRequest: (\n params: SignSignatureRequestParams,\n ) => Promise<SignSignatureRequestResult>;\n signPreparedCalls: (\n params: SignPreparedCallsParams,\n ) => Promise<SignPreparedCallsResult>;\n signMessage: (params: SignMessageParams) => Promise<Hex>;\n signTypedData: (params: SignTypedDataParams) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams<TAccount>,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends Address | undefined = Address | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount> {\n return {\n requestAccount: (params) => requestAccount(client, signer, params),\n prepareCalls: (params) => prepareCalls(client, params),\n listAccounts: (params) => listAccounts(client, signer, params),\n sendPreparedCalls: (params) => sendPreparedCalls(client, params),\n getCallsStatus: (params) => getCallsStatus(client, params),\n signSignatureRequest: (params) => signSignatureRequest(signer, params),\n signPreparedCalls: (params) => signPreparedCalls(signer, params),\n signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
@@ -1,16 +1,20 @@
1
1
  import type { SmartAccountSigner } from "@aa-sdk/core";
2
2
  import type { AlchemyTransport } from "@account-kit/infra";
3
- import type { Address, Chain, Prettify } from "viem";
3
+ import { type Address, type Chain, type Prettify } from "viem";
4
4
  import type { InnerWalletApiClient } from "../types.ts";
5
5
  import { type SmartWalletActions } from "./decorator.js";
6
6
  export type SmartWalletClientParams<TAccount extends Address | undefined = Address | undefined> = Prettify<{
7
7
  transport: AlchemyTransport;
8
8
  chain: Chain;
9
9
  signer: SmartAccountSigner;
10
- mode: "local" | "remote";
11
- policyId?: string;
12
10
  account?: TAccount | Address | undefined;
13
- }>;
11
+ } & ({
12
+ policyId?: string;
13
+ policyIds?: never;
14
+ } | {
15
+ policyIds?: string[];
16
+ policyId?: never;
17
+ })>;
14
18
  export type SmartWalletClient<TAccount extends Address | undefined = Address | undefined> = InnerWalletApiClient & SmartWalletActions<TAccount>;
15
19
  /**
16
20
  * Creates a smart wallet client that can be used to interact with a smart account.
@@ -19,12 +23,12 @@ export type SmartWalletClient<TAccount extends Address | undefined = Address | u
19
23
  * @param {AlchemyTransport} params.transport - The Alchemy transport to use
20
24
  * @param {Chain} params.chain - The chain to use
21
25
  * @param {SmartAccountSigner} params.signer - The signer to use for the smart account
22
- * @param {"local" | "remote"} params.mode - The client's mode (local or remote).
23
26
  * @param {string} [params.policyId] - The policy ID for gas sponsorship (optional)
24
27
  * @param {Address} [params.account] - The smart account address to use (optional)
25
28
  * @returns {SmartWalletClient} - A viem-compatible client
26
29
  *
27
30
  * @example
31
+ * ```ts
28
32
  * import { LocalAccountSigner } from "@aa-sdk/core";
29
33
  * import { alchemy, arbitrumSepolia } from "@account-kit/infra";
30
34
  * import { generatePrivateKey } from "viem/accounts";
@@ -37,8 +41,8 @@ export type SmartWalletClient<TAccount extends Address | undefined = Address | u
37
41
  * const client = createSmartWalletClient({
38
42
  * transport,
39
43
  * chain: arbitrumSepolia,
40
- * mode: "remote",
41
44
  * signer,
42
45
  * });
46
+ * ```
43
47
  */
44
48
  export declare function createSmartWalletClient<TAccount extends Address | undefined = undefined>(params: SmartWalletClientParams<TAccount>): SmartWalletClient<TAccount>;