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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/cjs/src/index.d.ts +3 -3
  2. package/dist/cjs/src/index.js +15 -15
  3. package/dist/cjs/src/index.js.map +1 -1
  4. package/dist/cjs/src/light-account/accounts/account.js +1 -1
  5. package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
  6. package/dist/cjs/src/light-account/accounts/multiOwner.js +2 -4
  7. package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
  8. package/dist/cjs/src/light-account/actions/transferOwnership.d.ts +1 -1
  9. package/dist/cjs/src/light-account/actions/transferOwnership.js +2 -1
  10. package/dist/cjs/src/light-account/actions/transferOwnership.js.map +1 -1
  11. package/dist/cjs/src/light-account/actions/updateOwners.js.map +1 -1
  12. package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
  13. package/dist/cjs/src/light-account/clients/client.js +2 -1
  14. package/dist/cjs/src/light-account/clients/client.js.map +1 -1
  15. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  16. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +2 -1
  17. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  18. package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
  19. package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  20. package/dist/cjs/src/light-account/utils.d.ts +3 -2
  21. package/dist/cjs/src/light-account/utils.js +14 -5
  22. package/dist/cjs/src/light-account/utils.js.map +1 -1
  23. package/dist/cjs/src/msca/account/multiOwnerAccount.js +2 -1
  24. package/dist/cjs/src/msca/account/multiOwnerAccount.js.map +1 -1
  25. package/dist/cjs/src/msca/account/multisigAccount.js +4 -3
  26. package/dist/cjs/src/msca/account/multisigAccount.js.map +1 -1
  27. package/dist/cjs/src/msca/account-loupe/decorator.js.map +1 -1
  28. package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
  29. package/dist/cjs/src/msca/client/client.js.map +1 -1
  30. package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  31. package/dist/cjs/src/msca/errors.js.map +1 -1
  32. package/dist/cjs/src/msca/plugin-manager/decorator.d.ts +1 -1
  33. package/dist/cjs/src/msca/plugin-manager/decorator.js +6 -4
  34. package/dist/cjs/src/msca/plugin-manager/decorator.js.map +1 -1
  35. package/dist/cjs/src/msca/plugin-manager/installPlugin.js.map +1 -1
  36. package/dist/cjs/src/msca/plugins/multi-owner/extension.js.map +1 -1
  37. package/dist/cjs/src/msca/plugins/multi-owner/index.d.ts +1 -1
  38. package/dist/cjs/src/msca/plugins/multi-owner/index.js +2 -1
  39. package/dist/cjs/src/msca/plugins/multi-owner/index.js.map +1 -1
  40. package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js +2 -2
  41. package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
  42. package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
  43. package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
  44. package/dist/cjs/src/msca/plugins/multisig/extension.js.map +1 -1
  45. package/dist/cjs/src/msca/plugins/multisig/index.d.ts +1 -8
  46. package/dist/cjs/src/msca/plugins/multisig/index.js +1 -16
  47. package/dist/cjs/src/msca/plugins/multisig/index.js.map +1 -1
  48. package/dist/cjs/src/msca/plugins/multisig/middleware.d.ts +1 -1
  49. package/dist/cjs/src/msca/plugins/multisig/middleware.js +1 -1
  50. package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
  51. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
  52. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
  53. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
  54. package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
  55. package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
  56. package/dist/cjs/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  57. package/dist/cjs/src/msca/plugins/multisig/utils/index.js.map +1 -1
  58. package/dist/cjs/src/msca/plugins/session-key/extension.js.map +1 -1
  59. package/dist/cjs/src/msca/plugins/session-key/index.d.ts +1 -1
  60. package/dist/cjs/src/msca/plugins/session-key/index.js +3 -1
  61. package/dist/cjs/src/msca/plugins/session-key/index.js.map +1 -1
  62. package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
  63. package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
  64. package/dist/cjs/src/msca/plugins/session-key/utils.d.ts +4 -2
  65. package/dist/cjs/src/msca/plugins/session-key/utils.js +3 -2
  66. package/dist/cjs/src/msca/plugins/session-key/utils.js.map +1 -1
  67. package/dist/cjs/src/msca/utils.d.ts +6 -4
  68. package/dist/cjs/src/msca/utils.js.map +1 -1
  69. package/dist/esm/src/index.d.ts +3 -3
  70. package/dist/esm/src/index.js +2 -2
  71. package/dist/esm/src/index.js.map +1 -1
  72. package/dist/esm/src/light-account/accounts/account.js +2 -2
  73. package/dist/esm/src/light-account/accounts/account.js.map +1 -1
  74. package/dist/esm/src/light-account/accounts/multiOwner.js +3 -5
  75. package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
  76. package/dist/esm/src/light-account/actions/transferOwnership.d.ts +1 -1
  77. package/dist/esm/src/light-account/actions/transferOwnership.js +2 -1
  78. package/dist/esm/src/light-account/actions/transferOwnership.js.map +1 -1
  79. package/dist/esm/src/light-account/actions/updateOwners.js.map +1 -1
  80. package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
  81. package/dist/esm/src/light-account/clients/client.js +2 -1
  82. package/dist/esm/src/light-account/clients/client.js.map +1 -1
  83. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  84. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +2 -1
  85. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  86. package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
  87. package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  88. package/dist/esm/src/light-account/utils.d.ts +3 -2
  89. package/dist/esm/src/light-account/utils.js +12 -4
  90. package/dist/esm/src/light-account/utils.js.map +1 -1
  91. package/dist/esm/src/msca/account/multiOwnerAccount.js +2 -1
  92. package/dist/esm/src/msca/account/multiOwnerAccount.js.map +1 -1
  93. package/dist/esm/src/msca/account/multisigAccount.js +4 -3
  94. package/dist/esm/src/msca/account/multisigAccount.js.map +1 -1
  95. package/dist/esm/src/msca/account-loupe/decorator.js.map +1 -1
  96. package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
  97. package/dist/esm/src/msca/client/client.js.map +1 -1
  98. package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  99. package/dist/esm/src/msca/errors.js.map +1 -1
  100. package/dist/esm/src/msca/plugin-manager/decorator.d.ts +1 -1
  101. package/dist/esm/src/msca/plugin-manager/decorator.js +6 -4
  102. package/dist/esm/src/msca/plugin-manager/decorator.js.map +1 -1
  103. package/dist/esm/src/msca/plugin-manager/installPlugin.js.map +1 -1
  104. package/dist/esm/src/msca/plugins/multi-owner/extension.js.map +1 -1
  105. package/dist/esm/src/msca/plugins/multi-owner/index.d.ts +1 -1
  106. package/dist/esm/src/msca/plugins/multi-owner/index.js +1 -1
  107. package/dist/esm/src/msca/plugins/multi-owner/index.js.map +1 -1
  108. package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js +1 -1
  109. package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
  110. package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
  111. package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
  112. package/dist/esm/src/msca/plugins/multisig/extension.js.map +1 -1
  113. package/dist/esm/src/msca/plugins/multisig/index.d.ts +1 -8
  114. package/dist/esm/src/msca/plugins/multisig/index.js +0 -7
  115. package/dist/esm/src/msca/plugins/multisig/index.js.map +1 -1
  116. package/dist/esm/src/msca/plugins/multisig/middleware.d.ts +1 -1
  117. package/dist/esm/src/msca/plugins/multisig/middleware.js +2 -1
  118. package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
  119. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
  120. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
  121. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
  122. package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
  123. package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
  124. package/dist/esm/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  125. package/dist/esm/src/msca/plugins/multisig/utils/index.js.map +1 -1
  126. package/dist/esm/src/msca/plugins/session-key/extension.js.map +1 -1
  127. package/dist/esm/src/msca/plugins/session-key/index.d.ts +1 -1
  128. package/dist/esm/src/msca/plugins/session-key/index.js +1 -1
  129. package/dist/esm/src/msca/plugins/session-key/index.js.map +1 -1
  130. package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
  131. package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
  132. package/dist/esm/src/msca/plugins/session-key/utils.d.ts +4 -2
  133. package/dist/esm/src/msca/plugins/session-key/utils.js +3 -2
  134. package/dist/esm/src/msca/plugins/session-key/utils.js.map +1 -1
  135. package/dist/esm/src/msca/utils.d.ts +6 -4
  136. package/dist/esm/src/msca/utils.js.map +1 -1
  137. package/dist/types/src/index.d.ts +3 -3
  138. package/dist/types/src/index.d.ts.map +1 -1
  139. package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
  140. package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
  141. package/dist/types/src/light-account/actions/transferOwnership.d.ts +26 -1
  142. package/dist/types/src/light-account/actions/transferOwnership.d.ts.map +1 -1
  143. package/dist/types/src/light-account/actions/updateOwners.d.ts +24 -0
  144. package/dist/types/src/light-account/actions/updateOwners.d.ts.map +1 -1
  145. package/dist/types/src/light-account/decorators/lightAccount.d.ts +19 -0
  146. package/dist/types/src/light-account/decorators/lightAccount.d.ts.map +1 -1
  147. package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +19 -0
  148. package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts.map +1 -1
  149. package/dist/types/src/light-account/utils.d.ts +11 -4
  150. package/dist/types/src/light-account/utils.d.ts.map +1 -1
  151. package/dist/types/src/msca/account/multisigAccount.d.ts.map +1 -1
  152. package/dist/types/src/msca/account-loupe/decorator.d.ts +15 -0
  153. package/dist/types/src/msca/account-loupe/decorator.d.ts.map +1 -1
  154. package/dist/types/src/msca/client/client.d.ts.map +1 -1
  155. package/dist/types/src/msca/errors.d.ts +12 -0
  156. package/dist/types/src/msca/errors.d.ts.map +1 -1
  157. package/dist/types/src/msca/plugin-manager/decorator.d.ts +16 -1
  158. package/dist/types/src/msca/plugin-manager/decorator.d.ts.map +1 -1
  159. package/dist/types/src/msca/plugin-manager/installPlugin.d.ts +21 -0
  160. package/dist/types/src/msca/plugin-manager/installPlugin.d.ts.map +1 -1
  161. package/dist/types/src/msca/plugins/multi-owner/extension.d.ts +15 -0
  162. package/dist/types/src/msca/plugins/multi-owner/extension.d.ts.map +1 -1
  163. package/dist/types/src/msca/plugins/multi-owner/index.d.ts +1 -1
  164. package/dist/types/src/msca/plugins/multi-owner/index.d.ts.map +1 -1
  165. package/dist/types/src/msca/plugins/multisig/actions/proposeUserOperation.d.ts.map +1 -1
  166. package/dist/types/src/msca/plugins/multisig/actions/signMultisigUserOperation.d.ts.map +1 -1
  167. package/dist/types/src/msca/plugins/multisig/extension.d.ts +13 -0
  168. package/dist/types/src/msca/plugins/multisig/extension.d.ts.map +1 -1
  169. package/dist/types/src/msca/plugins/multisig/index.d.ts +1 -8
  170. package/dist/types/src/msca/plugins/multisig/index.d.ts.map +1 -1
  171. package/dist/types/src/msca/plugins/multisig/middleware.d.ts +1 -1
  172. package/dist/types/src/msca/plugins/multisig/middleware.d.ts.map +1 -1
  173. package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts +28 -2
  174. package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts.map +1 -1
  175. package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts +21 -2
  176. package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts.map +1 -1
  177. package/dist/types/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  178. package/dist/types/src/msca/plugins/multisig/utils/index.d.ts.map +1 -1
  179. package/dist/types/src/msca/plugins/session-key/extension.d.ts +13 -0
  180. package/dist/types/src/msca/plugins/session-key/extension.d.ts.map +1 -1
  181. package/dist/types/src/msca/plugins/session-key/index.d.ts +1 -1
  182. package/dist/types/src/msca/plugins/session-key/index.d.ts.map +1 -1
  183. package/dist/types/src/msca/plugins/session-key/permissions.d.ts +3 -0
  184. package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
  185. package/dist/types/src/msca/plugins/session-key/signer.d.ts +1 -1
  186. package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
  187. package/dist/types/src/msca/plugins/session-key/utils.d.ts +22 -2
  188. package/dist/types/src/msca/plugins/session-key/utils.d.ts.map +1 -1
  189. package/dist/types/src/msca/utils.d.ts +43 -5
  190. package/dist/types/src/msca/utils.d.ts.map +1 -1
  191. package/package.json +5 -5
  192. package/src/index.ts +2 -3
  193. package/src/light-account/accounts/account.ts +22 -3
  194. package/src/light-account/accounts/multiOwner.ts +26 -5
  195. package/src/light-account/actions/transferOwnership.ts +28 -5
  196. package/src/light-account/actions/updateOwners.ts +24 -0
  197. package/src/light-account/clients/alchemyClient.ts +20 -0
  198. package/src/light-account/clients/client.ts +27 -6
  199. package/src/light-account/clients/multiOwnerAlchemyClient.ts +20 -0
  200. package/src/light-account/clients/multiOwnerLightAccount.ts +27 -6
  201. package/src/light-account/decorators/lightAccount.ts +19 -0
  202. package/src/light-account/decorators/multiOwnerLightAccount.ts +19 -0
  203. package/src/light-account/utils.ts +29 -6
  204. package/src/msca/account/multiOwnerAccount.ts +36 -11
  205. package/src/msca/account/multisigAccount.ts +40 -14
  206. package/src/msca/account-loupe/decorator.ts +15 -0
  207. package/src/msca/client/alchemyClient.ts +20 -0
  208. package/src/msca/client/client.ts +46 -0
  209. package/src/msca/client/multiSigAlchemyClient.ts +22 -0
  210. package/src/msca/errors.ts +12 -0
  211. package/src/msca/plugin-manager/decorator.ts +22 -5
  212. package/src/msca/plugin-manager/installPlugin.ts +21 -0
  213. package/src/msca/plugins/multi-owner/extension.ts +15 -0
  214. package/src/msca/plugins/multi-owner/index.ts +3 -0
  215. package/src/msca/plugins/multisig/actions/proposeUserOperation.ts +1 -1
  216. package/src/msca/plugins/multisig/actions/signMultisigUserOperation.ts +1 -1
  217. package/src/msca/plugins/multisig/extension.ts +13 -0
  218. package/src/msca/plugins/multisig/index.ts +1 -12
  219. package/src/msca/plugins/multisig/middleware.ts +2 -2
  220. package/src/msca/plugins/multisig/utils/combineSignatures.ts +36 -9
  221. package/src/msca/plugins/multisig/utils/getSignerType.ts +23 -4
  222. package/src/msca/plugins/multisig/utils/index.ts +4 -0
  223. package/src/msca/plugins/session-key/extension.ts +13 -0
  224. package/src/msca/plugins/session-key/index.ts +7 -1
  225. package/src/msca/plugins/session-key/permissions.ts +3 -0
  226. package/src/msca/plugins/session-key/signer.ts +1 -2
  227. package/src/msca/plugins/session-key/utils.ts +33 -12
  228. package/src/msca/utils.ts +64 -9
@@ -2,13 +2,11 @@ import { createBundlerClient, getAccountAddress, getEntryPoint, } from "@aa-sdk/
2
2
  import { concatHex, encodeFunctionData, hexToBigInt, } from "viem";
3
3
  import { MultiOwnerLightAccountAbi } from "../abis/MultiOwnerLightAccountAbi.js";
4
4
  import { MultiOwnerLightAccountFactoryAbi } from "../abis/MultiOwnerLightAccountFactoryAbi.js";
5
- import { AccountVersionRegistry, defaultLightAccountVersion, } from "../utils.js";
5
+ import { AccountVersionRegistry, defaultLightAccountVersion, getDefaultMultiOwnerLightAccountFactoryAddress, } from "../utils.js";
6
6
  import { createLightAccountBase, } from "./base.js";
7
7
  export async function createMultiOwnerLightAccount({ transport, chain, signer, initCode, version = defaultLightAccountVersion("MultiOwnerLightAccount"), entryPoint = getEntryPoint(chain, {
8
- version: AccountVersionRegistry["MultiOwnerLightAccount"][version]
9
- .entryPointVersion,
10
- }), accountAddress, factoryAddress = AccountVersionRegistry["MultiOwnerLightAccount"][version]
11
- .address[chain.id].factory, salt: salt_ = 0n, owners = [], }) {
8
+ version: "0.7.0",
9
+ }), accountAddress, factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(chain, version), salt: salt_ = 0n, owners = [], }) {
12
10
  const client = createBundlerClient({
13
11
  transport,
14
12
  chain,
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAK/F,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,GAGvB,MAAM,WAAW,CAAC;AA6EnB,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,KAAK,EACL,MAAM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Client,\n getAccountAddress,\n getEntryPoint,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerLightAccountAbi } from \"../abis/MultiOwnerLightAccountAbi.js\";\nimport { MultiOwnerLightAccountFactoryAbi } from \"../abis/MultiOwnerLightAccountFactoryAbi.js\";\nimport type {\n GetEntryPointForLightAccountVersion,\n GetLightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n defaultLightAccountVersion,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type MultiOwnerLightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = LightAccountBase<\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n> & {\n encodeUpdateOwners: (\n ownersToAdd: Address[],\n ownersToRemove: Address[]\n ) => Hex;\n getOwnerAddresses: () => Promise<readonly Address[]>;\n};\n\nexport type CreateMultiOwnerLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = Omit<\n CreateLightAccountBaseParams<\n TTransport,\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n >,\n \"getAccountInitCode\" | \"entryPoint\" | \"version\" | \"abi\" | \"accountAddress\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;\n owners?: Address[];\n};\n\nexport async function createMultiOwnerLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n>(\n config: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion,\n TEntryPointVersion\n >\n): Promise<\n MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>\n>;\n\nexport async function createMultiOwnerLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(\"MultiOwnerLightAccount\"),\n entryPoint = getEntryPoint(chain, {\n version:\n AccountVersionRegistry[\"MultiOwnerLightAccount\"][version]\n .entryPointVersion,\n }),\n accountAddress,\n factoryAddress = AccountVersionRegistry[\"MultiOwnerLightAccount\"][version]\n .address[chain.id].factory,\n salt: salt_ = 0n,\n owners = [],\n}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerLightAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [owners_, salt_],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n Transport,\n SmartAccountSigner,\n \"MultiOwnerLightAccount\"\n >({\n transport,\n chain,\n signer,\n abi: MultiOwnerLightAccountAbi,\n version: AccountVersionRegistry[\"MultiOwnerLightAccount\"][version],\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => {\n return encodeFunctionData({\n abi: MultiOwnerLightAccountAbi,\n functionName: \"updateOwners\",\n args: [ownersToAdd, ownersToRemove],\n });\n },\n async getOwnerAddresses(): Promise<readonly Address[]> {\n const callResult = await client.readContract({\n address,\n abi: MultiOwnerLightAccountAbi,\n functionName: \"owners\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owners\");\n }\n\n if (!callResult.includes(await signer.getAddress())) {\n throw new Error(\"on-chain owners does not include the current signer\");\n }\n\n return callResult;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAK/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E,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerLightAccountAbi } from \"../abis/MultiOwnerLightAccountAbi.js\";\nimport { MultiOwnerLightAccountFactoryAbi } from \"../abis/MultiOwnerLightAccountFactoryAbi.js\";\nimport type {\n GetEntryPointForLightAccountVersion,\n GetLightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n defaultLightAccountVersion,\n getDefaultMultiOwnerLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type MultiOwnerLightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = LightAccountBase<\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n> & {\n encodeUpdateOwners: (\n ownersToAdd: Address[],\n ownersToRemove: Address[]\n ) => Hex;\n getOwnerAddresses: () => Promise<readonly Address[]>;\n};\n\nexport type CreateMultiOwnerLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = Omit<\n CreateLightAccountBaseParams<\n TTransport,\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n >,\n \"getAccountInitCode\" | \"entryPoint\" | \"version\" | \"abi\" | \"accountAddress\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;\n owners?: Address[];\n};\n\nexport async function createMultiOwnerLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n>(\n config: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion,\n TEntryPointVersion\n >\n): Promise<\n MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>\n>;\n\n/**\n * Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccount } 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 createMultiOwnerLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountParams} config The parameters for creating a multi-owner light account\n * @returns {Promise<MultiOwnerLightAccount>} A promise that resolves to a `MultiOwnerLightAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(\"MultiOwnerLightAccount\"),\n entryPoint = getEntryPoint(chain, {\n version: \"0.7.0\",\n }),\n accountAddress,\n factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(\n chain,\n version\n ),\n salt: salt_ = 0n,\n owners = [],\n}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerLightAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [owners_, salt_],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n Transport,\n SmartAccountSigner,\n \"MultiOwnerLightAccount\"\n >({\n transport,\n chain,\n signer,\n abi: MultiOwnerLightAccountAbi,\n version: AccountVersionRegistry[\"MultiOwnerLightAccount\"][version],\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => {\n return encodeFunctionData({\n abi: MultiOwnerLightAccountAbi,\n functionName: \"updateOwners\",\n args: [ownersToAdd, ownersToRemove],\n });\n },\n async getOwnerAddresses(): Promise<readonly Address[]> {\n const callResult = await client.readContract({\n address,\n abi: MultiOwnerLightAccountAbi,\n functionName: \"owners\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owners\");\n }\n\n if (!callResult.includes(await signer.getAddress())) {\n throw new Error(\"on-chain owners does not include the current signer\");\n }\n\n return callResult;\n },\n };\n}\n"]}
@@ -5,4 +5,4 @@ export type TransferLightAccountOwnershipParams<TSigner extends SmartAccountSign
5
5
  newOwner: TSigner;
6
6
  waitForTxn?: boolean;
7
7
  } & GetAccountParameter<TAccount, LightAccount<TSigner>> & UserOperationOverridesParameter<TEntryPointVersion>;
8
- export declare const transferOwnership: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner = SmartAccountSigner, TAccount extends LightAccount<TSigner> | undefined = LightAccount<TSigner> | undefined>(client: Client<TTransport, TChain, TAccount>, args: TransferLightAccountOwnershipParams<TSigner, TAccount>) => Promise<Hex>;
8
+ export declare const transferOwnership: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TSigner extends SmartAccountSigner<any> = SmartAccountSigner<any>, TAccount extends LightAccount<TSigner> | undefined = LightAccount<TSigner> | undefined>(client: Client<TTransport, TChain, TAccount>, args: TransferLightAccountOwnershipParams<TSigner, TAccount, GetEntryPointFromAccount<TAccount, import("@aa-sdk/core").SmartContractAccount<string, keyof import("@aa-sdk/core").EntryPointRegistryBase<unknown>>>>) => Promise<Hex>;
@@ -1,5 +1,6 @@
1
1
  import { AccountNotFoundError, IncompatibleClientError, isSmartAccountClient, } from "@aa-sdk/core";
2
- export const transferOwnership = async (client, { newOwner, waitForTxn, overrides, account = client.account }) => {
2
+ export const transferOwnership = async (client, args) => {
3
+ const { newOwner, waitForTxn, overrides, account = client.account } = args;
3
4
  if (!account) {
4
5
  throw new AccountNotFoundError();
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transferOwnership.js","sourceRoot":"","sources":["../../../../../src/light-account/actions/transferOwnership.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAKrB,MAAM,cAAc,CAAC;AAgBtB,MAAM,CAAC,MAAM,iBAAiB,GAUV,KAAK,EACvB,MAAM,EACN,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAC7D,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAE1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QAC5C,EAAE,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,IAAI;SACL;QACD,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetEntryPointFromAccount,\n type SmartAccountSigner,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\n\nexport type TransferLightAccountOwnershipParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n newOwner: TSigner;\n waitForTxn?: boolean;\n} & GetAccountParameter<TAccount, LightAccount<TSigner>> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n\nexport const transferOwnership: <\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 args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n) => Promise<Hex> = async (\n client,\n { newOwner, waitForTxn, overrides, account = client.account }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"transferOwnership\",\n client\n );\n }\n\n const data = account.encodeTransferOwnership(await newOwner.getAddress());\n\n const result = await client.sendUserOperation({\n uo: {\n target: account.address,\n data,\n },\n account,\n overrides,\n });\n\n if (waitForTxn) {\n return client.waitForUserOperationTransaction(result);\n }\n\n return result.hash;\n};\n"]}
1
+ {"version":3,"file":"transferOwnership.js","sourceRoot":"","sources":["../../../../../src/light-account/actions/transferOwnership.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAKrB,MAAM,cAAc,CAAC;AAyCtB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAQpC,MAA4C,EAC5C,IAA4D,EAC9C,EAAE;IAChB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC3E,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAE1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QAC5C,EAAE,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,IAAI;SACL;QACD,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetEntryPointFromAccount,\n type SmartAccountSigner,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\n\nexport type TransferLightAccountOwnershipParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n newOwner: TSigner;\n waitForTxn?: boolean;\n} & GetAccountParameter<TAccount, LightAccount<TSigner>> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n\n/**\n * Transfers the ownership of a light account to a new owner.\n * This function ensures that the client is a compatible smart acccount client and that a Light Account is provided.\n * If the waitForTxn parameter is true, it will wait for the transaction to be completed before returning.\n *\n * @example\n * ```ts\n * import { transferOwnership, createLightAccountClient } from \"@account-kit/smart-contracts\";\n *\n * const lightAccountClient = createLightAccountClient({\n * signer,\n * transport,\n * chain,\n * });\n *\n * const txHash = await transferOwnership(lightAccountClient, {\n * newOwner: newOwnerSigner,\n * waitForTxn: true, // set to false to return a uoHash instead\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The smart account client instance used to execute the transfer\n * @param {TransferLightAccountOwnershipParams<TSigner, TAccount>} args The parameters for transferring ownership\n * @returns {Promise<Hex>} The transaction or UO hash as a Hex string\n */\nexport const transferOwnership = async <\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 args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n): Promise<Hex> => {\n const { newOwner, waitForTxn, overrides, account = client.account } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"transferOwnership\",\n client\n );\n }\n\n const data = account.encodeTransferOwnership(await newOwner.getAddress());\n\n const result = await client.sendUserOperation({\n uo: {\n target: account.address,\n data,\n },\n account,\n overrides,\n });\n\n if (waitForTxn) {\n return client.waitForUserOperationTransaction(result);\n }\n\n return result.hash;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateOwners.js","sourceRoot":"","sources":["../../../../../src/light-account/actions/updateOwners.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAKrB,MAAM,cAAc,CAAC;AAiBtB,MAAM,CAAC,MAAM,YAAY,GAUL,KAAK,EACvB,MAAM,EACN,EACE,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,OAAO,GAAG,MAAM,CAAC,OAAO,GACzB,EACD,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,cAAc,EACd,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QAC5C,EAAE,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,IAAI;SACL;QACD,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetEntryPointFromAccount,\n type SmartAccountSigner,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\n\nexport type UpdateMultiOwnerLightAccountOwnersParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n ownersToAdd: Address[];\n ownersToRemove: Address[];\n waitForTxn?: boolean;\n} & GetAccountParameter<TAccount, MultiOwnerLightAccount<TSigner>> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n\nexport const updateOwners: <\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 args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n) => Promise<Hex> = async (\n client,\n {\n ownersToAdd,\n ownersToRemove,\n waitForTxn,\n overrides,\n account = client.account,\n }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"updateOwners\",\n client\n );\n }\n\n const data = account.encodeUpdateOwners(ownersToAdd, ownersToRemove);\n\n const result = await client.sendUserOperation({\n uo: {\n target: account.address,\n data,\n },\n account,\n overrides,\n });\n\n if (waitForTxn) {\n return client.waitForUserOperationTransaction(result);\n }\n\n return result.hash;\n};\n"]}
1
+ {"version":3,"file":"updateOwners.js","sourceRoot":"","sources":["../../../../../src/light-account/actions/updateOwners.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAKrB,MAAM,cAAc,CAAC;AAyCtB,MAAM,CAAC,MAAM,YAAY,GAUL,KAAK,EACvB,MAAM,EACN,EACE,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,OAAO,GAAG,MAAM,CAAC,OAAO,GACzB,EACD,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,cAAc,EACd,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;QAC5C,EAAE,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,IAAI;SACL;QACD,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetEntryPointFromAccount,\n type SmartAccountSigner,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\n\nexport type UpdateMultiOwnerLightAccountOwnersParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n ownersToAdd: Address[];\n ownersToRemove: Address[];\n waitForTxn?: boolean;\n} & GetAccountParameter<TAccount, MultiOwnerLightAccount<TSigner>> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n\n/**\n * Updates the owners of a multi-owner light account. This includes adding new owners and removing existing ones.\n *\n * @example\n * ```ts\n * import { updateOwners, createLightAccountClient } from \"@account-kit/smart-contracts\";\n *\n * const lightAccountClient = createLightAccountClient({\n * signer,\n * transport,\n * chain,\n * });\n *\n * const txHash = await updateOwners(lightAccountClient, {\n * ownerstoAdd: [newOwnerAddress], // or empty if you just want to remove owners\n * ownersToRemove: [oldOwnerAddress], // or empty if you just want to add owners\n * waitForTxn: true, // set to false to return a uoHash instead\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance used to interact with the account\n * @param {UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>} args The parameters for updating the account owners\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash or the full transaction result if `waitForTxn` is `true`\n */\nexport const updateOwners: <\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 args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n) => Promise<Hex> = async (\n client,\n {\n ownersToAdd,\n ownersToRemove,\n waitForTxn,\n overrides,\n account = client.account,\n }\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"updateOwners\",\n client\n );\n }\n\n const data = account.encodeUpdateOwners(ownersToAdd, ownersToRemove);\n\n const result = await client.sendUserOperation({\n uo: {\n target: account.address,\n data,\n },\n account,\n overrides,\n });\n\n if (waitForTxn) {\n return client.waitForUserOperationTransaction(result);\n }\n\n return result.hash;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAI1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AA0BhF,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,MAAuC;IAEvC,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,kBAAkB,CAAC;QACvC,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,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createLightAccount,\n lightAccountClientActions,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\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 AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\nexport async function createLightAccountAlchemyClient(\n config: AlchemyLightAccountClientConfig\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 createLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(lightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAI1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AA8ChF,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,MAAuC;IAEvC,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,kBAAkB,CAAC;QACvC,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,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createLightAccount,\n lightAccountClientActions,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\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 AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates an Alchemy smart account client connected to a Light Account instance.\n *\n * @example\n * ```ts\n * import { createLightAccountAlchemyClient } 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 createLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client\n */\nexport async function createLightAccountAlchemyClient(\n config: AlchemyLightAccountClientConfig\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 createLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(lightAccountClientActions);\n}\n"]}
@@ -2,7 +2,8 @@ import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import {} from "viem";
3
3
  import { createLightAccount, } from "../accounts/account.js";
4
4
  import { lightAccountClientActions, } from "../decorators/lightAccount.js";
5
- export async function createLightAccountClient({ account, transport, chain, ...clientConfig }) {
5
+ export async function createLightAccountClient(params) {
6
+ const { account, transport, chain, ...clientConfig } = params;
6
7
  const lightAccount = await createLightAccount({
7
8
  ...account,
8
9
  transport,
@@ -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;AAiCvC,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAC7C,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EACgB;IAC/B,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\nexport async function createLightAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateLightAccountClientParams): Promise<SmartAccountClient> {\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;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 +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;AA8BhF,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\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":"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"]}
@@ -2,7 +2,8 @@ import { createSmartAccountClient, } from "@aa-sdk/core";
2
2
  import {} from "viem";
3
3
  import { createMultiOwnerLightAccount, } from "../accounts/multiOwner.js";
4
4
  import { multiOwnerLightAccountClientActions, } from "../decorators/multiOwnerLightAccount.js";
5
- export async function createMultiOwnerLightAccountClient({ account, transport, chain, ...clientConfig }) {
5
+ export async function createMultiOwnerLightAccountClient(params) {
6
+ const { account, transport, chain, ...clientConfig } = params;
6
7
  const lightAccount = await createMultiOwnerLightAccount({
7
8
  ...account,
8
9
  transport,
@@ -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;AAuCjD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,EACvD,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EAC0B;IACzC,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\nexport async function createMultiOwnerLightAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultiOwnerLightAccountClientParams): Promise<SmartAccountClient> {\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;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 +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;AAazC,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\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/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 +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;AAapC,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\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/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,10 +1,11 @@
1
1
  import { type Address, type Chain } from "viem";
2
2
  import type { LightAccountBase } from "./accounts/base";
3
- import type { AccountVersionDef, GetLightAccountType, GetLightAccountVersion, IAccountVersionRegistry, LightAccountVersion, LightAccountVersionDef } from "./types";
3
+ import type { AccountVersionDef, GetLightAccountType, GetLightAccountVersion, IAccountVersionRegistry, LightAccountVersionDef } from "./types";
4
4
  export declare const supportedChains: Chain[];
5
5
  export declare const AccountVersionRegistry: IAccountVersionRegistry;
6
6
  export declare const defaultLightAccountVersion: <TLightAccountType extends keyof IAccountVersionRegistry>(type: TLightAccountType) => keyof IAccountVersionRegistry[TLightAccountType];
7
- export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version?: LightAccountVersion) => Address;
7
+ export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"LightAccount">) => Address;
8
+ export declare const getDefaultMultiOwnerLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"MultiOwnerLightAccount">) => `0x${string}`;
8
9
  export declare const LightAccountUnsupported1271Impls: (AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0"> | AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">)[];
9
10
  export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
10
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>>;
@@ -75,12 +75,20 @@ export const AccountVersionRegistry = {
75
75
  export const defaultLightAccountVersion = (type) => (type === "LightAccount"
76
76
  ? "v1.1.0"
77
77
  : "v2.0.0");
78
- export const getDefaultLightAccountFactoryAddress = (chain, version = "v1.1.0") => {
79
- const address = AccountVersionRegistry.LightAccount[version].address[chain.id];
78
+ export const getDefaultLightAccountFactoryAddress = (chain, version) => {
79
+ const address = AccountVersionRegistry.LightAccount[version].address[chain.id] ??
80
+ AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
80
81
  if (!address)
81
82
  throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
82
83
  return address.factory;
83
84
  };
85
+ 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;
91
+ };
84
92
  export const LightAccountUnsupported1271Impls = [
85
93
  AccountVersionRegistry.LightAccount["v1.0.1"],
86
94
  AccountVersionRegistry.LightAccount["v1.0.2"],
@@ -95,7 +103,7 @@ export async function getLightAccountVersionDef(account, chain) {
95
103
  const [version, def] = pair;
96
104
  return chain.id in def.address
97
105
  ? [def.address[chain.id].impl, version]
98
- : [null, version];
106
+ : [def.address[supportedChains[0].id].impl, version];
99
107
  })
100
108
  .filter(([impl]) => impl !== null));
101
109
  const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
@@ -103,7 +111,7 @@ export async function getLightAccountVersionDef(account, chain) {
103
111
  const [version, def] = pair;
104
112
  return chain.id in def.address
105
113
  ? [def.address[chain.id].factory, version]
106
- : [null, version];
114
+ : [def.address[supportedChains[0].id].factory, version];
107
115
  })
108
116
  .filter(([impl]) => impl !== null));
109
117
  const version = fromHex(implAddress, "bigint") === 0n
@@ -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,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAA4B,MAAM,MAAM,CAAC;AAiBzD,MAAM,CAAC,MAAM,eAAe,GAAY;IACtC,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,aAAa;IACb,QAAQ;IACR,cAAc;IACd,eAAe;IACf,QAAQ;IACR,cAAc;IACd,eAAe;IACf,IAAI;IACJ,UAAU;IACV,WAAW;IACX,OAAO;IACP,cAAc;IACd,IAAI;IACJ,WAAW;CACZ,CAAC;AAOF,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,QAAQ,CACf,eAAe,EACf,IAAI,EACJ,GAAG,EAAE,CA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,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: LightAccountVersion = \"v1.1.0\"\n): Address => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\"LightAccount\", chain, \"0.6.0\");\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 *\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 *\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 : [null, 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 : [null, 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":"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,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAA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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"]}
@@ -4,7 +4,8 @@ import { MultiOwnerModularAccountFactoryAbi } from "../abis/MultiOwnerModularAcc
4
4
  import { multiOwnerMessageSigner } from "../plugins/multi-owner/signer.js";
5
5
  import { getDefaultMultiOwnerModularAccountFactoryAddress } from "../utils.js";
6
6
  import { standardExecutor } from "./standardExecutor.js";
7
- export async function createMultiOwnerModularAccount({ transport, chain, signer, accountAddress, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain), owners = [], salt = 0n, }) {
7
+ export async function createMultiOwnerModularAccount(config) {
8
+ const { transport, chain, signer, accountAddress, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain), owners = [], salt = 0n, } = config;
8
9
  const client = createBundlerClient({
9
10
  transport,
10
11
  chain,
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multiOwnerAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gDAAgD,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,gBAAg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CAAC,IAAI,EAAE,OAAO,CAAC;aACtB,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,MAAM,iBAAiB,CAAC;QAC9C,MAAM;QACN,UAAU;QACV,cAAc;QACd,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC/C,SAAS;QACT,KAAK;QACL,UAAU;QACV,cAAc,EAAE,eAAe;QAC/B,MAAM,EAAE,0BAA0B;QAClC,kBAAkB;QAClB,GAAG,gBAAgB;QACnB,GAAG,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;KAClE,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,WAAW;QACd,SAAS,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;QACpC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EntryPointParameter,\n SmartAccountSigner,\n SmartContractAccountWithSigner,\n ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"../abis/MultiOwnerModularAccountFactory.js\";\nimport { multiOwnerMessageSigner } from \"../plugins/multi-owner/signer.js\";\nimport { getDefaultMultiOwnerModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport type MultiOwnerModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n \"MultiOwnerModularAccount\",\n TSigner,\n \"0.6.0\"\n>;\n\n// [!region CreateMultiOwnerModularAccountParams]\nexport type CreateMultiOwnerModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultiOwnerModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n// [!endregion CreateMultiOwnerModularAccountParams]\n\nexport async function createMultiOwnerModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultiOwnerModularAccountParams<TTransport, TSigner>\n): Promise<MultiOwnerModularAccount<TSigner>>;\n\nexport async function createMultiOwnerModularAccount({\n transport,\n chain,\n signer,\n accountAddress,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n}: CreateMultiOwnerModularAccountParams): Promise<MultiOwnerModularAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, owners_],\n }),\n ]);\n };\n\n const _accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress: _accountAddress,\n source: `MultiOwnerModularAccount`,\n getAccountInitCode,\n ...standardExecutor,\n ...multiOwnerMessageSigner(client, _accountAddress, () => signer),\n });\n\n return {\n ...baseAccount,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n"]}
1
+ {"version":3,"file":"multiOwnerAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multiOwnerAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gDAAgD,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA6DzD,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAA4C;IAE5C,MAAM,EACJ,SAAS,EACT,KAAK,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,UAAU,GAAG,aAAa,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACvD,cAAc,GAAG,gDAAgD,CAAC,KAAK,CAAC,EACxE,MAAM,GAAG,EAAE,EACX,IAAI,GAAG,EAAE,GACV,GAAG,MAAM,CAAC;IAEX,MAAM,MAAM,GAAG,mBAAmB,CAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAGD,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,C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E,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EntryPointParameter,\n SmartAccountSigner,\n SmartContractAccountWithSigner,\n ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"../abis/MultiOwnerModularAccountFactory.js\";\nimport { multiOwnerMessageSigner } from \"../plugins/multi-owner/signer.js\";\nimport { getDefaultMultiOwnerModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport type MultiOwnerModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n \"MultiOwnerModularAccount\",\n TSigner,\n \"0.6.0\"\n>;\n\n// [!region CreateMultiOwnerModularAccountParams]\nexport type CreateMultiOwnerModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultiOwnerModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n// [!endregion CreateMultiOwnerModularAccountParams]\n\nexport async function createMultiOwnerModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultiOwnerModularAccountParams<TTransport, TSigner>\n): Promise<MultiOwnerModularAccount<TSigner>>;\n\n/**\n * Creates a multi-owner modular account with the given parameters, including transport, chain, signer, account address, initialization code, entry point, factory address, owners, and salt.\n * Ensures that the owners are unique, ordered, and non-zero.\n *\n * @example\n * ```ts\n * import { createMultiOwnerModularAccount } 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 createMultiOwnerModularAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerModularAccountParams} config Configuration parameters for creating a multi-owner modular account\n * @returns {Promise<MultiOwnerModularAccount>} A promise that resolves to a `MultiOwnerModularAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerModularAccount(\n config: CreateMultiOwnerModularAccountParams\n): Promise<MultiOwnerModularAccount> {\n const {\n transport,\n chain,\n signer,\n accountAddress,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n } = config;\n\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, owners_],\n }),\n ]);\n };\n\n const _accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress: _accountAddress,\n source: `MultiOwnerModularAccount`,\n getAccountInitCode,\n ...standardExecutor,\n ...multiOwnerMessageSigner(client, _accountAddress, () => signer),\n });\n\n return {\n ...baseAccount,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n"]}
@@ -5,7 +5,8 @@ import { multisigSignMethods } from "../plugins/multisig/signer.js";
5
5
  import { getDefaultMultisigModularAccountFactoryAddress } from "../utils.js";
6
6
  import { standardExecutor } from "./standardExecutor.js";
7
7
  export const MULTISIG_ACCOUNT_SOURCE = "MultisigModularAccount";
8
- export async function createMultisigModularAccount({ transport, chain, signer, accountAddress, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain), owners = [], salt = 0n, threshold, }) {
8
+ export async function createMultisigModularAccount(config) {
9
+ const { transport, chain, signer, accountAddress: accountAddress_, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain), owners = [], salt = 0n, threshold, } = config;
9
10
  const client = createBundlerClient({
10
11
  transport,
11
12
  chain,
@@ -31,10 +32,10 @@ export async function createMultisigModularAccount({ transport, chain, signer, a
31
32
  }),
32
33
  ]);
33
34
  };
34
- accountAddress = await getAccountAddress({
35
+ const accountAddress = await getAccountAddress({
35
36
  client,
36
37
  entryPoint,
37
- accountAddress: accountAddress,
38
+ accountAddress: accountAddress_,
38
39
  getAccountInitCode,
39
40
  });
40
41
  const baseAccount = await toSmartContractAccount({
@@ -1 +1 @@
1
- {"version":3,"file":"multisigAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multisigAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GAOvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAIZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gCAAgC,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GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEL,OAAO,SAAS,CAAC;YACf,cAAc;YACd,kBAAkB,CAAC;gBACjB,GAAG,EAAE,gCAAgC;gBACrC,YAAY,EAAE,eAAe;gBAC7B,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC;aAC/B,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,cAAc,GAAG,MAAM,iBAAiB,CAAC;QACvC,MAAM;QACN,UAAU;QACV,cAAc,EAAE,cAAc;QAC9B,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC/C,SAAS;QACT,KAAK;QACL,UAAU;QACV,cAAc;QACd,MAAM,EAAE,uBAAuB;QAC/B,kBAAkB;QAClB,GAAG,gBAAgB;QACnB,GAAG,mBAAmB,CAAC;YACrB,MAAM;YACN,cAAc;YACd,SAAS;YACT,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;SACrB,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,WAAW;QACd,iBAAiB,EAAE,GAAG,EAAE,CAAC,SAAS;QAClC,SAAS,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;QACpC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,IAA0B,EACM,EAAE;IAClC,OAAO,IAAI,CAAC,MAAM,KAAK,uBAAuB,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n type Address,\n type EntryPointParameter,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultisigModularAccountFactoryAbi } from \"../abis/MultisigModularAccountFactory.js\";\nimport { multisigSignMethods } from \"../plugins/multisig/signer.js\";\nimport { getDefaultMultisigModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport const MULTISIG_ACCOUNT_SOURCE = \"MultisigModularAccount\";\n\nexport type MultisigModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n typeof MULTISIG_ACCOUNT_SOURCE,\n TSigner,\n \"0.6.0\"\n> & {\n getLocalThreshold: () => bigint;\n};\n\nexport type CreateMultisigModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultisigModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n threshold: bigint;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createMultisigModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultisigModularAccountParams<TTransport, TSigner>\n): Promise<MultisigModularAccount<TSigner>>;\n\nexport async function createMultisigModularAccount({\n transport,\n chain,\n signer,\n accountAddress,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n threshold,\n}: CreateMultisigModularAccountParams): Promise<MultisigModularAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the sigs as well\n const sigAddress = await signer.getAddress();\n // sigs need to be deduped + ordered in ascending order and !== to zero address\n const sigs_ = Array.from(new Set([...owners, sigAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultisigModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, sigs_, threshold],\n }),\n ]);\n };\n\n accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress: accountAddress,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: MULTISIG_ACCOUNT_SOURCE,\n getAccountInitCode,\n ...standardExecutor,\n ...multisigSignMethods({\n client,\n accountAddress,\n threshold,\n signer: () => signer,\n }),\n });\n\n return {\n ...baseAccount,\n getLocalThreshold: () => threshold,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n\nexport const isMultisigModularAccount = (\n acct: SmartContractAccount\n): acct is MultisigModularAccount => {\n return acct.source === MULTISIG_ACCOUNT_SOURCE;\n};\n"]}
1
+ {"version":3,"file":"multisigAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multisigAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GAOvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAIZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,8CAA8C,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,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BACjB,GAAG,EAAE,gCAAgC;gBACrC,YAAY,EAAE,eAAe;gBAC7B,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC;aAC/B,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC;QAC7C,MAAM;QACN,UAAU;QACV,cAAc,EAAE,eAAe;QAC/B,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC/C,SAAS;QACT,KAAK;QACL,UAAU;QACV,cAAc;QACd,MAAM,EAAE,uBAAuB;QAC/B,kBAAkB;QAClB,GAAG,gBAAgB;QACnB,GAAG,mBAAmB,CAAC;YACrB,MAAM;YACN,cAAc;YACd,SAAS;YACT,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;SACrB,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,WAAW;QACd,iBAAiB,EAAE,GAAG,EAAE,CAAC,SAAS;QAClC,SAAS,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;QACpC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,IAA0B,EACM,EAAE;IAClC,OAAO,IAAI,CAAC,MAAM,KAAK,uBAAuB,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n type Address,\n type EntryPointParameter,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultisigModularAccountFactoryAbi } from \"../abis/MultisigModularAccountFactory.js\";\nimport { multisigSignMethods } from \"../plugins/multisig/signer.js\";\nimport { getDefaultMultisigModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport const MULTISIG_ACCOUNT_SOURCE = \"MultisigModularAccount\";\n\nexport type MultisigModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n typeof MULTISIG_ACCOUNT_SOURCE,\n TSigner,\n \"0.6.0\"\n> & {\n getLocalThreshold: () => bigint;\n};\n\nexport type CreateMultisigModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultisigModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n threshold: bigint;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createMultisigModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultisigModularAccountParams<TTransport, TSigner>\n): Promise<MultisigModularAccount<TSigner>>;\n\n/**\n * Creates a multisig modular account using the provided parameters, including transport, chain, signer, account address, and other account settings. It configures the account with multiple owners and the specified threshold.\n *\n * @example\n * ```ts\n * import { createMultisigModularAccount } 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 createMultisigModularAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * });\n * ```\n *\n * @param {CreateMultisigModularAccountParams} config The parameters for creating a multisig modular account.\n * @returns {Promise<MultisigModularAccount>} A promise that resolves to a `MultisigModularAccount` object containing the created account information and methods.\n */\nexport async function createMultisigModularAccount(\n config: CreateMultisigModularAccountParams\n): Promise<MultisigModularAccount> {\n const {\n transport,\n chain,\n signer,\n accountAddress: accountAddress_,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n threshold,\n } = config;\n\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the sigs as well\n const sigAddress = await signer.getAddress();\n // sigs need to be deduped + ordered in ascending order and !== to zero address\n const sigs_ = Array.from(new Set([...owners, sigAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultisigModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, sigs_, threshold],\n }),\n ]);\n };\n\n const accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress: accountAddress_,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: MULTISIG_ACCOUNT_SOURCE,\n getAccountInitCode,\n ...standardExecutor,\n ...multisigSignMethods({\n client,\n accountAddress,\n threshold,\n signer: () => signer,\n }),\n });\n\n return {\n ...baseAccount,\n getLocalThreshold: () => threshold,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n\nexport const isMultisigModularAccount = (\n acct: SmartContractAccount\n): acct is MultisigModularAccount => {\n return acct.source === MULTISIG_ACCOUNT_SOURCE;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/account-loupe/decorator.ts"],"names":[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;SACjB,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE;QACtE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,CACP,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,YAAY,CAAC;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,uBAAuB;YACrC,IAAI,EAAE,CAAC,QAAQ,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,EAAE,KAAK,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,CACP,CAAC;QACJ,CAAC;QAED,OAAO,MAAM;aACV,YAAY,CAAC;YACZ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,qBAAqB;SACpC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Client, Hash, Transport } from \"viem\";\nimport { IAccountLoupeAbi } from \"../abis/IAccountLoupe.js\";\nimport type {\n ExecutionFunctionConfig,\n ExecutionHooks,\n FunctionReference,\n PreValidationHooks,\n} from \"./types.js\";\n\nexport type AccountLoupeActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n /// @notice Gets the validation functions and plugin address for a selector\n /// @dev If the selector is a native function, the plugin address will be the address of the account\n /// @param selector The selector to get the configuration for\n /// @return The configuration for this selector\n getExecutionFunctionConfig(\n args: { selector: FunctionReference } & GetAccountParameter<TAccount>\n ): Promise<ExecutionFunctionConfig>;\n\n /// @notice Gets the pre and post execution hooks for a selector\n /// @param selector The selector to get the hooks for\n /// @return The pre and post execution hooks for this selector\n getExecutionHooks(\n args: {\n selector: FunctionReference;\n } & GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<ExecutionHooks>>;\n\n /// @notice Gets the pre user op and runtime validation hooks associated with a selector\n /// @param selector The selector to get the hooks for\n /// @return preUserOpValidationHooks The pre user op validation hooks for this selector\n /// @return preRuntimeValidationHooks The pre runtime validation hooks for this selector\n getPreValidationHooks(\n args: { selector: Hash } & GetAccountParameter<TAccount>\n ): Promise<Readonly<PreValidationHooks>>;\n\n /// @notice Gets an array of all installed plugins\n /// @return The addresses of all installed plugins\n getInstalledPlugins(\n args: GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<Address>>;\n};\n\nexport const accountLoupeActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AccountLoupeActions<TAccount> = (client) => ({\n getExecutionFunctionConfig: async ({\n selector,\n account = client.account,\n }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionFunctionConfig\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionFunctionConfig\",\n args: [selector],\n });\n },\n\n getExecutionHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionHooks\",\n args: [selector],\n });\n },\n\n getPreValidationHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getPreValidationHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getPreValidationHooks\",\n args: [selector],\n });\n },\n\n getInstalledPlugins: async ({ account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getInstalledPlugins\",\n client\n );\n }\n\n return client\n .readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getInstalledPlugins\",\n })\n .catch(() => []);\n },\n});\n"]}
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/account-loupe/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAGrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AA4D5D,MAAM,CAAC,MAAM,mBAAmB,GAQK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChD,0BAA0B,EAAE,KAAK,EAAE,EACjC,QAAQ,EACR,OAAO,GAAG,MAAM,CAAC,OAAO,GACzB,EAAE,EAAE;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,oBA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AAM,CAAC,YAAY,CAAC;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,uBAAuB;YACrC,IAAI,EAAE,CAAC,QAAQ,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,EAAE,KAAK,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,CACP,CAAC;QACJ,CAAC;QAED,OAAO,MAAM;aACV,YAAY,CAAC;YACZ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,qBAAqB;SACpC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Client, Hash, Transport } from \"viem\";\nimport { IAccountLoupeAbi } from \"../abis/IAccountLoupe.js\";\nimport type {\n ExecutionFunctionConfig,\n ExecutionHooks,\n FunctionReference,\n PreValidationHooks,\n} from \"./types.js\";\n\nexport type AccountLoupeActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n /// @notice Gets the validation functions and plugin address for a selector\n /// @dev If the selector is a native function, the plugin address will be the address of the account\n /// @param selector The selector to get the configuration for\n /// @return The configuration for this selector\n getExecutionFunctionConfig(\n args: { selector: FunctionReference } & GetAccountParameter<TAccount>\n ): Promise<ExecutionFunctionConfig>;\n\n /// @notice Gets the pre and post execution hooks for a selector\n /// @param selector The selector to get the hooks for\n /// @return The pre and post execution hooks for this selector\n getExecutionHooks(\n args: {\n selector: FunctionReference;\n } & GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<ExecutionHooks>>;\n\n /// @notice Gets the pre user op and runtime validation hooks associated with a selector\n /// @param selector The selector to get the hooks for\n /// @return preUserOpValidationHooks The pre user op validation hooks for this selector\n /// @return preRuntimeValidationHooks The pre runtime validation hooks for this selector\n getPreValidationHooks(\n args: { selector: Hash } & GetAccountParameter<TAccount>\n ): Promise<Readonly<PreValidationHooks>>;\n\n /// @notice Gets an array of all installed plugins\n /// @return The addresses of all installed plugins\n getInstalledPlugins(\n args: GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<Address>>;\n};\n\n/**\n * Provides a set of actions for account loupe operations using the specified client.\n * NOTE: this is already added to the client when using any of the Modular Account Clients.\n *\n * @example\n * ```ts\n * import { accountLoupeActions } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...).extend(accountLoupeActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client to be used for executing the account loupe actions\n * @returns {AccountLoupeActions<TAccount>} an object containing account loupe actions like `getExecutionFunctionConfig`, `getExecutionHooks`, `getPreValidationHooks`, and `getInstalledPlugins`\n */\nexport const accountLoupeActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AccountLoupeActions<TAccount> = (client) => ({\n getExecutionFunctionConfig: async ({\n selector,\n account = client.account,\n }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionFunctionConfig\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionFunctionConfig\",\n args: [selector],\n });\n },\n\n getExecutionHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionHooks\",\n args: [selector],\n });\n },\n\n getPreValidationHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getPreValidationHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getPreValidationHooks\",\n args: [selector],\n });\n },\n\n getInstalledPlugins: async ({ account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getInstalledPlugins\",\n client\n );\n }\n\n return client\n .readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getInstalledPlugins\",\n })\n .catch(() => []);\n },\n});\n"]}
@@ -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;AA4Bd,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\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":"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"]}