@account-kit/smart-contracts 4.0.0-alpha.5 → 4.0.0-alpha.7

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 (98) hide show
  1. package/dist/cjs/src/index.d.ts +1 -1
  2. package/dist/cjs/src/index.js +2 -2
  3. package/dist/cjs/src/index.js.map +1 -1
  4. package/dist/cjs/src/light-account/accounts/account.d.ts +5 -6
  5. package/dist/cjs/src/light-account/accounts/account.js +3 -2
  6. package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
  7. package/dist/cjs/src/light-account/accounts/base.d.ts +7 -6
  8. package/dist/cjs/src/light-account/accounts/base.js +8 -8
  9. package/dist/cjs/src/light-account/accounts/base.js.map +1 -1
  10. package/dist/cjs/src/light-account/accounts/multiOwner.d.ts +5 -5
  11. package/dist/cjs/src/light-account/accounts/multiOwner.js +3 -2
  12. package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
  13. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  14. package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  15. package/dist/cjs/src/light-account/types.d.ts +23 -31
  16. package/dist/cjs/src/light-account/types.js.map +1 -1
  17. package/dist/cjs/src/light-account/utils.d.ts +7 -10
  18. package/dist/cjs/src/light-account/utils.js +59 -88
  19. package/dist/cjs/src/light-account/utils.js.map +1 -1
  20. package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
  21. package/dist/cjs/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  22. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  23. package/dist/cjs/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  24. package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
  25. package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
  26. package/dist/cjs/src/msca/utils.js.map +1 -1
  27. package/dist/esm/src/index.d.ts +1 -1
  28. package/dist/esm/src/index.js +1 -1
  29. package/dist/esm/src/index.js.map +1 -1
  30. package/dist/esm/src/light-account/accounts/account.d.ts +5 -6
  31. package/dist/esm/src/light-account/accounts/account.js +3 -2
  32. package/dist/esm/src/light-account/accounts/account.js.map +1 -1
  33. package/dist/esm/src/light-account/accounts/base.d.ts +7 -6
  34. package/dist/esm/src/light-account/accounts/base.js +8 -8
  35. package/dist/esm/src/light-account/accounts/base.js.map +1 -1
  36. package/dist/esm/src/light-account/accounts/multiOwner.d.ts +5 -5
  37. package/dist/esm/src/light-account/accounts/multiOwner.js +4 -3
  38. package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
  39. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  40. package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
  41. package/dist/esm/src/light-account/types.d.ts +23 -31
  42. package/dist/esm/src/light-account/types.js.map +1 -1
  43. package/dist/esm/src/light-account/utils.d.ts +7 -10
  44. package/dist/esm/src/light-account/utils.js +57 -85
  45. package/dist/esm/src/light-account/utils.js.map +1 -1
  46. package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
  47. package/dist/esm/src/msca/plugins/multisig/utils/formatSignatures.js.map +1 -1
  48. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +3 -2
  49. package/dist/esm/src/msca/plugins/multisig/utils/splitAggregatedSignature.js.map +1 -1
  50. package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
  51. package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
  52. package/dist/esm/src/msca/utils.js.map +1 -1
  53. package/dist/types/src/index.d.ts +1 -1
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/src/light-account/accounts/account.d.ts +5 -6
  56. package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
  57. package/dist/types/src/light-account/accounts/base.d.ts +7 -6
  58. package/dist/types/src/light-account/accounts/base.d.ts.map +1 -1
  59. package/dist/types/src/light-account/accounts/multiOwner.d.ts +5 -5
  60. package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
  61. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
  62. package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
  63. package/dist/types/src/light-account/types.d.ts +23 -118
  64. package/dist/types/src/light-account/types.d.ts.map +1 -1
  65. package/dist/types/src/light-account/utils.d.ts +19 -48
  66. package/dist/types/src/light-account/utils.d.ts.map +1 -1
  67. package/dist/types/src/msca/plugins/multisig/middleware.d.ts +6 -6
  68. package/dist/types/src/msca/plugins/multisig/utils/formatSignatures.d.ts +3 -3
  69. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts +13 -12
  70. package/dist/types/src/msca/plugins/multisig/utils/splitAggregatedSignature.d.ts.map +1 -1
  71. package/dist/types/src/msca/plugins/session-key/permissions.d.ts +147 -1
  72. package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
  73. package/dist/types/src/msca/plugins/session-key/signer.d.ts +71 -1
  74. package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
  75. package/dist/types/src/msca/utils.d.ts +6 -6
  76. package/package.json +6 -5
  77. package/src/index.ts +1 -1
  78. package/src/light-account/accounts/account.ts +24 -45
  79. package/src/light-account/accounts/base.ts +39 -68
  80. package/src/light-account/accounts/multiOwner.ts +29 -43
  81. package/src/light-account/clients/multiOwnerAlchemyClient.ts +1 -1
  82. package/src/light-account/types.ts +31 -188
  83. package/src/light-account/utils.ts +91 -245
  84. package/src/msca/plugins/multisig/middleware.ts +6 -6
  85. package/src/msca/plugins/multisig/utils/formatSignatures.ts +3 -3
  86. package/src/msca/plugins/multisig/utils/splitAggregatedSignature.ts +15 -12
  87. package/src/msca/plugins/session-key/permissions.ts +147 -1
  88. package/src/msca/plugins/session-key/signer.ts +71 -1
  89. package/src/msca/utils.ts +6 -6
  90. package/dist/cjs/src/light-account/schema.d.ts +0 -21
  91. package/dist/cjs/src/light-account/schema.js +0 -30
  92. package/dist/cjs/src/light-account/schema.js.map +0 -1
  93. package/dist/esm/src/light-account/schema.d.ts +0 -21
  94. package/dist/esm/src/light-account/schema.js +0 -27
  95. package/dist/esm/src/light-account/schema.js.map +0 -1
  96. package/dist/types/src/light-account/schema.d.ts +0 -22
  97. package/dist/types/src/light-account/schema.d.ts.map +0 -1
  98. package/src/light-account/schema.ts +0 -39
@@ -7,7 +7,7 @@ export { createMultiOwnerLightAccountAlchemyClient, type AlchemyMultiOwnerLightA
7
7
  export type * from "./light-account/decorators/lightAccount.js";
8
8
  export { lightAccountClientActions } from "./light-account/decorators/lightAccount.js";
9
9
  export type * from "./light-account/types.js";
10
- export { AccountVersionRegistry, LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, defaultLightAccountVersion, getDefaultLightAccountFactoryAddress, getLightAccountVersionDef, } from "./light-account/utils.js";
10
+ export { AccountVersionRegistry, LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, defaultLightAccountVersion, getDefaultLightAccountFactoryAddress, getLightAccountVersionForAccount, } from "./light-account/utils.js";
11
11
  export type * from "./light-account/accounts/multiOwner.js";
12
12
  export { createMultiOwnerLightAccount } from "./light-account/accounts/multiOwner.js";
13
13
  export { updateOwners as updateMultiOwnerLightAccountOwners } from "./light-account/actions/updateOwners.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitAggregatedSignature = exports.getSignerType = exports.formatSignatures = exports.combineSignatures = exports.multisigSignatureMiddleware = exports.multisigPluginActions = exports.MultisigPluginExecutionFunctionAbi = exports.MultisigPluginAbi = exports.MultisigPlugin = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.installPlugin = exports.pluginManagerActions = exports.MultisigMissingSignatureError = exports.MultisigAccountExpectedError = exports.InvalidContextSignatureError = exports.InvalidAggregatedSignatureError = exports.createMultisigAccountAlchemyClient = exports.createMultisigModularAccountClient = exports.createMultiOwnerModularAccountClient = exports.createModularAccountAlchemyClient = exports.standardExecutor = exports.createMultisigModularAccount = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.UpgradeableModularAccountAbi = exports.MultisigModularAccountFactoryAbi = exports.MultiOwnerModularAccountFactoryAbi = exports.IStandardExecutorAbi = exports.IPluginManagerAbi = exports.IPluginAbi = exports.IAccountLoupeAbi = exports.multiOwnerLightAccountClientActions = exports.createMultiOwnerLightAccountClient = exports.updateMultiOwnerLightAccountOwners = exports.createMultiOwnerLightAccount = exports.getLightAccountVersionDef = exports.getDefaultLightAccountFactoryAddress = exports.defaultLightAccountVersion = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.AccountVersionRegistry = exports.lightAccountClientActions = exports.createMultiOwnerLightAccountAlchemyClient = exports.createLightAccountClient = exports.createLightAccountAlchemyClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
3
+ exports.splitAggregatedSignature = exports.getSignerType = exports.formatSignatures = exports.combineSignatures = exports.multisigSignatureMiddleware = exports.multisigPluginActions = exports.MultisigPluginExecutionFunctionAbi = exports.MultisigPluginAbi = exports.MultisigPlugin = exports.MultiOwnerPluginExecutionFunctionAbi = exports.MultiOwnerPluginAbi = exports.MultiOwnerPlugin = exports.multiOwnerPluginActions = exports.installPlugin = exports.pluginManagerActions = exports.MultisigMissingSignatureError = exports.MultisigAccountExpectedError = exports.InvalidContextSignatureError = exports.InvalidAggregatedSignatureError = exports.createMultisigAccountAlchemyClient = exports.createMultisigModularAccountClient = exports.createMultiOwnerModularAccountClient = exports.createModularAccountAlchemyClient = exports.standardExecutor = exports.createMultisigModularAccount = exports.createMultiOwnerModularAccount = exports.accountLoupeActions = exports.UpgradeableModularAccountAbi = exports.MultisigModularAccountFactoryAbi = exports.MultiOwnerModularAccountFactoryAbi = exports.IStandardExecutorAbi = exports.IPluginManagerAbi = exports.IPluginAbi = exports.IAccountLoupeAbi = exports.multiOwnerLightAccountClientActions = exports.createMultiOwnerLightAccountClient = exports.updateMultiOwnerLightAccountOwners = exports.createMultiOwnerLightAccount = exports.getLightAccountVersionForAccount = exports.getDefaultLightAccountFactoryAddress = exports.defaultLightAccountVersion = exports.LightAccountUnsupported1271Impls = exports.LightAccountUnsupported1271Factories = exports.AccountVersionRegistry = exports.lightAccountClientActions = exports.createMultiOwnerLightAccountAlchemyClient = exports.createLightAccountClient = exports.createLightAccountAlchemyClient = exports.transferLightAccountOwnership = exports.createLightAccount = void 0;
4
4
  exports.getMSCAUpgradeToData = exports.getMAInitializationData = exports.getDefaultMultisigModularAccountFactoryAddress = exports.getDefaultMultiOwnerModularAccountFactoryAddress = exports.buildSessionKeysToRemoveStruct = exports.SessionKeySigner = exports.SessionKeyPluginExecutionFunctionAbi = exports.SessionKeyPluginAbi = exports.SessionKeyPlugin = exports.SessionKeyPermissionsBuilder = exports.SessionKeyAccessListType = exports.sessionKeyPluginActions = void 0;
5
5
  var account_js_1 = require("./light-account/accounts/account.js");
6
6
  Object.defineProperty(exports, "createLightAccount", { enumerable: true, get: function () { return account_js_1.createLightAccount; } });
@@ -20,7 +20,7 @@ Object.defineProperty(exports, "LightAccountUnsupported1271Factories", { enumera
20
20
  Object.defineProperty(exports, "LightAccountUnsupported1271Impls", { enumerable: true, get: function () { return utils_js_1.LightAccountUnsupported1271Impls; } });
21
21
  Object.defineProperty(exports, "defaultLightAccountVersion", { enumerable: true, get: function () { return utils_js_1.defaultLightAccountVersion; } });
22
22
  Object.defineProperty(exports, "getDefaultLightAccountFactoryAddress", { enumerable: true, get: function () { return utils_js_1.getDefaultLightAccountFactoryAddress; } });
23
- Object.defineProperty(exports, "getLightAccountVersionDef", { enumerable: true, get: function () { return utils_js_1.getLightAccountVersionDef; } });
23
+ Object.defineProperty(exports, "getLightAccountVersionForAccount", { enumerable: true, get: function () { return utils_js_1.getLightAccountVersionForAccount; } });
24
24
  var multiOwner_js_1 = require("./light-account/accounts/multiOwner.js");
25
25
  Object.defineProperty(exports, "createMultiOwnerLightAccount", { enumerable: true, get: function () { return multiOwner_js_1.createMultiOwnerLightAccount; } });
26
26
  var updateOwners_js_1 = require("./light-account/actions/updateOwners.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;AAKA,kEAAyE;AAAhE,gHAAA,kBAAkB,OAAA;AAC3B,qFAAkH;AAAzG,qIAAA,iBAAiB,OAAiC;AAC3D,6EAGkD;AAFhD,mIAAA,+BAA+B,OAAA;AAGjC,+DAA6E;AAApE,qHAAA,wBAAwB,OAAA;AACjC,iGAG4D;AAF1D,uJAAA,yCAAyC,OAAA;AAI3C,8EAAuF;AAA9E,4HAAA,yBAAyB,OAAA;AAGlC,qDAOkC;AANhC,kHAAA,sBAAsB,OAAA;AACtB,gIAAA,oCAAoC,OAAA;AACpC,4HAAA,gCAAgC,OAAA;AAChC,sHAAA,0BAA0B,OAAA;AAC1B,gIAAA,oCAAoC,OAAA;AACpC,qHAAA,yBAAyB,OAAA;AAK3B,wEAAsF;AAA7E,6HAAA,4BAA4B,OAAA;AACrC,2EAA6G;AAApG,qIAAA,YAAY,OAAsC;AAC3D,+FAAuG;AAA9F,+IAAA,kCAAkC,OAAA;AAE3C,kGAA2G;AAAlG,gJAAA,mCAAmC,OAAA;AAG5C,iEAAgE;AAAvD,oHAAA,gBAAgB,OAAA;AACzB,qDAAoD;AAA3C,wGAAA,UAAU,OAAA;AACnB,mEAAkE;AAAzD,sHAAA,iBAAiB,OAAA;AAC1B,yEAAwE;AAA/D,4HAAA,oBAAoB,OAAA;AAC7B,qGAAoG;AAA3F,wJAAA,kCAAkC,OAAA;AAC3C,iGAAgG;AAAvF,oJAAA,gCAAgC,OAAA;AACzC,yFAAwF;AAA/E,4IAAA,4BAA4B,OAAA;AAErC,kEAAwE;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;AAA5E,0HAAA,8BAA8B,OAAA;AAEvC,4CAKyB;AAJvB,4IAAA,gDAAgD,OAAA;AAChD,0IAAA,8CAA8C,OAAA;AAC9C,mHAAA,uBAAuB,OAAA;AACvB,gHAAA,oBAAoB,OAAA","sourcesContent":["// Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them\n// Don't use wildcard exports, instead use named exports\n\n//light-account exports\nexport type * from \"./light-account/accounts/account.js\";\nexport { createLightAccount } from \"./light-account/accounts/account.js\";\nexport { transferOwnership as transferLightAccountOwnership } from \"./light-account/actions/transferOwnership.js\";\nexport {\n createLightAccountAlchemyClient,\n type AlchemyLightAccountClientConfig,\n} from \"./light-account/clients/alchemyClient.js\";\nexport { createLightAccountClient } from \"./light-account/clients/client.js\";\nexport {\n createMultiOwnerLightAccountAlchemyClient,\n type AlchemyMultiOwnerLightAccountClientConfig,\n} from \"./light-account/clients/multiOwnerAlchemyClient.js\";\nexport type * from \"./light-account/decorators/lightAccount.js\";\nexport { lightAccountClientActions } from \"./light-account/decorators/lightAccount.js\";\nexport type * from \"./light-account/types.js\";\n\nexport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n getLightAccountVersionDef,\n} from \"./light-account/utils.js\";\n\n//multi-owner-light-account exports\nexport type * from \"./light-account/accounts/multiOwner.js\";\nexport { createMultiOwnerLightAccount } from \"./light-account/accounts/multiOwner.js\";\nexport { updateOwners as updateMultiOwnerLightAccountOwners } from \"./light-account/actions/updateOwners.js\";\nexport { createMultiOwnerLightAccountClient } from \"./light-account/clients/multiOwnerLightAccount.js\";\nexport type * from \"./light-account/decorators/multiOwnerLightAccount.js\";\nexport { multiOwnerLightAccountClientActions } from \"./light-account/decorators/multiOwnerLightAccount.js\";\n\n// msca exports\nexport { IAccountLoupeAbi } from \"./msca/abis/IAccountLoupe.js\";\nexport { IPluginAbi } from \"./msca/abis/IPlugin.js\";\nexport { IPluginManagerAbi } from \"./msca/abis/IPluginManager.js\";\nexport { IStandardExecutorAbi } from \"./msca/abis/IStandardExecutor.js\";\nexport { MultiOwnerModularAccountFactoryAbi } from \"./msca/abis/MultiOwnerModularAccountFactory.js\";\nexport { MultisigModularAccountFactoryAbi } from \"./msca/abis/MultisigModularAccountFactory.js\";\nexport { UpgradeableModularAccountAbi } from \"./msca/abis/UpgradeableModularAccount.js\";\nexport type * from \"./msca/account-loupe/decorator.js\";\nexport { accountLoupeActions } from \"./msca/account-loupe/decorator.js\";\nexport type * from \"./msca/account-loupe/types.js\";\nexport type * from \"./msca/account/multiOwnerAccount.js\";\nexport { createMultiOwnerModularAccount } from \"./msca/account/multiOwnerAccount.js\";\nexport type * from \"./msca/account/multisigAccount.js\";\nexport { createMultisigModularAccount } from \"./msca/account/multisigAccount.js\";\nexport { standardExecutor } from \"./msca/account/standardExecutor.js\";\nexport {\n createModularAccountAlchemyClient,\n type AlchemyModularAccountClientConfig,\n} from \"./msca/client/alchemyClient.js\";\nexport {\n createMultiOwnerModularAccountClient,\n createMultisigModularAccountClient,\n} from \"./msca/client/client.js\";\nexport {\n createMultisigAccountAlchemyClient,\n type AlchemyMultisigAccountClientConfig,\n} from \"./msca/client/multiSigAlchemyClient.js\";\nexport {\n InvalidAggregatedSignatureError,\n InvalidContextSignatureError,\n MultisigAccountExpectedError,\n MultisigMissingSignatureError,\n} from \"./msca/errors.js\";\nexport type * from \"./msca/plugin-manager/decorator.js\";\nexport { pluginManagerActions } from \"./msca/plugin-manager/decorator.js\";\nexport { installPlugin } from \"./msca/plugin-manager/installPlugin.js\";\nexport { multiOwnerPluginActions } from \"./msca/plugins/multi-owner/extension.js\";\nexport type * from \"./msca/plugins/multi-owner/index.js\";\nexport {\n MultiOwnerPlugin,\n MultiOwnerPluginAbi,\n MultiOwnerPluginExecutionFunctionAbi,\n} from \"./msca/plugins/multi-owner/plugin.js\";\nexport type * from \"./msca/plugins/multisig/index.js\";\nexport {\n MultisigPlugin,\n MultisigPluginAbi,\n MultisigPluginExecutionFunctionAbi,\n multisigPluginActions,\n multisigSignatureMiddleware,\n} from \"./msca/plugins/multisig/index.js\";\nexport {\n combineSignatures,\n formatSignatures,\n getSignerType,\n splitAggregatedSignature,\n} from \"./msca/plugins/multisig/utils/index.js\";\nexport { sessionKeyPluginActions } from \"./msca/plugins/session-key/extension.js\";\nexport type * from \"./msca/plugins/session-key/index.js\";\nexport type * from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyAccessListType,\n SessionKeyPermissionsBuilder,\n} from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyPlugin,\n SessionKeyPluginAbi,\n SessionKeyPluginExecutionFunctionAbi,\n} from \"./msca/plugins/session-key/plugin.js\";\nexport { SessionKeySigner } from \"./msca/plugins/session-key/signer.js\";\nexport { buildSessionKeysToRemoveStruct } from \"./msca/plugins/session-key/utils.js\";\nexport type * from \"./msca/plugins/types.js\";\nexport {\n getDefaultMultiOwnerModularAccountFactoryAddress,\n getDefaultMultisigModularAccountFactoryAddress,\n getMAInitializationData,\n getMSCAUpgradeToData,\n} from \"./msca/utils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;AAKA,kEAAyE;AAAhE,gHAAA,kBAAkB,OAAA;AAC3B,qFAAkH;AAAzG,qIAAA,iBAAiB,OAAiC;AAC3D,6EAGkD;AAFhD,mIAAA,+BAA+B,OAAA;AAGjC,+DAA6E;AAApE,qHAAA,wBAAwB,OAAA;AACjC,iGAG4D;AAF1D,uJAAA,yCAAyC,OAAA;AAI3C,8EAAuF;AAA9E,4HAAA,yBAAyB,OAAA;AAGlC,qDAOkC;AANhC,kHAAA,sBAAsB,OAAA;AACtB,gIAAA,oCAAoC,OAAA;AACpC,4HAAA,gCAAgC,OAAA;AAChC,sHAAA,0BAA0B,OAAA;AAC1B,gIAAA,oCAAoC,OAAA;AACpC,4HAAA,gCAAgC,OAAA;AA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iB,OAAA;AACjB,8HAAA,kCAAkC,OAAA;AAClC,iHAAA,qBAAqB,OAAA;AACrB,uHAAA,2BAA2B,OAAA;AAE7B,mEAKgD;AAJ9C,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,yGAAA,aAAa,OAAA;AACb,oHAAA,wBAAwB,OAAA;AAE1B,wEAAkF;AAAzE,uHAAA,uBAAuB,OAAA;AAGhC,4EAGmD;AAFjD,0HAAA,wBAAwB,OAAA;AACxB,8HAAA,4BAA4B,OAAA;AAE9B,kEAI8C;AAH5C,6GAAA,gBAAgB,OAAA;AAChB,gHAAA,mBAAmB,OAAA;AACnB,iIAAA,oCAAoC,OAAA;AAEtC,kEAAwE;AAA/D,6GAAA,gBAAgB,OAAA;AACzB,gEAAqF;AAA5E,0HAAA,8BAA8B,OAAA;AAEvC,4CAKyB;AAJvB,4IAAA,gDAAgD,OAAA;AAChD,0IAAA,8CAA8C,OAAA;AAC9C,mHAAA,uBAAuB,OAAA;AACvB,gHAAA,oBAAoB,OAAA","sourcesContent":["// Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them\n// Don't use wildcard exports, instead use named exports\n\n//light-account exports\nexport type * from \"./light-account/accounts/account.js\";\nexport { createLightAccount } from \"./light-account/accounts/account.js\";\nexport { transferOwnership as transferLightAccountOwnership } from \"./light-account/actions/transferOwnership.js\";\nexport {\n createLightAccountAlchemyClient,\n type AlchemyLightAccountClientConfig,\n} from \"./light-account/clients/alchemyClient.js\";\nexport { createLightAccountClient } from \"./light-account/clients/client.js\";\nexport {\n createMultiOwnerLightAccountAlchemyClient,\n type AlchemyMultiOwnerLightAccountClientConfig,\n} from \"./light-account/clients/multiOwnerAlchemyClient.js\";\nexport type * from \"./light-account/decorators/lightAccount.js\";\nexport { lightAccountClientActions } from \"./light-account/decorators/lightAccount.js\";\nexport type * from \"./light-account/types.js\";\n\nexport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n getLightAccountVersionForAccount,\n} from \"./light-account/utils.js\";\n\n//multi-owner-light-account exports\nexport type * from \"./light-account/accounts/multiOwner.js\";\nexport { createMultiOwnerLightAccount } from \"./light-account/accounts/multiOwner.js\";\nexport { updateOwners as updateMultiOwnerLightAccountOwners } from \"./light-account/actions/updateOwners.js\";\nexport { createMultiOwnerLightAccountClient } from \"./light-account/clients/multiOwnerLightAccount.js\";\nexport type * from \"./light-account/decorators/multiOwnerLightAccount.js\";\nexport { multiOwnerLightAccountClientActions } from \"./light-account/decorators/multiOwnerLightAccount.js\";\n\n// msca exports\nexport { IAccountLoupeAbi } from \"./msca/abis/IAccountLoupe.js\";\nexport { IPluginAbi } from \"./msca/abis/IPlugin.js\";\nexport { IPluginManagerAbi } from \"./msca/abis/IPluginManager.js\";\nexport { IStandardExecutorAbi } from \"./msca/abis/IStandardExecutor.js\";\nexport { MultiOwnerModularAccountFactoryAbi } from \"./msca/abis/MultiOwnerModularAccountFactory.js\";\nexport { MultisigModularAccountFactoryAbi } from \"./msca/abis/MultisigModularAccountFactory.js\";\nexport { UpgradeableModularAccountAbi } from \"./msca/abis/UpgradeableModularAccount.js\";\nexport type * from \"./msca/account-loupe/decorator.js\";\nexport { accountLoupeActions } from \"./msca/account-loupe/decorator.js\";\nexport type * from \"./msca/account-loupe/types.js\";\nexport type * from \"./msca/account/multiOwnerAccount.js\";\nexport { createMultiOwnerModularAccount } from \"./msca/account/multiOwnerAccount.js\";\nexport type * from \"./msca/account/multisigAccount.js\";\nexport { createMultisigModularAccount } from \"./msca/account/multisigAccount.js\";\nexport { standardExecutor } from \"./msca/account/standardExecutor.js\";\nexport {\n createModularAccountAlchemyClient,\n type AlchemyModularAccountClientConfig,\n} from \"./msca/client/alchemyClient.js\";\nexport {\n createMultiOwnerModularAccountClient,\n createMultisigModularAccountClient,\n} from \"./msca/client/client.js\";\nexport {\n createMultisigAccountAlchemyClient,\n type AlchemyMultisigAccountClientConfig,\n} from \"./msca/client/multiSigAlchemyClient.js\";\nexport {\n InvalidAggregatedSignatureError,\n InvalidContextSignatureError,\n MultisigAccountExpectedError,\n MultisigMissingSignatureError,\n} from \"./msca/errors.js\";\nexport type * from \"./msca/plugin-manager/decorator.js\";\nexport { pluginManagerActions } from \"./msca/plugin-manager/decorator.js\";\nexport { installPlugin } from \"./msca/plugin-manager/installPlugin.js\";\nexport { multiOwnerPluginActions } from \"./msca/plugins/multi-owner/extension.js\";\nexport type * from \"./msca/plugins/multi-owner/index.js\";\nexport {\n MultiOwnerPlugin,\n MultiOwnerPluginAbi,\n MultiOwnerPluginExecutionFunctionAbi,\n} from \"./msca/plugins/multi-owner/plugin.js\";\nexport type * from \"./msca/plugins/multisig/index.js\";\nexport {\n MultisigPlugin,\n MultisigPluginAbi,\n MultisigPluginExecutionFunctionAbi,\n multisigPluginActions,\n multisigSignatureMiddleware,\n} from \"./msca/plugins/multisig/index.js\";\nexport {\n combineSignatures,\n formatSignatures,\n getSignerType,\n splitAggregatedSignature,\n} from \"./msca/plugins/multisig/utils/index.js\";\nexport { sessionKeyPluginActions } from \"./msca/plugins/session-key/extension.js\";\nexport type * from \"./msca/plugins/session-key/index.js\";\nexport type * from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyAccessListType,\n SessionKeyPermissionsBuilder,\n} from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyPlugin,\n SessionKeyPluginAbi,\n SessionKeyPluginExecutionFunctionAbi,\n} from \"./msca/plugins/session-key/plugin.js\";\nexport { SessionKeySigner } from \"./msca/plugins/session-key/signer.js\";\nexport { buildSessionKeysToRemoveStruct } from \"./msca/plugins/session-key/utils.js\";\nexport type * from \"./msca/plugins/types.js\";\nexport {\n getDefaultMultiOwnerModularAccountFactoryAddress,\n getDefaultMultisigModularAccountFactoryAddress,\n getMAInitializationData,\n getMSCAUpgradeToData,\n} from \"./msca/utils.js\";\n"]}
@@ -1,18 +1,17 @@
1
1
  import { type Address, type EntryPointDef, type SmartAccountSigner } from "@aa-sdk/core";
2
2
  import { type Chain, type Hex, type Transport } from "viem";
3
- import type { GetEntryPointForLightAccountVersion, GetLightAccountVersion } from "../types.js";
3
+ import type { LightAccountEntryPointVersion, LightAccountVersion } from "../types.js";
4
4
  import { type CreateLightAccountBaseParams, type LightAccountBase } from "./base.js";
5
- export type LightAccount<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>> = LightAccountBase<TSigner, "LightAccount", TLightAccountVersion, TEntryPointVersion> & {
5
+ export type LightAccount<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"LightAccount"> = LightAccountVersion<"LightAccount">> = LightAccountBase<TSigner, "LightAccount", TLightAccountVersion> & {
6
6
  encodeTransferOwnership: (newOwner: Address) => Hex;
7
7
  getOwnerAddress: () => Promise<Address>;
8
8
  };
9
- export type CreateLightAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>> = Omit<CreateLightAccountBaseParams<TTransport, TSigner, "LightAccount", TLightAccountVersion, TEntryPointVersion>, "getAccountInitCode" | "entryPoint" | "version" | "abi" | "accountAddress"> & {
9
+ export type CreateLightAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"LightAccount"> = LightAccountVersion<"LightAccount">> = Omit<CreateLightAccountBaseParams<"LightAccount", TLightAccountVersion, TTransport, TSigner>, "getAccountInitCode" | "entryPoint" | "version" | "abi" | "accountAddress" | "type"> & {
10
10
  salt?: bigint;
11
11
  initCode?: Hex;
12
12
  accountAddress?: Address;
13
13
  factoryAddress?: Address;
14
14
  version?: TLightAccountVersion;
15
- entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;
15
+ entryPoint?: EntryPointDef<LightAccountEntryPointVersion<"LightAccount", TLightAccountVersion>, Chain>;
16
16
  };
17
- export declare function createLightAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = "v1.1.0">(config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>): Promise<LightAccount<TSigner, TLightAccountVersion>>;
18
- export declare function createLightAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"LightAccount"> = GetLightAccountVersion<"LightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"LightAccount", TLightAccountVersion>>(config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion, TEntryPointVersion>): Promise<LightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>>;
17
+ export declare function createLightAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"LightAccount"> = "v2.0.0">(config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>): Promise<LightAccount<TSigner, TLightAccountVersion>>;
@@ -9,7 +9,7 @@ const LightAccountFactoryAbi_v1_js_1 = require("../abis/LightAccountFactoryAbi_v
9
9
  const LightAccountFactoryAbi_v2_js_1 = require("../abis/LightAccountFactoryAbi_v2.js");
10
10
  const utils_js_1 = require("../utils.js");
11
11
  const base_js_1 = require("./base.js");
12
- async function createLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)("LightAccount"), entryPoint = (0, core_1.getEntryPoint)(chain, {
12
+ async function createLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)(), entryPoint = (0, core_1.getEntryPoint)(chain, {
13
13
  version: utils_js_1.AccountVersionRegistry["LightAccount"][version]
14
14
  .entryPointVersion,
15
15
  }), accountAddress, factoryAddress = (0, utils_js_1.getDefaultLightAccountFactoryAddress)(chain, version), salt: salt_ = 0n, }) {
@@ -47,7 +47,8 @@ async function createLightAccount({ transport, chain, signer, initCode, version
47
47
  chain,
48
48
  signer,
49
49
  abi: accountAbi,
50
- version: utils_js_1.AccountVersionRegistry["LightAccount"][version],
50
+ type: "LightAccount",
51
+ version,
51
52
  entryPoint,
52
53
  accountAddress: address,
53
54
  getAccountInitCode,
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/account.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AACtB,+BAMc;AACd,yEAAmE;AACnE,yEAAmE;AACnE,uFAAiF;AACjF,uFAAiF;AAKjF,0CAKqB;AACrB,uCAImB;AA4FZ,KAAK,UAAU,kBAAkB,CAAC,EACvC,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAA,qCAA0B,EAAC,cAAc,CAAC,EACpD,UAAU,GAAG,IAAA,oBAAa,EAAC,KAAK,EAAE;IAChC,OAAO,EAAE,iCAAsB,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;SACrD,iBAAwB;CAC5B,CAAC,EACF,cAAc,EACd,cAAc,GAAG,IAAA,+CAAoC,EAAC,KAAK,EAAE,OAAO,CAAC,EACrE,IAAI,EAAE,KAAK,GAAG,EAAE,GACS;IACzB,MAAM,MAAM,GAAG,IAAA,0BAAmB,EAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,0CAAkB,CAAC,CAAC,CAAC,0CAAkB,CAAC;IACjE,M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,GAAG,EAAE,UAAU;gBACf,YAAY,EAAE,OAAO;aACtB,CAAC,CAAC;YAEH,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AA3FD,gDA2FC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n type Address,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\nimport { LightAccountAbi_v2 } from \"../abis/LightAccountAbi_v2.js\";\nimport { LightAccountFactoryAbi_v1 } from \"../abis/LightAccountFactoryAbi_v1.js\";\nimport { LightAccountFactoryAbi_v2 } from \"../abis/LightAccountFactoryAbi_v2.js\";\nimport type {\n GetEntryPointForLightAccountVersion,\n GetLightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type LightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"LightAccount\"> = GetLightAccountVersion<\"LightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"LightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\"LightAccount\", TLightAccountVersion>\n> = LightAccountBase<\n TSigner,\n \"LightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n> & {\n encodeTransferOwnership: (newOwner: Address) => Hex;\n getOwnerAddress: () => Promise<Address>;\n};\n\n// [!region CreateLightAccountParams]\nexport type CreateLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"LightAccount\"> = GetLightAccountVersion<\"LightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"LightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\"LightAccount\", TLightAccountVersion>\n> = Omit<\n CreateLightAccountBaseParams<\n TTransport,\n TSigner,\n \"LightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n >,\n \"getAccountInitCode\" | \"entryPoint\" | \"version\" | \"abi\" | \"accountAddress\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;\n};\n// [!endregion CreateLightAccountParams]\n\nexport async function createLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"LightAccount\"> = \"v1.1.0\"\n>(\n config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>\n): Promise<LightAccount<TSigner, TLightAccountVersion>>;\n\nexport async function createLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"LightAccount\"> = GetLightAccountVersion<\"LightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"LightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\"LightAccount\", TLightAccountVersion>\n>(\n config: CreateLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion,\n TEntryPointVersion\n >\n): Promise<LightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>>;\n\n/**\n * Creates a light account based on the provided parameters such as transport, chain, signer, init code, and more. Ensures that an account is configured and returned with various capabilities, such as transferring ownership and retrieving the owner's address.\n *\n * @example\n * ```ts\n * import { createLightAccount } 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 createLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountParams} config The parameters for creating a light account\n * @returns {Promise<LightAccount>} A promise that resolves to a `LightAccount` object containing the created account information and methods\n */\nexport async function createLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(\"LightAccount\"),\n entryPoint = getEntryPoint(chain, {\n version: AccountVersionRegistry[\"LightAccount\"][version]\n .entryPointVersion as any,\n }),\n accountAddress,\n factoryAddress = getDefaultLightAccountFactoryAddress(chain, version),\n salt: salt_ = 0n,\n}: CreateLightAccountParams): Promise<LightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const accountAbi =\n version === \"v2.0.0\" ? LightAccountAbi_v2 : LightAccountAbi_v1;\n const factoryAbi =\n version === \"v2.0.0\"\n ? LightAccountFactoryAbi_v1\n : LightAccountFactoryAbi_v2;\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n const salt = LightAccountUnsupported1271Factories.has(\n factoryAddress.toLowerCase() as Address\n )\n ? 0n\n : salt_;\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: factoryAbi,\n functionName: \"createAccount\",\n args: [await signer.getAddress(), salt],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n Transport,\n SmartAccountSigner,\n \"LightAccount\"\n >({\n transport,\n chain,\n signer,\n abi: accountAbi,\n version: AccountVersionRegistry[\"LightAccount\"][version],\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n\n encodeTransferOwnership: (newOwner: Address) => {\n return encodeFunctionData({\n abi: accountAbi,\n functionName: \"transferOwnership\",\n args: [newOwner],\n });\n },\n async getOwnerAddress(): Promise<Address> {\n const callResult = await client.readContract({\n address,\n abi: accountAbi,\n functionName: \"owner\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owner\");\n }\n\n return callResult;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/account.ts"],"names":[],"mappings":";;;AAAA,uCAOsB;AACtB,+BAMc;AACd,yEAAmE;AACnE,yEAAmE;AACnE,uFAAiF;AACjF,uFAAiF;AAKjF,0CAKqB;AACrB,uCAImB;AAqEZ,KAAK,UAAU,kBAAkB,CAAC,EACvC,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAA,qCAA0B,GAAE,EACtC,UAAU,GAAG,IAAA,oBAAa,EAAC,KAAK,EAAE;IAChC,OAAO,EAAE,iCAAsB,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC;SACrD,iBAAwB;CAC5B,CAAC,EACF,cAAc,EACd,cAAc,GAAG,IAAA,+CAAoC,EAAC,KAAK,EAAE,OAAO,CAAC,EACrE,IAAI,EAAE,KAAK,GAAG,EAAE,GACS;IACzB,MAAM,MAAM,GAAG,IAAA,0BAAmB,EAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,0CAAkB,CAAC,CAAC,CAAC,0CAAkB,CAAC;IACjE,MAAM,UAAU,GACd,OAAO,KAAK,QAAQ;QAClB,CAAC,CAAC,wDAAyB;QAC3B,CAAC,CAAC,wDAAyB,CAAC;IAEhC,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,MAAM,IAAI,GAAG,+CAAoC,CAAC,GAAG,CACnD,cAAc,CAAC,WAAW,EAAa,CACxC;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,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\nimport { LightAccountAbi_v2 } from \"../abis/LightAccountAbi_v2.js\";\nimport { LightAccountFactoryAbi_v1 } from \"../abis/LightAccountFactoryAbi_v1.js\";\nimport { LightAccountFactoryAbi_v2 } from \"../abis/LightAccountFactoryAbi_v2.js\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type LightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"LightAccount\"> = LightAccountVersion<\"LightAccount\">\n> = LightAccountBase<TSigner, \"LightAccount\", TLightAccountVersion> & {\n encodeTransferOwnership: (newOwner: Address) => Hex;\n getOwnerAddress: () => Promise<Address>;\n};\n\n// [!region CreateLightAccountParams]\nexport type CreateLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"LightAccount\"> = LightAccountVersion<\"LightAccount\">\n> = Omit<\n CreateLightAccountBaseParams<\n \"LightAccount\",\n TLightAccountVersion,\n TTransport,\n TSigner\n >,\n | \"getAccountInitCode\"\n | \"entryPoint\"\n | \"version\"\n | \"abi\"\n | \"accountAddress\"\n | \"type\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<\n LightAccountEntryPointVersion<\"LightAccount\", TLightAccountVersion>,\n Chain\n >;\n};\n// [!endregion CreateLightAccountParams]\n\nexport async function createLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"LightAccount\"> = \"v2.0.0\"\n>(\n config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>\n): Promise<LightAccount<TSigner, TLightAccountVersion>>;\n\n/**\n * Creates a light account based on the provided parameters such as transport, chain, signer, init code, and more. Ensures that an account is configured and returned with various capabilities, such as transferring ownership and retrieving the owner's address.\n *\n * @example\n * ```ts\n * import { createLightAccount } 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 createLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountParams} config The parameters for creating a light account\n * @returns {Promise<LightAccount>} A promise that resolves to a `LightAccount` object containing the created account information and methods\n */\nexport async function createLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(),\n entryPoint = getEntryPoint(chain, {\n version: AccountVersionRegistry[\"LightAccount\"][version]\n .entryPointVersion as any,\n }),\n accountAddress,\n factoryAddress = getDefaultLightAccountFactoryAddress(chain, version),\n salt: salt_ = 0n,\n}: CreateLightAccountParams): Promise<LightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const accountAbi =\n version === \"v2.0.0\" ? LightAccountAbi_v2 : LightAccountAbi_v1;\n const factoryAbi =\n version === \"v2.0.0\"\n ? LightAccountFactoryAbi_v1\n : LightAccountFactoryAbi_v2;\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n const salt = LightAccountUnsupported1271Factories.has(\n factoryAddress.toLowerCase() as Address\n )\n ? 0n\n : salt_;\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: factoryAbi,\n functionName: \"createAccount\",\n args: [await signer.getAddress(), salt],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n \"LightAccount\",\n LightAccountVersion<\"LightAccount\">,\n Transport,\n SmartAccountSigner\n >({\n transport,\n chain,\n signer,\n abi: accountAbi,\n type: \"LightAccount\",\n version,\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n\n encodeTransferOwnership: (newOwner: Address) => {\n return encodeFunctionData({\n abi: accountAbi,\n functionName: \"transferOwnership\",\n args: [newOwner],\n });\n },\n async getOwnerAddress(): Promise<Address> {\n const callResult = await client.readContract({\n address,\n abi: accountAbi,\n functionName: \"owner\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owner\");\n }\n\n return callResult;\n },\n };\n}\n"]}
@@ -1,14 +1,15 @@
1
1
  import { type Abi, type EntryPointDef, type SmartAccountSigner, type SmartContractAccountWithSigner, type ToSmartContractAccountParams } from "@aa-sdk/core";
2
2
  import { type Address, type Chain, type Transport } from "viem";
3
- import type { GetEntryPointForLightAccountVersion, GetLightAccountVersion, LightAccountType, LightAccountVersionDef } from "../types.js";
4
- export type LightAccountBase<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>, TEntryPointVersion extends GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion> = GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion>> = SmartContractAccountWithSigner<TLightAccountType, TSigner, TEntryPointVersion> & {
3
+ import type { LightAccountEntryPointVersion, LightAccountType, LightAccountVersion } from "../types.js";
4
+ export type LightAccountBase<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = SmartContractAccountWithSigner<TLightAccountType, TSigner, LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>> & {
5
5
  getLightAccountVersion: () => TLightAccountVersion;
6
6
  };
7
- export type CreateLightAccountBaseParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>, TEntryPointVersion extends GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion> = GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion>> = Pick<ToSmartContractAccountParams<TLightAccountType, TTransport, Chain, TEntryPointVersion>, "transport" | "chain" | "getAccountInitCode"> & {
7
+ export type CreateLightAccountBaseParams<TLightAccountType extends LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>, TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner> = Pick<ToSmartContractAccountParams<TLightAccountType, TTransport, Chain>, "transport" | "chain" | "getAccountInitCode"> & {
8
8
  abi: Abi;
9
9
  signer: TSigner;
10
10
  accountAddress: Address;
11
- version: LightAccountVersionDef<TLightAccountType, TLightAccountVersion>;
12
- entryPoint: EntryPointDef<TEntryPointVersion, Chain>;
11
+ type: TLightAccountType;
12
+ version: TLightAccountVersion;
13
+ entryPoint: EntryPointDef<LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>, Chain>;
13
14
  };
14
- export declare function createLightAccountBase<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>, TEntryPointVersion extends GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion> = GetEntryPointForLightAccountVersion<TLightAccountType, TLightAccountVersion>>(config: CreateLightAccountBaseParams<TTransport, TSigner, TLightAccountType, TLightAccountVersion, TEntryPointVersion>): Promise<LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion, TEntryPointVersion>>;
15
+ export declare function createLightAccountBase<TLightAccountType extends LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType>, TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner>({ transport, chain, signer, abi, version, type, entryPoint, accountAddress, getAccountInitCode, }: CreateLightAccountBaseParams<TLightAccountType, TLightAccountVersion, TTransport, TSigner>): Promise<LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion>>;
@@ -10,7 +10,7 @@ var SignatureType;
10
10
  SignatureType["CONTRACT"] = "0x01";
11
11
  SignatureType["CONTRACT_WITH_ADDR"] = "0x02";
12
12
  })(SignatureType || (SignatureType = {}));
13
- async function createLightAccountBase({ transport, chain, signer, abi, version: { version, type }, entryPoint, accountAddress, getAccountInitCode, }) {
13
+ async function createLightAccountBase({ transport, chain, signer, abi, version, type, entryPoint, accountAddress, getAccountInitCode, }) {
14
14
  const client = (0, core_1.createBundlerClient)({
15
15
  transport,
16
16
  chain,
@@ -23,10 +23,10 @@ async function createLightAccountBase({ transport, chain, signer, abi, version:
23
23
  if (storage == null) {
24
24
  throw new core_1.FailedToGetStorageSlotError("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", "Proxy Implementation Address");
25
25
  }
26
- const implementationAddresses = Object.values(utils_js_1.AccountVersionRegistry[type]).map((x) => x.address[chain.id].impl);
26
+ const implementationAddresses = Object.values(utils_js_1.AccountVersionRegistry[type]).map((x) => x.addresses.overrides?.[chain.id]?.impl ?? x.addresses.default.impl);
27
27
  if ((0, viem_1.fromHex)(storage, "number") !== 0 &&
28
28
  !implementationAddresses.some((x) => x === (0, viem_1.trim)(storage))) {
29
- throw new Error(`could not determine if smart account implementation is ${type} ${version}`);
29
+ throw new Error(`could not determine if smart account implementation is ${type} ${String(version)}`);
30
30
  }
31
31
  return (0, viem_1.encodeFunctionData)({
32
32
  abi,
@@ -92,14 +92,14 @@ async function createLightAccountBase({ transport, chain, signer, abi, version:
92
92
  case "v1.0.1":
93
93
  return signer.signMessage(message);
94
94
  case "v1.0.2":
95
- throw new Error(`${type} ${version} doesn't support 1271`);
95
+ throw new Error(`${type} ${String(version)} doesn't support 1271`);
96
96
  case "v1.1.0":
97
97
  return signWith1271WrapperV1((0, viem_1.hashMessage)(message));
98
98
  case "v2.0.0":
99
99
  const signature = await signWith1271WrapperV1((0, viem_1.hashMessage)(message));
100
100
  return (0, viem_1.concat)([SignatureType.EOA, signature]);
101
101
  default:
102
- throw new Error(`Unknown version ${type} of ${version}`);
102
+ throw new Error(`Unknown version ${type} of ${String(version)}`);
103
103
  }
104
104
  },
105
105
  async signTypedData(params) {
@@ -107,14 +107,14 @@ async function createLightAccountBase({ transport, chain, signer, abi, version:
107
107
  case "v1.0.1":
108
108
  return signer.signTypedData(params);
109
109
  case "v1.0.2":
110
- throw new Error(`Version ${version} of LightAccount doesn't support 1271`);
110
+ throw new Error(`Version ${String(version)} of LightAccount doesn't support 1271`);
111
111
  case "v1.1.0":
112
112
  return signWith1271WrapperV1((0, viem_1.hashTypedData)(params));
113
113
  case "v2.0.0":
114
114
  const signature = await signWith1271WrapperV1((0, viem_1.hashTypedData)(params));
115
115
  return (0, viem_1.concat)([SignatureType.EOA, signature]);
116
116
  default:
117
- throw new Error(`Unknown version ${version} of LightAccount`);
117
+ throw new Error(`Unknown version ${String(version)} of LightAccount`);
118
118
  }
119
119
  },
120
120
  getDummySignature: () => {
@@ -127,7 +127,7 @@ async function createLightAccountBase({ transport, chain, signer, abi, version:
127
127
  case "v2.0.0":
128
128
  return (0, viem_1.concat)([SignatureType.EOA, signature]);
129
129
  default:
130
- throw new Error(`Unknown version ${type} of ${version}`);
130
+ throw new Error(`Unknown version ${type} of ${String(version)}`);
131
131
  }
132
132
  },
133
133
  encodeUpgradeToAndCall,
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["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KAAK,CAAC,mBAAmB,IAAI,OAAO,OAAO,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;QACD,sBAAsB;KACvB,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO;QACV,MAAM,EAAE,IAAI;QACZ,sBAAsB,EAAE,GAAG,EAAE,CAAC,OAAO;QACrC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AA7KD,wDA6KC","sourcesContent":["import {\n FailedToGetStorageSlotError,\n createBundlerClient,\n toSmartContractAccount,\n type Abi,\n type EntryPointDef,\n type SmartAccountSigner,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n type UpgradeToAndCallParams,\n} from \"@aa-sdk/core\";\nimport {\n concat,\n encodeFunctionData,\n fromHex,\n hashMessage,\n hashTypedData,\n trim,\n type Address,\n type Chain,\n type Hex,\n type SignTypedDataParameters,\n type Transport,\n} from \"viem\";\nimport type {\n AccountVersionDef,\n GetEntryPointForLightAccountVersion,\n GetLightAccountVersion,\n LightAccountType,\n LightAccountVersionDef,\n} from \"../types.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\n\nenum SignatureType {\n EOA = \"0x00\",\n CONTRACT = \"0x01\",\n CONTRACT_WITH_ADDR = \"0x02\",\n}\n\nexport type LightAccountBase<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n >\n> = SmartContractAccountWithSigner<\n TLightAccountType,\n TSigner,\n TEntryPointVersion\n> & {\n getLightAccountVersion: () => TLightAccountVersion;\n};\n\n//#region CreateLightAccountBaseParams\nexport type CreateLightAccountBaseParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n >\n> = Pick<\n ToSmartContractAccountParams<\n TLightAccountType,\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\" | \"getAccountInitCode\"\n> & {\n abi: Abi;\n signer: TSigner;\n accountAddress: Address;\n version: LightAccountVersionDef<TLightAccountType, TLightAccountVersion>;\n entryPoint: EntryPointDef<TEntryPointVersion, Chain>;\n};\n//#endregion CreateLightAccountBaseParams\n\nexport async function createLightAccountBase<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n TLightAccountType,\n TLightAccountVersion\n >\n>(\n config: CreateLightAccountBaseParams<\n TTransport,\n TSigner,\n TLightAccountType,\n TLightAccountVersion,\n TEntryPointVersion\n >\n): Promise<\n LightAccountBase<\n TSigner,\n TLightAccountType,\n TLightAccountVersion,\n TEntryPointVersion\n >\n>;\n\nexport async function createLightAccountBase({\n transport,\n chain,\n signer,\n abi,\n version: { version, type },\n entryPoint,\n accountAddress,\n getAccountInitCode,\n}: CreateLightAccountBaseParams): Promise<LightAccountBase> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const encodeUpgradeToAndCall = async ({\n upgradeToAddress,\n upgradeToInitData,\n }: UpgradeToAndCallParams): Promise<Hex> => {\n const storage = await client.getStorageAt({\n address: accountAddress,\n // the slot at which impl addresses are stored by UUPS\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n if (storage == null) {\n throw new FailedToGetStorageSlotError(\n \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n \"Proxy Implementation Address\"\n );\n }\n\n const implementationAddresses = Object.values(\n AccountVersionRegistry[type]\n ).map((x: AccountVersionDef) => x.address[chain.id].impl);\n\n // only upgrade undeployed accounts (storage 0) or deployed light accounts, error otherwise\n if (\n fromHex(storage, \"number\") !== 0 &&\n !implementationAddresses.some((x) => x === trim(storage))\n ) {\n throw new Error(\n `could not determine if smart account implementation is ${type} ${version}`\n );\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"upgradeToAndCall\",\n args: [upgradeToAddress, upgradeToInitData],\n });\n };\n\n const signWith1271WrapperV1 = async (hashedMessage: Hex): Promise<Hex> => {\n return signer.signTypedData({\n // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\n // https://github.com/alchemyplatform/light-account/blob/main/src/LightAccount.sol#L236\n domain: {\n chainId: Number(client.chain.id),\n name: type,\n verifyingContract: accountAddress,\n version: \"1\",\n },\n types: {\n LightAccountMessage: [{ name: \"message\", type: \"bytes\" }],\n },\n message: {\n message: hashedMessage,\n },\n primaryType: \"LightAccountMessage\",\n });\n };\n\n const account = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: type,\n getAccountInitCode,\n encodeExecute: async ({ target, data, value }) => {\n return encodeFunctionData({\n abi,\n functionName: \"execute\",\n args: [target, value ?? 0n, data],\n });\n },\n encodeBatchExecute: async (txs) => {\n const [targets, values, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.value ?? 0n);\n accum[2].push(curr.data);\n\n return accum;\n },\n [[], [], []] as [Address[], bigint[], Hex[]]\n );\n return encodeFunctionData({\n abi,\n functionName: \"executeBatch\",\n args: [targets, values, datas],\n });\n },\n signUserOperationHash: async (uoHash: Hex) => {\n const signature = await signer.signMessage({ raw: uoHash });\n switch (version) {\n case \"v2.0.0\":\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n return signature;\n }\n },\n async signMessage({ message }) {\n switch (version as string) {\n case \"v1.0.1\":\n return signer.signMessage(message);\n case \"v1.0.2\":\n throw new Error(`${type} ${version} doesn't support 1271`);\n case \"v1.1.0\":\n return signWith1271WrapperV1(hashMessage(message));\n case \"v2.0.0\":\n const signature = await signWith1271WrapperV1(hashMessage(message));\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${type} of ${version}`);\n }\n },\n async signTypedData(params) {\n switch (version as string) {\n case \"v1.0.1\":\n return signer.signTypedData(\n params as unknown as SignTypedDataParameters\n );\n case \"v1.0.2\":\n throw new Error(\n `Version ${version} of LightAccount doesn't support 1271`\n );\n case \"v1.1.0\":\n return signWith1271WrapperV1(hashTypedData(params));\n case \"v2.0.0\":\n const signature = await signWith1271WrapperV1(hashTypedData(params));\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${version} of LightAccount`);\n }\n },\n getDummySignature: (): Hex => {\n const signature =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n switch (version as string) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n return signature;\n case \"v2.0.0\":\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${type} of ${version}`);\n }\n },\n encodeUpgradeToAndCall,\n });\n\n return {\n ...account,\n source: type,\n getLightAccountVersion: () => version,\n getSigner: () => signer,\n };\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/base.ts"],"names":[],"mappings":";;;AAAA,uCAUsB;AACtB,+BAYc;AAMd,0C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S,CAAC,CAAC,CAAC;gBAChD;oBACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QACD,sBAAsB;KACvB,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO;QACV,MAAM,EAAE,IAAI;QACZ,sBAAsB,EAAE,GAAG,EAAE,CAAC,OAAO;QACrC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AA9LD,wDA8LC","sourcesContent":["import {\n FailedToGetStorageSlotError,\n createBundlerClient,\n toSmartContractAccount,\n type Abi,\n type EntryPointDef,\n type SmartAccountSigner,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n type UpgradeToAndCallParams,\n} from \"@aa-sdk/core\";\nimport {\n concat,\n encodeFunctionData,\n fromHex,\n hashMessage,\n hashTypedData,\n trim,\n type Address,\n type Chain,\n type Hex,\n type SignTypedDataParameters,\n type Transport,\n} from \"viem\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountType,\n LightAccountVersion,\n} from \"../types.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\n\nenum SignatureType {\n EOA = \"0x00\",\n CONTRACT = \"0x01\",\n CONTRACT_WITH_ADDR = \"0x02\",\n}\n\nexport type LightAccountBase<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>\n> = SmartContractAccountWithSigner<\n TLightAccountType,\n TSigner,\n LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>\n> & {\n getLightAccountVersion: () => TLightAccountVersion;\n};\n\n//#region CreateLightAccountBaseParams\nexport type CreateLightAccountBaseParams<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Pick<\n ToSmartContractAccountParams<TLightAccountType, TTransport, Chain>,\n \"transport\" | \"chain\" | \"getAccountInitCode\"\n> & {\n abi: Abi;\n signer: TSigner;\n accountAddress: Address;\n type: TLightAccountType;\n version: TLightAccountVersion;\n entryPoint: EntryPointDef<\n LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>,\n Chain\n >;\n};\n//#endregion CreateLightAccountBaseParams\n\nexport async function createLightAccountBase<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>({\n transport,\n chain,\n signer,\n abi,\n version,\n type,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n}: CreateLightAccountBaseParams<\n TLightAccountType,\n TLightAccountVersion,\n TTransport,\n TSigner\n>): Promise<\n LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion>\n> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const encodeUpgradeToAndCall = async ({\n upgradeToAddress,\n upgradeToInitData,\n }: UpgradeToAndCallParams): Promise<Hex> => {\n const storage = await client.getStorageAt({\n address: accountAddress,\n // the slot at which impl addresses are stored by UUPS\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n if (storage == null) {\n throw new FailedToGetStorageSlotError(\n \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n \"Proxy Implementation Address\"\n );\n }\n\n const implementationAddresses = Object.values(\n AccountVersionRegistry[type]\n ).map(\n (x) => x.addresses.overrides?.[chain.id]?.impl ?? x.addresses.default.impl\n );\n\n // only upgrade undeployed accounts (storage 0) or deployed light accounts, error otherwise\n if (\n fromHex(storage, \"number\") !== 0 &&\n !implementationAddresses.some((x) => x === trim(storage))\n ) {\n throw new Error(\n `could not determine if smart account implementation is ${type} ${String(\n version\n )}`\n );\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"upgradeToAndCall\",\n args: [upgradeToAddress, upgradeToInitData],\n });\n };\n\n const signWith1271WrapperV1 = async (hashedMessage: Hex): Promise<Hex> => {\n return signer.signTypedData({\n // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\n // https://github.com/alchemyplatform/light-account/blob/main/src/LightAccount.sol#L236\n domain: {\n chainId: Number(client.chain.id),\n name: type,\n verifyingContract: accountAddress,\n version: \"1\",\n },\n types: {\n LightAccountMessage: [{ name: \"message\", type: \"bytes\" }],\n },\n message: {\n message: hashedMessage,\n },\n primaryType: \"LightAccountMessage\",\n });\n };\n\n const account = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: type,\n getAccountInitCode,\n encodeExecute: async ({ target, data, value }) => {\n return encodeFunctionData({\n abi,\n functionName: \"execute\",\n args: [target, value ?? 0n, data],\n });\n },\n encodeBatchExecute: async (txs) => {\n const [targets, values, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.value ?? 0n);\n accum[2].push(curr.data);\n\n return accum;\n },\n [[], [], []] as [Address[], bigint[], Hex[]]\n );\n return encodeFunctionData({\n abi,\n functionName: \"executeBatch\",\n args: [targets, values, datas],\n });\n },\n signUserOperationHash: async (uoHash: Hex) => {\n const signature = await signer.signMessage({ raw: uoHash });\n switch (version) {\n case \"v2.0.0\":\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n return signature;\n }\n },\n async signMessage({ message }) {\n switch (version as string) {\n case \"v1.0.1\":\n return signer.signMessage(message);\n case \"v1.0.2\":\n throw new Error(`${type} ${String(version)} doesn't support 1271`);\n case \"v1.1.0\":\n return signWith1271WrapperV1(hashMessage(message));\n case \"v2.0.0\":\n const signature = await signWith1271WrapperV1(hashMessage(message));\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${type} of ${String(version)}`);\n }\n },\n async signTypedData(params) {\n switch (version as string) {\n case \"v1.0.1\":\n return signer.signTypedData(\n params as unknown as SignTypedDataParameters\n );\n case \"v1.0.2\":\n throw new Error(\n `Version ${String(version)} of LightAccount doesn't support 1271`\n );\n case \"v1.1.0\":\n return signWith1271WrapperV1(hashTypedData(params));\n case \"v2.0.0\":\n const signature = await signWith1271WrapperV1(hashTypedData(params));\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${String(version)} of LightAccount`);\n }\n },\n getDummySignature: (): Hex => {\n const signature =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n switch (version as string) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n return signature;\n case \"v2.0.0\":\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${type} of ${String(version)}`);\n }\n },\n encodeUpgradeToAndCall,\n });\n\n return {\n ...account,\n source: type,\n getLightAccountVersion: () => version,\n getSigner: () => signer,\n };\n}\n"]}
@@ -1,18 +1,18 @@
1
1
  import { type EntryPointDef, type SmartAccountSigner } from "@aa-sdk/core";
2
2
  import { type Address, type Chain, type Hex, type Transport } from "viem";
3
- import type { GetEntryPointForLightAccountVersion, GetLightAccountVersion } from "../types.js";
3
+ import type { LightAccountEntryPointVersion, LightAccountVersion } from "../types.js";
4
4
  import { type CreateLightAccountBaseParams, type LightAccountBase } from "./base.js";
5
- export type MultiOwnerLightAccount<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"MultiOwnerLightAccount"> = GetLightAccountVersion<"MultiOwnerLightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion>> = LightAccountBase<TSigner, "MultiOwnerLightAccount", TLightAccountVersion, TEntryPointVersion> & {
5
+ export type MultiOwnerLightAccount<TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">> = LightAccountBase<TSigner, "MultiOwnerLightAccount", TLightAccountVersion> & {
6
6
  encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => Hex;
7
7
  getOwnerAddresses: () => Promise<readonly Address[]>;
8
8
  };
9
- export type CreateMultiOwnerLightAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"MultiOwnerLightAccount"> = GetLightAccountVersion<"MultiOwnerLightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion>> = Omit<CreateLightAccountBaseParams<TTransport, TSigner, "MultiOwnerLightAccount", TLightAccountVersion, TEntryPointVersion>, "getAccountInitCode" | "entryPoint" | "version" | "abi" | "accountAddress"> & {
9
+ export type CreateMultiOwnerLightAccountParams<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">> = Omit<CreateLightAccountBaseParams<"MultiOwnerLightAccount", TLightAccountVersion, TTransport, TSigner>, "getAccountInitCode" | "entryPoint" | "version" | "abi" | "accountAddress" | "type"> & {
10
10
  salt?: bigint;
11
11
  initCode?: Hex;
12
12
  accountAddress?: Address;
13
13
  factoryAddress?: Address;
14
14
  version?: TLightAccountVersion;
15
- entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;
15
+ entryPoint?: EntryPointDef<LightAccountEntryPointVersion<"MultiOwnerLightAccount", TLightAccountVersion>, Chain>;
16
16
  owners?: Address[];
17
17
  };
18
- export declare function createMultiOwnerLightAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends GetLightAccountVersion<"MultiOwnerLightAccount"> = GetLightAccountVersion<"MultiOwnerLightAccount">, TEntryPointVersion extends GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion> = GetEntryPointForLightAccountVersion<"MultiOwnerLightAccount", TLightAccountVersion>>(config: CreateMultiOwnerLightAccountParams<TTransport, TSigner, TLightAccountVersion, TEntryPointVersion>): Promise<MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>>;
18
+ export declare function createMultiOwnerLightAccount<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner, TLightAccountVersion extends LightAccountVersion<"MultiOwnerLightAccount"> = LightAccountVersion<"MultiOwnerLightAccount">>(config: CreateMultiOwnerLightAccountParams<TTransport, TSigner, TLightAccountVersion>): Promise<MultiOwnerLightAccount<TSigner, TLightAccountVersion>>;
@@ -7,7 +7,7 @@ const MultiOwnerLightAccountAbi_js_1 = require("../abis/MultiOwnerLightAccountAb
7
7
  const MultiOwnerLightAccountFactoryAbi_js_1 = require("../abis/MultiOwnerLightAccountFactoryAbi.js");
8
8
  const utils_js_1 = require("../utils.js");
9
9
  const base_js_1 = require("./base.js");
10
- async function createMultiOwnerLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)("MultiOwnerLightAccount"), entryPoint = (0, core_1.getEntryPoint)(chain, {
10
+ async function createMultiOwnerLightAccount({ transport, chain, signer, initCode, version = (0, utils_js_1.defaultLightAccountVersion)(), entryPoint = (0, core_1.getEntryPoint)(chain, {
11
11
  version: "0.7.0",
12
12
  }), accountAddress, factoryAddress = (0, utils_js_1.getDefaultMultiOwnerLightAccountFactoryAddress)(chain, version), salt: salt_ = 0n, owners = [], }) {
13
13
  const client = (0, core_1.createBundlerClient)({
@@ -45,7 +45,8 @@ async function createMultiOwnerLightAccount({ transport, chain, signer, initCode
45
45
  chain,
46
46
  signer,
47
47
  abi: MultiOwnerLightAccountAbi_js_1.MultiOwnerLightAccountAbi,
48
- version: utils_js_1.AccountVersionRegistry["MultiOwnerLightAccount"][version],
48
+ version,
49
+ type: "MultiOwnerLightAccount",
49
50
  entryPoint,
50
51
  accountAddress: address,
51
52
  getAccountInitCode,
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":";;;AAAA,uCAMsB;AACtB,+BAQc;AACd,uFAAiF;AACjF,qGAA+F;AAK/F,0CAIqB;AACrB,uCAImB;AAiGZ,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAA,qCAA0B,EAAC,wBAAwB,CAAC,EAC9D,UAAU,GAAG,IAAA,oBAAa,EAAC,KAAK,EAAE;IAChC,OAAO,EAAE,OAAO;CACjB,CAAC,EACF,cAAc,EACd,cAAc,GAAG,IAAA,yDAA8C,EAC7D,KAAK,EACL,OAAO,CACR,EACD,IAAI,EAAE,KAAK,GAAG,EAAE,EAChB,MAAM,GAAG,EAAE,GACwB;IACnC,MAAM,MAAM,GAAG,IAAA,0BAAmB,EAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAG9B,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAE/C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;aAC3D,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kBAAW,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC;aACpC,IAAI,CAAC,CAAC,CAAC,EAAE,C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OAAO;gBACP,GAAG,EAAE,wDAAyB;gBAC9B,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;YAEH,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AAhGD,oEAgGC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerLightAccountAbi } from \"../abis/MultiOwnerLightAccountAbi.js\";\nimport { MultiOwnerLightAccountFactoryAbi } from \"../abis/MultiOwnerLightAccountFactoryAbi.js\";\nimport type {\n GetEntryPointForLightAccountVersion,\n GetLightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n defaultLightAccountVersion,\n getDefaultMultiOwnerLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type MultiOwnerLightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = LightAccountBase<\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n> & {\n encodeUpdateOwners: (\n ownersToAdd: Address[],\n ownersToRemove: Address[]\n ) => Hex;\n getOwnerAddresses: () => Promise<readonly Address[]>;\n};\n\nexport type CreateMultiOwnerLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n> = Omit<\n CreateLightAccountBaseParams<\n TTransport,\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TEntryPointVersion\n >,\n \"getAccountInitCode\" | \"entryPoint\" | \"version\" | \"abi\" | \"accountAddress\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<TEntryPointVersion, Chain>;\n owners?: Address[];\n};\n\nexport async function createMultiOwnerLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends GetLightAccountVersion<\"MultiOwnerLightAccount\"> = GetLightAccountVersion<\"MultiOwnerLightAccount\">,\n TEntryPointVersion extends GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n > = GetEntryPointForLightAccountVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >\n>(\n config: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion,\n TEntryPointVersion\n >\n): Promise<\n MultiOwnerLightAccount<TSigner, TLightAccountVersion, TEntryPointVersion>\n>;\n\n/**\n * Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountParams} config The parameters for creating a multi-owner light account\n * @returns {Promise<MultiOwnerLightAccount>} A promise that resolves to a `MultiOwnerLightAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(\"MultiOwnerLightAccount\"),\n entryPoint = getEntryPoint(chain, {\n version: \"0.7.0\",\n }),\n accountAddress,\n factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(\n chain,\n version\n ),\n salt: salt_ = 0n,\n owners = [],\n}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerLightAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [owners_, salt_],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n Transport,\n SmartAccountSigner,\n \"MultiOwnerLightAccount\"\n >({\n transport,\n chain,\n signer,\n abi: MultiOwnerLightAccountAbi,\n version: AccountVersionRegistry[\"MultiOwnerLightAccount\"][version],\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => {\n return encodeFunctionData({\n abi: MultiOwnerLightAccountAbi,\n functionName: \"updateOwners\",\n args: [ownersToAdd, ownersToRemove],\n });\n },\n async getOwnerAddresses(): Promise<readonly Address[]> {\n const callResult = await client.readContract({\n address,\n abi: MultiOwnerLightAccountAbi,\n functionName: \"owners\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owners\");\n }\n\n if (!callResult.includes(await signer.getAddress())) {\n throw new Error(\"on-chain owners does not include the current signer\");\n }\n\n return callResult;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"multiOwner.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/multiOwner.ts"],"names":[],"mappings":";;;AAAA,uCAMsB;AACtB,+BAQc;AACd,uFAAiF;AACjF,qGAA+F;AAK/F,0CAGqB;AACrB,uCAImB;AAkFZ,KAAK,UAAU,4BAA4B,CAAC,EACjD,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAA,qCAA0B,GAAE,EACtC,UAAU,GAAG,IAAA,oBAAa,EAAC,KAAK,EAAE;IAChC,OAAO,EAAE,OAAO;CACjB,CAAC,EACF,cAAc,EACd,cAAc,GAAG,IAAA,yDAA8C,EAC7D,KAAK,EACL,OAAO,CACR,EACD,IAAI,EAAE,KAAK,GAAG,EAAE,EAChB,MAAM,GAAG,EAAE,GACwB;IACnC,MAAM,MAAM,GAAG,IAAA,0BAAmB,EAAC;QACjC,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,KAAK,IAAI,EAAE;QACpC,IAAI,QAAQ;YAAE,OAA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kB,EAAE,CAAC,WAAsB,EAAE,cAAyB,EAAE,EAAE;YACxE,OAAO,IAAA,yBAAkB,EAAC;gBACxB,GAAG,EAAE,wDAAyB;gBAC9B,YAAY,EAAE,cAAc;gBAC5B,IAAI,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,iBAAiB;YACrB,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;gBAC3C,OAAO;gBACP,GAAG,EAAE,wDAAyB;gBAC9B,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;YAEH,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;gBACpD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AAlGD,oEAkGC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerLightAccountAbi } from \"../abis/MultiOwnerLightAccountAbi.js\";\nimport { MultiOwnerLightAccountFactoryAbi } from \"../abis/MultiOwnerLightAccountFactoryAbi.js\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountVersion,\n} from \"../types.js\";\nimport {\n defaultLightAccountVersion,\n getDefaultMultiOwnerLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\n\nexport type MultiOwnerLightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n> = LightAccountBase<\n TSigner,\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n> & {\n encodeUpdateOwners: (\n ownersToAdd: Address[],\n ownersToRemove: Address[]\n ) => Hex;\n getOwnerAddresses: () => Promise<readonly Address[]>;\n};\n\nexport type CreateMultiOwnerLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n> = Omit<\n CreateLightAccountBaseParams<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion,\n TTransport,\n TSigner\n >,\n | \"getAccountInitCode\"\n | \"entryPoint\"\n | \"version\"\n | \"abi\"\n | \"accountAddress\"\n | \"type\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<\n LightAccountEntryPointVersion<\n \"MultiOwnerLightAccount\",\n TLightAccountVersion\n >,\n Chain\n >;\n owners?: Address[];\n};\n\nexport async function createMultiOwnerLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"MultiOwnerLightAccount\"> = LightAccountVersion<\"MultiOwnerLightAccount\">\n>(\n config: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner,\n TLightAccountVersion\n >\n): Promise<MultiOwnerLightAccount<TSigner, TLightAccountVersion>>;\n\n/**\n * Creates a multi-owner light account using the provided parameters, including transport, chain, signer, initialization code, version, account address, factory address, salt, and owners. Ensures the owners list is deduplicated, ordered, and valid.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountParams} config The parameters for creating a multi-owner light account\n * @returns {Promise<MultiOwnerLightAccount>} A promise that resolves to a `MultiOwnerLightAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(),\n entryPoint = getEntryPoint(chain, {\n version: \"0.7.0\",\n }),\n accountAddress,\n factoryAddress = getDefaultMultiOwnerLightAccountFactoryAddress(\n chain,\n version\n ),\n salt: salt_ = 0n,\n owners = [],\n}: CreateMultiOwnerLightAccountParams): Promise<MultiOwnerLightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerLightAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [owners_, salt_],\n }),\n ]);\n };\n\n const address = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const account = await createLightAccountBase<\n \"MultiOwnerLightAccount\",\n LightAccountVersion<\"MultiOwnerLightAccount\">,\n Transport,\n SmartAccountSigner\n >({\n transport,\n chain,\n signer,\n abi: MultiOwnerLightAccountAbi,\n version,\n type: \"MultiOwnerLightAccount\",\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n encodeUpdateOwners: (ownersToAdd: Address[], ownersToRemove: Address[]) => {\n return encodeFunctionData({\n abi: MultiOwnerLightAccountAbi,\n functionName: \"updateOwners\",\n args: [ownersToAdd, ownersToRemove],\n });\n },\n async getOwnerAddresses(): Promise<readonly Address[]> {\n const callResult = await client.readContract({\n address,\n abi: MultiOwnerLightAccountAbi,\n functionName: \"owners\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owners\");\n }\n\n if (!callResult.includes(await signer.getAddress())) {\n throw new Error(\"on-chain owners does not include the current signer\");\n }\n\n return callResult;\n },\n };\n}\n"]}
@@ -2,5 +2,5 @@ import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
2
2
  import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
3
3
  import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions } from "@account-kit/smart-contracts";
4
4
  import { type Chain, type CustomTransport, type Transport } from "viem";
5
- export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
5
+ export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain" | "type"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, MultiOwnerLightAccount<TSigner>>, "account">;
6
6
  export declare function createMultiOwnerLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerLightAccount<TSigner>, MultiOwnerLightAccountClientActions<TSigner>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":";;;AACA,8CAM4B;AAC5B,kEAMsC;AACtC,+BAAgF;AAkDzE,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,mCAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,8CAA4B,EAAC;QACjD,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,IAAA,mDAA2C,EAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,qDAAmC,CAAC,CAAC;AACjD,CAAC;AAtBD,8FAsBC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n MultiOwnerLightAccount<TSigner>\n >,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient(\n config: AlchemyMultiOwnerLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
1
+ {"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":";;;AACA,8CAM4B;AAC5B,kEAMsC;AACtC,+BAAgF;AAkDzE,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,mCAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,IAAA,oCAA4B,EAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,IAAA,8CAA4B,EAAC;QACjD,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,IAAA,mDAA2C,EAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,qDAAmC,CAAC,CAAC;AACjD,CAAC;AAtBD,8FAsBC","sourcesContent":["import type { HttpTransport, SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n createMultiOwnerLightAccount,\n multiOwnerLightAccountClientActions,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n type MultiOwnerLightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyMultiOwnerLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\" | \"type\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n MultiOwnerLightAccount<TSigner>\n >,\n \"account\"\n >;\n\nexport async function createMultiOwnerLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultiOwnerLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerLightAccount<TSigner>,\n MultiOwnerLightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates a multi-owner light account Alchemy client using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createMultiOwnerLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyMultiOwnerLightAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created account information and methods\n */\nexport async function createMultiOwnerLightAccountAlchemyClient(\n config: AlchemyMultiOwnerLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(multiOwnerLightAccountClientActions);\n}\n"]}
@@ -1,39 +1,31 @@
1
- import { type EntryPointVersion, type GetAccountParameter, type OneOf, type SmartAccountSigner, type SmartContractAccount } from "@aa-sdk/core";
1
+ import { type EntryPointVersion } from "@aa-sdk/core";
2
2
  import { type Address, type Chain } from "viem";
3
3
  import type { LightAccountBase } from "./accounts/base";
4
- export type LightAccountType = keyof IAccountVersionRegistry;
5
- export type AccountVersionDef<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>, TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
6
- type: TLightAccountType;
7
- version: TLightAccountVersion;
4
+ export type LightAccountType = "LightAccount" | "MultiOwnerLightAccount";
5
+ export type LightAccountVersionConfig<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = {
8
6
  entryPointVersion: TEntryPointVersion;
9
- address: Record<Chain["id"], {
10
- factory: Address;
11
- impl: Address;
12
- }>;
7
+ addresses: {
8
+ default: {
9
+ factory: Address;
10
+ impl: Address;
11
+ };
12
+ overrides?: Record<Chain["id"], {
13
+ factory: Address;
14
+ impl: Address;
15
+ }>;
16
+ };
13
17
  };
14
- export type LightAccountVersion = keyof IAccountVersionRegistry["LightAccount"] | keyof IAccountVersionRegistry["MultiOwnerLightAccount"];
15
- export type GetLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = keyof IAccountVersionRegistry[TLightAccountType];
16
- export type LightAccountVersionDef<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];
17
- export interface IAccountVersionRegistry {
18
+ export type LightAccountVersionConfigs = {
18
19
  LightAccount: {
19
- "v1.0.1": AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0">;
20
- "v1.0.2": AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">;
21
- "v1.1.0": AccountVersionDef<"LightAccount", "v1.1.0", "0.6.0">;
22
- "v2.0.0": AccountVersionDef<"LightAccount", "v2.0.0", "0.7.0">;
20
+ "v1.0.1": LightAccountVersionConfig<"0.6.0">;
21
+ "v1.0.2": LightAccountVersionConfig<"0.6.0">;
22
+ "v1.1.0": LightAccountVersionConfig<"0.6.0">;
23
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
23
24
  };
24
25
  MultiOwnerLightAccount: {
25
- "v2.0.0": AccountVersionDef<"MultiOwnerLightAccount", "v2.0.0", "0.7.0">;
26
+ "v2.0.0": LightAccountVersionConfig<"0.7.0">;
26
27
  };
27
- }
28
- export type GetLightAccountVersionDefsForType<TType extends LightAccountType> = Extract<IAccountVersionRegistry[TType][keyof IAccountVersionRegistry[TType]], {
29
- type: TType;
30
- }>;
31
- export type GetLightAccountVersionDef<TType extends LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TType>> = IAccountVersionRegistry[TType][TLightAccountVersion];
32
- export type GetLightAccountVersionDefsForEntryPoint<TType extends LightAccountType, TEntryPointVersion extends EntryPointVersion> = Extract<GetLightAccountVersionDefsForType<TType>, {
33
- entryPointVersion: TEntryPointVersion;
34
- }>;
35
- export type GetLightAccountType<TAccount extends SmartContractAccount | undefined, TAccountOverride extends SmartContractAccount = SmartContractAccount> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, infer TLightAccountType> ? OneOf<TLightAccountType, LightAccountType> : LightAccountType;
36
- export type GetLightAccountVersionFromAccount<TAccount extends LightAccountBase | undefined, TAccountOverride extends LightAccountBase = LightAccountBase> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<SmartAccountSigner, LightAccountType, infer TLightAccountVersion> ? OneOf<TLightAccountVersion, LightAccountVersion> : LightAccountVersion;
37
- export type GetEntryPointForLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>> = GetLightAccountVersionDef<TLightAccountType, TLightAccountVersion> extends AccountVersionDef<TLightAccountType, TLightAccountVersion, infer TEntryPointVersion> ? TEntryPointVersion : EntryPointVersion;
38
- export type GetLightAccountTypesForVersion<TLightAccountVersion extends LightAccountVersion = LightAccountVersion> = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType> ? TLightAccountType : LightAccountType;
39
- export type GetDefaultLightAccountVersion<TLightAccountType extends LightAccountType = LightAccountType> = TLightAccountType extends "MultiOwnerLightAccount" ? "v2.0.0" & LightAccountVersion : "v1.1.0" & LightAccountVersion;
28
+ };
29
+ export type LightAccountVersion<TAccountType extends LightAccountType> = keyof LightAccountVersionConfigs[TAccountType];
30
+ export type GetLightAccountType<TAccount extends LightAccountBase> = TAccount["source"] extends LightAccountType ? TAccount["source"] : never;
31
+ export type LightAccountEntryPointVersion<TLightAccountType extends LightAccountType, TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion]["entryPointVersion"] : never;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n type EntryPointVersion,\n type GetAccountParameter,\n type OneOf,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\n\n/**\n * Light account types supported: LightAccount, MultiOwnerLightAccount\n *\n */\nexport type LightAccountType = keyof IAccountVersionRegistry;\n\n/**\n * Account version definition, which is the base type defining the LightAccountVersionDef interface\n *\n * @template {LightAccountType} TLightAccountType type\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion version\n * @template {EntryPointVersion} TEntryPointVersion entryPointVersion\n */\nexport type AccountVersionDef<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n type: TLightAccountType;\n version: TLightAccountVersion;\n entryPointVersion: TEntryPointVersion;\n address: Record<\n Chain[\"id\"],\n {\n factory: Address;\n impl: Address;\n }\n >;\n};\n\n/**\n * Light account version type defs for tightly coupled types for smart accounts\n *\n */\nexport type LightAccountVersion =\n | keyof IAccountVersionRegistry[\"LightAccount\"]\n | keyof IAccountVersionRegistry[\"MultiOwnerLightAccount\"];\n\n/**\n * Get the light account versions available for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n */\nexport type GetLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType\n> = keyof IAccountVersionRegistry[TLightAccountType];\n\n/**\n * Light account version definition type based on the light account type and version\n *\n * @template {LightAccountType} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n */\nexport type LightAccountVersionDef<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n> = IAccountVersionRegistry[TLightAccountType][TLightAccountVersion];\n\n/**\n * Light account version registry interface defining the supported light account versions\n *\n */\nexport interface IAccountVersionRegistry {\n LightAccount: {\n /** @deprecated This version does not support 1271 signature validation */\n \"v1.0.1\": AccountVersionDef<\"LightAccount\", \"v1.0.1\", \"0.6.0\">;\n /** @deprecated This version has a known issue with 1271 validation */\n \"v1.0.2\": AccountVersionDef<\"LightAccount\", \"v1.0.2\", \"0.6.0\">;\n \"v1.1.0\": AccountVersionDef<\"LightAccount\", \"v1.1.0\", \"0.6.0\">;\n /**\n * LightAccount v2 Changelog.\n * It is recommended to use v2.0.0\n * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd\n */\n \"v2.0.0\": AccountVersionDef<\"LightAccount\", \"v2.0.0\", \"0.7.0\">;\n };\n MultiOwnerLightAccount: {\n /**\n * MultiOwnerLightAccount v2 Changelog\n * It is recommended to use v2.0.0\n * https://alchemotion.notion.site/External-Light-Account-v2-Changelog-725b306ab1e04eb0a3e596521dd8f0bd\n */\n \"v2.0.0\": AccountVersionDef<\"MultiOwnerLightAccount\", \"v2.0.0\", \"0.7.0\">;\n };\n}\n\n/**\n * Get the light account version definitions available for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n *\n * @example\n * type T1 = GetLightAccountVersionsForType<\"LightAccount\">;\n * const t1: T1 = AccountVersionRegistry.LightAccount[\"v1.0.2\"];\n */\nexport type GetLightAccountVersionDefsForType<TType extends LightAccountType> =\n Extract<\n IAccountVersionRegistry[TType][keyof IAccountVersionRegistry[TType]],\n { type: TType }\n >;\n\n/**\n * Get the light account version definition for the given light account type and version\n *\n * @template {LightAccountType} TType\n * @template {GetLightAccountVersion<TType>} TLightAccountVersion\n */\nexport type GetLightAccountVersionDef<\n TType extends LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TType>\n> = IAccountVersionRegistry[TType][TLightAccountVersion];\n\n/**\n * @example\n * type T = GetLightAccountVersionDefsForEntryPoint<\"LightAccount\", \"0.6.0\">;\n * const t_1: T = AccountVersionRegistry.LightAccount[\"v1.0.2\"]; // compiles\n * const t_2: T = AccountVersionRegistry.LightAccount[\"v2.0.0\"]; // errors\n */\nexport type GetLightAccountVersionDefsForEntryPoint<\n TType extends LightAccountType,\n TEntryPointVersion extends EntryPointVersion\n> = Extract<\n GetLightAccountVersionDefsForType<TType>,\n { entryPointVersion: TEntryPointVersion }\n>;\n\n/**\n * Get the light account type for the given light account by inferring from its type definition\n *\n * @template {SmartContractAccount | undefined} TAccount\n * @template {SmartContractAccount} TAccountOverride\n */\nexport type GetLightAccountType<\n TAccount extends SmartContractAccount | undefined,\n TAccountOverride extends SmartContractAccount = SmartContractAccount\n> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<\n SmartAccountSigner,\n infer TLightAccountType\n>\n ? OneOf<TLightAccountType, LightAccountType>\n : LightAccountType;\n\n/**\n * Get the light account version for the given light account by inferring from its type definition\n *\n * @template {LightAccountBase | undefined} TAccount\n * @template {LightAccountBase} TAccountOverride\n */\nexport type GetLightAccountVersionFromAccount<\n TAccount extends LightAccountBase | undefined,\n TAccountOverride extends LightAccountBase = LightAccountBase\n> = GetAccountParameter<TAccount, TAccountOverride> extends LightAccountBase<\n SmartAccountSigner,\n LightAccountType,\n infer TLightAccountVersion\n>\n ? OneOf<TLightAccountVersion, LightAccountVersion>\n : LightAccountVersion;\n\n/**\n * Get the entry point version supported for the given light account type and version\n *\n * @template {LightAccountType} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n */\nexport type GetEntryPointForLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n> = GetLightAccountVersionDef<\n TLightAccountType,\n TLightAccountVersion\n> extends AccountVersionDef<\n TLightAccountType,\n TLightAccountVersion,\n infer TEntryPointVersion\n>\n ? TEntryPointVersion\n : EntryPointVersion;\n\n/**\n * Get the light account type for the given light account version by inferring from its type definition\n *\n * @template {LightAccountVersion} TLightAccountVersion\n */\nexport type GetLightAccountTypesForVersion<\n TLightAccountVersion extends LightAccountVersion = LightAccountVersion\n> = TLightAccountVersion extends GetLightAccountVersion<infer TLightAccountType>\n ? TLightAccountType\n : LightAccountType;\n\n/**\n * Get default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n */\nexport type GetDefaultLightAccountVersion<\n TLightAccountType extends LightAccountType = LightAccountType\n> = TLightAccountType extends \"MultiOwnerLightAccount\"\n ? \"v2.0.0\" & LightAccountVersion\n : \"v1.1.0\" & LightAccountVersion;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/light-account/types.ts"],"names":[],"mappings":"","sourcesContent":["import { type EntryPointVersion } from \"@aa-sdk/core\";\nimport { type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\n\n/**\n * Light account types supported: LightAccount, MultiOwnerLightAccount\n *\n */\nexport type LightAccountType = \"LightAccount\" | \"MultiOwnerLightAccount\";\n\nexport type LightAccountVersionConfig<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n entryPointVersion: TEntryPointVersion;\n addresses: {\n default: {\n factory: Address;\n impl: Address;\n };\n overrides?: Record<\n Chain[\"id\"],\n {\n factory: Address;\n impl: Address;\n }\n >;\n };\n};\n\nexport type LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.0.2\": LightAccountVersionConfig<\"0.6.0\">;\n \"v1.1.0\": LightAccountVersionConfig<\"0.6.0\">;\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n MultiOwnerLightAccount: {\n \"v2.0.0\": LightAccountVersionConfig<\"0.7.0\">;\n };\n};\n\nexport type LightAccountVersion<TAccountType extends LightAccountType> =\n keyof LightAccountVersionConfigs[TAccountType];\n\nexport type GetLightAccountType<TAccount extends LightAccountBase> =\n TAccount[\"source\"] extends LightAccountType ? TAccount[\"source\"] : never;\n\nexport type LightAccountEntryPointVersion<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>\n> = LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion] extends LightAccountVersionConfig\n ? LightAccountVersionConfigs[TLightAccountType][TLightAccountVersion][\"entryPointVersion\"]\n : never;\n"]}