@account-kit/smart-contracts 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (184) hide show
  1. package/dist/cjs/plugindefs/multi-owner/config.js +16 -17
  2. package/dist/cjs/plugindefs/multi-owner/config.js.map +1 -1
  3. package/dist/cjs/plugindefs/multisig/config.js +15 -15
  4. package/dist/cjs/plugindefs/multisig/config.js.map +1 -1
  5. package/dist/cjs/plugindefs/session-key/config.js +17 -17
  6. package/dist/cjs/plugindefs/session-key/config.js.map +1 -1
  7. package/dist/cjs/src/index.d.ts +1 -1
  8. package/dist/cjs/src/index.js +4 -3
  9. package/dist/cjs/src/index.js.map +1 -1
  10. package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
  11. package/dist/cjs/src/light-account/accounts/account.js +3 -2
  12. package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
  13. package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
  14. package/dist/cjs/src/light-account/accounts/base.js +8 -8
  15. package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
  16. package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
  17. package/dist/cjs/src/light-account/accounts/multiOwner.js +3 -2
  18. package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
  19. package/dist/cjs/src/light-account/clients/alchemyClient.d.ts +1 -1
  20. package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
  21. package/dist/cjs/src/light-account/clients/client.d.ts +1 -2
  22. package/dist/cjs/src/light-account/clients/client.js +3 -3
  23. package/dist/cjs/src/light-account/clients/client.js.map +1 -1
  24. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  25. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  26. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
  27. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +3 -3
  28. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  29. package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
  30. package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  31. package/dist/cjs/src/light-account/types.d.ts +23 -31
  32. package/dist/cjs/src/light-account/types.js.map +1 -1
  33. package/dist/cjs/src/light-account/utils.d.ts +7 -10
  34. package/dist/cjs/src/light-account/utils.js +59 -87
  35. package/dist/cjs/src/light-account/utils.js.map +1 -1
  36. package/dist/cjs/src/msca/client/alchemyClient.d.ts +1 -1
  37. package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
  38. package/dist/cjs/src/msca/client/client.d.ts +2 -6
  39. package/dist/cjs/src/msca/client/client.js +6 -6
  40. package/dist/cjs/src/msca/client/client.js.map +1 -1
  41. package/dist/cjs/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  42. package/dist/cjs/src/msca/client/multiSigAlchemyClient.js +1 -1
  43. package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  44. package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
  45. package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  46. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  47. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  48. package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
  49. package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
  50. package/dist/cjs/src/msca/utils.js +11 -10
  51. package/dist/cjs/src/msca/utils.js.map +1 -1
  52. package/dist/esm/plugindefs/multi-owner/config.js +1 -2
  53. package/dist/esm/plugindefs/multi-owner/config.js.map +1 -1
  54. package/dist/esm/plugindefs/multisig/config.js +1 -1
  55. package/dist/esm/plugindefs/multisig/config.js.map +1 -1
  56. package/dist/esm/plugindefs/session-key/config.js +1 -1
  57. package/dist/esm/plugindefs/session-key/config.js.map +1 -1
  58. package/dist/esm/src/index.d.ts +1 -1
  59. package/dist/esm/src/index.js +1 -1
  60. package/dist/esm/src/index.js.map +1 -1
  61. package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
  62. package/dist/esm/src/light-account/accounts/account.js +3 -2
  63. package/dist/esm/src/light-account/accounts/account.js.map +1 -1
  64. package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
  65. package/dist/esm/src/light-account/accounts/base.js +8 -8
  66. package/dist/esm/src/light-account/accounts/base.js.map +1 -1
  67. package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
  68. package/dist/esm/src/light-account/accounts/multiOwner.js +4 -3
  69. package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
  70. package/dist/esm/src/light-account/clients/alchemyClient.d.ts +1 -1
  71. package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
  72. package/dist/esm/src/light-account/clients/client.d.ts +1 -2
  73. package/dist/esm/src/light-account/clients/client.js +3 -3
  74. package/dist/esm/src/light-account/clients/client.js.map +1 -1
  75. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  76. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  77. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
  78. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +3 -3
  79. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  80. package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
  81. package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  82. package/dist/esm/src/light-account/types.d.ts +23 -31
  83. package/dist/esm/src/light-account/types.js.map +1 -1
  84. package/dist/esm/src/light-account/utils.d.ts +7 -10
  85. package/dist/esm/src/light-account/utils.js +57 -84
  86. package/dist/esm/src/light-account/utils.js.map +1 -1
  87. package/dist/esm/src/msca/client/alchemyClient.d.ts +1 -1
  88. package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
  89. package/dist/esm/src/msca/client/client.d.ts +2 -6
  90. package/dist/esm/src/msca/client/client.js +6 -6
  91. package/dist/esm/src/msca/client/client.js.map +1 -1
  92. package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  93. package/dist/esm/src/msca/client/multiSigAlchemyClient.js +1 -1
  94. package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  95. package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
  96. package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  97. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  98. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  99. package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
  100. package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
  101. package/dist/esm/src/msca/utils.js +2 -1
  102. package/dist/esm/src/msca/utils.js.map +1 -1
  103. package/dist/types/plugindefs/multi-owner/config.d.ts.map +1 -1
  104. package/dist/types/src/index.d.ts +1 -1
  105. package/dist/types/src/index.d.ts.map +1 -1
  106. package/dist/types/src/light-account/accounts/account.d.ts +5 -6
  107. package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
  108. package/dist/types/src/light-account/accounts/base.d.ts +7 -6
  109. package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
  110. package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
  111. package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
  112. package/dist/types/src/light-account/clients/alchemyClient.d.ts +1 -1
  113. package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
  114. package/dist/types/src/light-account/clients/client.d.ts +1 -2
  115. package/dist/types/src/light-account/clients/client.d.ts.map +1 -1
  116. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  117. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
  118. package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts +1 -2
  119. package/dist/types/src/light-account/clients/multiOwnerLightAccount.d.ts.map +1 -1
  120. package/dist/types/src/light-account/decorators/lightAccount.d.ts +1 -1
  121. package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +1 -1
  122. package/dist/types/src/light-account/types.d.ts +23 -118
  123. package/dist/types/src/light-account/types.d.ts.map +1 -1
  124. package/dist/types/src/light-account/utils.d.ts +19 -48
  125. package/dist/types/src/light-account/utils.d.ts.map +1 -1
  126. package/dist/types/src/msca/client/alchemyClient.d.ts +1 -1
  127. package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
  128. package/dist/types/src/msca/client/client.d.ts +2 -6
  129. package/dist/types/src/msca/client/client.d.ts.map +1 -1
  130. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  131. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
  132. package/dist/types/src/msca/plugins/multisig/middleware.d.ts +6 -6
  133. package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
  134. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
  135. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
  136. package/dist/types/src/msca/plugins/session-key/permissions.d.ts +147 -1
  137. package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
  138. package/dist/types/src/msca/plugins/session-key/signer.d.ts +71 -1
  139. package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
  140. package/dist/types/src/msca/utils.d.ts +6 -6
  141. package/dist/types/src/msca/utils.d.ts.map +1 -1
  142. package/package.json +7 -6
  143. package/plugindefs/multi-owner/config.ts +1 -2
  144. package/plugindefs/multisig/config.ts +1 -1
  145. package/plugindefs/session-key/config.ts +1 -1
  146. package/src/index.ts +2 -1
  147. package/src/light-account/accounts/account.ts +24 -45
  148. package/src/light-account/accounts/base.ts +39 -68
  149. package/src/light-account/accounts/multiOwner.ts +29 -43
  150. package/src/light-account/clients/alchemyClient.ts +2 -2
  151. package/src/light-account/clients/client.ts +8 -13
  152. package/src/light-account/clients/multiOwnerAlchemyClient.ts +3 -3
  153. package/src/light-account/clients/multiOwnerLightAccount.ts +11 -13
  154. package/src/light-account/decorators/lightAccount.ts +1 -1
  155. package/src/light-account/decorators/multiOwnerLightAccount.ts +1 -1
  156. package/src/light-account/types.ts +31 -188
  157. package/src/light-account/utils.ts +91 -246
  158. package/src/msca/client/alchemyClient.ts +2 -2
  159. package/src/msca/client/client.ts +24 -36
  160. package/src/msca/client/multiSigAlchemyClient.ts +5 -5
  161. package/src/msca/plugins/multisig/middleware.ts +6 -6
  162. package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
  163. package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
  164. package/src/msca/plugins/session-key/permissions.ts +147 -1
  165. package/src/msca/plugins/session-key/signer.ts +71 -1
  166. package/src/msca/utils.ts +15 -13
  167. package/dist/cjs/src/light-account/e2e-tests/constants.d.ts +0 -6
  168. package/dist/cjs/src/light-account/e2e-tests/constants.js +0 -10
  169. package/dist/cjs/src/light-account/e2e-tests/constants.js.map +0 -1
  170. package/dist/cjs/src/light-account/schema.d.ts +0 -21
  171. package/dist/cjs/src/light-account/schema.js +0 -30
  172. package/dist/cjs/src/light-account/schema.js.map +0 -1
  173. package/dist/esm/src/light-account/e2e-tests/constants.d.ts +0 -6
  174. package/dist/esm/src/light-account/e2e-tests/constants.js +0 -7
  175. package/dist/esm/src/light-account/e2e-tests/constants.js.map +0 -1
  176. package/dist/esm/src/light-account/schema.d.ts +0 -21
  177. package/dist/esm/src/light-account/schema.js +0 -27
  178. package/dist/esm/src/light-account/schema.js.map +0 -1
  179. package/dist/types/src/light-account/e2e-tests/constants.d.ts +0 -7
  180. package/dist/types/src/light-account/e2e-tests/constants.d.ts.map +0 -1
  181. package/dist/types/src/light-account/schema.d.ts +0 -22
  182. package/dist/types/src/light-account/schema.d.ts.map +0 -1
  183. package/src/light-account/e2e-tests/constants.ts +0 -8
  184. package/src/light-account/schema.ts +0 -39
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,kBAAkB,GAGnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC;AAuDvC,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAE9D,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC;QAC5C,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,YAAY;QACf,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"../accounts/account.js\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n account: Omit<\n CreateLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n>;\n\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * }\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { account, transport, chain, ...clientConfig } = params;\n\n const lightAccount = await createLightAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,kBAAkB,GAGnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC;AAkDvC,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC;QAC5C,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"../accounts/account.js\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<CreateLightAccountParams<TTransport, TSigner>, \"transport\" | \"chain\"> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n"]}
@@ -1,6 +1,6 @@
1
+ import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
1
2
  import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
2
3
  import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions } from "@account-kit/smart-contracts";
3
- import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
4
4
  import { type Chain, type CustomTransport, type Transport } from "viem";
5
- export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
5
+ export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain" | "type"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
6
6
  export declare function createMultiOwnerLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerLightAccount<TSigner>, MultiOwnerLightAccountClientActions<TSigner>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,GAIpC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AAkDhF,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n MultiOwnerLightAccount<TSigner>\n >,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra/chains\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient(\n config: AlchemyMultiOwnerLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,GAIpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AAkDhF,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\" | \"type\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n MultiOwnerLightAccount<TSigner>\n >,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient(\n config: AlchemyMultiOwnerLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
@@ -5,6 +5,5 @@ import { type MultiOwnerLightAccountClientActions } from "../decorators/multiOwn
5
5
  export type CreateMultiOwnerLightAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
6
6
  transport: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["transport"];
7
7
  chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>["chain"];
8
- account: Omit<CreateMultiOwnerLightAccountParams<TTransport, TSigner>, "transport" | "chain">;
9
- } & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
8
+ } & Omit<CreateMultiOwnerLightAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
10
9
  export declare function createMultiOwnerLightAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerLightAccount<TSigner>, SmartAccountClientActions<Chain, SmartContractAccount> & MultiOwnerLightAccountClientActions<TSigner, MultiOwnerLightAccount<TSigner>>>>;
@@ -3,14 +3,14 @@ import {} from "viem";
3
3
  import { createMultiOwnerLightAccount, } from "../accounts/multiOwner.js";
4
4
  import { multiOwnerLightAccountClientActions, } from "../decorators/multiOwnerLightAccount.js";
5
5
  export async function createMultiOwnerLightAccountClient(params) {
6
- const { account, transport, chain, ...clientConfig } = params;
6
+ const { transport, chain } = params;
7
7
  const lightAccount = await createMultiOwnerLightAccount({
8
- ...account,
8
+ ...params,
9
9
  transport,
10
10
  chain,
11
11
  });
12
12
  return createSmartAccountClient({
13
- ...clientConfig,
13
+ ...params,
14
14
  transport,
15
15
  chain: chain,
16
16
  account: lightAccount,
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,GAEpC,MAAM,yCAAyC,CAAC;AA6DjD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAgD;IAEhD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAE9D,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC;QACtD,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,YAAY;QACf,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n} from \"../accounts/multiOwner.js\";\nimport {\n multiOwnerLightAccountClientActions,\n type MultiOwnerLightAccountClientActions,\n} from \"../decorators/multiOwnerLightAccount.js\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n account: Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n>;\n\nexport function createMultiOwnerLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * }\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { account, transport, chain, ...clientConfig } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,GAEpC,MAAM,yCAAyC,CAAC;AA2DjD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAgD;IAEhD,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC;QACtD,GAAG,MAAM;QACT,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n} from \"../accounts/multiOwner.js\";\nimport {\n multiOwnerLightAccountClientActions,\n type MultiOwnerLightAccountClientActions,\n} from \"../decorators/multiOwnerLightAccount.js\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createMultiOwnerLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...params,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AAgCzC,MAAM,CAAC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chains\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(lightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions\n */\nexport const lightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => LightAccountClientActions<TSigner, TAccount> = (client) => ({\n transferOwnership: async (args) => transferOwnership(client, args),\n});\n"]}
1
+ {"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AAgCzC,MAAM,CAAC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(lightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions\n */\nexport const lightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => LightAccountClientActions<TSigner, TAccount> = (client) => ({\n transferOwnership: async (args) => transferOwnership(client, args),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,GAEb,MAAM,4BAA4B,CAAC;AAgCpC,MAAM,CAAC,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chains\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createMultiOwnerLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(multiOwnerLightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client for interacting with the multi-owner light account\n * @returns {MultiOwnerLightAccountClientActions<TSigner, TAccount>} an object containing the client actions specifically for a multi-owner light account\n */\nexport const multiOwnerLightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => MultiOwnerLightAccountClientActions<TSigner, TAccount> = (client) => ({\n updateOwners: async (args) => updateOwners(client, args),\n});\n"]}
1
+ {"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,GAEb,MAAM,4BAA4B,CAAC;AAgCpC,MAAM,CAAC,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createMultiOwnerLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(multiOwnerLightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client for interacting with the multi-owner light account\n * @returns {MultiOwnerLightAccountClientActions<TSigner, TAccount>} an object containing the client actions specifically for a multi-owner light account\n */\nexport const multiOwnerLightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => MultiOwnerLightAccountClientActions<TSigner, TAccount> = (client) => ({\n updateOwners: async (args) => updateOwners(client, args),\n});\n"]}
@@ -1,39 +1,31 @@
1
- import { type EntryPointVersion, type GetAccountParameter, type OneOf, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
1
+ import { type EntryPointVersion } from "@aa-sdk/core";
2
2
  import { type Address, type Chain } from "viem";
3
3
  import type { LightAccountBase } from "./accounts/base";
4
- export type LightAccountType = keyof IAccountVersionRegistry;
5
- export type AccountVersionDef<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
6
- type: TLightAccountType;
7
- version: TLightAccountVersion;
4
+ export type LightAccountType = "LightAccount" | "MultiOwnerLightAccount";
5
+ export type LightAccountVersionConfig<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
8
6
  entryPointVersion: TEntryPointVersion;
9
- address: Record<Chain["id"], {
10
- factory: Address;
11
- impl: Address;
12
- }>;
7
+ addresses: {
8
+ default: {
9
+ factory: Address;
10
+ impl: Address;
11
+ };
12
+ overrides?: Record<Chain["id"], {
13
+ factory: Address;
14
+ impl: Address;
15
+ }>;
16
+ };
13
17
  };
14
- export type LightAccountVersion = keyof IAccountVersionRegistry["LightAccount"] | keyof IAccountVersionRegistry["MultiOwnerLightAccount"];
15
- export type GetLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = keyof IAccountVersionRegistry[TLightAccountType];
16
- export type LightAccountVersionDef<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];
17
- export interface IAccountVersionRegistry {
18
+ export type LightAccountVersionConfigs = {
18
19
  LightAccount: {
19
- "v1.0.1": AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0">;
20
- "v1.0.2": AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">;
21
- "v1.1.0": AccountVersionDef<"LightAccount", "v1.1.0", "0.6.0">;
22
- "v2.0.0": AccountVersionDef<"LightAccount", "v2.0.0", "0.7.0">;
20
+ "v1.0.1": LightAccountVersionConfig<"0.6.0">;
21
+ "v1.0.2": LightAccountVersionConfig<"0.6.0">;
22
+ "v1.1.0": LightAccountVersionConfig<"0.6.0">;
23
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
23
24
  };
24
25
  MultiOwnerLightAccount: {
25
- "v2.0.0": AccountVersionDef<"MultiOwnerLightAccount", "v2.0.0", "0.7.0">;
26
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
26
27
  };
27
- }
28
- export type GetLightAccountVersionDefsForType<TType extends LightAccountType> = Extract<IAccountVersionRegistry[TType][keyof IAccountVersionRegistry[TType]], {
29
- type: TType;
30
- }>;
31
- export type GetLightAccountVersionDef<TType extends LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TType>> = IAccountVersionRegistry[TType][TLightAccountVersion];
32
- export type GetLightAccountVersionDefsForEntryPoint<TType extends LightAccountType, TEntryPointVersion extends EntryPointVersion> = Extract<GetLightAccountVersionDefsForType<TType>, {
33
- entryPointVersion: TEntryPointVersion;
34
- }>;
35
- export type GetLightAccountType<TAccount extends SmartContractAccount | undefined, TAccountOverride extends SmartContractAccount = SmartContractAccount> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, infer TLightAccountType> ? OneOf<TLightAccountType, LightAccountType> : LightAccountType;
36
- export type GetLightAccountVersionFromAccount<TAccount extends LightAccountBase | undefined, TAccountOverride extends LightAccountBase = LightAccountBase> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, LightAccountType, infer TLightAccountVersion> ? OneOf<TLightAccountVersion, LightAccountVersion> : LightAccountVersion;
37
- export type GetEntryPointForLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = GetLightAccountVersionDef<TLightAccountType, TLightAccountVersion> extends AccountVersionDef<TLightAccountType, TLightAccountVersion, infer TEntryPointVersion> ? TEntryPointVersion : EntryPointVersion;
38
- export type GetLightAccountTypesForVersion<TLightAccountVersion extends LightAccountVersion = LightAccountVersion> = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType> ? TLightAccountType : LightAccountType;
39
- export type GetDefaultLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = TLightAccountType extends "MultiOwnerLightAccount" ? "v2.0.0" & LightAccountVersion : "v1.1.0" & LightAccountVersion;
28
+ };
29
+ export type LightAccountVersion<TAccountType extends LightAccountType> = keyof LightAccountVersionConfigs[TAccountType];
30
+ export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["source"] extends LightAccountType ? TAccount["source"] : never;
31
+ export type LightAccountEntryPointVersion<TLightAccountType extends LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion]["entryPointVersion"] : never;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,cAAc,CAAC;AACtB,OAAO,EAA4B,MAAM,MAAM,CAAC","sourcesContent":["import {\n type EntryPointVersion,\n type GetAccountParameter,\n type OneOf,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\n\n/**\n * Light account types supported: LightAccount, MultiOwnerLightAccount\n *\n */\nexport type LightAccountType = keyof IAccountVersionRegistry;\n\n/**\n * Account version definition, which is the base type defining the LightAccountVersionDef interface\n *\n * @template {LightAccountType} TLightAccountType type\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion version\n * @template {EntryPointVersion} TEntryPointVersion entryPointVersion\n */\nexport type AccountVersionDef<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n type: TLightAccountType;\n version: TLightAccountVersion;\n entryPointVersion: TEntryPointVersion;\n address: Record<\n Chain[\"id\"],\n {\n factory: Address;\n impl: Address;\n }\n >;\n};\n\n/**\n * Light account version type defs for tightly coupled types for smart accounts\n *\n */\nexport type LightAccountVersion =\n | keyof IAccountVersionRegistry[\"LightAccount\"]\n | keyof IAccountVersionRegistry[\"MultiOwnerLightAccount\"];\n\n/**\n * Get the light account versions available for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n */\nexport type GetLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType\n> = keyof IAccountVersionRegistry[TLightAccountType];\n\n/**\n * Light account version definition type based on the light account type and version\n *\n * @template {LightAccountType} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n */\nexport type LightAccountVersionDef<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];\n\n/**\n * Light account version registry interface defining the supported light account versions\n *\n */\nexport interface IAccountVersionRegistry {\n LightAccount: {\n /** @deprecated This version does not support 1271 signature validation */\n \"v1.0.1\": AccountVersionDef<\"LightAccount\", \"v1.0.1\", \"0.6.0\">;\n /** @deprecated This version has a known issue with 1271 validation */\n \"v1.0.2\": AccountVersionDef<\"LightAccount\", \"v1.0.2\", \"0.6.0\">;\n \"v1.1.0\": AccountVersionDef<\"LightAccount\", \"v1.1.0\", \"0.6.0\">;\n /**\n * LightAccount v2 Changelog.\n * It is recommended to use v2.0.0\n * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd\n */\n \"v2.0.0\": AccountVersionDef<\"LightAccount\", \"v2.0.0\", \"0.7.0\">;\n };\n MultiOwnerLightAccount: {\n /**\n * MultiOwnerLightAccount v2 Changelog\n * It is recommended to use v2.0.0\n * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd\n */\n \"v2.0.0\": AccountVersionDef<\"MultiOwnerLightAccount\", \"v2.0.0\", \"0.7.0\">;\n };\n}\n\n/**\n * Get the light account version definitions available for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n *\n * @example\n * type T1 = GetLightAccountVersionsForType<\"LightAccount\">;\n * const t1: T1 = AccountVersionRegistry.LightAccount[\"v1.0.2\"];\n */\nexport type GetLightAccountVersionDefsForType<TType extends LightAccountType> =\n Extract<\n IAccountVersionRegistry[TType][keyof IAccountVersionRegistry[TType]],\n { type: TType }\n >;\n\n/**\n * Get the light account version definition for the given light account type and version\n *\n * @template {LightAccountType} TType\n * @template {GetLightAccountVersion<TType>} TLightAccountVersion\n */\nexport type GetLightAccountVersionDef<\n TType extends LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TType>\n> = IAccountVersionRegistry[TType][TLightAccountVersion];\n\n/**\n * @example\n * type T = GetLightAccountVersionDefsForEntryPoint<\"LightAccount\", \"0.6.0\">;\n * const t_1: T = AccountVersionRegistry.LightAccount[\"v1.0.2\"]; // compiles\n * const t_2: T = AccountVersionRegistry.LightAccount[\"v2.0.0\"]; // errors\n */\nexport type GetLightAccountVersionDefsForEntryPoint<\n TType extends LightAccountType,\n TEntryPointVersion extends EntryPointVersion\n> = Extract<\n GetLightAccountVersionDefsForType<TType>,\n { entryPointVersion: TEntryPointVersion }\n>;\n\n/**\n * Get the light account type for the given light account by inferring from its type definition\n *\n * @template {SmartContractAccount | undefined} TAccount\n * @template {SmartContractAccount} TAccountOverride\n */\nexport type GetLightAccountType<\n TAccount extends SmartContractAccount | undefined,\n TAccountOverride extends SmartContractAccount = SmartContractAccount\n> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<\n SmartAccountSigner,\n infer TLightAccountType\n>\n ? OneOf<TLightAccountType, LightAccountType>\n : LightAccountType;\n\n/**\n * Get the light account version for the given light account by inferring from its type definition\n *\n * @template {LightAccountBase | undefined} TAccount\n * @template {LightAccountBase} TAccountOverride\n */\nexport type GetLightAccountVersionFromAccount<\n TAccount extends LightAccountBase | undefined,\n TAccountOverride extends LightAccountBase = LightAccountBase\n> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<\n SmartAccountSigner,\n LightAccountType,\n infer TLightAccountVersion\n>\n ? OneOf<TLightAccountVersion, LightAccountVersion>\n : LightAccountVersion;\n\n/**\n * Get the entry point version supported for the given light account type and version\n *\n * @template {LightAccountType} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n */\nexport type GetEntryPointForLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n> = GetLightAccountVersionDef<\n TLightAccountType,\n TLightAccountVersion\n> extends AccountVersionDef<\n TLightAccountType,\n TLightAccountVersion,\n infer TEntryPointVersion\n>\n ? TEntryPointVersion\n : EntryPointVersion;\n\n/**\n * Get the light account type for the given light account version by inferring from its type definition\n *\n * @template {LightAccountVersion} TLightAccountVersion\n */\nexport type GetLightAccountTypesForVersion<\n TLightAccountVersion extends LightAccountVersion = LightAccountVersion\n> = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType>\n ? TLightAccountType\n : LightAccountType;\n\n/**\n * Get default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n */\nexport type GetDefaultLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType\n> = TLightAccountType extends \"MultiOwnerLightAccount\"\n ? \"v2.0.0\" & LightAccountVersion\n : \"v1.1.0\" & LightAccountVersion;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,MAAM,cAAc,CAAC;AACtD,OAAO,EAA4B,MAAM,MAAM,CAAC","sourcesContent":["import { type EntryPointVersion } from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\n\n/**\n * Light account types supported: LightAccount, MultiOwnerLightAccount\n *\n */\nexport type LightAccountType = \"LightAccount\" | \"MultiOwnerLightAccount\";\n\nexport type LightAccountVersionConfig<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n entryPointVersion: TEntryPointVersion;\n addresses: {\n default: {\n factory: Address;\n impl: Address;\n };\n overrides?: Record<\n Chain[\"id\"],\n {\n factory: Address;\n impl: Address;\n }\n >;\n };\n};\n\nexport type LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.0.2\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.1.0\": LightAccountVersionConfig<\"0.6.0\">;\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n MultiOwnerLightAccount: {\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n};\n\nexport type LightAccountVersion<TAccountType extends LightAccountType> =\n keyof LightAccountVersionConfigs[TAccountType];\n\nexport type GetLightAccountType<TAccount extends LightAccountBase> =\n TAccount[\"source\"] extends LightAccountType ? TAccount[\"source\"] : never;\n\nexport type LightAccountEntryPointVersion<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>\n> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig\n ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion][\"entryPointVersion\"]\n : never;\n"]}
@@ -1,13 +1,10 @@
1
1
  import { type Address, type Chain } from "viem";
2
2
  import type { LightAccountBase } from "./accounts/base";
3
- import type { AccountVersionDef, GetLightAccountType, GetLightAccountVersion, IAccountVersionRegistry, LightAccountVersionDef } from "./types";
4
- export declare const supportedChains: Chain[];
5
- export declare const AccountVersionRegistry: IAccountVersionRegistry;
6
- export declare const defaultLightAccountVersion: <TLightAccountType extends keyof IAccountVersionRegistry>(type: TLightAccountType) => keyof IAccountVersionRegistry[TLightAccountType];
7
- export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"LightAccount">) => Address;
8
- export declare const getDefaultMultiOwnerLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"MultiOwnerLightAccount">) => `0x${string}`;
9
- export declare const LightAccountUnsupported1271Impls: (AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0"> | AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">)[];
3
+ import type { LightAccountType, LightAccountVersion, LightAccountVersionConfig, LightAccountVersionConfigs } from "./types";
4
+ export declare const AccountVersionRegistry: LightAccountVersionConfigs;
5
+ export declare const defaultLightAccountVersion: <TLightAccountType extends LightAccountType>() => keyof LightAccountVersionConfigs[TLightAccountType];
6
+ export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version: LightAccountVersion<"LightAccount">) => Address;
7
+ export declare const getDefaultMultiOwnerLightAccountFactoryAddress: (chain: Chain, version: LightAccountVersion<"MultiOwnerLightAccount">) => `0x${string}`;
8
+ export declare const LightAccountUnsupported1271Impls: LightAccountVersionConfig<"0.6.0">[];
10
9
  export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
11
- export declare function getLightAccountVersionDef<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>>(account: TAccount, chain: Chain): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;
12
- export declare function getLightAccountVersionDef<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>>(account: TAccount, chain: Chain): Promise<AccountVersionDef<TLightAccountType, GetLightAccountVersion<TLightAccountType>>>;
13
- export declare function getLightAccountVersion<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>>(account: TAccount, chain?: Chain): Promise<GetLightAccountVersion<TLightAccountType>>;
10
+ export declare function getLightAccountVersionForAccount<TAccount extends LightAccountBase>(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig>;
@@ -1,119 +1,95 @@
1
- import { DefaultFactoryNotDefinedError, arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, toRecord, zora, zoraSepolia, } from "@aa-sdk/core";
2
1
  import { fromHex } from "viem";
3
- export const supportedChains = [
4
- mainnet,
5
- sepolia,
6
- goerli,
7
- polygon,
8
- polygonAmoy,
9
- polygonMumbai,
10
- optimism,
11
- optimismGoerli,
12
- optimismSepolia,
13
- arbitrum,
14
- arbitrumGoerli,
15
- arbitrumSepolia,
16
- base,
17
- baseGoerli,
18
- baseSepolia,
19
- fraxtal,
20
- fraxtalSepolia,
21
- zora,
22
- zoraSepolia,
23
- ];
24
2
  export const AccountVersionRegistry = {
25
3
  LightAccount: {
26
4
  "v1.0.1": {
27
- type: "LightAccount",
28
- version: "v1.0.1",
29
- address: toRecord(supportedChains, "id", () => ({
30
- factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
31
- impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
32
- })),
33
5
  entryPointVersion: "0.6.0",
6
+ addresses: {
7
+ default: {
8
+ factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
9
+ impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
10
+ },
11
+ },
34
12
  },
35
13
  "v1.0.2": {
36
- type: "LightAccount",
37
- version: "v1.0.2",
38
- address: toRecord(supportedChains, "id", () => ({
39
- factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
40
- impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
41
- })),
42
14
  entryPointVersion: "0.6.0",
15
+ addresses: {
16
+ default: {
17
+ factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
18
+ impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
19
+ },
20
+ },
43
21
  },
44
22
  "v1.1.0": {
45
- type: "LightAccount",
46
- version: "v1.1.0",
47
- address: toRecord(supportedChains, "id", () => ({
48
- factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
49
- impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
50
- })),
51
23
  entryPointVersion: "0.6.0",
24
+ addresses: {
25
+ default: {
26
+ factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
27
+ impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
28
+ },
29
+ },
52
30
  },
53
31
  "v2.0.0": {
54
- type: "LightAccount",
55
- version: "v2.0.0",
56
- address: toRecord(supportedChains, "id", () => ({
57
- factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
58
- impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
59
- })),
60
32
  entryPointVersion: "0.7.0",
33
+ addresses: {
34
+ default: {
35
+ factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
36
+ impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
37
+ },
38
+ },
61
39
  },
62
40
  },
63
41
  MultiOwnerLightAccount: {
64
42
  "v2.0.0": {
65
- type: "MultiOwnerLightAccount",
66
- version: "v2.0.0",
67
- address: toRecord(supportedChains, "id", () => ({
68
- factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
69
- impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
70
- })),
71
43
  entryPointVersion: "0.7.0",
44
+ addresses: {
45
+ default: {
46
+ factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
47
+ impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
48
+ },
49
+ },
72
50
  },
73
51
  },
74
52
  };
75
- export const defaultLightAccountVersion = (type) => (type === "LightAccount"
76
- ? "v1.1.0"
77
- : "v2.0.0");
53
+ export const defaultLightAccountVersion = () => "v2.0.0";
78
54
  export const getDefaultLightAccountFactoryAddress = (chain, version) => {
79
- const address = AccountVersionRegistry.LightAccount[version].address[chain.id] ??
80
- AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
81
- if (!address)
82
- throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
83
- return address.factory;
55
+ return (AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]
56
+ ?.factory ??
57
+ AccountVersionRegistry.LightAccount[version].addresses.default.factory);
84
58
  };
85
59
  export const getDefaultMultiOwnerLightAccountFactoryAddress = (chain, version) => {
86
- const address = AccountVersionRegistry.LightAccount[version].address[chain.id] ??
87
- AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
88
- if (!address)
89
- throw new DefaultFactoryNotDefinedError("MultiOwnerLightAccount", chain, "0.7.0");
90
- return address.factory;
60
+ return (AccountVersionRegistry.MultiOwnerLightAccount[version].addresses
61
+ .overrides?.[chain.id]?.factory ??
62
+ AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default
63
+ .factory);
91
64
  };
92
65
  export const LightAccountUnsupported1271Impls = [
93
66
  AccountVersionRegistry.LightAccount["v1.0.1"],
94
67
  AccountVersionRegistry.LightAccount["v1.0.2"],
95
68
  ];
96
- export const LightAccountUnsupported1271Factories = new Set(LightAccountUnsupported1271Impls.map((x) => Object.values(x.address).map((addr) => addr.factory)).flat());
97
- export async function getLightAccountVersionDef(account, chain) {
69
+ export const LightAccountUnsupported1271Factories = new Set(LightAccountUnsupported1271Impls.map((x) => [
70
+ x.addresses.default.factory,
71
+ ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),
72
+ ]).flat());
73
+ export async function getLightAccountVersionForAccount(account, chain) {
98
74
  const accountType = account.source;
99
75
  const factoryAddress = await account.getFactoryAddress();
100
76
  const implAddress = await account.getImplementationAddress();
101
- const implToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
102
- .map((pair) => {
77
+ const implToVersion = new Map(Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
103
78
  const [version, def] = pair;
104
- return chain.id in def.address
105
- ? [def.address[chain.id].impl, version]
106
- : [def.address[supportedChains[0].id].impl, version];
107
- })
108
- .filter(([impl]) => impl !== null));
109
- const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
110
- .map((pair) => {
79
+ if (def.addresses.overrides != null &&
80
+ chain.id in def.addresses.overrides) {
81
+ return [def.addresses.overrides[chain.id].impl, version];
82
+ }
83
+ return [def.addresses.default.impl, version];
84
+ }));
85
+ const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
111
86
  const [version, def] = pair;
112
- return chain.id in def.address
113
- ? [def.address[chain.id].factory, version]
114
- : [def.address[supportedChains[0].id].factory, version];
115
- })
116
- .filter(([impl]) => impl !== null));
87
+ if (def.addresses.overrides != null &&
88
+ chain.id in def.addresses.overrides) {
89
+ return [def.addresses.overrides[chain.id].factory, version];
90
+ }
91
+ return [def.addresses.default.factory, version];
92
+ }));
117
93
  const version = fromHex(implAddress, "bigint") === 0n
118
94
  ? factoryToVersion.get(factoryAddress.toLowerCase())
119
95
  : implToVersion.get(implAddress.toLowerCase());
@@ -122,7 +98,4 @@ export async function getLightAccountVersionDef(account, chain) {
122
98
  }
123
99
  return AccountVersionRegistry[accountType][version];
124
100
  }
125
- export async function getLightAccountVersion(account, chain = supportedChains[0]) {
126
- return (await getLightAccountVersionDef(account, chain)).version;
127
- }
128
101
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP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AC,KAAK,EAAE;QACnC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAa,CAAC;QAC/D,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,EAAa,CAAC,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,MAAM,sBAAsB,KAAK,CAAC,EAAE,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC;AA4BD,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAyB,EACzB,QAAe,eAAe,CAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,MAAM,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AACnE,CAAC","sourcesContent":["import {\n DefaultFactoryNotDefinedError,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n toRecord,\n zora,\n zoraSepolia,\n} from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n AccountVersionDef,\n GetLightAccountType,\n GetLightAccountVersion,\n GetLightAccountVersionFromAccount,\n IAccountVersionRegistry,\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionDef,\n} from \"./types\";\n\n/**\n * Light account deployed chains\n *\n */\nexport const supportedChains: Chain[] = [\n mainnet,\n sepolia,\n goerli,\n polygon,\n polygonAmoy,\n polygonMumbai,\n optimism,\n optimismGoerli,\n optimismSepolia,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n zora,\n zoraSepolia,\n];\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: IAccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": {\n type: \"LightAccount\",\n version: \"v1.0.1\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.0.2\": {\n type: \"LightAccount\",\n version: \"v1.0.2\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.1.0\": {\n type: \"LightAccount\",\n version: \"v1.1.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v2.0.0\": {\n type: \"LightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n type: \"MultiOwnerLightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @param type - the light account type to get the default version for\n * @returns the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(\n type: TLightAccountType\n): GetLightAccountVersion<TLightAccountType> =>\n (type === \"LightAccount\"\n ? \"v1.1.0\"\n : \"v2.0.0\") as GetLightAccountVersion<TLightAccountType>;\n\n/**\n * Utility method returning the default light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"LightAccount\">\n): Address => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\"LightAccount\", chain, \"0.6.0\");\n return address.factory;\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"MultiOwnerLightAccount\">\n) => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\n \"MultiOwnerLightAccount\",\n chain,\n \"0.7.0\"\n );\n return address.factory;\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) =>\n Object.values(x.address).map((addr) => addr.factory)\n ).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n>(\n account: TAccount,\n chain: Chain\n): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain: Chain\n): Promise<\n AccountVersionDef<\n TLightAccountType,\n GetLightAccountVersion<TLightAccountType>\n >\n>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<AccountVersionDef> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n GetLightAccountVersionFromAccount<TAccount>,\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].impl, version]\n : [def.address[supportedChains[0].id].impl, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n keyof IAccountVersionRegistry[typeof accountType],\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].factory, version]\n : [def.address[supportedChains[0].id].factory, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n\n/**\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n * Migrate to using getLightAccountVersionDef instead\n *\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain?: Chain\n): Promise<GetLightAccountVersion<TLightAccountType>>;\n\n/**\n * Get the light account version for the given light account and chain\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n *\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion(\n account: LightAccountBase,\n chain: Chain = supportedChains[0]\n): Promise<LightAccountVersion> {\n return (await getLightAccountVersionDef(account, chain)).version;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA4B,MAAM,MAAM,CAAC;AAczD,MAAM,CAAC,MAAM,sBAAsB,GAA+B;IAChE,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,iBAAiB,EAAE,OAAO;YAC1B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;oBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;iBAC5E;aACF;SACF;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,OAAO;YAC1B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;oBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;iBAC5E;aACF;SACF;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,OAAO;YAC1B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;oBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;iBAC5E;aACF;SACF;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,OAAO;YAC1B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;oBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;iBAC5E;aACF;SACF;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EF,IACE,GAAG,CAAC,SAAS,CAAC,SAAS,IAAI,IAAI;YAC/B,KAAK,CAAC,EAAE,IAAI,GAAG,CAAC,SAAS,CAAC,SAAU,EACpC,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,EAAE;QACnC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAa,CAAC;QAC/D,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,EAAa,CAAC,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,MAAM,sBAAsB,KAAK,CAAC,EAAE,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { GetEntryPointFromAccount } from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionConfig,\n LightAccountVersionConfigs,\n} from \"./types\";\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n },\n },\n },\n \"v1.0.2\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n },\n },\n },\n \"v1.1.0\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n },\n },\n },\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n },\n },\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n },\n },\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @returns {LightAccountVersion<TLightAccountType>} the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(): LightAccountVersion<TLightAccountType> => \"v2.0.0\";\n\n/**\n * Utility method returning the default light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {LightAccountVersion} version - the version of the light account to get the factory address for\n * @returns {Address} an for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"LightAccount\">\n): Address => {\n return (\n AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]\n ?.factory ??\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n );\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {string} version - the version of the light account to get the factory address for\n * @returns {Address} an Address for the given chain\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"MultiOwnerLightAccount\">\n) => {\n return (\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses\n .overrides?.[chain.id]?.factory ??\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default\n .factory\n );\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) => [\n x.addresses.default.factory,\n ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),\n ]).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param {LightAccountBase} account the light account to get the version for\n * @param {Chain} chain - the chain to get the version for\n * @returns {Promise<LightAccountVersionConfig>} the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionForAccount<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].impl, version];\n }\n\n return [def.addresses.default.impl, version];\n })\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].factory, version];\n }\n\n return [def.addresses.default.factory, version];\n })\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n"]}
@@ -1,6 +1,6 @@
1
+ import type { SmartAccountSigner } from "@aa-sdk/core";
1
2
  import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
2
3
  import { type AccountLoupeActions, type CreateMultiOwnerModularAccountParams, type LightAccount, type MultiOwnerModularAccount, type MultiOwnerPluginActions, type PluginManagerActions } from "@account-kit/smart-contracts";
3
- import type { SmartAccountSigner } from "@aa-sdk/core";
4
4
  import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
5
5
  export type AlchemyModularAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
6
6
  export declare function createModularAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAgDd,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra/chains\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
1
+ {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAgDd,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
@@ -7,11 +7,7 @@ import { type CreateMultisigModularAccountParams, type MultisigModularAccount }
7
7
  import { type PluginManagerActions } from "../plugin-manager/decorator.js";
8
8
  import { type MultiOwnerPluginActions } from "../plugins/multi-owner/index.js";
9
9
  import { type MultisigPluginActions, type MultisigUserOperationContext } from "../plugins/multisig/index.js";
10
- export type CreateMultiOwnerModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
11
- account: Omit<CreateMultiOwnerModularAccountParams<TTransport, TSigner>, "transport" | "chain">;
12
- } & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
13
- export type CreateMultisigModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = {
14
- account: Omit<CreateMultisigModularAccountParams<TTransport, TSigner>, "transport" | "chain">;
15
- } & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
10
+ export type CreateMultiOwnerModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
11
+ export type CreateMultisigModularAccountClientParams<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<TTransport, TSigner>, "transport" | "chain"> & Omit<CreateLightAccountClientParams<TTransport, TChain, TSigner>, "account">;
16
12
  export declare function createMultiOwnerModularAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultiOwnerModularAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
17
13
  export declare function createMultisigModularAccountClient<TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateMultisigModularAccountClientParams<Transport, TChain, TSigner>): Promise<SmartAccountClient<CustomTransport, Chain, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, SmartAccountClientRpcSchema, MultisigUserOperationContext>>;