@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,10 +1,4 @@
1
- import {
2
- type EntryPointVersion,
3
- type GetAccountParameter,
4
- type OneOf,
5
- type SmartAccountSigner,
6
- type SmartContractAccount,
7
- } from "@aa-sdk/core";
1
+ import { type EntryPointVersion } from "@aa-sdk/core";
8
2
  import { type Address, type Chain } from "viem";
9
3
  import type { LightAccountBase } from "./accounts/base";
10
4
 
@@ -12,199 +6,48 @@ import type { LightAccountBase } from "./accounts/base";
12
6
  * Light account types supported: LightAccount, MultiOwnerLightAccount
13
7
  *
14
8
  */
15
- export type LightAccountType = keyof IAccountVersionRegistry;
9
+ export type LightAccountType = "LightAccount" | "MultiOwnerLightAccount";
16
10
 
17
- /**
18
- * Account version definition, which is the base type defining the LightAccountVersionDef interface
19
- *
20
- * @template {LightAccountType} TLightAccountType type
21
- * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion version
22
- * @template {EntryPointVersion} TEntryPointVersion entryPointVersion
23
- */
24
- export type AccountVersionDef<
25
- TLightAccountType extends LightAccountType = LightAccountType,
26
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,
11
+ export type LightAccountVersionConfig<
27
12
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion
28
13
  > = {
29
- type: TLightAccountType;
30
- version: TLightAccountVersion;
31
14
  entryPointVersion: TEntryPointVersion;
32
- address: Record<
33
- Chain["id"],
34
- {
15
+ addresses: {
16
+ default: {
35
17
  factory: Address;
36
18
  impl: Address;
37
- }
38
- >;
19
+ };
20
+ overrides?: Record<
21
+ Chain["id"],
22
+ {
23
+ factory: Address;
24
+ impl: Address;
25
+ }
26
+ >;
27
+ };
39
28
  };
40
29
 
41
- /**
42
- * Light account version type defs for tightly coupled types for smart accounts
43
- *
44
- */
45
- export type LightAccountVersion =
46
- | keyof IAccountVersionRegistry["LightAccount"]
47
- | keyof IAccountVersionRegistry["MultiOwnerLightAccount"];
48
-
49
- /**
50
- * Get the light account versions available for the given light account type
51
- *
52
- * @template {LightAccountType} TLightAccountType
53
- */
54
- export type GetLightAccountVersion<
55
- TLightAccountType extends LightAccountType = LightAccountType
56
- > = keyof IAccountVersionRegistry[TLightAccountType];
57
-
58
- /**
59
- * Light account version definition type based on the light account type and version
60
- *
61
- * @template {LightAccountType} TLightAccountType
62
- * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion
63
- */
64
- export type LightAccountVersionDef<
65
- TLightAccountType extends LightAccountType = LightAccountType,
66
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>
67
- > = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];
68
-
69
- /**
70
- * Light account version registry interface defining the supported light account versions
71
- *
72
- */
73
- export interface IAccountVersionRegistry {
30
+ export type LightAccountVersionConfigs = {
74
31
  LightAccount: {
75
- /** @deprecated This version does not support 1271 signature validation */
76
- "v1.0.1": AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0">;
77
- /** @deprecated This version has a known issue with 1271 validation */
78
- "v1.0.2": AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">;
79
- "v1.1.0": AccountVersionDef<"LightAccount", "v1.1.0", "0.6.0">;
80
- /**
81
- * LightAccount v2 Changelog.
82
- * It is recommended to use v2.0.0
83
- * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd
84
- */
85
- "v2.0.0": AccountVersionDef<"LightAccount", "v2.0.0", "0.7.0">;
32
+ "v1.0.1": LightAccountVersionConfig<"0.6.0">;
33
+ "v1.0.2": LightAccountVersionConfig<"0.6.0">;
34
+ "v1.1.0": LightAccountVersionConfig<"0.6.0">;
35
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
86
36
  };
87
37
  MultiOwnerLightAccount: {
88
- /**
89
- * MultiOwnerLightAccount v2 Changelog
90
- * It is recommended to use v2.0.0
91
- * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd
92
- */
93
- "v2.0.0": AccountVersionDef<"MultiOwnerLightAccount", "v2.0.0", "0.7.0">;
38
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
94
39
  };
95
- }
96
-
97
- /**
98
- * Get the light account version definitions available for the given light account type
99
- *
100
- * @template {LightAccountType} TLightAccountType
101
- *
102
- * @example
103
- * type T1 = GetLightAccountVersionsForType<"LightAccount">;
104
- * const t1: T1 = AccountVersionRegistry.LightAccount["v1.0.2"];
105
- */
106
- export type GetLightAccountVersionDefsForType<TType extends LightAccountType> =
107
- Extract<
108
- IAccountVersionRegistry[TType][keyof IAccountVersionRegistry[TType]],
109
- { type: TType }
110
- >;
111
-
112
- /**
113
- * Get the light account version definition for the given light account type and version
114
- *
115
- * @template {LightAccountType} TType
116
- * @template {GetLightAccountVersion<TType>} TLightAccountVersion
117
- */
118
- export type GetLightAccountVersionDef<
119
- TType extends LightAccountType,
120
- TLightAccountVersion extends GetLightAccountVersion<TType>
121
- > = IAccountVersionRegistry[TType][TLightAccountVersion];
122
-
123
- /**
124
- * @example
125
- * type T = GetLightAccountVersionDefsForEntryPoint<"LightAccount", "0.6.0">;
126
- * const t_1: T = AccountVersionRegistry.LightAccount["v1.0.2"]; // compiles
127
- * const t_2: T = AccountVersionRegistry.LightAccount["v2.0.0"]; // errors
128
- */
129
- export type GetLightAccountVersionDefsForEntryPoint<
130
- TType extends LightAccountType,
131
- TEntryPointVersion extends EntryPointVersion
132
- > = Extract<
133
- GetLightAccountVersionDefsForType<TType>,
134
- { entryPointVersion: TEntryPointVersion }
135
- >;
136
-
137
- /**
138
- * Get the light account type for the given light account by inferring from its type definition
139
- *
140
- * @template {SmartContractAccount | undefined} TAccount
141
- * @template {SmartContractAccount} TAccountOverride
142
- */
143
- export type GetLightAccountType<
144
- TAccount extends SmartContractAccount | undefined,
145
- TAccountOverride extends SmartContractAccount = SmartContractAccount
146
- > = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<
147
- SmartAccountSigner,
148
- infer TLightAccountType
149
- >
150
- ? OneOf<TLightAccountType, LightAccountType>
151
- : LightAccountType;
152
-
153
- /**
154
- * Get the light account version for the given light account by inferring from its type definition
155
- *
156
- * @template {LightAccountBase | undefined} TAccount
157
- * @template {LightAccountBase} TAccountOverride
158
- */
159
- export type GetLightAccountVersionFromAccount<
160
- TAccount extends LightAccountBase | undefined,
161
- TAccountOverride extends LightAccountBase = LightAccountBase
162
- > = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<
163
- SmartAccountSigner,
164
- LightAccountType,
165
- infer TLightAccountVersion
166
- >
167
- ? OneOf<TLightAccountVersion, LightAccountVersion>
168
- : LightAccountVersion;
40
+ };
169
41
 
170
- /**
171
- * Get the entry point version supported for the given light account type and version
172
- *
173
- * @template {LightAccountType} TLightAccountType
174
- * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion
175
- */
176
- export type GetEntryPointForLightAccountVersion<
177
- TLightAccountType extends LightAccountType = LightAccountType,
178
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>
179
- > = GetLightAccountVersionDef<
180
- TLightAccountType,
181
- TLightAccountVersion
182
- > extends AccountVersionDef<
183
- TLightAccountType,
184
- TLightAccountVersion,
185
- infer TEntryPointVersion
186
- >
187
- ? TEntryPointVersion
188
- : EntryPointVersion;
42
+ export type LightAccountVersion<TAccountType extends LightAccountType> =
43
+ keyof LightAccountVersionConfigs[TAccountType];
189
44
 
190
- /**
191
- * Get the light account type for the given light account version by inferring from its type definition
192
- *
193
- * @template {LightAccountVersion} TLightAccountVersion
194
- */
195
- export type GetLightAccountTypesForVersion<
196
- TLightAccountVersion extends LightAccountVersion = LightAccountVersion
197
- > = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType>
198
- ? TLightAccountType
199
- : LightAccountType;
45
+ export type GetLightAccountType<TAccount extends LightAccountBase> =
46
+ TAccount["source"] extends LightAccountType ? TAccount["source"] : never;
200
47
 
201
- /**
202
- * Get default light account version for the given light account type
203
- *
204
- * @template {LightAccountType} TLightAccountType
205
- */
206
- export type GetDefaultLightAccountVersion<
207
- TLightAccountType extends LightAccountType = LightAccountType
208
- > = TLightAccountType extends "MultiOwnerLightAccount"
209
- ? "v2.0.0" & LightAccountVersion
210
- : "v1.1.0" & LightAccountVersion;
48
+ export type LightAccountEntryPointVersion<
49
+ TLightAccountType extends LightAccountType,
50
+ TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>
51
+ > = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig
52
+ ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion]["entryPointVersion"]
53
+ : never;
@@ -1,143 +1,71 @@
1
- import {
2
- DefaultFactoryNotDefinedError,
3
- arbitrum,
4
- arbitrumGoerli,
5
- arbitrumSepolia,
6
- base,
7
- baseGoerli,
8
- baseSepolia,
9
- fraxtal,
10
- fraxtalSepolia,
11
- goerli,
12
- mainnet,
13
- optimism,
14
- optimismGoerli,
15
- optimismSepolia,
16
- polygon,
17
- polygonAmoy,
18
- polygonMumbai,
19
- sepolia,
20
- toRecord,
21
- zora,
22
- zoraSepolia,
23
- } from "@aa-sdk/core";
1
+ import type { GetEntryPointFromAccount } from "@aa-sdk/core";
24
2
  import { fromHex, type Address, type Chain } from "viem";
25
3
  import type { LightAccountBase } from "./accounts/base";
26
4
  import type {
27
- AccountVersionDef,
28
- GetLightAccountType,
29
- GetLightAccountVersion,
30
- GetLightAccountVersionFromAccount,
31
- IAccountVersionRegistry,
32
5
  LightAccountType,
33
6
  LightAccountVersion,
34
- LightAccountVersionDef,
7
+ LightAccountVersionConfig,
8
+ LightAccountVersionConfigs,
35
9
  } from "./types";
36
10
 
37
- /**
38
- * Light account deployed chains
39
- *
40
- */
41
- export const supportedChains: Chain[] = [
42
- mainnet,
43
- sepolia,
44
- goerli,
45
- polygon,
46
- polygonAmoy,
47
- polygonMumbai,
48
- optimism,
49
- optimismGoerli,
50
- optimismSepolia,
51
- arbitrum,
52
- arbitrumGoerli,
53
- arbitrumSepolia,
54
- base,
55
- baseGoerli,
56
- baseSepolia,
57
- fraxtal,
58
- fraxtalSepolia,
59
- zora,
60
- zoraSepolia,
61
- ];
62
-
63
11
  /**
64
12
  * Account version registry interface that defines the light account versions
65
13
  * and the version definition for each light account type
66
14
  *
67
15
  */
68
- export const AccountVersionRegistry: IAccountVersionRegistry = {
16
+ export const AccountVersionRegistry: LightAccountVersionConfigs = {
69
17
  LightAccount: {
70
18
  "v1.0.1": {
71
- type: "LightAccount",
72
- version: "v1.0.1",
73
- address: toRecord<Chain, "id", { factory: Address; impl: Address }>(
74
- supportedChains,
75
- "id",
76
- () => ({
19
+ entryPointVersion: "0.6.0",
20
+ addresses: {
21
+ default: {
77
22
  factory:
78
23
  "0x000000893A26168158fbeaDD9335Be5bC96592E2".toLowerCase() as Address,
79
24
  impl: "0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0".toLowerCase() as Address,
80
- })
81
- ),
82
- entryPointVersion: "0.6.0",
25
+ },
26
+ },
83
27
  },
84
28
  "v1.0.2": {
85
- type: "LightAccount",
86
- version: "v1.0.2",
87
- address: toRecord<Chain, "id", { factory: Address; impl: Address }>(
88
- supportedChains,
89
- "id",
90
- () => ({
29
+ entryPointVersion: "0.6.0",
30
+ addresses: {
31
+ default: {
91
32
  factory:
92
33
  "0x00000055C0b4fA41dde26A74435ff03692292FBD".toLowerCase() as Address,
93
34
  impl: "0x5467b1947F47d0646704EB801E075e72aeAe8113".toLowerCase() as Address,
94
- })
95
- ),
96
- entryPointVersion: "0.6.0",
35
+ },
36
+ },
97
37
  },
98
38
  "v1.1.0": {
99
- type: "LightAccount",
100
- version: "v1.1.0",
101
- address: toRecord<Chain, "id", { factory: Address; impl: Address }>(
102
- supportedChains,
103
- "id",
104
- () => ({
39
+ entryPointVersion: "0.6.0",
40
+ addresses: {
41
+ default: {
105
42
  factory:
106
43
  "0x00004EC70002a32400f8ae005A26081065620D20".toLowerCase() as Address,
107
44
  impl: "0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba".toLowerCase() as Address,
108
- })
109
- ),
110
- entryPointVersion: "0.6.0",
45
+ },
46
+ },
111
47
  },
112
48
  "v2.0.0": {
113
- type: "LightAccount",
114
- version: "v2.0.0",
115
- address: toRecord<Chain, "id", { factory: Address; impl: Address }>(
116
- supportedChains,
117
- "id",
118
- () => ({
49
+ entryPointVersion: "0.7.0",
50
+ addresses: {
51
+ default: {
119
52
  factory:
120
53
  "0x0000000000400CdFef5E2714E63d8040b700BC24".toLowerCase() as Address,
121
54
  impl: "0x8E8e658E22B12ada97B402fF0b044D6A325013C7".toLowerCase() as Address,
122
- })
123
- ),
124
- entryPointVersion: "0.7.0",
55
+ },
56
+ },
125
57
  },
126
58
  },
127
59
  MultiOwnerLightAccount: {
128
60
  "v2.0.0": {
129
- type: "MultiOwnerLightAccount",
130
- version: "v2.0.0",
131
- address: toRecord<Chain, "id", { factory: Address; impl: Address }>(
132
- supportedChains,
133
- "id",
134
- () => ({
61
+ entryPointVersion: "0.7.0",
62
+ addresses: {
63
+ default: {
135
64
  factory:
136
65
  "0x000000000019d2Ee9F2729A65AfE20bb0020AefC".toLowerCase() as Address,
137
66
  impl: "0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D".toLowerCase() as Address,
138
- })
139
- ),
140
- entryPointVersion: "0.7.0",
67
+ },
68
+ },
141
69
  },
142
70
  },
143
71
  };
@@ -146,35 +74,48 @@ export const AccountVersionRegistry: IAccountVersionRegistry = {
146
74
  * Get the default light account version for the given light account type
147
75
  *
148
76
  * @template {LightAccountType} TLightAccountType
149
- * @param type - the light account type to get the default version for
150
- * @returns the default version for the given light account type
77
+ * @returns {LightAccountVersion<TLightAccountType>} the default version for the given light account type
151
78
  */
152
79
  export const defaultLightAccountVersion = <
153
80
  TLightAccountType extends LightAccountType
154
- >(
155
- type: TLightAccountType
156
- ): GetLightAccountVersion<TLightAccountType> =>
157
- (type === "LightAccount"
158
- ? "v1.1.0"
159
- : "v2.0.0") as GetLightAccountVersion<TLightAccountType>;
81
+ >(): LightAccountVersion<TLightAccountType> => "v2.0.0";
160
82
 
161
83
  /**
162
- * Utility method returning the default light account factory address given a {@link Chain} object
84
+ * Utility method returning the default light account factory address given a Chain object
163
85
  *
164
- * @param chain - a {@link Chain} object
165
- * @param version - the version of the light account to get the factory address for
166
- * @returns a {@link Address} for the given chain
86
+ * @param {Chain} chain - a Chain object
87
+ * @param {LightAccountVersion} version - the version of the light account to get the factory address for
88
+ * @returns {Address} an for the given chain
167
89
  * @throws if the chain doesn't have an address currently deployed
168
90
  */
169
91
  export const getDefaultLightAccountFactoryAddress = (
170
92
  chain: Chain,
171
- version: LightAccountVersion = "v1.1.0"
93
+ version: LightAccountVersion<"LightAccount">
172
94
  ): Address => {
173
- const address =
174
- AccountVersionRegistry.LightAccount[version].address[chain.id];
175
- if (!address)
176
- throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
177
- return address.factory;
95
+ return (
96
+ AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]
97
+ ?.factory ??
98
+ AccountVersionRegistry.LightAccount[version].addresses.default.factory
99
+ );
100
+ };
101
+
102
+ /**
103
+ * Utility method returning the default multi owner light account factory address given a Chain object
104
+ *
105
+ * @param {Chain} chain - a Chain object
106
+ * @param {string} version - the version of the light account to get the factory address for
107
+ * @returns {Address} an Address for the given chain
108
+ */
109
+ export const getDefaultMultiOwnerLightAccountFactoryAddress = (
110
+ chain: Chain,
111
+ version: LightAccountVersion<"MultiOwnerLightAccount">
112
+ ) => {
113
+ return (
114
+ AccountVersionRegistry.MultiOwnerLightAccount[version].addresses
115
+ .overrides?.[chain.id]?.factory ??
116
+ AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default
117
+ .factory
118
+ );
178
119
  };
179
120
 
180
121
  /**
@@ -182,7 +123,6 @@ export const getDefaultLightAccountFactoryAddress = (
182
123
  * to not support 1271 signing.
183
124
  *
184
125
  * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.
185
- *
186
126
  */
187
127
  export const LightAccountUnsupported1271Impls = [
188
128
  AccountVersionRegistry.LightAccount["v1.0.1"],
@@ -194,101 +134,62 @@ export const LightAccountUnsupported1271Impls = [
194
134
  * to not support 1271 signing.
195
135
  *
196
136
  * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.
197
- *
198
137
  */
199
138
  export const LightAccountUnsupported1271Factories = new Set(
200
- LightAccountUnsupported1271Impls.map((x) =>
201
- Object.values(x.address).map((addr) => addr.factory)
202
- ).flat()
139
+ LightAccountUnsupported1271Impls.map((x) => [
140
+ x.addresses.default.factory,
141
+ ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),
142
+ ]).flat()
203
143
  );
204
144
 
205
145
  /**
206
146
  * Get the light account version definition for the given light account and chain
207
147
  *
208
148
  * @template {LightAccountBase} TAccount
209
- * @template {GetLightAccountType<TAccount>} TLightAccountType
210
- * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion
211
- * @param account - the light account to get the version for
212
- * @param chain - the chain to get the version for
213
- * @returns the light account version definition for the given light account and chain
214
- */
215
- export async function getLightAccountVersionDef<
216
- TAccount extends LightAccountBase,
217
- TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>,
218
- TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>
219
- >(
220
- account: TAccount,
221
- chain: Chain
222
- ): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;
223
-
224
- /**
225
- * Get the light account version definition for the given light account and chain
226
- *
227
- * @template {LightAccountBase} TAccount
228
- * @template {GetLightAccountType<TAccount>} TLightAccountType
229
- * @param account - the light account to get the version for
230
- * @param chain - the chain to get the version for
231
- * @returns the light account version definition for the given light account and chain
149
+ * @param {LightAccountBase} account the light account to get the version for
150
+ * @param {Chain} chain - the chain to get the version for
151
+ * @returns {Promise<LightAccountVersionConfig>} the light account version definition for the given light account and chain
232
152
  */
233
- export async function getLightAccountVersionDef<
234
- TAccount extends LightAccountBase,
235
- TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>
236
- >(
237
- account: TAccount,
238
- chain: Chain
239
- ): Promise<
240
- AccountVersionDef<
241
- TLightAccountType,
242
- GetLightAccountVersion<TLightAccountType>
243
- >
244
- >;
245
-
246
- /**
247
- * Get the light account version definition for the given light account and chain
248
- *
249
- * @template {LightAccountBase} TAccount
250
- * @param account - the light account to get the version for
251
- * @param chain - the chain to get the version for
252
- * @returns the light account version definition for the given light account and chain
253
- */
254
- export async function getLightAccountVersionDef<
153
+ export async function getLightAccountVersionForAccount<
255
154
  TAccount extends LightAccountBase
256
- >(account: TAccount, chain: Chain): Promise<AccountVersionDef> {
155
+ >(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig> {
257
156
  const accountType = account.source as LightAccountType;
258
157
  const factoryAddress = await account.getFactoryAddress();
259
158
  const implAddress = await account.getImplementationAddress();
260
159
  const implToVersion = new Map(
261
- Object.entries(AccountVersionRegistry[accountType])
262
- .map((pair) => {
263
- const [version, def] = pair as [
264
- GetLightAccountVersionFromAccount<TAccount>,
265
- LightAccountVersionDef
266
- ];
267
- return chain.id in def.address
268
- ? [def.address[chain.id].impl, version]
269
- : [null, version];
270
- })
271
- .filter(([impl]) => impl !== null) as [
272
- Address,
273
- keyof IAccountVersionRegistry[typeof accountType]
274
- ][]
160
+ Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
161
+ const [version, def] = pair as [
162
+ LightAccountVersion<LightAccountType>,
163
+ LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>
164
+ ];
165
+
166
+ if (
167
+ def.addresses.overrides != null &&
168
+ chain.id in def.addresses.overrides!
169
+ ) {
170
+ return [def.addresses.overrides[chain.id].impl, version];
171
+ }
172
+
173
+ return [def.addresses.default.impl, version];
174
+ })
275
175
  );
276
176
 
277
177
  const factoryToVersion = new Map(
278
- Object.entries(AccountVersionRegistry[accountType])
279
- .map((pair) => {
280
- const [version, def] = pair as [
281
- keyof IAccountVersionRegistry[typeof accountType],
282
- LightAccountVersionDef
283
- ];
284
- return chain.id in def.address
285
- ? [def.address[chain.id].factory, version]
286
- : [null, version];
287
- })
288
- .filter(([impl]) => impl !== null) as [
289
- Address,
290
- keyof IAccountVersionRegistry[typeof accountType]
291
- ][]
178
+ Object.entries(AccountVersionRegistry[accountType]).map((pair) => {
179
+ const [version, def] = pair as [
180
+ LightAccountVersion<LightAccountType>,
181
+ LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>
182
+ ];
183
+
184
+ if (
185
+ def.addresses.overrides != null &&
186
+ chain.id in def.addresses.overrides!
187
+ ) {
188
+ return [def.addresses.overrides[chain.id].factory, version];
189
+ }
190
+
191
+ return [def.addresses.default.factory, version];
192
+ })
292
193
  );
293
194
 
294
195
  const version =
@@ -304,36 +205,3 @@ export async function getLightAccountVersionDef<
304
205
 
305
206
  return AccountVersionRegistry[accountType][version];
306
207
  }
307
-
308
- /**
309
- * @param account - the light account to get the version for
310
- * @param chain - the chain to get the version for
311
- *
312
- * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.
313
- * Migrate to using getLightAccountVersionDef instead
314
- *
315
- * @returns the light account version for the given light account and chain
316
- */
317
- export async function getLightAccountVersion<
318
- TAccount extends LightAccountBase,
319
- TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>
320
- >(
321
- account: TAccount,
322
- chain?: Chain
323
- ): Promise<GetLightAccountVersion<TLightAccountType>>;
324
-
325
- /**
326
- * Get the light account version for the given light account and chain
327
- *
328
- * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.
329
- *
330
- * @param account - the light account to get the version for
331
- * @param chain - the chain to get the version for
332
- * @returns the light account version for the given light account and chain
333
- */
334
- export async function getLightAccountVersion(
335
- account: LightAccountBase,
336
- chain: Chain = supportedChains[0]
337
- ): Promise<LightAccountVersion> {
338
- return (await getLightAccountVersionDef(account, chain)).version;
339
- }