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

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 (306) hide show
  1. package/dist/cjs/plugindefs/multi-owner/config.js +16 -17
  2. package/dist/cjs/plugindefs/multi-owner/config.js.map +1 -1
  3. package/dist/cjs/plugindefs/multisig/config.js +15 -15
  4. package/dist/cjs/plugindefs/multisig/config.js.map +1 -1
  5. package/dist/cjs/plugindefs/session-key/config.js +17 -17
  6. package/dist/cjs/plugindefs/session-key/config.js.map +1 -1
  7. package/dist/cjs/src/index.d.ts +4 -4
  8. package/dist/cjs/src/index.js +17 -17
  9. package/dist/cjs/src/index.js.map +1 -1
  10. package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
  11. package/dist/cjs/src/light-account/accounts/account.js +4 -3
  12. package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
  13. package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
  14. package/dist/cjs/src/light-account/accounts/base.js +8 -8
  15. package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
  16. package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
  17. package/dist/cjs/src/light-account/accounts/multiOwner.js +5 -6
  18. package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
  19. package/dist/cjs/src/light-account/actions/transferOwnership.d.ts +1 -1
  20. package/dist/cjs/src/light-account/actions/transferOwnership.js +2 -1
  21. package/dist/cjs/src/light-account/actions/transferOwnership.js.map +1 -1
  22. package/dist/cjs/src/light-account/actions/updateOwners.js.map +1 -1
  23. package/dist/cjs/src/light-account/clients/alchemyClient.d.ts +1 -1
  24. package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
  25. package/dist/cjs/src/light-account/clients/client.js +2 -1
  26. package/dist/cjs/src/light-account/clients/client.js.map +1 -1
  27. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  28. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  29. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js +2 -1
  30. package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  31. package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
  32. package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  33. package/dist/cjs/src/light-account/types.d.ts +23 -31
  34. package/dist/cjs/src/light-account/types.js.map +1 -1
  35. package/dist/cjs/src/light-account/utils.d.ts +7 -9
  36. package/dist/cjs/src/light-account/utils.js +63 -82
  37. package/dist/cjs/src/light-account/utils.js.map +1 -1
  38. package/dist/cjs/src/msca/account/multiOwnerAccount.js +2 -1
  39. package/dist/cjs/src/msca/account/multiOwnerAccount.js.map +1 -1
  40. package/dist/cjs/src/msca/account/multisigAccount.js +4 -3
  41. package/dist/cjs/src/msca/account/multisigAccount.js.map +1 -1
  42. package/dist/cjs/src/msca/account-loupe/decorator.js.map +1 -1
  43. package/dist/cjs/src/msca/client/alchemyClient.d.ts +1 -1
  44. package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
  45. package/dist/cjs/src/msca/client/client.js.map +1 -1
  46. package/dist/cjs/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  47. package/dist/cjs/src/msca/client/multiSigAlchemyClient.js +1 -1
  48. package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  49. package/dist/cjs/src/msca/errors.js.map +1 -1
  50. package/dist/cjs/src/msca/plugin-manager/decorator.d.ts +1 -1
  51. package/dist/cjs/src/msca/plugin-manager/decorator.js +6 -4
  52. package/dist/cjs/src/msca/plugin-manager/decorator.js.map +1 -1
  53. package/dist/cjs/src/msca/plugin-manager/installPlugin.js.map +1 -1
  54. package/dist/cjs/src/msca/plugins/multi-owner/extension.js.map +1 -1
  55. package/dist/cjs/src/msca/plugins/multi-owner/index.d.ts +1 -1
  56. package/dist/cjs/src/msca/plugins/multi-owner/index.js +2 -1
  57. package/dist/cjs/src/msca/plugins/multi-owner/index.js.map +1 -1
  58. package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js +2 -2
  59. package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
  60. package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
  61. package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
  62. package/dist/cjs/src/msca/plugins/multisig/extension.js.map +1 -1
  63. package/dist/cjs/src/msca/plugins/multisig/index.d.ts +1 -8
  64. package/dist/cjs/src/msca/plugins/multisig/index.js +1 -16
  65. package/dist/cjs/src/msca/plugins/multisig/index.js.map +1 -1
  66. package/dist/cjs/src/msca/plugins/multisig/middleware.d.ts +1 -1
  67. package/dist/cjs/src/msca/plugins/multisig/middleware.js +1 -1
  68. package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
  69. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
  70. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
  71. package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
  72. package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  73. package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
  74. package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
  75. package/dist/cjs/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  76. package/dist/cjs/src/msca/plugins/multisig/utils/index.js.map +1 -1
  77. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  78. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  79. package/dist/cjs/src/msca/plugins/session-key/extension.js.map +1 -1
  80. package/dist/cjs/src/msca/plugins/session-key/index.d.ts +1 -1
  81. package/dist/cjs/src/msca/plugins/session-key/index.js +3 -1
  82. package/dist/cjs/src/msca/plugins/session-key/index.js.map +1 -1
  83. package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
  84. package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
  85. package/dist/cjs/src/msca/plugins/session-key/utils.d.ts +4 -2
  86. package/dist/cjs/src/msca/plugins/session-key/utils.js +3 -2
  87. package/dist/cjs/src/msca/plugins/session-key/utils.js.map +1 -1
  88. package/dist/cjs/src/msca/utils.d.ts +6 -4
  89. package/dist/cjs/src/msca/utils.js +11 -10
  90. package/dist/cjs/src/msca/utils.js.map +1 -1
  91. package/dist/esm/plugindefs/multi-owner/config.js +1 -2
  92. package/dist/esm/plugindefs/multi-owner/config.js.map +1 -1
  93. package/dist/esm/plugindefs/multisig/config.js +1 -1
  94. package/dist/esm/plugindefs/multisig/config.js.map +1 -1
  95. package/dist/esm/plugindefs/session-key/config.js +1 -1
  96. package/dist/esm/plugindefs/session-key/config.js.map +1 -1
  97. package/dist/esm/src/index.d.ts +4 -4
  98. package/dist/esm/src/index.js +3 -3
  99. package/dist/esm/src/index.js.map +1 -1
  100. package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
  101. package/dist/esm/src/light-account/accounts/account.js +5 -4
  102. package/dist/esm/src/light-account/accounts/account.js.map +1 -1
  103. package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
  104. package/dist/esm/src/light-account/accounts/base.js +8 -8
  105. package/dist/esm/src/light-account/accounts/base.js.map +1 -1
  106. package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
  107. package/dist/esm/src/light-account/accounts/multiOwner.js +6 -7
  108. package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
  109. package/dist/esm/src/light-account/actions/transferOwnership.d.ts +1 -1
  110. package/dist/esm/src/light-account/actions/transferOwnership.js +2 -1
  111. package/dist/esm/src/light-account/actions/transferOwnership.js.map +1 -1
  112. package/dist/esm/src/light-account/actions/updateOwners.js.map +1 -1
  113. package/dist/esm/src/light-account/clients/alchemyClient.d.ts +1 -1
  114. package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
  115. package/dist/esm/src/light-account/clients/client.js +2 -1
  116. package/dist/esm/src/light-account/clients/client.js.map +1 -1
  117. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  118. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  119. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js +2 -1
  120. package/dist/esm/src/light-account/clients/multiOwnerLightAccount.js.map +1 -1
  121. package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
  122. package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
  123. package/dist/esm/src/light-account/types.d.ts +23 -31
  124. package/dist/esm/src/light-account/types.js.map +1 -1
  125. package/dist/esm/src/light-account/utils.d.ts +7 -9
  126. package/dist/esm/src/light-account/utils.js +60 -79
  127. package/dist/esm/src/light-account/utils.js.map +1 -1
  128. package/dist/esm/src/msca/account/multiOwnerAccount.js +2 -1
  129. package/dist/esm/src/msca/account/multiOwnerAccount.js.map +1 -1
  130. package/dist/esm/src/msca/account/multisigAccount.js +4 -3
  131. package/dist/esm/src/msca/account/multisigAccount.js.map +1 -1
  132. package/dist/esm/src/msca/account-loupe/decorator.js.map +1 -1
  133. package/dist/esm/src/msca/client/alchemyClient.d.ts +1 -1
  134. package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
  135. package/dist/esm/src/msca/client/client.js.map +1 -1
  136. package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  137. package/dist/esm/src/msca/client/multiSigAlchemyClient.js +1 -1
  138. package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
  139. package/dist/esm/src/msca/errors.js.map +1 -1
  140. package/dist/esm/src/msca/plugin-manager/decorator.d.ts +1 -1
  141. package/dist/esm/src/msca/plugin-manager/decorator.js +6 -4
  142. package/dist/esm/src/msca/plugin-manager/decorator.js.map +1 -1
  143. package/dist/esm/src/msca/plugin-manager/installPlugin.js.map +1 -1
  144. package/dist/esm/src/msca/plugins/multi-owner/extension.js.map +1 -1
  145. package/dist/esm/src/msca/plugins/multi-owner/index.d.ts +1 -1
  146. package/dist/esm/src/msca/plugins/multi-owner/index.js +1 -1
  147. package/dist/esm/src/msca/plugins/multi-owner/index.js.map +1 -1
  148. package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js +1 -1
  149. package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
  150. package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
  151. package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
  152. package/dist/esm/src/msca/plugins/multisig/extension.js.map +1 -1
  153. package/dist/esm/src/msca/plugins/multisig/index.d.ts +1 -8
  154. package/dist/esm/src/msca/plugins/multisig/index.js +0 -7
  155. package/dist/esm/src/msca/plugins/multisig/index.js.map +1 -1
  156. package/dist/esm/src/msca/plugins/multisig/middleware.d.ts +1 -1
  157. package/dist/esm/src/msca/plugins/multisig/middleware.js +2 -1
  158. package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
  159. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
  160. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
  161. package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
  162. package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  163. package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
  164. package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
  165. package/dist/esm/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  166. package/dist/esm/src/msca/plugins/multisig/utils/index.js.map +1 -1
  167. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  168. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  169. package/dist/esm/src/msca/plugins/session-key/extension.js.map +1 -1
  170. package/dist/esm/src/msca/plugins/session-key/index.d.ts +1 -1
  171. package/dist/esm/src/msca/plugins/session-key/index.js +1 -1
  172. package/dist/esm/src/msca/plugins/session-key/index.js.map +1 -1
  173. package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
  174. package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
  175. package/dist/esm/src/msca/plugins/session-key/utils.d.ts +4 -2
  176. package/dist/esm/src/msca/plugins/session-key/utils.js +3 -2
  177. package/dist/esm/src/msca/plugins/session-key/utils.js.map +1 -1
  178. package/dist/esm/src/msca/utils.d.ts +6 -4
  179. package/dist/esm/src/msca/utils.js +2 -1
  180. package/dist/esm/src/msca/utils.js.map +1 -1
  181. package/dist/types/plugindefs/multi-owner/config.d.ts.map +1 -1
  182. package/dist/types/src/index.d.ts +4 -4
  183. package/dist/types/src/index.d.ts.map +1 -1
  184. package/dist/types/src/light-account/accounts/account.d.ts +5 -6
  185. package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
  186. package/dist/types/src/light-account/accounts/base.d.ts +7 -6
  187. package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
  188. package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
  189. package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
  190. package/dist/types/src/light-account/actions/transferOwnership.d.ts +26 -1
  191. package/dist/types/src/light-account/actions/transferOwnership.d.ts.map +1 -1
  192. package/dist/types/src/light-account/actions/updateOwners.d.ts +24 -0
  193. package/dist/types/src/light-account/actions/updateOwners.d.ts.map +1 -1
  194. package/dist/types/src/light-account/clients/alchemyClient.d.ts +1 -1
  195. package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
  196. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +2 -2
  197. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
  198. package/dist/types/src/light-account/decorators/lightAccount.d.ts +19 -0
  199. package/dist/types/src/light-account/decorators/lightAccount.d.ts.map +1 -1
  200. package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +19 -0
  201. package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts.map +1 -1
  202. package/dist/types/src/light-account/types.d.ts +23 -118
  203. package/dist/types/src/light-account/types.d.ts.map +1 -1
  204. package/dist/types/src/light-account/utils.d.ts +22 -44
  205. package/dist/types/src/light-account/utils.d.ts.map +1 -1
  206. package/dist/types/src/msca/account/multisigAccount.d.ts.map +1 -1
  207. package/dist/types/src/msca/account-loupe/decorator.d.ts +15 -0
  208. package/dist/types/src/msca/account-loupe/decorator.d.ts.map +1 -1
  209. package/dist/types/src/msca/client/alchemyClient.d.ts +1 -1
  210. package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
  211. package/dist/types/src/msca/client/client.d.ts.map +1 -1
  212. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
  213. package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
  214. package/dist/types/src/msca/errors.d.ts +12 -0
  215. package/dist/types/src/msca/errors.d.ts.map +1 -1
  216. package/dist/types/src/msca/plugin-manager/decorator.d.ts +16 -1
  217. package/dist/types/src/msca/plugin-manager/decorator.d.ts.map +1 -1
  218. package/dist/types/src/msca/plugin-manager/installPlugin.d.ts +21 -0
  219. package/dist/types/src/msca/plugin-manager/installPlugin.d.ts.map +1 -1
  220. package/dist/types/src/msca/plugins/multi-owner/extension.d.ts +15 -0
  221. package/dist/types/src/msca/plugins/multi-owner/extension.d.ts.map +1 -1
  222. package/dist/types/src/msca/plugins/multi-owner/index.d.ts +1 -1
  223. package/dist/types/src/msca/plugins/multi-owner/index.d.ts.map +1 -1
  224. package/dist/types/src/msca/plugins/multisig/actions/proposeUserOperation.d.ts.map +1 -1
  225. package/dist/types/src/msca/plugins/multisig/actions/signMultisigUserOperation.d.ts.map +1 -1
  226. package/dist/types/src/msca/plugins/multisig/extension.d.ts +13 -0
  227. package/dist/types/src/msca/plugins/multisig/extension.d.ts.map +1 -1
  228. package/dist/types/src/msca/plugins/multisig/index.d.ts +1 -8
  229. package/dist/types/src/msca/plugins/multisig/index.d.ts.map +1 -1
  230. package/dist/types/src/msca/plugins/multisig/middleware.d.ts +7 -7
  231. package/dist/types/src/msca/plugins/multisig/middleware.d.ts.map +1 -1
  232. package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts +28 -2
  233. package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts.map +1 -1
  234. package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
  235. package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts +21 -2
  236. package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts.map +1 -1
  237. package/dist/types/src/msca/plugins/multisig/utils/index.d.ts +4 -0
  238. package/dist/types/src/msca/plugins/multisig/utils/index.d.ts.map +1 -1
  239. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
  240. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
  241. package/dist/types/src/msca/plugins/session-key/extension.d.ts +13 -0
  242. package/dist/types/src/msca/plugins/session-key/extension.d.ts.map +1 -1
  243. package/dist/types/src/msca/plugins/session-key/index.d.ts +1 -1
  244. package/dist/types/src/msca/plugins/session-key/index.d.ts.map +1 -1
  245. package/dist/types/src/msca/plugins/session-key/permissions.d.ts +150 -1
  246. package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
  247. package/dist/types/src/msca/plugins/session-key/signer.d.ts +72 -2
  248. package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
  249. package/dist/types/src/msca/plugins/session-key/utils.d.ts +22 -2
  250. package/dist/types/src/msca/plugins/session-key/utils.d.ts.map +1 -1
  251. package/dist/types/src/msca/utils.d.ts +48 -10
  252. package/dist/types/src/msca/utils.d.ts.map +1 -1
  253. package/package.json +7 -6
  254. package/plugindefs/multi-owner/config.ts +1 -2
  255. package/plugindefs/multisig/config.ts +1 -1
  256. package/plugindefs/session-key/config.ts +1 -1
  257. package/src/index.ts +3 -4
  258. package/src/light-account/accounts/account.ts +46 -48
  259. package/src/light-account/accounts/base.ts +39 -68
  260. package/src/light-account/accounts/multiOwner.ts +55 -48
  261. package/src/light-account/actions/transferOwnership.ts +28 -5
  262. package/src/light-account/actions/updateOwners.ts +24 -0
  263. package/src/light-account/clients/alchemyClient.ts +21 -1
  264. package/src/light-account/clients/client.ts +27 -6
  265. package/src/light-account/clients/multiOwnerAlchemyClient.ts +22 -2
  266. package/src/light-account/clients/multiOwnerLightAccount.ts +27 -6
  267. package/src/light-account/decorators/lightAccount.ts +19 -0
  268. package/src/light-account/decorators/multiOwnerLightAccount.ts +19 -0
  269. package/src/light-account/types.ts +31 -188
  270. package/src/light-account/utils.ts +99 -231
  271. package/src/msca/account/multiOwnerAccount.ts +36 -11
  272. package/src/msca/account/multisigAccount.ts +40 -14
  273. package/src/msca/account-loupe/decorator.ts +15 -0
  274. package/src/msca/client/alchemyClient.ts +21 -1
  275. package/src/msca/client/client.ts +46 -0
  276. package/src/msca/client/multiSigAlchemyClient.ts +26 -4
  277. package/src/msca/errors.ts +12 -0
  278. package/src/msca/plugin-manager/decorator.ts +22 -5
  279. package/src/msca/plugin-manager/installPlugin.ts +21 -0
  280. package/src/msca/plugins/multi-owner/extension.ts +15 -0
  281. package/src/msca/plugins/multi-owner/index.ts +3 -0
  282. package/src/msca/plugins/multisig/actions/proposeUserOperation.ts +1 -1
  283. package/src/msca/plugins/multisig/actions/signMultisigUserOperation.ts +1 -1
  284. package/src/msca/plugins/multisig/extension.ts +13 -0
  285. package/src/msca/plugins/multisig/index.ts +1 -12
  286. package/src/msca/plugins/multisig/middleware.ts +8 -8
  287. package/src/msca/plugins/multisig/utils/combineSignatures.ts +36 -9
  288. package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
  289. package/src/msca/plugins/multisig/utils/getSignerType.ts +23 -4
  290. package/src/msca/plugins/multisig/utils/index.ts +4 -0
  291. package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
  292. package/src/msca/plugins/session-key/extension.ts +13 -0
  293. package/src/msca/plugins/session-key/index.ts +7 -1
  294. package/src/msca/plugins/session-key/permissions.ts +150 -1
  295. package/src/msca/plugins/session-key/signer.ts +72 -3
  296. package/src/msca/plugins/session-key/utils.ts +33 -12
  297. package/src/msca/utils.ts +78 -21
  298. package/dist/cjs/src/light-account/schema.d.ts +0 -21
  299. package/dist/cjs/src/light-account/schema.js +0 -30
  300. package/dist/cjs/src/light-account/schema.js.map +0 -1
  301. package/dist/esm/src/light-account/schema.d.ts +0 -21
  302. package/dist/esm/src/light-account/schema.js +0 -27
  303. package/dist/esm/src/light-account/schema.js.map +0 -1
  304. package/dist/types/src/light-account/schema.d.ts +0 -22
  305. package/dist/types/src/light-account/schema.d.ts.map +0 -1
  306. package/src/light-account/schema.ts +0 -39
@@ -1,111 +1,95 @@
1
- import { DefaultFactoryNotDefinedError, arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, toRecord, zora, zoraSepolia, } from "@aa-sdk/core";
2
1
  import { fromHex } from "viem";
3
- export const supportedChains = [
4
- mainnet,
5
- sepolia,
6
- goerli,
7
- polygon,
8
- polygonAmoy,
9
- polygonMumbai,
10
- optimism,
11
- optimismGoerli,
12
- optimismSepolia,
13
- arbitrum,
14
- arbitrumGoerli,
15
- arbitrumSepolia,
16
- base,
17
- baseGoerli,
18
- baseSepolia,
19
- fraxtal,
20
- fraxtalSepolia,
21
- zora,
22
- zoraSepolia,
23
- ];
24
2
  export const AccountVersionRegistry = {
25
3
  LightAccount: {
26
4
  "v1.0.1": {
27
- type: "LightAccount",
28
- version: "v1.0.1",
29
- address: toRecord(supportedChains, "id", () => ({
30
- factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
31
- impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
32
- })),
33
5
  entryPointVersion: "0.6.0",
6
+ addresses: {
7
+ default: {
8
+ factory: "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase(),
9
+ impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase(),
10
+ },
11
+ },
34
12
  },
35
13
  "v1.0.2": {
36
- type: "LightAccount",
37
- version: "v1.0.2",
38
- address: toRecord(supportedChains, "id", () => ({
39
- factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
40
- impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
41
- })),
42
14
  entryPointVersion: "0.6.0",
15
+ addresses: {
16
+ default: {
17
+ factory: "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase(),
18
+ impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase(),
19
+ },
20
+ },
43
21
  },
44
22
  "v1.1.0": {
45
- type: "LightAccount",
46
- version: "v1.1.0",
47
- address: toRecord(supportedChains, "id", () => ({
48
- factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
49
- impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
50
- })),
51
23
  entryPointVersion: "0.6.0",
24
+ addresses: {
25
+ default: {
26
+ factory: "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase(),
27
+ impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase(),
28
+ },
29
+ },
52
30
  },
53
31
  "v2.0.0": {
54
- type: "LightAccount",
55
- version: "v2.0.0",
56
- address: toRecord(supportedChains, "id", () => ({
57
- factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
58
- impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
59
- })),
60
32
  entryPointVersion: "0.7.0",
33
+ addresses: {
34
+ default: {
35
+ factory: "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase(),
36
+ impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase(),
37
+ },
38
+ },
61
39
  },
62
40
  },
63
41
  MultiOwnerLightAccount: {
64
42
  "v2.0.0": {
65
- type: "MultiOwnerLightAccount",
66
- version: "v2.0.0",
67
- address: toRecord(supportedChains, "id", () => ({
68
- factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
69
- impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
70
- })),
71
43
  entryPointVersion: "0.7.0",
44
+ addresses: {
45
+ default: {
46
+ factory: "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase(),
47
+ impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase(),
48
+ },
49
+ },
72
50
  },
73
51
  },
74
52
  };
75
- export const defaultLightAccountVersion = (type) => (type === "LightAccount"
76
- ? "v1.1.0"
77
- : "v2.0.0");
78
- export const getDefaultLightAccountFactoryAddress = (chain, version = "v1.1.0") => {
79
- const address = AccountVersionRegistry.LightAccount[version].address[chain.id];
80
- if (!address)
81
- throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
82
- return address.factory;
53
+ export const defaultLightAccountVersion = () => "v2.0.0";
54
+ export const getDefaultLightAccountFactoryAddress = (chain, version) => {
55
+ return (AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]
56
+ ?.factory ??
57
+ AccountVersionRegistry.LightAccount[version].addresses.default.factory);
58
+ };
59
+ export const getDefaultMultiOwnerLightAccountFactoryAddress = (chain, version) => {
60
+ return (AccountVersionRegistry.MultiOwnerLightAccount[version].addresses
61
+ .overrides?.[chain.id]?.factory ??
62
+ AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default
63
+ .factory);
83
64
  };
84
65
  export const LightAccountUnsupported1271Impls = [
85
66
  AccountVersionRegistry.LightAccount["v1.0.1"],
86
67
  AccountVersionRegistry.LightAccount["v1.0.2"],
87
68
  ];
88
- export const LightAccountUnsupported1271Factories = new Set(LightAccountUnsupported1271Impls.map((x) => Object.values(x.address).map((addr) => addr.factory)).flat());
89
- export async function getLightAccountVersionDef(account, chain) {
69
+ export const LightAccountUnsupported1271Factories = new Set(LightAccountUnsupported1271Impls.map((x) => [
70
+ x.addresses.default.factory,
71
+ ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),
72
+ ]).flat());
73
+ export async function getLightAccountVersionForAccount(account, chain) {
90
74
  const accountType = account.source;
91
75
  const factoryAddress = await account.getFactoryAddress();
92
76
  const implAddress = await account.getImplementationAddress();
93
- const implToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
94
- .map((pair) => {
77
+ const implToVersion = new Map(Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
95
78
  const [version, def] = pair;
96
- return chain.id in def.address
97
- ? [def.address[chain.id].impl, version]
98
- : [null, version];
99
- })
100
- .filter(([impl]) => impl !== null));
101
- const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
102
- .map((pair) => {
79
+ if (def.addresses.overrides != null &&
80
+ chain.id in def.addresses.overrides) {
81
+ return [def.addresses.overrides[chain.id].impl, version];
82
+ }
83
+ return [def.addresses.default.impl, version];
84
+ }));
85
+ const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
103
86
  const [version, def] = pair;
104
- return chain.id in def.address
105
- ? [def.address[chain.id].factory, version]
106
- : [null, version];
107
- })
108
- .filter(([impl]) => impl !== null));
87
+ if (def.addresses.overrides != null &&
88
+ chain.id in def.addresses.overrides) {
89
+ return [def.addresses.overrides[chain.id].factory, version];
90
+ }
91
+ return [def.addresses.default.factory, version];
92
+ }));
109
93
  const version = fromHex(implAddress, "bigint") === 0n
110
94
  ? factoryToVersion.get(factoryAddress.toLowerCase())
111
95
  : implToVersion.get(implAddress.toLowerCase());
@@ -114,7 +98,4 @@ export async function getLightAccountVersionDef(account, chain) {
114
98
  }
115
99
  return AccountVersionRegistry[accountType][version];
116
100
  }
117
- export async function getLightAccountVersion(account, chain = supportedChains[0]) {
118
- return (await getLightAccountVersionDef(account, chain)).version;
119
- }
120
101
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,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,CAAC,CAAC;gBACL,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;gBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;aAC5E,C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AC;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":"AACA,OAAO,EAAE,OAAO,EAA4B,MAAM,MAAM,CAAC;AAczD,MAAM,CAAC,MAAM,sBAAsB,GAA+B;IAChE,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,iBAAiB,EAAE,OAAO;YAC1B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;oBACvE,IAAI,EAAE,4CAA4C,CAAC,WAAW,EAAa;iBAC5E;aACF;SACF;QACD,QAAQ,EA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AsB,KAAK,CAAC,EAAE,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { GetEntryPointFromAccount } from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionConfig,\n LightAccountVersionConfigs,\n} from \"./types\";\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n },\n },\n },\n \"v1.0.2\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n },\n },\n },\n \"v1.1.0\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n },\n },\n },\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n },\n },\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n },\n },\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @returns {LightAccountVersion<TLightAccountType>} the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(): LightAccountVersion<TLightAccountType> => \"v2.0.0\";\n\n/**\n * Utility method returning the default light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {LightAccountVersion} version - the version of the light account to get the factory address for\n * @returns {Address} an for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"LightAccount\">\n): Address => {\n return (\n AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]\n ?.factory ??\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n );\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {string} version - the version of the light account to get the factory address for\n * @returns {Address} an Address for the given chain\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"MultiOwnerLightAccount\">\n) => {\n return (\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses\n .overrides?.[chain.id]?.factory ??\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default\n .factory\n );\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) => [\n x.addresses.default.factory,\n ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),\n ]).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param {LightAccountBase} account the light account to get the version for\n * @param {Chain} chain - the chain to get the version for\n * @returns {Promise<LightAccountVersionConfig>} the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionForAccount<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].impl, version];\n }\n\n return [def.addresses.default.impl, version];\n })\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].factory, version];\n }\n\n return [def.addresses.default.factory, version];\n })\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n"]}
@@ -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,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAwCzD,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,EACnD,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,GAC4B;IACrC,MA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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,m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C;YAC/B,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAE/B,OAAO,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,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,kCAAkC;gBACvC,YAAY,EAAE,eAAe;gBAC7B,IAAI,EAAE,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\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,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,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAyChE,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,KAAK,EACL,MAA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Ac,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,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AA+DhE,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,MAA0C;IAE1C,MAAM,EACJ,SAAS,EACT,KAAK,EACL,MAAM,EACN,cAAc,EAAE,eAAe,EAC/B,QAAQ,EACR,UAAU,GAAG,aAAa,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EACvD,cAAc,GAAG,8CAA8C,CAAC,KAAK,CAAC,EACtE,MAAM,GAA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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":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAGrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AA6C5D,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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,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,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,uBAAuB,CAC/B,oBAAoB,EACpB,4BAA4B,EAC5B,MAAM,CACP,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,YAAY,CAAC;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,gBAAgB;YACrB,YAAY,EAAE,4BAA4B;YAC1C,IAAI,EA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,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,6 +1,6 @@
1
+ import type { SmartAccountSigner } from "@aa-sdk/core";
1
2
  import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
2
3
  import { type AccountLoupeActions, type CreateMultiOwnerModularAccountParams, type LightAccount, type MultiOwnerModularAccount, type MultiOwnerPluginActions, type PluginManagerActions } from "@account-kit/smart-contracts";
3
- import type { SmartAccountSigner } from "@aa-sdk/core";
4
4
  import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
5
5
  export type AlchemyModularAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
6
6
  export declare function createModularAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;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":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAgDd,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/msca/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD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B,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n smartAccountClientActions,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport type { CreateLightAccountClientParams } from \"../../light-account/clients/client.js\";\nimport {\n accountLoupeActions,\n type AccountLoupeActions,\n} from \"../account-loupe/decorator.js\";\nimport {\n createMultiOwnerModularAccount,\n type CreateMultiOwnerModularAccountParams,\n type MultiOwnerModularAccount,\n} from \"../account/multiOwnerAccount.js\";\nimport {\n createMultisigModularAccount,\n type CreateMultisigModularAccountParams,\n type MultisigModularAccount,\n} from \"../account/multisigAccount.js\";\nimport {\n pluginManagerActions,\n type PluginManagerActions,\n} from \"../plugin-manager/decorator.js\";\nimport {\n multiOwnerPluginActions,\n type MultiOwnerPluginActions,\n} from \"../plugins/multi-owner/index.js\";\nimport {\n multisigPluginActions,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n} from \"../plugins/multisig/index.js\";\nimport { multisigSignatureMiddleware } from \"../plugins/multisig/middleware.js\";\n\nexport type CreateMultiOwnerModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultiOwnerModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport type CreateMultisigModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultisigModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport function createMultiOwnerModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\nexport async function createMultiOwnerModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultiOwnerModularAccountClientParams): Promise<SmartAccountClient> {\n const modularAccount = await createMultiOwnerModularAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n })\n .extend(pluginManagerActions)\n .extend(multiOwnerPluginActions)\n .extend(accountLoupeActions);\n}\n\nexport function createMultisigModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultisigModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n>;\n\nexport async function createMultisigModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultisigModularAccountClientParams): Promise<\n SmartAccountClient<\n Transport,\n Chain,\n MultisigModularAccount<SmartAccountSigner>,\n {},\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n> {\n const modularAccount = await createMultisigModularAccount({\n ...account,\n transport,\n chain,\n });\n\n const client = createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(pluginManagerActions)\n .extend(multisigPluginActions)\n .extend(accountLoupeActions);\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/msca/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EACL,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,8BAA8B,GAG/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,4BAA4B,GAG7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,oBAAoB,GAErB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,GAGtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAoEhF,MAAM,CAAC,KAAK,UAAU,oCAAoC,CAAC,EACzD,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EAC4B;IAC3C,MAAM,cAAc,GAAG,MAAM,8BAA8B,CAAC;QAC1D,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,YAAY;QACf,SAAS;QACT,KAAK;QACL,OAAO,EAAE,cAAc;KACxB,CAAC;SACC,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC;AA4CD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,EACvD,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EAC0B;IAUzC,MAAM,cAAc,GAAG,MAAM,4BAA4B,CAAC;QACxD,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACtC,GAAG,YAAY;QACf,SAAS;QACT,KAAK;QACL,OAAO,EAAE,cAAc;QACvB,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n smartAccountClientActions,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport type { CreateLightAccountClientParams } from \"../../light-account/clients/client.js\";\nimport {\n accountLoupeActions,\n type AccountLoupeActions,\n} from \"../account-loupe/decorator.js\";\nimport {\n createMultiOwnerModularAccount,\n type CreateMultiOwnerModularAccountParams,\n type MultiOwnerModularAccount,\n} from \"../account/multiOwnerAccount.js\";\nimport {\n createMultisigModularAccount,\n type CreateMultisigModularAccountParams,\n type MultisigModularAccount,\n} from \"../account/multisigAccount.js\";\nimport {\n pluginManagerActions,\n type PluginManagerActions,\n} from \"../plugin-manager/decorator.js\";\nimport {\n multiOwnerPluginActions,\n type MultiOwnerPluginActions,\n} from \"../plugins/multi-owner/index.js\";\nimport {\n multisigPluginActions,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n} from \"../plugins/multisig/index.js\";\nimport { multisigSignatureMiddleware } from \"../plugins/multisig/middleware.js\";\n\nexport type CreateMultiOwnerModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultiOwnerModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport type CreateMultisigModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultisigModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport function createMultiOwnerModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a multi-owner modular account client with the provided parameters including account, transport, chain, and additional client configuration. This function uses a modular account and extends it with various plugin actions.\n *\n * @example\n * ```ts\n * import { createMultiOwnerModularAccountClient } 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 accountClient = await createMultiOwnerModularAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * }\n * });\n * ```\n *\n * @param {CreateMultiOwnerModularAccountClientParams} config The parameters for creating the multi-owner modular account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance with extended plugin actions\n */\nexport async function createMultiOwnerModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultiOwnerModularAccountClientParams): Promise<SmartAccountClient> {\n const modularAccount = await createMultiOwnerModularAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n })\n .extend(pluginManagerActions)\n .extend(multiOwnerPluginActions)\n .extend(accountLoupeActions);\n}\n\nexport function createMultisigModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultisigModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n>;\n\n/**\n * Creates a multisig modular account client using the provided parameters including account details, transport, chain, and additional client configuration. This function constructs the multisig modular account and extends it with various actions to create a comprehensive client.\n *\n * @example\n * ```ts\n * import { createMultisigModularAccountClient } 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 accountClient = await createMultisigModularAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * }\n * });\n * ```\n *\n * @param {CreateMultisigModularAccountClientParams} config the parameters for configuring the multisig modular account client\n * @returns {Promise<SmartAccountClient<Transport, Chain, MultisigModularAccount<SmartAccountSigner>, {}, SmartAccountClientRpcSchema, MultisigUserOperationContext>>} a promise that resolves to a `SmartAccountClient` object extended with the multisig modular account and additional actions\n */\nexport async function createMultisigModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultisigModularAccountClientParams): Promise<\n SmartAccountClient<\n Transport,\n Chain,\n MultisigModularAccount<SmartAccountSigner>,\n {},\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n> {\n const modularAccount = await createMultisigModularAccount({\n ...account,\n transport,\n chain,\n });\n\n const client = createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(pluginManagerActions)\n .extend(multisigPluginActions)\n .extend(accountLoupeActions);\n\n return client;\n}\n"]}
@@ -1,6 +1,6 @@
1
+ import { type SmartAccountSigner } from "@aa-sdk/core";
1
2
  import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
2
3
  import { type AccountLoupeActions, type CreateMultisigModularAccountParams, type LightAccount, type MultisigModularAccount, type MultisigPluginActions, type MultisigUserOperationContext, type PluginManagerActions } from "@account-kit/smart-contracts";
3
- import { type SmartAccountSigner } from "@aa-sdk/core";
4
4
  import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
5
5
  export type AlchemyMultisigAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>, MultisigUserOperationContext>, "account">;
6
6
  export declare function createMultisigAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultisigAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, MultisigUserOperationContext>>;
@@ -1,6 +1,6 @@
1
+ import { smartAccountClientActions, } from "@aa-sdk/core";
1
2
  import { AlchemyProviderConfigSchema, createAlchemyPublicRpcClient, createAlchemySmartAccountClientFromExisting, } from "@account-kit/infra";
2
3
  import { accountLoupeActions, createMultisigModularAccount, multisigPluginActions, multisigSignatureMiddleware, pluginManagerActions, } from "@account-kit/smart-contracts";
3
- import { smartAccountClientActions, } from "@aa-sdk/core";
4
4
  import { custom, } from "viem";
5
5
  export async function createMultisigAccountAlchemyClient(config) {
6
6
  const { chain, opts, ...connectionConfig } = AlchemyProviderConfigSchema.parse(config);
@@ -1 +1 @@
1
- {"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAoCd,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAA0C;IAY1C,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,CAIhD;QACA,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;QACJ,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,qBAAqB,CAAC;SAC7B,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 createMultisigModularAccount,\n multisigPluginActions,\n multisigSignatureMiddleware,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultisigModularAccountParams,\n type LightAccount,\n type MultisigModularAccount,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n smartAccountClientActions,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\n// todo: this file seems somewhat duplicated with ./modularAccountClient.ts, but that file has some multi-owner specific fields. Is there a way to refactor these two to de-dupe?\n\nexport type AlchemyMultisigAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultisigModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n LightAccount<TSigner>,\n MultisigUserOperationContext\n >,\n \"account\"\n >;\n\nexport function createMultisigAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultisigAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n MultisigUserOperationContext\n >\n>;\n\nexport async function createMultisigAccountAlchemyClient(\n config: AlchemyMultisigAccountClientConfig\n): Promise<\n AlchemySmartAccountClient<\n Transport,\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> &\n PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> &\n AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>,\n MultisigUserOperationContext\n >\n> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultisigModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting<\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigUserOperationContext\n >({\n ...config,\n client,\n account,\n opts,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(multisigPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
1
+ {"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AA0Dd,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAA0C;IAY1C,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,CAIhD;QACA,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;QACJ,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import {\n smartAccountClientActions,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultisigModularAccount,\n multisigPluginActions,\n multisigSignatureMiddleware,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultisigModularAccountParams,\n type LightAccount,\n type MultisigModularAccount,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\n// todo: this file seems somewhat duplicated with ./modularAccountClient.ts, but that file has some multi-owner specific fields. Is there a way to refactor these two to de-dupe?\n\nexport type AlchemyMultisigAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultisigModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n LightAccount<TSigner>,\n MultisigUserOperationContext\n >,\n \"account\"\n >;\n\nexport function createMultisigAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultisigAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n MultisigUserOperationContext\n >\n>;\n\n/**\n * Creates an Alchemy client for a multisig account using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultisigAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createMultisigAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * });\n * ```\n *\n * @param {AlchemyMultisigAccountClientConfig} config The configuration for the Alchemy multisig account client\n * @returns {Promise<AlchemySmartAccountClient<Transport, Chain | undefined, MultisigModularAccount<SmartAccountSigner>, MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> & PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> & AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>, MultisigUserOperationContext>>} A promise that resolves to an Alchemy Smart Account Client for multisig accounts with extended functionalities.\n */\nexport async function createMultisigAccountAlchemyClient(\n config: AlchemyMultisigAccountClientConfig\n): Promise<\n AlchemySmartAccountClient<\n Transport,\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> &\n PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> &\n AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>,\n MultisigUserOperationContext\n >\n> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultisigModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting<\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigUserOperationContext\n >({\n ...config,\n client,\n account,\n opts,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(multisigPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/msca/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAE5D;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAF/B;;;;mBAAO,iCAAiC;WAAC;IAGlD,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAFhD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAFpD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAED,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAE1D;QACE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAFlD;;;;mBAAO,+BAA+B;WAAC;IAGhD,CAAC;CACF","sourcesContent":["import { BaseError } from \"@aa-sdk/core\";\n\nexport class InvalidAggregatedSignatureError extends BaseError {\n override name = \"InvalidAggregatedSignatureError\";\n constructor() {\n super(\"Invalid aggregated signature\");\n }\n}\n\nexport class InvalidContextSignatureError extends BaseError {\n override name = \"InvalidContextSignatureError\";\n constructor() {\n super(\"Expected context.signature to be a hex string\");\n }\n}\n\nexport class MultisigAccountExpectedError extends BaseError {\n override name = \"MultisigAccountExpectedError\";\n constructor() {\n super(\"Expected account to be a multisig modular account\");\n }\n}\n\nexport class MultisigMissingSignatureError extends BaseError {\n override name = \"MultisigMissingSignatureError\";\n constructor() {\n super(\"UserOp must have at least one signature already\");\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/msca/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAE5D;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAF/B;;;;mBAAO,iCAAiC;WAAC;IAGlD,CAAC;CACF;AAKD,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAFhD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAKD,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAFpD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAKD,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAE1D;QACE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAFlD;;;;mBAAO,+BAA+B;WAAC;IAGhD,CAAC;CACF","sourcesContent":["import { BaseError } from \"@aa-sdk/core\";\n\n/**\n * Error thrown when the aggregated signature is invalid\n */\nexport class InvalidAggregatedSignatureError extends BaseError {\n override name = \"InvalidAggregatedSignatureError\";\n constructor() {\n super(\"Invalid aggregated signature\");\n }\n}\n\n/**\n * Error thrown when the context signature is invalid\n */\nexport class InvalidContextSignatureError extends BaseError {\n override name = \"InvalidContextSignatureError\";\n constructor() {\n super(\"Expected context.signature to be a hex string\");\n }\n}\n\n/**\n * Error thrown when the expected account is not a multisig modular account\n */\nexport class MultisigAccountExpectedError extends BaseError {\n override name = \"MultisigAccountExpectedError\";\n constructor() {\n super(\"Expected account to be a multisig modular account\");\n }\n}\n\n/**\n * Error thrown when a multisig user op is missing a signature\n */\nexport class MultisigMissingSignatureError extends BaseError {\n override name = \"MultisigMissingSignatureError\";\n constructor() {\n super(\"UserOp must have at least one signature already\");\n }\n}\n"]}
@@ -8,4 +8,4 @@ export type PluginManagerActions<TAccount extends SmartContractAccount | undefin
8
8
  installPlugin: (params: InstallPluginParams<TAccount>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
9
9
  uninstallPlugin: (params: UninstallPluginParams<TAccount>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
10
10
  };
11
- export declare const pluginManagerActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>) => PluginManagerActions<TAccount>;
11
+ export declare function pluginManagerActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>): PluginManagerActions<TAccount>;
@@ -2,8 +2,10 @@ import { installPlugin } from "./installPlugin.js";
2
2
  import { uninstallPlugin, } from "./uninstallPlugin.js";
3
3
  export {} from "./installPlugin.js";
4
4
  export {} from "./uninstallPlugin.js";
5
- export const pluginManagerActions = (client) => ({
6
- installPlugin: async (params) => installPlugin(client, params),
7
- uninstallPlugin: async (params) => uninstallPlugin(client, params),
8
- });
5
+ export function pluginManagerActions(client) {
6
+ return {
7
+ installPlugin: async (params) => installPlugin(client, params),
8
+ uninstallPlugin: async (params) => uninstallPlugin(client, params),
9
+ };
10
+ }
9
11
  //# sourceMappingURL=decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAA8B,MAAM,sBAAsB,CAAC;AAgBlE,MAAM,CAAC,MAAM,oBAAoB,GAQK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjD,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;IAC9D,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SendUserOperationResult,\n SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { installPlugin, type InstallPluginParams } from \"./installPlugin.js\";\nimport {\n uninstallPlugin,\n type UninstallPluginParams,\n} from \"./uninstallPlugin.js\";\n\nexport { type InstallPluginParams } from \"./installPlugin.js\";\nexport { type UninstallPluginParams } from \"./uninstallPlugin.js\";\n\nexport type PluginManagerActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n installPlugin: (\n params: InstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n uninstallPlugin: (\n params: UninstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n};\n\nexport const pluginManagerActions: <\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) => PluginManagerActions<TAccount> = (client) => ({\n installPlugin: async (params) => installPlugin(client, params),\n uninstallPlugin: async (params) => uninstallPlugin(client, params),\n});\n"]}
1
+ {"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAA8B,MAAM,sBAAsB,CAAC;AA+BlE,MAAM,UAAU,oBAAoB,CAOlC,MAA4C;IAE5C,OAAO;QACL,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;QAC9D,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SendUserOperationResult,\n SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { installPlugin, type InstallPluginParams } from \"./installPlugin.js\";\nimport {\n uninstallPlugin,\n type UninstallPluginParams,\n} from \"./uninstallPlugin.js\";\n\nexport { type InstallPluginParams } from \"./installPlugin.js\";\nexport { type UninstallPluginParams } from \"./uninstallPlugin.js\";\n\nexport type PluginManagerActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n installPlugin: (\n params: InstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n uninstallPlugin: (\n params: UninstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n};\n\n/**\n * Provides actions for managing plugins on a given client, including installing and uninstalling plugins.\n * NOTE: this is provided by default when using a modular account client\n *\n * @example\n * ```ts\n * import { pluginManagerActions } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...).extend(pluginManagerActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance on which to manage plugins\n * @returns {PluginManagerActions<TAccount>} An object containing functions to install and uninstall plugins\n */\nexport function pluginManagerActions<\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): PluginManagerActions<TAccount> {\n return {\n installPlugin: async (params) => installPlugin(client, params),\n uninstallPlugin: async (params) => uninstallPlugin(client, params),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"installPlugin.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/installPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,GAMV,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAoB9D,MAAM,CAAC,KAAK,UAAU,aAAa,CAUjC,MAA4C,EAC5C,EACE,SAAS,EACT,OAAO,EACP,OAAO,GAAG,MAAM,CAAC,OAAO,EACxB,GAAG,MAAM,EAC+B;IAE1C,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,eAAe,EACf,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,gCAAgC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExE,OAAO,MAAM,CAAC,iBAAiB,CAAC;QAC9B,EAAE,EAAE,QAAQ;QACZ,SAAS;QACT,OAAO;QACP,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAOpD,MAAwD,EACxD,MAAsE;IAEtE,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;QAC/C,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,MAAM,CAAC,aAAa;QAC7B,YAAY,EAAE,gBAAgB;KAC/B,CAAC,CAAC;IAEH,MAAM,YAAY,GAChB,MAAM,CAAC,YAAY;QACnB,SAAS,CACP,oBAAoB,CAAC;YACnB,GAAG,EAAE,UAAU;YACf,YAAY,EAAE,gBAAgB;YAC9B,MAAM,EAAE,cAAc;SACvB,CAAC,CACH,CAAC;IACJ,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,iBAAiB;QACtB,YAAY,EAAE,eAAe;QAC7B,IAAI,EAAE;YACJ,MAAM,CAAC,aAAa;YACpB,YAAY;YACZ,MAAM,CAAC,cAAc,IAAI,IAAI;YAC7B,MAAM,CAAC,YAAY,IAAI,EAAE;SAC1B;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetContextParameter,\n type GetEntryPointFromAccount,\n type SmartAccountClient,\n type SmartContractAccount,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport {\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n type Address,\n type Chain,\n type Client,\n type Hash,\n type Transport,\n} from \"viem\";\nimport { IPluginAbi } from \"../abis/IPlugin.js\";\nimport { IPluginManagerAbi } from \"../abis/IPluginManager.js\";\nimport type { FunctionReference } from \"../account-loupe/types.js\";\n\nexport type InstallPluginParams<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends Record<string, unknown> | undefined =\n | Record<string, unknown>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n pluginAddress: Address;\n manifestHash?: Hash;\n pluginInitData?: Hash;\n dependencies?: FunctionReference[];\n} & UserOperationOverridesParameter<TEntryPointVersion> &\n GetAccountParameter<TAccount> &\n GetContextParameter<TContext>;\n\nexport async function installPlugin<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends Record<string, unknown> | undefined =\n | Record<string, unknown>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n {\n overrides,\n context,\n account = client.account,\n ...params\n }: InstallPluginParams<TAccount, TContext>\n) {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"installPlugin\",\n client\n );\n }\n\n const callData = await encodeInstallPluginUserOperation(client, params);\n\n return client.sendUserOperation({\n uo: callData,\n overrides,\n account,\n context,\n });\n}\n\nexport async function encodeInstallPluginUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n params: Omit<InstallPluginParams, \"overrides\" | \"account\" | \"context\">\n) {\n const pluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: params.pluginAddress,\n functionName: \"pluginManifest\",\n });\n // use the manifest hash passed in or get it from the plugin\n const manifestHash: Hash =\n params.manifestHash ??\n keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: pluginManifest,\n })\n );\n return encodeFunctionData({\n abi: IPluginManagerAbi,\n functionName: \"installPlugin\",\n args: [\n params.pluginAddress,\n manifestHash,\n params.pluginInitData ?? \"0x\",\n params.dependencies ?? [],\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"installPlugin.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/installPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACp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GAAG,EAAE,iBAAiB;QACtB,YAAY,EAAE,eAAe;QAC7B,IAAI,EAAE;YACJ,MAAM,CAAC,aAAa;YACpB,YAAY;YACZ,MAAM,CAAC,cAAc,IAAI,IAAI;YAC7B,MAAM,CAAC,YAAY,IAAI,EAAE;SAC1B;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetContextParameter,\n type GetEntryPointFromAccount,\n type SmartAccountClient,\n type SmartContractAccount,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport {\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n type Address,\n type Chain,\n type Client,\n type Hash,\n type Transport,\n} from \"viem\";\nimport { IPluginAbi } from \"../abis/IPlugin.js\";\nimport { IPluginManagerAbi } from \"../abis/IPluginManager.js\";\nimport type { FunctionReference } from \"../account-loupe/types.js\";\n\nexport type InstallPluginParams<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends Record<string, unknown> | undefined =\n | Record<string, unknown>\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n pluginAddress: Address;\n manifestHash?: Hash;\n pluginInitData?: Hash;\n dependencies?: FunctionReference[];\n} & UserOperationOverridesParameter<TEntryPointVersion> &\n GetAccountParameter<TAccount> &\n GetContextParameter<TContext>;\n\n/**\n * Installs a plugin on a smart account via the client, sending the user operation with the appropriate parameters.\n * NOTE: it's recommended to just use the installPlugin action returned from generated plugins\n *\n * @example\n * ```ts\n * import { installPlugin, createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n *\n * const client = createModularAccountAlchemyClient(...);\n *\n * const hash = await installPlugin(client, {\n * pluginAddress: \"0x...\",\n * manifestHash: \"0x...\",\n * dependencies: [], // this is defined by the plugin you're installing\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client configured to the smart account on which the plugin will be installed\n * @param {InstallPluginParams<TAccount, TContext>} params The parameters required to install the plugin, including overrides, context, and account information\n * @returns {Promise<any>} A promise that resolves once the plugin installation operation is sent\n */\nexport async function installPlugin<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends Record<string, unknown> | undefined =\n | Record<string, unknown>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>,\n {\n overrides,\n context,\n account = client.account,\n ...params\n }: InstallPluginParams<TAccount, TContext>\n) {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"installPlugin\",\n client\n );\n }\n\n const callData = await encodeInstallPluginUserOperation(client, params);\n\n return client.sendUserOperation({\n uo: callData,\n overrides,\n account,\n context,\n });\n}\n\nexport async function encodeInstallPluginUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n params: Omit<InstallPluginParams, \"overrides\" | \"account\" | \"context\">\n) {\n const pluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: params.pluginAddress,\n functionName: \"pluginManifest\",\n });\n // use the manifest hash passed in or get it from the plugin\n const manifestHash: Hash =\n params.manifestHash ??\n keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: pluginManifest,\n })\n );\n return encodeFunctionData({\n abi: IPluginManagerAbi,\n functionName: \"installPlugin\",\n args: [\n params.pluginAddress,\n manifestHash,\n params.pluginInitData ?? \"0x\",\n params.dependencies ?? [],\n ],\n });\n}\n"]}