@account-kit/wallet-client 0.0.1-alpha.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 (259) hide show
  1. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_1.d.ts +55 -0
  2. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_1.js +45 -0
  3. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_1.js.map +1 -0
  4. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_2.d.ts +55 -0
  5. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_2.js +45 -0
  6. package/dist/esm/abi/LightAccountFactoryAbi_V1_0_2.js.map +1 -0
  7. package/dist/esm/abi/LightAccountFactoryAbi_V1_1_0.d.ts +55 -0
  8. package/dist/esm/abi/LightAccountFactoryAbi_V1_1_0.js +45 -0
  9. package/dist/esm/abi/LightAccountFactoryAbi_V1_1_0.js.map +1 -0
  10. package/dist/esm/abi/LightAccountFactoryAbi_V2_0_0.d.ts +256 -0
  11. package/dist/esm/abi/LightAccountFactoryAbi_V2_0_0.js +202 -0
  12. package/dist/esm/abi/LightAccountFactoryAbi_V2_0_0.js.map +1 -0
  13. package/dist/esm/abi/ModularAccountFactoryAbi_V2_0_0.d.ts +492 -0
  14. package/dist/esm/abi/ModularAccountFactoryAbi_V2_0_0.js +399 -0
  15. package/dist/esm/abi/ModularAccountFactoryAbi_V2_0_0.js.map +1 -0
  16. package/dist/esm/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.d.ts +286 -0
  17. package/dist/esm/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.js +225 -0
  18. package/dist/esm/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.js.map +1 -0
  19. package/dist/esm/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.d.ts +234 -0
  20. package/dist/esm/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.js +179 -0
  21. package/dist/esm/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.js.map +1 -0
  22. package/dist/esm/abi/MultisigModularAccountFactoryAbi_V1_0_0.d.ts +246 -0
  23. package/dist/esm/abi/MultisigModularAccountFactoryAbi_V1_0_0.js +182 -0
  24. package/dist/esm/abi/MultisigModularAccountFactoryAbi_V1_0_0.js.map +1 -0
  25. package/dist/esm/abi/index.d.ts +8 -0
  26. package/dist/esm/abi/index.js +9 -0
  27. package/dist/esm/abi/index.js.map +1 -0
  28. package/dist/esm/capabilities/index.d.ts +8 -0
  29. package/dist/esm/capabilities/index.js +8 -0
  30. package/dist/esm/capabilities/index.js.map +1 -0
  31. package/dist/esm/capabilities/paymaster.d.ts +3 -0
  32. package/dist/esm/capabilities/paymaster.js +5 -0
  33. package/dist/esm/capabilities/paymaster.js.map +1 -0
  34. package/dist/esm/capabilities/permissions/index.d.ts +98 -0
  35. package/dist/esm/capabilities/permissions/index.js +60 -0
  36. package/dist/esm/capabilities/permissions/index.js.map +1 -0
  37. package/dist/esm/capabilities/permissions/mav2.d.ts +36 -0
  38. package/dist/esm/capabilities/permissions/mav2.js +79 -0
  39. package/dist/esm/capabilities/permissions/mav2.js.map +1 -0
  40. package/dist/esm/client/actions/createAccount.d.ts +10 -0
  41. package/dist/esm/client/actions/createAccount.js +7 -0
  42. package/dist/esm/client/actions/createAccount.js.map +1 -0
  43. package/dist/esm/client/actions/getCallsStatus.d.ts +6 -0
  44. package/dist/esm/client/actions/getCallsStatus.js +7 -0
  45. package/dist/esm/client/actions/getCallsStatus.js.map +1 -0
  46. package/dist/esm/client/actions/grantPermissions.d.ts +13 -0
  47. package/dist/esm/client/actions/grantPermissions.js +11 -0
  48. package/dist/esm/client/actions/grantPermissions.js.map +1 -0
  49. package/dist/esm/client/actions/listAccounts.d.ts +6 -0
  50. package/dist/esm/client/actions/listAccounts.js +4 -0
  51. package/dist/esm/client/actions/listAccounts.js.map +1 -0
  52. package/dist/esm/client/actions/prepareCalls.d.ts +15 -0
  53. package/dist/esm/client/actions/prepareCalls.js +17 -0
  54. package/dist/esm/client/actions/prepareCalls.js.map +1 -0
  55. package/dist/esm/client/actions/requestAccount.d.ts +11 -0
  56. package/dist/esm/client/actions/requestAccount.js +28 -0
  57. package/dist/esm/client/actions/requestAccount.js.map +1 -0
  58. package/dist/esm/client/actions/sendPreparedCalls.d.ts +6 -0
  59. package/dist/esm/client/actions/sendPreparedCalls.js +8 -0
  60. package/dist/esm/client/actions/sendPreparedCalls.js.map +1 -0
  61. package/dist/esm/client/actions/signMessage.d.ts +6 -0
  62. package/dist/esm/client/actions/signMessage.js +7 -0
  63. package/dist/esm/client/actions/signMessage.js.map +1 -0
  64. package/dist/esm/client/actions/signSignatureRequest.d.ts +10 -0
  65. package/dist/esm/client/actions/signSignatureRequest.js +15 -0
  66. package/dist/esm/client/actions/signSignatureRequest.js.map +1 -0
  67. package/dist/esm/client/actions/signTypedData.d.ts +6 -0
  68. package/dist/esm/client/actions/signTypedData.js +7 -0
  69. package/dist/esm/client/actions/signTypedData.js.map +1 -0
  70. package/dist/esm/client/client.e2e-test.d.ts +1 -0
  71. package/dist/esm/client/client.e2e-test.js +238 -0
  72. package/dist/esm/client/client.e2e-test.js.map +1 -0
  73. package/dist/esm/client/decorator.d.ts +24 -0
  74. package/dist/esm/client/decorator.js +25 -0
  75. package/dist/esm/client/decorator.js.map +1 -0
  76. package/dist/esm/client/index.d.ts +18 -0
  77. package/dist/esm/client/index.js +43 -0
  78. package/dist/esm/client/index.js.map +1 -0
  79. package/dist/esm/exports/index.d.ts +13 -0
  80. package/dist/esm/exports/index.js +18 -0
  81. package/dist/esm/exports/index.js.map +1 -0
  82. package/dist/esm/exports/internal.d.ts +13 -0
  83. package/dist/esm/exports/internal.js +15 -0
  84. package/dist/esm/exports/internal.js.map +1 -0
  85. package/dist/esm/isomorphic/actions/createSession.d.ts +14 -0
  86. package/dist/esm/isomorphic/actions/createSession.js +63 -0
  87. package/dist/esm/isomorphic/actions/createSession.js.map +1 -0
  88. package/dist/esm/isomorphic/actions/getCallsStatus.d.ts +21 -0
  89. package/dist/esm/isomorphic/actions/getCallsStatus.js +60 -0
  90. package/dist/esm/isomorphic/actions/getCallsStatus.js.map +1 -0
  91. package/dist/esm/isomorphic/actions/prepareCalls.d.ts +8 -0
  92. package/dist/esm/isomorphic/actions/prepareCalls.js +57 -0
  93. package/dist/esm/isomorphic/actions/prepareCalls.js.map +1 -0
  94. package/dist/esm/isomorphic/actions/sendPreparedCalls.d.ts +8 -0
  95. package/dist/esm/isomorphic/actions/sendPreparedCalls.js +43 -0
  96. package/dist/esm/isomorphic/actions/sendPreparedCalls.js.map +1 -0
  97. package/dist/esm/isomorphic/client.d.ts +97 -0
  98. package/dist/esm/isomorphic/client.js +30 -0
  99. package/dist/esm/isomorphic/client.js.map +1 -0
  100. package/dist/esm/isomorphic/utils/createAccount.d.ts +22 -0
  101. package/dist/esm/isomorphic/utils/createAccount.js +32 -0
  102. package/dist/esm/isomorphic/utils/createAccount.js.map +1 -0
  103. package/dist/esm/isomorphic/utils/createDummySigner.d.ts +3 -0
  104. package/dist/esm/isomorphic/utils/createDummySigner.js +17 -0
  105. package/dist/esm/isomorphic/utils/createDummySigner.js.map +1 -0
  106. package/dist/esm/isomorphic/utils/parsePermissionsContext.d.ts +20 -0
  107. package/dist/esm/isomorphic/utils/parsePermissionsContext.js +21 -0
  108. package/dist/esm/isomorphic/utils/parsePermissionsContext.js.map +1 -0
  109. package/dist/esm/local/client.d.ts +3 -0
  110. package/dist/esm/local/client.js +89 -0
  111. package/dist/esm/local/client.js.map +1 -0
  112. package/dist/esm/remote/client.d.ts +3 -0
  113. package/dist/esm/remote/client.js +42 -0
  114. package/dist/esm/remote/client.js.map +1 -0
  115. package/dist/esm/rpc/request.d.ts +329 -0
  116. package/dist/esm/rpc/request.js +194 -0
  117. package/dist/esm/rpc/request.js.map +1 -0
  118. package/dist/esm/rpc/schema.d.ts +319 -0
  119. package/dist/esm/rpc/schema.js +5 -0
  120. package/dist/esm/rpc/schema.js.map +1 -0
  121. package/dist/esm/schemas.d.ts +216 -0
  122. package/dist/esm/schemas.js +211 -0
  123. package/dist/esm/schemas.js.map +1 -0
  124. package/dist/esm/types.d.ts +27 -0
  125. package/dist/esm/types.js +2 -0
  126. package/dist/esm/types.js.map +1 -0
  127. package/dist/esm/utils.d.ts +4 -0
  128. package/dist/esm/utils.js +12 -0
  129. package/dist/esm/utils.js.map +1 -0
  130. package/dist/types/abi/LightAccountFactoryAbi_V1_0_1.d.ts +56 -0
  131. package/dist/types/abi/LightAccountFactoryAbi_V1_0_1.d.ts.map +1 -0
  132. package/dist/types/abi/LightAccountFactoryAbi_V1_0_2.d.ts +56 -0
  133. package/dist/types/abi/LightAccountFactoryAbi_V1_0_2.d.ts.map +1 -0
  134. package/dist/types/abi/LightAccountFactoryAbi_V1_1_0.d.ts +56 -0
  135. package/dist/types/abi/LightAccountFactoryAbi_V1_1_0.d.ts.map +1 -0
  136. package/dist/types/abi/LightAccountFactoryAbi_V2_0_0.d.ts +257 -0
  137. package/dist/types/abi/LightAccountFactoryAbi_V2_0_0.d.ts.map +1 -0
  138. package/dist/types/abi/ModularAccountFactoryAbi_V2_0_0.d.ts +493 -0
  139. package/dist/types/abi/ModularAccountFactoryAbi_V2_0_0.d.ts.map +1 -0
  140. package/dist/types/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.d.ts +287 -0
  141. package/dist/types/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.d.ts.map +1 -0
  142. package/dist/types/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.d.ts +235 -0
  143. package/dist/types/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.d.ts.map +1 -0
  144. package/dist/types/abi/MultisigModularAccountFactoryAbi_V1_0_0.d.ts +247 -0
  145. package/dist/types/abi/MultisigModularAccountFactoryAbi_V1_0_0.d.ts.map +1 -0
  146. package/dist/types/abi/index.d.ts +9 -0
  147. package/dist/types/abi/index.d.ts.map +1 -0
  148. package/dist/types/capabilities/index.d.ts +9 -0
  149. package/dist/types/capabilities/index.d.ts.map +1 -0
  150. package/dist/types/capabilities/paymaster.d.ts +4 -0
  151. package/dist/types/capabilities/paymaster.d.ts.map +1 -0
  152. package/dist/types/capabilities/permissions/index.d.ts +99 -0
  153. package/dist/types/capabilities/permissions/index.d.ts.map +1 -0
  154. package/dist/types/capabilities/permissions/mav2.d.ts +37 -0
  155. package/dist/types/capabilities/permissions/mav2.d.ts.map +1 -0
  156. package/dist/types/client/actions/createAccount.d.ts +11 -0
  157. package/dist/types/client/actions/createAccount.d.ts.map +1 -0
  158. package/dist/types/client/actions/getCallsStatus.d.ts +7 -0
  159. package/dist/types/client/actions/getCallsStatus.d.ts.map +1 -0
  160. package/dist/types/client/actions/grantPermissions.d.ts +14 -0
  161. package/dist/types/client/actions/grantPermissions.d.ts.map +1 -0
  162. package/dist/types/client/actions/listAccounts.d.ts +7 -0
  163. package/dist/types/client/actions/listAccounts.d.ts.map +1 -0
  164. package/dist/types/client/actions/prepareCalls.d.ts +16 -0
  165. package/dist/types/client/actions/prepareCalls.d.ts.map +1 -0
  166. package/dist/types/client/actions/requestAccount.d.ts +12 -0
  167. package/dist/types/client/actions/requestAccount.d.ts.map +1 -0
  168. package/dist/types/client/actions/sendPreparedCalls.d.ts +7 -0
  169. package/dist/types/client/actions/sendPreparedCalls.d.ts.map +1 -0
  170. package/dist/types/client/actions/signMessage.d.ts +7 -0
  171. package/dist/types/client/actions/signMessage.d.ts.map +1 -0
  172. package/dist/types/client/actions/signSignatureRequest.d.ts +11 -0
  173. package/dist/types/client/actions/signSignatureRequest.d.ts.map +1 -0
  174. package/dist/types/client/actions/signTypedData.d.ts +7 -0
  175. package/dist/types/client/actions/signTypedData.d.ts.map +1 -0
  176. package/dist/types/client/client.e2e-test.d.ts +2 -0
  177. package/dist/types/client/client.e2e-test.d.ts.map +1 -0
  178. package/dist/types/client/decorator.d.ts +25 -0
  179. package/dist/types/client/decorator.d.ts.map +1 -0
  180. package/dist/types/client/index.d.ts +19 -0
  181. package/dist/types/client/index.d.ts.map +1 -0
  182. package/dist/types/exports/index.d.ts +14 -0
  183. package/dist/types/exports/index.d.ts.map +1 -0
  184. package/dist/types/exports/internal.d.ts +14 -0
  185. package/dist/types/exports/internal.d.ts.map +1 -0
  186. package/dist/types/isomorphic/actions/createSession.d.ts +15 -0
  187. package/dist/types/isomorphic/actions/createSession.d.ts.map +1 -0
  188. package/dist/types/isomorphic/actions/getCallsStatus.d.ts +22 -0
  189. package/dist/types/isomorphic/actions/getCallsStatus.d.ts.map +1 -0
  190. package/dist/types/isomorphic/actions/prepareCalls.d.ts +9 -0
  191. package/dist/types/isomorphic/actions/prepareCalls.d.ts.map +1 -0
  192. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts +9 -0
  193. package/dist/types/isomorphic/actions/sendPreparedCalls.d.ts.map +1 -0
  194. package/dist/types/isomorphic/client.d.ts +98 -0
  195. package/dist/types/isomorphic/client.d.ts.map +1 -0
  196. package/dist/types/isomorphic/utils/createAccount.d.ts +23 -0
  197. package/dist/types/isomorphic/utils/createAccount.d.ts.map +1 -0
  198. package/dist/types/isomorphic/utils/createDummySigner.d.ts +4 -0
  199. package/dist/types/isomorphic/utils/createDummySigner.d.ts.map +1 -0
  200. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts +21 -0
  201. package/dist/types/isomorphic/utils/parsePermissionsContext.d.ts.map +1 -0
  202. package/dist/types/local/client.d.ts +4 -0
  203. package/dist/types/local/client.d.ts.map +1 -0
  204. package/dist/types/remote/client.d.ts +4 -0
  205. package/dist/types/remote/client.d.ts.map +1 -0
  206. package/dist/types/rpc/request.d.ts +330 -0
  207. package/dist/types/rpc/request.d.ts.map +1 -0
  208. package/dist/types/rpc/schema.d.ts +320 -0
  209. package/dist/types/rpc/schema.d.ts.map +1 -0
  210. package/dist/types/schemas.d.ts +217 -0
  211. package/dist/types/schemas.d.ts.map +1 -0
  212. package/dist/types/types.d.ts +28 -0
  213. package/dist/types/types.d.ts.map +1 -0
  214. package/dist/types/utils.d.ts +5 -0
  215. package/dist/types/utils.d.ts.map +1 -0
  216. package/package.json +67 -0
  217. package/src/abi/LightAccountFactoryAbi_V1_0_1.ts +44 -0
  218. package/src/abi/LightAccountFactoryAbi_V1_0_2.ts +44 -0
  219. package/src/abi/LightAccountFactoryAbi_V1_1_0.ts +44 -0
  220. package/src/abi/LightAccountFactoryAbi_V2_0_0.ts +201 -0
  221. package/src/abi/ModularAccountFactoryAbi_V2_0_0.ts +398 -0
  222. package/src/abi/MultiOwnerLightAccountFactoryAbi_V2_0_0.ts +224 -0
  223. package/src/abi/MultiOwnerModularAccountFactoryAbi_V1_0_0.ts +178 -0
  224. package/src/abi/MultisigModularAccountFactoryAbi_V1_0_0.ts +181 -0
  225. package/src/abi/index.ts +8 -0
  226. package/src/capabilities/index.ts +11 -0
  227. package/src/capabilities/paymaster.ts +5 -0
  228. package/src/capabilities/permissions/index.ts +124 -0
  229. package/src/capabilities/permissions/mav2.ts +127 -0
  230. package/src/client/actions/createAccount.ts +28 -0
  231. package/src/client/actions/getCallsStatus.ts +29 -0
  232. package/src/client/actions/grantPermissions.ts +48 -0
  233. package/src/client/actions/listAccounts.ts +18 -0
  234. package/src/client/actions/prepareCalls.ts +55 -0
  235. package/src/client/actions/requestAccount.ts +71 -0
  236. package/src/client/actions/sendPreparedCalls.ts +23 -0
  237. package/src/client/actions/signMessage.ts +32 -0
  238. package/src/client/actions/signSignatureRequest.ts +34 -0
  239. package/src/client/actions/signTypedData.ts +32 -0
  240. package/src/client/client.e2e-test.ts +294 -0
  241. package/src/client/decorator.ts +102 -0
  242. package/src/client/index.ts +93 -0
  243. package/src/exports/index.ts +32 -0
  244. package/src/exports/internal.ts +16 -0
  245. package/src/isomorphic/actions/createSession.ts +116 -0
  246. package/src/isomorphic/actions/getCallsStatus.ts +98 -0
  247. package/src/isomorphic/actions/prepareCalls.ts +99 -0
  248. package/src/isomorphic/actions/sendPreparedCalls.ts +95 -0
  249. package/src/isomorphic/client.ts +81 -0
  250. package/src/isomorphic/utils/createAccount.ts +58 -0
  251. package/src/isomorphic/utils/createDummySigner.ts +26 -0
  252. package/src/isomorphic/utils/parsePermissionsContext.ts +33 -0
  253. package/src/local/client.ts +132 -0
  254. package/src/remote/client.ts +67 -0
  255. package/src/rpc/request.ts +258 -0
  256. package/src/rpc/schema.ts +40 -0
  257. package/src/schemas.ts +257 -0
  258. package/src/types.ts +60 -0
  259. package/src/utils.ts +13 -0
@@ -0,0 +1,13 @@
1
+ import { type Address, type Hex, type IsUndefined, type JsonRpcAccount } from "viem";
2
+ import type { InnerWalletApiClient } from "../../types";
3
+ import type { SmartAccountSigner } from "@aa-sdk/core";
4
+ import type { CreateSessionParams } from "../../isomorphic/actions/createSession";
5
+ export type GrantPermissionsParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Omit<CreateSessionParams, "account" | "chainId"> & (IsUndefined<TAccount> extends true ? {
6
+ account: Address;
7
+ } : {
8
+ account?: never;
9
+ });
10
+ export type GrantPermissionsResult = {
11
+ context: Hex;
12
+ };
13
+ export declare function grantPermissions<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient, signer: SmartAccountSigner, params: GrantPermissionsParams<TAccount>): Promise<GrantPermissionsResult>;
@@ -0,0 +1,11 @@
1
+ import { toHex, } from "viem";
2
+ export async function grantPermissions(client, signer, params) {
3
+ if (client.account && !params.account) {
4
+ params.account = client.account.address;
5
+ }
6
+ return client.grantPermissions(signer, {
7
+ ...params,
8
+ chainId: toHex(client.chain.id),
9
+ });
10
+ }
11
+ //# sourceMappingURL=grantPermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantPermissions.js","sourceRoot":"","sources":["../../../../src/client/actions/grantPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GACN,MAAM,MAAM,CAAC;AA4Bd,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAA4B,EAC5B,MAA0B,EAC1B,MAA8B;IAE9B,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;QACrC,GAAG,MAAM;QACT,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type IsUndefined,\n type JsonRpcAccount,\n toHex,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { CreateSessionParams } from \"../../isomorphic/actions/createSession\";\n\nexport type GrantPermissionsParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Omit<CreateSessionParams, \"account\" | \"chainId\"> &\n (IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: never });\n\nexport type GrantPermissionsResult = {\n context: Hex;\n};\n\nexport async function grantPermissions<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: GrantPermissionsParams<TAccount>,\n): Promise<GrantPermissionsResult>;\n\nexport async function grantPermissions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params: GrantPermissionsParams,\n): Promise<GrantPermissionsResult> {\n if (client.account && !params.account) {\n params.account = client.account.address;\n }\n\n return client.grantPermissions(signer, {\n ...params,\n chainId: toHex(client.chain.id),\n });\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { Static } from "@sinclair/typebox";
2
+ import type { wallet_listAccounts } from "../../rpc/request";
3
+ import type { InnerWalletApiClient } from "../../types";
4
+ export type ListAccountsParams = Static<typeof wallet_listAccounts>["Request"]["params"][0];
5
+ export type ListAccountsResult = Static<typeof wallet_listAccounts>["ReturnType"];
6
+ export declare function listAccounts(client: InnerWalletApiClient, params: ListAccountsParams): Promise<ListAccountsResult>;
@@ -0,0 +1,4 @@
1
+ export async function listAccounts(client, params) {
2
+ return client.request({ method: "wallet_listAccounts", params: [params] });
3
+ }
4
+ //# sourceMappingURL=listAccounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listAccounts.js","sourceRoot":"","sources":["../../../../src/client/actions/listAccounts.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B;IAE1B,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_listAccounts } from \"../../rpc/request\";\nimport type { InnerWalletApiClient } from \"../../types\";\n\nexport type ListAccountsParams = Static<\n typeof wallet_listAccounts\n>[\"Request\"][\"params\"][0];\n\nexport type ListAccountsResult = Static<\n typeof wallet_listAccounts\n>[\"ReturnType\"];\n\nexport async function listAccounts(\n client: InnerWalletApiClient,\n params: ListAccountsParams,\n): Promise<ListAccountsResult> {\n return client.request({ method: \"wallet_listAccounts\", params: [params] });\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { type Address, type IsUndefined, type JsonRpcAccount } from "viem";
2
+ import type { PrepareCallsParams as IsomorphicPrepareCallsParams, PrepareCallsResult as IsomorphicPrepareCallsResult } from "../../isomorphic/actions/prepareCalls";
3
+ import type { InnerWalletApiClient } from "../../types";
4
+ export type GetAccountParam<TAccount> = IsUndefined<TAccount> extends true ? {
5
+ account: Address;
6
+ } : {
7
+ account?: never;
8
+ };
9
+ export type PrepareCallsParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Omit<IsomorphicPrepareCallsParams, "from" | "chainId"> & (IsUndefined<TAccount> extends true ? {
10
+ from: Address;
11
+ } : {
12
+ from?: never;
13
+ });
14
+ export type PrepareCallsResult = IsomorphicPrepareCallsResult;
15
+ export declare function prepareCalls<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, params: PrepareCallsParams<TAccount>): Promise<PrepareCallsResult>;
@@ -0,0 +1,17 @@
1
+ import { toHex, } from "viem";
2
+ export async function prepareCalls(client, params) {
3
+ if (client.policyId && !params.capabilities?.paymasterService) {
4
+ params.capabilities = {
5
+ ...params.capabilities,
6
+ paymasterService: { policyId: client.policyId },
7
+ };
8
+ }
9
+ if (client.account && !params.from) {
10
+ params.from = client.account.address;
11
+ }
12
+ return await client.request({
13
+ method: "wallet_prepareCalls",
14
+ params: [{ ...params, chainId: toHex(client.chain.id) }],
15
+ });
16
+ }
17
+ //# sourceMappingURL=prepareCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/prepareCalls.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAIN,MAAM,MAAM,CAAC;AA8Bd,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B,EAC5B,MAA0B;IAE1B,IAAI,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,EAAE,CAAC;QAC9D,MAAM,CAAC,YAAY,GAAG;YACpB,GAAG,MAAM,CAAC,YAAY;YACtB,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;SAChD,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC;QAC1B,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KACzD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n toHex,\n type Address,\n type IsUndefined,\n type JsonRpcAccount,\n} from \"viem\";\nimport type {\n PrepareCallsParams as IsomorphicPrepareCallsParams,\n PrepareCallsResult as IsomorphicPrepareCallsResult,\n} from \"../../isomorphic/actions/prepareCalls\";\nimport type { InnerWalletApiClient } from \"../../types\";\n\nexport type GetAccountParam<TAccount> =\n IsUndefined<TAccount> extends true\n ? { account: Address }\n : { account?: never };\n\nexport type PrepareCallsParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> = Omit<IsomorphicPrepareCallsParams, \"from\" | \"chainId\"> &\n (IsUndefined<TAccount> extends true ? { from: Address } : { from?: never });\n\nexport type PrepareCallsResult = IsomorphicPrepareCallsResult;\n\nexport async function prepareCalls<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n params: PrepareCallsParams<TAccount>,\n): Promise<PrepareCallsResult>;\n\nexport async function prepareCalls(\n client: InnerWalletApiClient,\n params: PrepareCallsParams,\n): Promise<PrepareCallsResult> {\n if (client.policyId && !params.capabilities?.paymasterService) {\n params.capabilities = {\n ...params.capabilities,\n paymasterService: { policyId: client.policyId },\n };\n }\n\n if (client.account && !params.from) {\n params.from = client.account.address;\n }\n\n return await client.request({\n method: \"wallet_prepareCalls\",\n params: [{ ...params, chainId: toHex(client.chain.id) }],\n });\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { SmartAccountSigner, SmartContractAccount } from "@aa-sdk/core";
2
+ import type { Static } from "@sinclair/typebox";
3
+ import type { Address } from "abitype";
4
+ import { type IsUndefined, type JsonRpcAccount } from "viem";
5
+ import type { wallet_requestAccount } from "../../rpc/request";
6
+ import type { InnerWalletApiClient } from "../../types";
7
+ export type RequestAccountParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = IsUndefined<TAccount> extends true ? Omit<Extract<Static<typeof wallet_requestAccount>["Request"]["params"][0], {
8
+ signerAddress: Address;
9
+ }>, "signerAddress" | "includeCounterfactualInfo"> : never;
10
+ export type RequestAccountResult = SmartContractAccount;
11
+ export declare function requestAccount<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params?: RequestAccountParams<TAccount>): Promise<RequestAccountResult>;
@@ -0,0 +1,28 @@
1
+ import { Value } from "@sinclair/typebox/value";
2
+ import { custom } from "viem";
3
+ import { createAccount } from "../../isomorphic/utils/createAccount";
4
+ import { TypeSerializedInitcode } from "../../schemas";
5
+ export async function requestAccount(client, signer, params) {
6
+ const args = client.account && !params
7
+ ? {
8
+ accountAddress: client.account.address,
9
+ includeCounterfactualInfo: true,
10
+ }
11
+ : {
12
+ ...params,
13
+ signerAddress: await signer.getAddress(),
14
+ includeCounterfactualInfo: true,
15
+ };
16
+ const { counterfactualInfo, accountAddress } = await client.request({
17
+ method: "wallet_requestAccount",
18
+ params: [args],
19
+ });
20
+ return createAccount({
21
+ accountAddress: accountAddress,
22
+ counterfactualInfo: Value.Parse(TypeSerializedInitcode, counterfactualInfo),
23
+ chain: client.chain,
24
+ transport: custom(client.transport),
25
+ signer,
26
+ });
27
+ }
28
+ //# sourceMappingURL=requestAccount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestAccount.js","sourceRoot":"","sources":["../../../../src/client/actions/requestAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAyC,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AA+BvD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA0B,EAC1B,MAA6B;IAE7B,MAAM,IAAI,GACR,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM;QACvB,CAAC,CAAC;YACE,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;YACtC,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,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClE,MAAM,EAAE,uBAAuB;QAC/B,MAAM,EAAE,CAAC,IAAI,CAAC;KACf,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC;QACnB,cAAc,EAAE,cAAc;QAC9B,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAC7B,sBAAsB,EACtB,kBAAmB,CACpB;QACD,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACnC,MAAM;KACP,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { SmartAccountSigner, SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport type { Address } from \"abitype\";\nimport { custom, type IsUndefined, type JsonRpcAccount } from \"viem\";\nimport { createAccount } from \"../../isomorphic/utils/createAccount\";\nimport type { wallet_requestAccount } from \"../../rpc/request\";\nimport { TypeSerializedInitcode } from \"../../schemas\";\nimport type { InnerWalletApiClient } from \"../../types\";\n\nexport type RequestAccountParams<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n> =\n IsUndefined<TAccount> extends true\n ? Omit<\n Extract<\n Static<typeof wallet_requestAccount>[\"Request\"][\"params\"][0],\n { signerAddress: Address }\n >,\n \"signerAddress\" | \"includeCounterfactualInfo\"\n >\n : never;\n\n// TODO: this could be more specific potentially :shrug:\nexport type RequestAccountResult = SmartContractAccount;\n\nexport function requestAccount<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params?: RequestAccountParams<TAccount>,\n): Promise<RequestAccountResult>;\n\nexport async function requestAccount(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n params?: RequestAccountParams,\n): Promise<RequestAccountResult> {\n const args =\n client.account && !params\n ? {\n accountAddress: client.account.address,\n includeCounterfactualInfo: true,\n }\n : {\n ...params,\n signerAddress: await signer.getAddress(),\n includeCounterfactualInfo: true,\n };\n\n const { counterfactualInfo, accountAddress } = await client.request({\n method: \"wallet_requestAccount\",\n params: [args],\n });\n\n return createAccount({\n accountAddress: accountAddress,\n counterfactualInfo: Value.Parse(\n TypeSerializedInitcode,\n counterfactualInfo!,\n ),\n chain: client.chain,\n transport: custom(client.transport),\n signer,\n });\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { Static } from "@sinclair/typebox";
2
+ import type { wallet_sendPreparedCalls } from "../../rpc/request";
3
+ import type { InnerWalletApiClient } from "../../types";
4
+ export type SendPreparedCallsParams = Omit<Static<typeof wallet_sendPreparedCalls>["Request"]["params"][0], "chainId">;
5
+ export type SendPreparedCallsResult = Static<typeof wallet_sendPreparedCalls>["ReturnType"];
6
+ export declare function sendPreparedCalls(client: InnerWalletApiClient, params: SendPreparedCallsParams): Promise<SendPreparedCallsResult>;
@@ -0,0 +1,8 @@
1
+ import { toHex } from "viem";
2
+ export async function sendPreparedCalls(client, params) {
3
+ return client.request({
4
+ method: "wallet_sendPreparedCalls",
5
+ params: [{ ...params, chainId: toHex(client.chain.id) }],
6
+ });
7
+ }
8
+ //# sourceMappingURL=sendPreparedCalls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendPreparedCalls.js","sourceRoot":"","sources":["../../../../src/client/actions/sendPreparedCalls.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAW7B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAA4B,EAC5B,MAA+B;IAE/B,OAAO,MAAM,CAAC,OAAO,CAAC;QACpB,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;KACzD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Static } from \"@sinclair/typebox\";\nimport type { wallet_sendPreparedCalls } from \"../../rpc/request\";\nimport type { InnerWalletApiClient } from \"../../types\";\nimport { toHex } from \"viem\";\n\nexport type SendPreparedCallsParams = Omit<\n Static<typeof wallet_sendPreparedCalls>[\"Request\"][\"params\"][0],\n \"chainId\"\n>;\n\nexport type SendPreparedCallsResult = Static<\n typeof wallet_sendPreparedCalls\n>[\"ReturnType\"];\n\nexport async function sendPreparedCalls(\n client: InnerWalletApiClient,\n params: SendPreparedCallsParams,\n): Promise<SendPreparedCallsResult> {\n return client.request({\n method: \"wallet_sendPreparedCalls\",\n params: [{ ...params, chainId: toHex(client.chain.id) }],\n });\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { type Address, type Hex, type JsonRpcAccount, type SignableMessage } from "viem";
2
+ import type { InnerWalletApiClient } from "../../types";
3
+ import type { SmartAccountSigner } from "@aa-sdk/core";
4
+ export type SignMessageParams = SignableMessage;
5
+ export type SignMessageResult = Hex;
6
+ export declare function signMessage<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignMessageParams): Promise<SignMessageResult>;
@@ -0,0 +1,7 @@
1
+ import {} from "viem";
2
+ import { requestAccount } from "./requestAccount";
3
+ export async function signMessage(client, signer, params) {
4
+ const account = await requestAccount(client, signer);
5
+ return account.signMessageWith6492({ message: params });
6
+ }
7
+ //# sourceMappingURL=signMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../../src/client/actions/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAA4B,EAC5B,MAA0B,EAC1B,MAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type SignableMessage,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { requestAccount } from \"./requestAccount\";\n\nexport type SignMessageParams = SignableMessage;\n\nexport type SignMessageResult = Hex;\n\nexport async function signMessage<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignMessageParams,\n): Promise<SignMessageResult>;\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 return account.signMessageWith6492({ message: params });\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { SmartAccountSigner } from "@aa-sdk/core";
2
+ import type { Static } from "@sinclair/typebox";
3
+ import { type Hex } from "viem";
4
+ import { TypeSignatureRequest } from "../../schemas";
5
+ export type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;
6
+ export type SignSignatureRequestResult = {
7
+ type: "ecdsa";
8
+ signature: Hex;
9
+ };
10
+ export declare function signSignatureRequest(signer: SmartAccountSigner, params: SignSignatureRequestParams): Promise<SignSignatureRequestResult>;
@@ -0,0 +1,15 @@
1
+ import {} from "viem";
2
+ import { TypeSignatureRequest } from "../../schemas";
3
+ import { assertNever } from "../../utils";
4
+ export async function signSignatureRequest(signer, params) {
5
+ const signature = params.type === "personal_sign"
6
+ ? await signer.signMessage(params.data)
7
+ : params.type === "eth_signTypedData_v4"
8
+ ? await signer.signTypedData(params.data)
9
+ : assertNever(params, "Unexpected signature request type");
10
+ return {
11
+ type: "ecdsa",
12
+ signature,
13
+ };
14
+ }
15
+ //# sourceMappingURL=signSignatureRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signSignatureRequest.js","sourceRoot":"","sources":["../../../../src/client/actions/signSignatureRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc1C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,MAAkC;IAElC,MAAM,SAAS,GACb,MAAM,CAAC,IAAI,KAAK,eAAe;QAC7B,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QACvC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAsB;YACtC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;IAEjE,OAAO;QACL,IAAI,EAAE,OAAO;QACb,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { type Hex } from \"viem\";\nimport { TypeSignatureRequest } from \"../../schemas\";\nimport { assertNever } from \"../../utils\";\n\nexport type SignSignatureRequestParams = Static<typeof TypeSignatureRequest>;\n\nexport type SignSignatureRequestResult = {\n type: \"ecdsa\";\n signature: Hex;\n};\n\nexport function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult>;\n\nexport async function signSignatureRequest(\n signer: SmartAccountSigner,\n params: SignSignatureRequestParams,\n): Promise<SignSignatureRequestResult> {\n const signature =\n params.type === \"personal_sign\"\n ? await signer.signMessage(params.data)\n : params.type === \"eth_signTypedData_v4\"\n ? await signer.signTypedData(params.data)\n : assertNever(params, \"Unexpected signature request type\");\n\n return {\n type: \"ecdsa\",\n signature,\n };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { type Address, type Hex, type JsonRpcAccount, type TypedDataDefinition } from "viem";
2
+ import type { InnerWalletApiClient } from "../../types";
3
+ import type { SmartAccountSigner } from "@aa-sdk/core";
4
+ export type SignTypedDataParams = TypedDataDefinition;
5
+ export type SignTypedDataResult = Hex;
6
+ export declare function signTypedData<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner, params: SignTypedDataParams): Promise<SignTypedDataResult>;
@@ -0,0 +1,7 @@
1
+ import {} from "viem";
2
+ import { requestAccount } from "./requestAccount";
3
+ export async function signTypedData(client, signer, params) {
4
+ const account = await requestAccount(client, signer);
5
+ return account.signTypedDataWith6492(params);
6
+ }
7
+ //# sourceMappingURL=signTypedData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../../src/client/actions/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAgBlD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA4B,EAC5B,MAA0B,EAC1B,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type JsonRpcAccount,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { InnerWalletApiClient } from \"../../types\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport { requestAccount } from \"./requestAccount\";\n\nexport type SignTypedDataParams = TypedDataDefinition;\n\nexport type SignTypedDataResult = Hex;\n\nexport async function signTypedData<\n TAccount extends JsonRpcAccount<Address> | undefined =\n | JsonRpcAccount<Address>\n | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n params: SignTypedDataParams,\n): Promise<SignTypedDataResult>;\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 return account.signTypedDataWith6492(params);\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,238 @@
1
+ import { LocalAccountSigner } from "@aa-sdk/core";
2
+ import { alchemy, arbitrumSepolia } from "@account-kit/infra";
3
+ import { describe, expect, it } from "bun:test";
4
+ import { createPublicClient, zeroAddress } from "viem";
5
+ import { createSmartWalletClient } from ".";
6
+ import { PermissionType } from "@account-kit/smart-contracts/experimental";
7
+ import { signSignatureRequest } from "./actions/signSignatureRequest";
8
+ describe("Client E2E Tests", () => {
9
+ const transport = alchemy(process.env.ALCHEMY_PROXY_RPC_URL
10
+ ? {
11
+ rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,
12
+ }
13
+ : {
14
+ apiKey: process.env.TEST_ALCHEMY_API_KEY,
15
+ });
16
+ describe("Local Mode Tests", () => {
17
+ const signer = LocalAccountSigner.privateKeyToAccountSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81");
18
+ const client = createSmartWalletClient({
19
+ transport,
20
+ chain: arbitrumSepolia,
21
+ mode: "local",
22
+ signer,
23
+ });
24
+ const publicClient = createPublicClient({
25
+ chain: arbitrumSepolia,
26
+ transport,
27
+ });
28
+ it("should successfully get a counterfactual address", async () => {
29
+ const account = await client.requestAccount();
30
+ expect(account.address).toMatchInlineSnapshot(`"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58"`);
31
+ });
32
+ it("can correctly sign a message", async () => {
33
+ const account = await client.requestAccount();
34
+ const message = "hello world";
35
+ const signature = await client.signMessage(message);
36
+ const publicClient = createPublicClient({
37
+ chain: arbitrumSepolia,
38
+ transport,
39
+ });
40
+ const isValid = await publicClient.verifyMessage({
41
+ address: account.address,
42
+ message: "hello world",
43
+ signature,
44
+ });
45
+ expect(isValid).toBeTrue();
46
+ });
47
+ it("can correctly sign typed data", async () => {
48
+ const account = await client.requestAccount();
49
+ const signature = await client.signTypedData(givenTypedData);
50
+ const isValid = await publicClient.verifyTypedData({
51
+ ...givenTypedData,
52
+ signature,
53
+ address: account.address,
54
+ });
55
+ expect(isValid).toBeTrue();
56
+ });
57
+ it("should successfully send a UO with paymaster", async () => {
58
+ const account = await client.requestAccount();
59
+ const preparedUO = await client.prepareCalls({
60
+ calls: [{ to: zeroAddress, value: "0x0" }],
61
+ from: account.address,
62
+ capabilities: {
63
+ paymasterService: {
64
+ policyId: process.env.TEST_PAYMASTER_POLICY_ID,
65
+ },
66
+ },
67
+ });
68
+ if (preparedUO.signatureRequest.type !== "personal_sign") {
69
+ throw new Error("Invalid signature request type");
70
+ }
71
+ const signature = await signer.signMessage(preparedUO.signatureRequest.data);
72
+ const result = await client.sendPreparedCalls({
73
+ ...preparedUO,
74
+ signature: {
75
+ type: "ECDSA",
76
+ signature,
77
+ },
78
+ });
79
+ expect(result.preparedCallIds).toBeArrayOfSize(1);
80
+ });
81
+ it("should successfully create a session with grantPermissions and send a UO", async () => {
82
+ const account = await client.requestAccount();
83
+ const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
84
+ const permissions = await client.grantPermissions({
85
+ account: account.address,
86
+ expiry: Math.floor(Date.now() / 1000) + 60 * 60,
87
+ key: {
88
+ publicKey: await sessionKey.getAddress(),
89
+ type: "secp256k1",
90
+ },
91
+ permissions: [{ type: PermissionType.ROOT }],
92
+ });
93
+ const preparedUO = await client.prepareCalls({
94
+ calls: [{ to: zeroAddress, value: "0x0" }],
95
+ from: account.address,
96
+ capabilities: {
97
+ paymasterService: {
98
+ policyId: process.env.TEST_PAYMASTER_POLICY_ID,
99
+ },
100
+ permissions,
101
+ },
102
+ });
103
+ const signature = await signSignatureRequest(sessionKey, preparedUO.signatureRequest);
104
+ const result = await client.sendPreparedCalls({
105
+ ...preparedUO,
106
+ signature,
107
+ capabilities: {
108
+ permissions,
109
+ },
110
+ });
111
+ expect(result.preparedCallIds).toBeArrayOfSize(1);
112
+ });
113
+ });
114
+ describe("Remote Mode Tests", () => {
115
+ const signer = LocalAccountSigner.privateKeyToAccountSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
116
+ const client = createSmartWalletClient({
117
+ transport,
118
+ chain: arbitrumSepolia,
119
+ mode: "remote",
120
+ signer,
121
+ });
122
+ const publicClient = createPublicClient({
123
+ chain: arbitrumSepolia,
124
+ transport,
125
+ });
126
+ it("should successfully get a counterfactual address", async () => {
127
+ const account = await client.requestAccount();
128
+ expect(account.address).toMatchInlineSnapshot(`"0x65b5DE0251f553B2208762a4724303E750294D96"`);
129
+ });
130
+ it("can correctly sign a message", async () => {
131
+ const account = await client.requestAccount();
132
+ const message = "hello world";
133
+ const signature = await client.signMessage(message);
134
+ const publicClient = createPublicClient({
135
+ chain: arbitrumSepolia,
136
+ transport,
137
+ });
138
+ const isValid = await publicClient.verifyMessage({
139
+ address: account.address,
140
+ message: "hello world",
141
+ signature,
142
+ });
143
+ expect(isValid).toBeTrue();
144
+ });
145
+ it("can correctly sign typed data", async () => {
146
+ const account = await client.requestAccount();
147
+ const signature = await client.signTypedData(givenTypedData);
148
+ const isValid = await publicClient.verifyTypedData({
149
+ ...givenTypedData,
150
+ signature,
151
+ address: account.address,
152
+ });
153
+ expect(isValid).toBeTrue();
154
+ });
155
+ it("should successfully send a UO with paymaster", async () => {
156
+ const account = await client.requestAccount();
157
+ const preparedUO = await client.prepareCalls({
158
+ calls: [{ to: zeroAddress, value: "0x0" }],
159
+ from: account.address,
160
+ capabilities: {
161
+ paymasterService: {
162
+ policyId: process.env.TEST_PAYMASTER_POLICY_ID,
163
+ },
164
+ },
165
+ });
166
+ const signature = await client.signSignatureRequest(preparedUO.signatureRequest);
167
+ const result = await client.sendPreparedCalls({
168
+ ...preparedUO,
169
+ signature,
170
+ });
171
+ expect(result.preparedCallIds).toBeArrayOfSize(1);
172
+ });
173
+ it("should successfully create a session with grantPermissions and send a UO", async () => {
174
+ const account = await client.requestAccount();
175
+ const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
176
+ const permissions = await client.grantPermissions({
177
+ account: account.address,
178
+ expiry: Math.floor(Date.now() / 1000) + 60 * 60,
179
+ key: {
180
+ publicKey: await sessionKey.getAddress(),
181
+ type: "secp256k1",
182
+ },
183
+ permissions: [{ type: PermissionType.ROOT }],
184
+ });
185
+ const preparedUO = await client.prepareCalls({
186
+ calls: [{ to: zeroAddress, value: "0x0" }],
187
+ from: account.address,
188
+ capabilities: {
189
+ paymasterService: {
190
+ policyId: process.env.TEST_PAYMASTER_POLICY_ID,
191
+ },
192
+ permissions,
193
+ },
194
+ });
195
+ const signature = await signSignatureRequest(sessionKey, preparedUO.signatureRequest);
196
+ const result = await client.sendPreparedCalls({
197
+ ...preparedUO,
198
+ signature,
199
+ capabilities: {
200
+ permissions,
201
+ },
202
+ });
203
+ expect(result.preparedCallIds).toBeArrayOfSize(1);
204
+ });
205
+ });
206
+ const givenTypedData = {
207
+ types: {
208
+ Person: [
209
+ { name: "name", type: "string" },
210
+ { name: "wallet", type: "address" },
211
+ ],
212
+ Mail: [
213
+ { name: "from", type: "Person" },
214
+ { name: "to", type: "Person" },
215
+ { name: "contents", type: "string" },
216
+ ],
217
+ },
218
+ primaryType: "Mail",
219
+ domain: {
220
+ name: "Ether Mail",
221
+ version: "1",
222
+ chainId: 1,
223
+ verifyingContract: "0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c",
224
+ },
225
+ message: {
226
+ from: {
227
+ name: "Alice",
228
+ wallet: "0xFC24e57486116026740634F629ffC4E5C95A6893",
229
+ },
230
+ to: {
231
+ name: "Bob",
232
+ wallet: "0xe7a26f006EAA562308C5df235C02BFB9a5849177",
233
+ },
234
+ contents: "Hello, Bob!",
235
+ },
236
+ };
237
+ });
238
+ //# sourceMappingURL=client.e2e-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.e2e-test.js","sourceRoot":"","sources":["../../../src/client/client.e2e-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAgB,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,GAAG,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,SAAS,GAAG,OAAO,CACvB,OAAO,CAAC,GAAG,CAAC,qBAAqB;QAC/B,CAAC,CAAC;YACE,MAAM,EAAE,OAAO,C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,IAAI,EAAE,SAAS,EAAE;aACpC;YACD,IAAI,EAAE;gBACJ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAChC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC9B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;aACrC;SACF;QACD,WAAW,EAAE,MAAe;QAC5B,MAAM,EAAE;YACN,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,CAAC;YACV,iBAAiB,EACf,4CAAuD;SAC1D;QACD,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,4CAA4C;aACrD;YACD,EAAE,EAAE;gBACF,IAAI,EAAE,KAAK;gBACX,MAAM,EAAE,4CAA4C;aACrD;YACD,QAAQ,EAAE,aAAa;SACxB;KACO,CAAC;AACb,CAAC,CAAC,CAAC","sourcesContent":["import { LocalAccountSigner } from \"@aa-sdk/core\";\nimport { alchemy, arbitrumSepolia } from \"@account-kit/infra\";\nimport { describe, expect, it } from \"bun:test\";\nimport { createPublicClient, zeroAddress, type Address } from \"viem\";\nimport { createSmartWalletClient } from \".\";\nimport { PermissionType } from \"@account-kit/smart-contracts/experimental\";\nimport { signSignatureRequest } from \"./actions/signSignatureRequest\";\n\ndescribe(\"Client E2E Tests\", () => {\n const transport = alchemy(\n process.env.ALCHEMY_PROXY_RPC_URL\n ? {\n rpcUrl: process.env.ALCHEMY_PROXY_RPC_URL,\n }\n : {\n apiKey: process.env.TEST_ALCHEMY_API_KEY!,\n },\n );\n describe(\"Local Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff81\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"local\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x26809de7733F9CcB5c0c61210a4f78d6F1daFc58\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n if (preparedUO.signatureRequest.type !== \"personal_sign\") {\n throw new Error(\"Invalid signature request type\");\n }\n\n const signature = await signer.signMessage(\n preparedUO.signatureRequest.data,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature: {\n type: \"ECDSA\",\n signature,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: PermissionType.ROOT }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n describe(\"Remote Mode Tests\", () => {\n const signer = LocalAccountSigner.privateKeyToAccountSigner(\n \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\",\n );\n\n const client = createSmartWalletClient({\n transport,\n chain: arbitrumSepolia,\n mode: \"remote\",\n signer,\n });\n\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n\n it(\"should successfully get a counterfactual address\", async () => {\n const account = await client.requestAccount();\n expect(account.address).toMatchInlineSnapshot(\n `\"0x65b5DE0251f553B2208762a4724303E750294D96\"`,\n );\n });\n\n it(\"can correctly sign a message\", async () => {\n const account = await client.requestAccount();\n const message = \"hello world\";\n const signature = await client.signMessage(message);\n const publicClient = createPublicClient({\n chain: arbitrumSepolia,\n transport,\n });\n const isValid = await publicClient.verifyMessage({\n address: account.address,\n message: \"hello world\",\n signature,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"can correctly sign typed data\", async () => {\n const account = await client.requestAccount();\n const signature = await client.signTypedData(givenTypedData);\n const isValid = await publicClient.verifyTypedData({\n ...givenTypedData,\n signature,\n address: account.address,\n });\n expect(isValid).toBeTrue();\n });\n\n it(\"should successfully send a UO with paymaster\", async () => {\n const account = await client.requestAccount();\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n },\n });\n\n const signature = await client.signSignatureRequest(\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n\n it(\"should successfully create a session with grantPermissions and send a UO\", async () => {\n const account = await client.requestAccount();\n\n const sessionKey = LocalAccountSigner.generatePrivateKeySigner();\n\n const permissions = await client.grantPermissions({\n account: account.address,\n expiry: Math.floor(Date.now() / 1000) + 60 * 60,\n key: {\n publicKey: await sessionKey.getAddress(),\n type: \"secp256k1\",\n },\n permissions: [{ type: PermissionType.ROOT }],\n });\n\n const preparedUO = await client.prepareCalls({\n calls: [{ to: zeroAddress, value: \"0x0\" }],\n from: account.address,\n capabilities: {\n paymasterService: {\n policyId: process.env.TEST_PAYMASTER_POLICY_ID!,\n },\n permissions,\n },\n });\n\n const signature = await signSignatureRequest(\n sessionKey,\n preparedUO.signatureRequest,\n );\n\n const result = await client.sendPreparedCalls({\n ...preparedUO,\n signature,\n capabilities: {\n permissions,\n },\n });\n\n expect(result.preparedCallIds).toBeArrayOfSize(1);\n });\n });\n\n const givenTypedData = {\n types: {\n Person: [\n { name: \"name\", type: \"string\" },\n { name: \"wallet\", type: \"address\" },\n ],\n Mail: [\n { name: \"from\", type: \"Person\" },\n { name: \"to\", type: \"Person\" },\n { name: \"contents\", type: \"string\" },\n ],\n },\n primaryType: \"Mail\" as const,\n domain: {\n name: \"Ether Mail\",\n version: \"1\",\n chainId: 1,\n verifyingContract:\n \"0xbbc68f94D29d52EE8D4994E54d6ED0fEAeb99C2c\" as Address,\n },\n message: {\n from: {\n name: \"Alice\",\n wallet: \"0xFC24e57486116026740634F629ffC4E5C95A6893\",\n },\n to: {\n name: \"Bob\",\n wallet: \"0xe7a26f006EAA562308C5df235C02BFB9a5849177\",\n },\n contents: \"Hello, Bob!\",\n },\n } as const;\n});\n"]}
@@ -0,0 +1,24 @@
1
+ import type { SmartAccountSigner } from "@aa-sdk/core";
2
+ import type { Hex, JsonRpcAccount, SignableMessage, TypedDataDefinition } from "viem";
3
+ import type { SendPreparedCallsParams, SendPreparedCallsResult } from "../isomorphic/actions/sendPreparedCalls";
4
+ import type { InnerWalletApiClient } from "../types";
5
+ import { type CreateAccountParams, type CreateAccountResult } from "./actions/createAccount";
6
+ import { type ListAccountsParams, type ListAccountsResult } from "./actions/listAccounts";
7
+ import { type PrepareCallsParams, type PrepareCallsResult } from "./actions/prepareCalls";
8
+ import { type RequestAccountParams, type RequestAccountResult } from "./actions/requestAccount";
9
+ import { type GetCallsStatusParams, type GetCallsStatusResult } from "./actions/getCallsStatus";
10
+ import { type SignSignatureRequestParams, type SignSignatureRequestResult } from "./actions/signSignatureRequest";
11
+ import { type GrantPermissionsParams, type GrantPermissionsResult } from "./actions/grantPermissions";
12
+ export type SmartWalletActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined> = {
13
+ requestAccount: (params?: RequestAccountParams<TAccount>) => Promise<RequestAccountResult>;
14
+ prepareCalls: (params: PrepareCallsParams<TAccount>) => Promise<PrepareCallsResult>;
15
+ sendPreparedCalls: (params: SendPreparedCallsParams) => Promise<SendPreparedCallsResult>;
16
+ createAccount: (params: CreateAccountParams) => Promise<CreateAccountResult>;
17
+ listAccounts: (params: ListAccountsParams) => Promise<ListAccountsResult>;
18
+ getCallsStatus: (params: GetCallsStatusParams) => Promise<GetCallsStatusResult>;
19
+ signSignatureRequest: (params: SignSignatureRequestParams) => Promise<SignSignatureRequestResult>;
20
+ signMessage: (params: SignableMessage) => Promise<Hex>;
21
+ signTypedData: (params: TypedDataDefinition) => Promise<Hex>;
22
+ grantPermissions: (params: GrantPermissionsParams) => Promise<GrantPermissionsResult>;
23
+ };
24
+ export declare function smartWalletClientActions<TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined>(client: InnerWalletApiClient<TAccount>, signer: SmartAccountSigner): SmartWalletActions<TAccount>;
@@ -0,0 +1,25 @@
1
+ import { createAccount, } from "./actions/createAccount";
2
+ import { listAccounts, } from "./actions/listAccounts";
3
+ import { prepareCalls, } from "./actions/prepareCalls";
4
+ import { requestAccount, } from "./actions/requestAccount";
5
+ import { getCallsStatus, } from "./actions/getCallsStatus";
6
+ import { signSignatureRequest, } from "./actions/signSignatureRequest";
7
+ import { signMessage } from "./actions/signMessage";
8
+ import { signTypedData } from "./actions/signTypedData";
9
+ import { grantPermissions, } from "./actions/grantPermissions";
10
+ import { sendPreparedCalls } from "./actions/sendPreparedCalls";
11
+ export function smartWalletClientActions(client, signer) {
12
+ return {
13
+ requestAccount: (params) => requestAccount(client, signer, params),
14
+ createAccount: (params) => createAccount(client, signer, params),
15
+ prepareCalls: (params) => prepareCalls(client, params),
16
+ listAccounts: (params) => listAccounts(client, params),
17
+ sendPreparedCalls: (params) => sendPreparedCalls(client, params),
18
+ getCallsStatus: (params) => getCallsStatus(client, params),
19
+ signSignatureRequest: (params) => signSignatureRequest(signer, params),
20
+ signMessage: (params) => signMessage(client, signer, params),
21
+ signTypedData: (params) => signTypedData(client, signer, params),
22
+ grantPermissions: (params) => grantPermissions(client, signer, params),
23
+ };
24
+ }
25
+ //# sourceMappingURL=decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/client/decorator.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,aAAa,GAGd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,YAAY,GAGb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,GAGb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,oBAAoB,GAGrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,gBAAgB,GAGjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAoChE,MAAM,UAAU,wBAAwB,CACtC,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,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 {\n Hex,\n JsonRpcAccount,\n SignableMessage,\n TypedDataDefinition,\n} from \"viem\";\nimport type {\n SendPreparedCallsParams,\n SendPreparedCallsResult,\n} from \"../isomorphic/actions/sendPreparedCalls\";\nimport type { InnerWalletApiClient } from \"../types\";\nimport {\n createAccount,\n type CreateAccountParams,\n type CreateAccountResult,\n} from \"./actions/createAccount\";\nimport {\n listAccounts,\n type ListAccountsParams,\n type ListAccountsResult,\n} from \"./actions/listAccounts\";\nimport {\n prepareCalls,\n type PrepareCallsParams,\n type PrepareCallsResult,\n} from \"./actions/prepareCalls\";\nimport {\n requestAccount,\n type RequestAccountParams,\n type RequestAccountResult,\n} from \"./actions/requestAccount\";\nimport {\n getCallsStatus,\n type GetCallsStatusParams,\n type GetCallsStatusResult,\n} from \"./actions/getCallsStatus\";\nimport {\n signSignatureRequest,\n type SignSignatureRequestParams,\n type SignSignatureRequestResult,\n} from \"./actions/signSignatureRequest\";\nimport { signMessage } from \"./actions/signMessage\";\nimport { signTypedData } from \"./actions/signTypedData\";\nimport {\n grantPermissions,\n type GrantPermissionsParams,\n type GrantPermissionsResult,\n} from \"./actions/grantPermissions\";\nimport { sendPreparedCalls } from \"./actions/sendPreparedCalls\";\n\nexport type SmartWalletActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n> = {\n requestAccount: (\n params?: RequestAccountParams<TAccount>,\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 signMessage: (params: SignableMessage) => Promise<Hex>;\n signTypedData: (params: TypedDataDefinition) => Promise<Hex>;\n grantPermissions: (\n params: GrantPermissionsParams,\n ) => Promise<GrantPermissionsResult>;\n};\n\nexport function smartWalletClientActions<\n TAccount extends JsonRpcAccount | undefined = JsonRpcAccount | undefined,\n>(\n client: InnerWalletApiClient<TAccount>,\n signer: SmartAccountSigner,\n): SmartWalletActions<TAccount>;\n\nexport function smartWalletClientActions(\n client: InnerWalletApiClient,\n signer: SmartAccountSigner,\n): SmartWalletActions {\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 signMessage: (params) => signMessage(client, signer, params),\n signTypedData: (params) => signTypedData(client, signer, params),\n grantPermissions: (params) => grantPermissions(client, signer, params),\n };\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { type SmartAccountSigner } from "@aa-sdk/core";
2
+ import { type AlchemyTransport } from "@account-kit/infra";
3
+ import { type Address, type Chain, type IsUndefined, type JsonRpcAccount, type Prettify } from "viem";
4
+ import type { InnerWalletApiClient } from "../types";
5
+ import { type SmartWalletActions } from "./decorator";
6
+ export type SmartWalletClientParams<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined> = Prettify<{
7
+ transport: AlchemyTransport;
8
+ chain: Chain;
9
+ signer: SmartAccountSigner;
10
+ mode: "local" | "remote";
11
+ policyId?: string;
12
+ } & (IsUndefined<TAccount> extends true ? {
13
+ account?: never;
14
+ } : {
15
+ account: Address;
16
+ })>;
17
+ export declare function createSmartWalletClient<TAccount extends JsonRpcAccount<Address> | undefined = JsonRpcAccount<Address> | undefined>(params: SmartWalletClientParams<TAccount>): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;
18
+ export declare function createSmartWalletClient<TAccount extends JsonRpcAccount<Address> = JsonRpcAccount<Address>>(params: SmartWalletClientParams<TAccount>): InnerWalletApiClient<TAccount> & SmartWalletActions<TAccount>;