@account-kit/smart-contracts 4.43.1 → 4.44.0

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.
@@ -7,6 +7,8 @@ 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 { predictLightAccountAddress } from "./light-account/accounts/predictAddress.js";
11
+ export { predictMultiOwnerLightAccountAddress } from "./light-account/accounts/predictAddress.js";
10
12
  export { AccountVersionRegistry, LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, defaultLightAccountVersion, getDefaultLightAccountFactoryAddress, getDefaultMultiOwnerLightAccountFactoryAddress, getLightAccountVersionForAccount, } from "./light-account/utils.js";
11
13
  export type * from "./light-account/accounts/multiOwner.js";
12
14
  export { createMultiOwnerLightAccount } from "./light-account/accounts/multiOwner.js";
@@ -58,3 +60,4 @@ export type * from "./ma-v2/client/client.js";
58
60
  export { createModularAccountV2Client } from "./ma-v2/client/client.js";
59
61
  export type * from "./ma-v2/utils.js";
60
62
  export { getMAV2UpgradeToData } from "./ma-v2/utils.js";
63
+ export { predictModularAccountV2Address } from "./ma-v2/account/predictAddress.js";
@@ -6,6 +6,8 @@ export { createLightAccountAlchemyClient, } from "./light-account/clients/alchem
6
6
  export { createLightAccountClient } from "./light-account/clients/client.js";
7
7
  export { createMultiOwnerLightAccountAlchemyClient, } from "./light-account/clients/multiOwnerAlchemyClient.js";
8
8
  export { lightAccountClientActions } from "./light-account/decorators/lightAccount.js";
9
+ export { predictLightAccountAddress } from "./light-account/accounts/predictAddress.js";
10
+ export { predictMultiOwnerLightAccountAddress } from "./light-account/accounts/predictAddress.js";
9
11
  export { AccountVersionRegistry, LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, defaultLightAccountVersion, getDefaultLightAccountFactoryAddress, getDefaultMultiOwnerLightAccountFactoryAddress, getLightAccountVersionForAccount, } from "./light-account/utils.js";
10
12
  export { createMultiOwnerLightAccount } from "./light-account/accounts/multiOwner.js";
11
13
  export { updateOwners as updateMultiOwnerLightAccountOwners } from "./light-account/actions/updateOwners.js";
@@ -42,4 +44,5 @@ export { getDefaultMultiOwnerModularAccountFactoryAddress, getDefaultMultisigMod
42
44
  export { createModularAccountV2 } from "./ma-v2/account/modularAccountV2.js";
43
45
  export { createModularAccountV2Client } from "./ma-v2/client/client.js";
44
46
  export { getMAV2UpgradeToData } from "./ma-v2/utils.js";
47
+ export { predictModularAccountV2Address } from "./ma-v2/account/predictAddress.js";
45
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,wDAAwD;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,IAAI,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClH,OAAO,EACL,+BAA+B,GAEhC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACL,yCAAyC,GAE1C,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAGvF,OAAO,EACL,sBAAsB,EACtB,oCAAoC,EACpC,gCAAgC,EAChC,0BAA0B,EAC1B,oCAAoC,EACpC,8CAA8C,EAC9C,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,YAAY,IAAI,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AAEvG,OAAO,EAAE,mCAAmC,EAAE,MAAM,sD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AAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAGlF,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,GACrC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EACL,gDAAgD,EAChD,8CAA8C,EAC9C,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC","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 getDefaultMultiOwnerLightAccountFactoryAddress,\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\n// ma v2 types\nexport type * from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/account/common/modularAccountV2Base.js\";\nexport { createModularAccountV2 } from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/client/client.js\";\nexport { createModularAccountV2Client } from \"./ma-v2/client/client.js\";\nexport type * from \"./ma-v2/utils.js\";\nexport { getMAV2UpgradeToData } from \"./ma-v2/utils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,wDAAwD;AAIxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,IAAI,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClH,OAAO,EACL,+BAA+B,GAEhC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACL,yCAAyC,GAE1C,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAEvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAElG,OAAO,EACL,sBAAsB,EACtB,oCAAoC,EACpC,gCAAgC,EAChC,0BAA0B,EAC1B,oCAAoC,EACpC,8CAA8C,EAC9C,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,YAAY,IAAI,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AAEvG,OAAO,EAAE,mCAAmC,EAAE,MAAM,sDAAsD,CAAC;AAE3G,eAAe;AACf,OAAO,EAAE,gBAAgB,EAAE,MAAM,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,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAGlF,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,GACrC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,EACL,gDAAgD,EAChD,8CAA8C,EAC9C,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC","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\";\nexport { predictLightAccountAddress } from \"./light-account/accounts/predictAddress.js\";\nexport { predictMultiOwnerLightAccountAddress } from \"./light-account/accounts/predictAddress.js\";\n\nexport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n getDefaultMultiOwnerLightAccountFactoryAddress,\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\n// ma v2 types\nexport type * from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/account/common/modularAccountV2Base.js\";\nexport { createModularAccountV2 } from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/client/client.js\";\nexport { createModularAccountV2Client } from \"./ma-v2/client/client.js\";\nexport type * from \"./ma-v2/utils.js\";\nexport { getMAV2UpgradeToData } from \"./ma-v2/utils.js\";\nexport { predictModularAccountV2Address } from \"./ma-v2/account/predictAddress.js\";\n"]}
@@ -6,10 +6,30 @@ export type PredictLightAccountAddressParams = {
6
6
  ownerAddress: Address;
7
7
  version: keyof LightAccountVersionConfigs["LightAccount"];
8
8
  };
9
+ /**
10
+ * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.
11
+ *
12
+ * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version
13
+ * @returns {Address} The predicted address of the light account calculated based on the provided parameters
14
+ */
9
15
  export declare function predictLightAccountAddress({ factoryAddress, salt, ownerAddress, version, }: PredictLightAccountAddressParams): Address;
10
16
  export type PredictMultiOwnerLightAccountAddressParams = {
11
17
  factoryAddress: Address;
12
18
  salt: bigint;
13
19
  ownerAddresses: Address[];
14
20
  };
21
+ /**
22
+ * Predicts the address of a **Multi-Owner Light Account** given the factory, salt
23
+ * and the set of owner addresses.
24
+ *
25
+ * Internally replicates the CREATE2 calculation performed by the factory so
26
+ * you can obtain the counter-factual account address before deployment (useful
27
+ * for funding or displaying to users).
28
+ *
29
+ * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:
30
+ * – `factoryAddress` Factory contract that will deploy the account.
31
+ * – `salt` Arbitrary salt used when calling the factory.
32
+ * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).
33
+ * @returns {Address} Predicted account address for the multi-owner light account.
34
+ */
15
35
  export declare function predictMultiOwnerLightAccountAddress({ factoryAddress, salt, ownerAddresses, }: PredictMultiOwnerLightAccountAddressParams): Address;
@@ -2,6 +2,12 @@ import { encodeAbiParameters, encodeDeployData, keccak256, getContractAddress, t
2
2
  import { OZ_ERC1967Proxy_ConstructorAbi } from "../abis/OZ_ERC1967Proxy.js";
3
3
  import { AccountVersionRegistry } from "../utils.js";
4
4
  import { LightAccountAbi_v1 } from "../abis/LightAccountAbi_v1.js";
5
+ /**
6
+ * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.
7
+ *
8
+ * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version
9
+ * @returns {Address} The predicted address of the light account calculated based on the provided parameters
10
+ */
5
11
  export function predictLightAccountAddress({ factoryAddress, salt, ownerAddress, version, }) {
6
12
  const implementationAddress =
7
13
  // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.
@@ -51,6 +57,20 @@ export function predictLightAccountAddress({ factoryAddress, salt, ownerAddress,
51
57
  }
52
58
  }
53
59
  // Note: assumes the owner addresses are already deduped, sorted in ascending order, and have the signer address included.
60
+ /**
61
+ * Predicts the address of a **Multi-Owner Light Account** given the factory, salt
62
+ * and the set of owner addresses.
63
+ *
64
+ * Internally replicates the CREATE2 calculation performed by the factory so
65
+ * you can obtain the counter-factual account address before deployment (useful
66
+ * for funding or displaying to users).
67
+ *
68
+ * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:
69
+ * – `factoryAddress` Factory contract that will deploy the account.
70
+ * – `salt` Arbitrary salt used when calling the factory.
71
+ * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).
72
+ * @returns {Address} Predicted account address for the multi-owner light account.
73
+ */
54
74
  export function predictMultiOwnerLightAccountAddress({ factoryAddress, salt, ownerAddresses, }) {
55
75
  const implementationAddress =
56
76
  // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.
@@ -1 +1 @@
1
- {"version":3,"file":"predictAddress.js","sourceRoot":"","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AAM,QAAQ,GAAQ,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IAElE,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC;AAED,+HAA+H;AAE/H,SAAS,oBAAoB,CAAC,qBAA8B;IAC1D,OAAO,uBAAuB,qBAAqB,CAAC,KAAK,CACvD,CAAC,CACF,sIAAsI,CAAC;AAC1I,CAAC;AAED,SAAS,8BAA8B,CAAC,OAAc;IACpD,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import {\n encodeAbiParameters,\n encodeDeployData,\n keccak256,\n getContractAddress,\n type Address,\n type Hex,\n toHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { LightAccountVersionConfigs } from \"../types\";\nimport { OZ_ERC1967Proxy_ConstructorAbi } from \"../abis/OZ_ERC1967Proxy.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\n\nexport type PredictLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddress: Address;\n version: keyof LightAccountVersionConfigs[\"LightAccount\"];\n};\n\nexport function predictLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddress,\n version,\n}: PredictLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.LightAccount[version].addresses.default.impl;\n\n switch (version) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n // Same proxy initcode for all LA v1 factories\n const LAv1_proxy_bytecode: Hex =\n \"0x60406080815261042c908138038061001681610218565b93843982019181818403126102135780516001600160a01b038116808203610213576020838101516001600160401b0394919391858211610213570186601f820112156102135780519061007161006c83610253565b610218565b918083528583019886828401011161021357888661008f930161026e565b813b156101b9577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916841790556000927fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a28051158015906101b2575b61010b575b855160e790816103458239f35b855194606086019081118682101761019e578697849283926101889952602788527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c87890152660819985a5b195960ca1b8a8901525190845af4913d15610194573d9061017a61006c83610253565b91825281943d92013e610291565b508038808080806100fe565b5060609250610291565b634e487b7160e01b84526041600452602484fd5b50826100f9565b855162461bcd60e51b815260048101859052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761023d57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161023d57601f01601f191660200190565b60005b8381106102815750506000910152565b8181015183820152602001610271565b919290156102f357508151156102a5575090565b3b156102ae5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156103065750805190602001fd5b6044604051809262461bcd60e51b825260206004830152610336815180928160248601526020868601910161026e565b601f01601f19168101030190fdfe60806040523615605f5773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f3fea26469706673582212205da2750cd2b0cadfd354d8a1ca4752ed7f22214c8069d852f7dc6b8e9e5ee66964736f6c63430008150033\";\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: toHex(salt, { size: 32 }),\n bytecode: encodeDeployData({\n bytecode: LAv1_proxy_bytecode,\n abi: OZ_ERC1967Proxy_ConstructorAbi,\n args: [\n implementationAddress,\n encodeFunctionData({\n abi: LightAccountAbi_v1,\n functionName: \"initialize\",\n args: [ownerAddress],\n }),\n ],\n }),\n });\n\n case \"v2.0.0\":\n // Logic ported from LA factory v2.0.0\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address\" }, { type: \"uint256\" }],\n [ownerAddress, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n\n default:\n assertNeverLightAccountVersion(version);\n }\n}\n\nexport type PredictMultiOwnerLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddresses: Address[];\n // There's just one version of the MultiOwnerLightAccount for now, so skip requiring the version as a parameter.\n};\n\n// Note: assumes the owner addresses are already deduped, sorted in ascending order, and have the signer address included.\nexport function predictMultiOwnerLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddresses,\n}: PredictMultiOwnerLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses.default\n .factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses\n .default.impl;\n\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address[]\" }, { type: \"uint256\" }],\n [ownerAddresses, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n}\n\n// Bytecode from https://github.com/Vectorized/solady/blob/c6e5238e5f3b621789c59e1a443f43b6606394b2/src/utils/LibClone.sol#L721\n\nfunction getLAv2ProxyBytecode(implementationAddress: Address): Hex {\n return `0x603d3d8160223d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3`;\n}\n\nfunction assertNeverLightAccountVersion(version: never): never {\n throw new Error(`Unknown light account version: ${version}`);\n}\n"]}
1
+ {"version":3,"file":"predictAddress.js","sourceRoot":"","sources":["../../../../../src/light-account/accounts/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAGlB,KAAK,EACL,kBAAkB,GACnB,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AASnE;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,OAAO,GAC0B;IACjC,MAAM,qBAAqB;IACzB,gIAAgI;IAChI,sJAAsJ;IACtJ,cAAc;QACd,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO;QACpE,CAAC,CAAC,kBAAkB,CAAC;YACjB,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,EAAE;SACV,CAAC;QACJ,CAAC,CAAC,sBAAsB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;IAE1E,QAAQ,OAAO,EAAE,C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AsJ;IACtJ,cAAc;QACd,sBAAsB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,OAAO;aACtE,OAAO;QACR,CAAC,CAAC,kBAAkB,CAAC;YACjB,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,EAAE;SACV,CAAC;QACJ,CAAC,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,SAAS;aAC9D,OAAO,CAAC,IAAI,CAAC;IAEtB,MAAM,YAAY,GAAG,SAAS,CAC5B,mBAAmB,CACjB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC5C,CAAC,cAAc,EAAE,IAAI,CAAC,CACvB,CACF,CAAC;IAEF,MAAM,QAAQ,GAAQ,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IAElE,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC;AAED,+HAA+H;AAE/H,SAAS,oBAAoB,CAAC,qBAA8B;IAC1D,OAAO,uBAAuB,qBAAqB,CAAC,KAAK,CACvD,CAAC,CACF,sIAAsI,CAAC;AAC1I,CAAC;AAED,SAAS,8BAA8B,CAAC,OAAc;IACpD,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import {\n encodeAbiParameters,\n encodeDeployData,\n keccak256,\n getContractAddress,\n type Address,\n type Hex,\n toHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { LightAccountVersionConfigs } from \"../types\";\nimport { OZ_ERC1967Proxy_ConstructorAbi } from \"../abis/OZ_ERC1967Proxy.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\n\nexport type PredictLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddress: Address;\n version: keyof LightAccountVersionConfigs[\"LightAccount\"];\n};\n\n/**\n * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.\n *\n * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version\n * @returns {Address} The predicted address of the light account calculated based on the provided parameters\n */\nexport function predictLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddress,\n version,\n}: PredictLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.LightAccount[version].addresses.default.impl;\n\n switch (version) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n // Same proxy initcode for all LA v1 factories\n const LAv1_proxy_bytecode: Hex =\n \"0x60406080815261042c908138038061001681610218565b93843982019181818403126102135780516001600160a01b038116808203610213576020838101516001600160401b0394919391858211610213570186601f820112156102135780519061007161006c83610253565b610218565b918083528583019886828401011161021357888661008f930161026e565b813b156101b9577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916841790556000927fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a28051158015906101b2575b61010b575b855160e790816103458239f35b855194606086019081118682101761019e578697849283926101889952602788527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c87890152660819985a5b195960ca1b8a8901525190845af4913d15610194573d9061017a61006c83610253565b91825281943d92013e610291565b508038808080806100fe565b5060609250610291565b634e487b7160e01b84526041600452602484fd5b50826100f9565b855162461bcd60e51b815260048101859052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761023d57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161023d57601f01601f191660200190565b60005b8381106102815750506000910152565b8181015183820152602001610271565b919290156102f357508151156102a5575090565b3b156102ae5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156103065750805190602001fd5b6044604051809262461bcd60e51b825260206004830152610336815180928160248601526020868601910161026e565b601f01601f19168101030190fdfe60806040523615605f5773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f3fea26469706673582212205da2750cd2b0cadfd354d8a1ca4752ed7f22214c8069d852f7dc6b8e9e5ee66964736f6c63430008150033\";\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: toHex(salt, { size: 32 }),\n bytecode: encodeDeployData({\n bytecode: LAv1_proxy_bytecode,\n abi: OZ_ERC1967Proxy_ConstructorAbi,\n args: [\n implementationAddress,\n encodeFunctionData({\n abi: LightAccountAbi_v1,\n functionName: \"initialize\",\n args: [ownerAddress],\n }),\n ],\n }),\n });\n\n case \"v2.0.0\":\n // Logic ported from LA factory v2.0.0\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address\" }, { type: \"uint256\" }],\n [ownerAddress, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n\n default:\n assertNeverLightAccountVersion(version);\n }\n}\n\nexport type PredictMultiOwnerLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddresses: Address[];\n // There's just one version of the MultiOwnerLightAccount for now, so skip requiring the version as a parameter.\n};\n\n// Note: assumes the owner addresses are already deduped, sorted in ascending order, and have the signer address included.\n/**\n * Predicts the address of a **Multi-Owner Light Account** given the factory, salt\n * and the set of owner addresses.\n *\n * Internally replicates the CREATE2 calculation performed by the factory so\n * you can obtain the counter-factual account address before deployment (useful\n * for funding or displaying to users).\n *\n * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:\n * – `factoryAddress` Factory contract that will deploy the account.\n * – `salt` Arbitrary salt used when calling the factory.\n * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).\n * @returns {Address} Predicted account address for the multi-owner light account.\n */\nexport function predictMultiOwnerLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddresses,\n}: PredictMultiOwnerLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses.default\n .factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses\n .default.impl;\n\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address[]\" }, { type: \"uint256\" }],\n [ownerAddresses, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n}\n\n// Bytecode from https://github.com/Vectorized/solady/blob/c6e5238e5f3b621789c59e1a443f43b6606394b2/src/utils/LibClone.sol#L721\n\nfunction getLAv2ProxyBytecode(implementationAddress: Address): Hex {\n return `0x603d3d8160223d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3`;\n}\n\nfunction assertNeverLightAccountVersion(version: never): never {\n throw new Error(`Unknown light account version: ${version}`);\n}\n"]}
@@ -18,4 +18,22 @@ export type PredictModularAccountV2AddressParams = {
18
18
  };
19
19
  entityId: number;
20
20
  });
21
- export declare function predictModularAccountV2Address(params: PredictModularAccountV2AddressParams): Address;
21
+ /**
22
+ * Predicts the address of a modular account V2 based on the provided parameters, which include factory address, salt, and implementation address. This function supports different types of accounts including "SMA", "MA", and "WebAuthn".
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { predictModularAccountV2Address } from "@account-kit/smart-contracts";
27
+ *
28
+ * const accountAddress = predictModularAccountV2Address({
29
+ * factoryAddress: "0xFactoryAddress" as Address,
30
+ * implementationAddress: "0xImplementation" as Address,
31
+ * salt: 0n,
32
+ * type: "SMA",
33
+ * ownerAddress: "0xOwner" as Address,
34
+ * });
35
+ * ```
36
+ *
37
+ * @param {PredictModularAccountV2AddressParams} params The parameters for predicting the modular account address, including `factoryAddress`, `salt`, `implementationAddress`, and additional properties based on the account type.
38
+ * @returns {Address} The predicted address for the modular account V2.
39
+ */ export declare function predictModularAccountV2Address(params: PredictModularAccountV2AddressParams): Address;
@@ -1,5 +1,23 @@
1
1
  import { encodePacked, getContractAddress, keccak256, } from "viem";
2
- export function predictModularAccountV2Address(params) {
2
+ /**
3
+ * Predicts the address of a modular account V2 based on the provided parameters, which include factory address, salt, and implementation address. This function supports different types of accounts including "SMA", "MA", and "WebAuthn".
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { predictModularAccountV2Address } from "@account-kit/smart-contracts";
8
+ *
9
+ * const accountAddress = predictModularAccountV2Address({
10
+ * factoryAddress: "0xFactoryAddress" as Address,
11
+ * implementationAddress: "0xImplementation" as Address,
12
+ * salt: 0n,
13
+ * type: "SMA",
14
+ * ownerAddress: "0xOwner" as Address,
15
+ * });
16
+ * ```
17
+ *
18
+ * @param {PredictModularAccountV2AddressParams} params The parameters for predicting the modular account address, including `factoryAddress`, `salt`, `implementationAddress`, and additional properties based on the account type.
19
+ * @returns {Address} The predicted address for the modular account V2.
20
+ */ export function predictModularAccountV2Address(params) {
3
21
  const { factoryAddress, salt, implementationAddress } = params;
4
22
  let combinedSalt;
5
23
  let initcode;
@@ -1 +1 @@
1
- {"version":3,"file":"predictAddress.js","sourceRoot":"","sources":["../../../../../src/ma-v2/account/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,SAAS,GAGV,MAAM,MAAM,CAAC;AA0Bd,MAAM,UAAU,8BAA8B,CAC5C,MAA4C;IAE5C,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC;IAE/D,IAAI,YAAiB,CAAC;IACtB,IAAI,QAAa,CAAC;IAElB,qHAAqH;IACrH,0KAA0K;IAC1K,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,KAAK;YACR,gDAAgD;YAChD,YAAY,GAAG,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;YACxE,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;YAC1C,QAAQ,GAAG,iCAAiC,CAC1C,qBAAqB,EACrB,aAAa,CACd,CAAC;YACF,MAAM;QACR,KAAK,IAAI;YACP,YAAY,GAAG,iBAAiB,CAC9B,MAAM,CAAC,YAAY,EACnB,IAAI,EACJ,MAAM,CAAC,QAAQ,CAChB,CAAC;YAEF,QAAQ,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,UAAU;YACb,MAAM,EACJ,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GACzB,GAAG,MAAM,CAAC;YAEX,YAAY,GAAG,SAAS,CACtB,YAAY,CACV,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC3C,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAC9B,CACF,CAAC;YAEF,QAAQ,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YAEnD,MAAM;QACR;YACE,OAAO,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,YAAqB,EACrB,IAAY,EACZ,QAAgB;IAEhB,OAAO,SAAS,CACd,YAAY,CACV,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAChC,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,CAC/B,CACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,qBAA8B;IACtD,OAAO,uBAAuB,qBAAqB,CAAC,KAAK,CACvD,CAAC,CACF,sIAAsI,CAAC;AAC1I,CAAC;AAED,SAAS,iCAAiC,CACxC,qBAA8B,EAC9B,aAAkB;IAElB,OAAO,yBAAyB,qBAAqB,CAAC,KAAK,CACzD,CAAC,CACF,uIAAuI,aAAa,CAAC,KAAK,CACzJ,CAAC,CACF,EAAE,CAAC;AACN,CAAC;AAED,SAAS,+BAA+B,CAAC,CAAQ;IAC/C,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC","sourcesContent":["import {\n encodePacked,\n getContractAddress,\n keccak256,\n type Address,\n type Hex,\n} from \"viem\";\n\nexport type PredictModularAccountV2AddressParams = {\n factoryAddress: Address;\n implementationAddress: Address; // Should be the implementation address of the account type you are predicting the address for.\n salt: bigint;\n} & (\n | {\n type: \"MA\";\n ownerAddress: Address;\n entityId: number;\n }\n | {\n type: \"SMA\";\n ownerAddress: Address;\n }\n | {\n type: \"WebAuthn\";\n ownerPublicKey: {\n x: bigint;\n y: bigint;\n };\n entityId: number;\n }\n);\n\nexport function predictModularAccountV2Address(\n params: PredictModularAccountV2AddressParams,\n): Address {\n const { factoryAddress, salt, implementationAddress } = params;\n\n let combinedSalt: Hex;\n let initcode: Hex;\n\n // Note: prediction for MA and WebAuthn is currently untested, because they are not supported as an account type yet.\n // Prior to using this prediction logic, ensure that the counterfactual computation is correct by updating `predictAddress.test.ts` to include a test for MA and WebAuthn.\n switch (params.type) {\n case \"SMA\":\n // MAv2 factory uses max uint32 for SMA entityId\n combinedSalt = getCombinedSaltK1(params.ownerAddress, salt, 0xffffffff);\n const immutableArgs = params.ownerAddress;\n initcode = getProxyBytecodeWithImmutableArgs(\n implementationAddress,\n immutableArgs,\n );\n break;\n case \"MA\":\n combinedSalt = getCombinedSaltK1(\n params.ownerAddress,\n salt,\n params.entityId,\n );\n\n initcode = getProxyBytecode(implementationAddress);\n break;\n case \"WebAuthn\":\n const {\n ownerPublicKey: { x, y },\n } = params;\n\n combinedSalt = keccak256(\n encodePacked(\n [\"uint256\", \"uint256\", \"uint256\", \"uint32\"],\n [x, y, salt, params.entityId],\n ),\n );\n\n initcode = getProxyBytecode(implementationAddress);\n\n break;\n default:\n return assertNeverModularAccountV2Type(params);\n }\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initcode,\n });\n}\n\nfunction getCombinedSaltK1(\n ownerAddress: Address,\n salt: bigint,\n entityId: number,\n): Hex {\n return keccak256(\n encodePacked(\n [\"address\", \"uint256\", \"uint32\"],\n [ownerAddress, salt, entityId],\n ),\n );\n}\n\nfunction getProxyBytecode(implementationAddress: Address): Hex {\n return `0x603d3d8160223d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3`;\n}\n\nfunction getProxyBytecodeWithImmutableArgs(\n implementationAddress: Address,\n immutableArgs: Hex,\n): Hex {\n return `0x6100513d8160233d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3${immutableArgs.slice(\n 2,\n )}`;\n}\n\nfunction assertNeverModularAccountV2Type(_: never): never {\n throw new Error(\n \"Unknown modular account type in predictModularAccountV2Address\",\n );\n}\n"]}
1
+ {"version":3,"file":"predictAddress.js","sourceRoot":"","sources":["../../../../../src/ma-v2/account/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,SAAS,GAGV,MAAM,MAAM,CAAC;AA0Bd;;;;;;;;;;;;;;;;;;GAkBG,CAAC,MAAM,UAAU,8BAA8B,CAChD,MAA4C;IAE5C,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC;IAE/D,IAAI,YAAiB,CAAC;IACtB,IAAI,QAAa,CAAC;IAElB,qHAAqH;IACrH,0KAA0K;IAC1K,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,KAAK;YACR,gDAAgD;YAChD,YAAY,GAAG,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;YACxE,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;YAC1C,QAAQ,GAAG,iCAAiC,CAC1C,qBAAqB,EACrB,aAAa,CACd,CAAC;YACF,MAAM;QACR,KAAK,IAAI;YACP,YAAY,GAAG,iBAAiB,CAC9B,MAAM,CAAC,YAAY,EACnB,IAAI,EACJ,MAAM,CAAC,QAAQ,CAChB,CAAC;YAEF,QAAQ,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,UAAU;YACb,MAAM,EACJ,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GACzB,GAAG,MAAM,CAAC;YAEX,YAAY,GAAG,SAAS,CACtB,YAAY,CACV,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAC3C,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAC9B,CACF,CAAC;YAEF,QAAQ,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;YAEnD,MAAM;QACR;YACE,OAAO,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,kBAAkB,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,YAAqB,EACrB,IAAY,EACZ,QAAgB;IAEhB,OAAO,SAAS,CACd,YAAY,CACV,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,EAChC,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,CAC/B,CACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,qBAA8B;IACtD,OAAO,uBAAuB,qBAAqB,CAAC,KAAK,CACvD,CAAC,CACF,sIAAsI,CAAC;AAC1I,CAAC;AAED,SAAS,iCAAiC,CACxC,qBAA8B,EAC9B,aAAkB;IAElB,OAAO,yBAAyB,qBAAqB,CAAC,KAAK,CACzD,CAAC,CACF,uIAAuI,aAAa,CAAC,KAAK,CACzJ,CAAC,CACF,EAAE,CAAC;AACN,CAAC;AAED,SAAS,+BAA+B,CAAC,CAAQ;IAC/C,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC","sourcesContent":["import {\n encodePacked,\n getContractAddress,\n keccak256,\n type Address,\n type Hex,\n} from \"viem\";\n\nexport type PredictModularAccountV2AddressParams = {\n factoryAddress: Address;\n implementationAddress: Address; // Should be the implementation address of the account type you are predicting the address for.\n salt: bigint;\n} & (\n | {\n type: \"MA\";\n ownerAddress: Address;\n entityId: number;\n }\n | {\n type: \"SMA\";\n ownerAddress: Address;\n }\n | {\n type: \"WebAuthn\";\n ownerPublicKey: {\n x: bigint;\n y: bigint;\n };\n entityId: number;\n }\n);\n\n/**\n * Predicts the address of a modular account V2 based on the provided parameters, which include factory address, salt, and implementation address. This function supports different types of accounts including \"SMA\", \"MA\", and \"WebAuthn\".\n *\n * @example\n * ```ts\n * import { predictModularAccountV2Address } from \"@account-kit/smart-contracts\";\n *\n * const accountAddress = predictModularAccountV2Address({\n * factoryAddress: \"0xFactoryAddress\" as Address,\n * implementationAddress: \"0xImplementation\" as Address,\n * salt: 0n,\n * type: \"SMA\",\n * ownerAddress: \"0xOwner\" as Address,\n * });\n * ```\n *\n * @param {PredictModularAccountV2AddressParams} params The parameters for predicting the modular account address, including `factoryAddress`, `salt`, `implementationAddress`, and additional properties based on the account type.\n * @returns {Address} The predicted address for the modular account V2.\n */ export function predictModularAccountV2Address(\n params: PredictModularAccountV2AddressParams,\n): Address {\n const { factoryAddress, salt, implementationAddress } = params;\n\n let combinedSalt: Hex;\n let initcode: Hex;\n\n // Note: prediction for MA and WebAuthn is currently untested, because they are not supported as an account type yet.\n // Prior to using this prediction logic, ensure that the counterfactual computation is correct by updating `predictAddress.test.ts` to include a test for MA and WebAuthn.\n switch (params.type) {\n case \"SMA\":\n // MAv2 factory uses max uint32 for SMA entityId\n combinedSalt = getCombinedSaltK1(params.ownerAddress, salt, 0xffffffff);\n const immutableArgs = params.ownerAddress;\n initcode = getProxyBytecodeWithImmutableArgs(\n implementationAddress,\n immutableArgs,\n );\n break;\n case \"MA\":\n combinedSalt = getCombinedSaltK1(\n params.ownerAddress,\n salt,\n params.entityId,\n );\n\n initcode = getProxyBytecode(implementationAddress);\n break;\n case \"WebAuthn\":\n const {\n ownerPublicKey: { x, y },\n } = params;\n\n combinedSalt = keccak256(\n encodePacked(\n [\"uint256\", \"uint256\", \"uint256\", \"uint32\"],\n [x, y, salt, params.entityId],\n ),\n );\n\n initcode = getProxyBytecode(implementationAddress);\n\n break;\n default:\n return assertNeverModularAccountV2Type(params);\n }\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initcode,\n });\n}\n\nfunction getCombinedSaltK1(\n ownerAddress: Address,\n salt: bigint,\n entityId: number,\n): Hex {\n return keccak256(\n encodePacked(\n [\"address\", \"uint256\", \"uint32\"],\n [ownerAddress, salt, entityId],\n ),\n );\n}\n\nfunction getProxyBytecode(implementationAddress: Address): Hex {\n return `0x603d3d8160223d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3`;\n}\n\nfunction getProxyBytecodeWithImmutableArgs(\n implementationAddress: Address,\n immutableArgs: Hex,\n): Hex {\n return `0x6100513d8160233d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3${immutableArgs.slice(\n 2,\n )}`;\n}\n\nfunction assertNeverModularAccountV2Type(_: never): never {\n throw new Error(\n \"Unknown modular account type in predictModularAccountV2Address\",\n );\n}\n"]}
@@ -7,6 +7,8 @@ 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 { predictLightAccountAddress } from "./light-account/accounts/predictAddress.js";
11
+ export { predictMultiOwnerLightAccountAddress } from "./light-account/accounts/predictAddress.js";
10
12
  export { AccountVersionRegistry, LightAccountUnsupported1271Factories, LightAccountUnsupported1271Impls, defaultLightAccountVersion, getDefaultLightAccountFactoryAddress, getDefaultMultiOwnerLightAccountFactoryAddress, getLightAccountVersionForAccount, } from "./light-account/utils.js";
11
13
  export type * from "./light-account/accounts/multiOwner.js";
12
14
  export { createMultiOwnerLightAccount } from "./light-account/accounts/multiOwner.js";
@@ -58,4 +60,5 @@ export type * from "./ma-v2/client/client.js";
58
60
  export { createModularAccountV2Client } from "./ma-v2/client/client.js";
59
61
  export type * from "./ma-v2/utils.js";
60
62
  export { getMAV2UpgradeToData } from "./ma-v2/utils.js";
63
+ export { predictModularAccountV2Address } from "./ma-v2/account/predictAddress.js";
61
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,IAAI,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClH,OAAO,EACL,+BAA+B,EAC/B,KAAK,+BAA+B,GACrC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACL,yCAAyC,EACzC,KAAK,yCAAyC,GAC/C,MAAM,oDAAoD,CAAC;AAC5D,mBAAmB,4CAA4C,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,mBAAmB,0BAA0B,CAAC;AAE9C,OAAO,EACL,sBAAsB,EACtB,oCAAoC,EACpC,gCAAgC,EAChC,0BAA0B,EAC1B,oCAAoC,EACpC,8CAA8C,EAC9C,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAGlC,mBAAmB,wCAAwC,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,YAAY,IAAI,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,kCAAk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1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,2CAA2C,CAAC;AAC/D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,GACrC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EACL,gDAAgD,EAChD,8CAA8C,EAC9C,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAGzB,mBAAmB,qCAAqC,CAAC;AACzD,mBAAmB,gDAAgD,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,mBAAmB,0BAA0B,CAAC;AAC9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,mBAAmB,kBAAkB,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC"}
@@ -6,11 +6,31 @@ export type PredictLightAccountAddressParams = {
6
6
  ownerAddress: Address;
7
7
  version: keyof LightAccountVersionConfigs["LightAccount"];
8
8
  };
9
+ /**
10
+ * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.
11
+ *
12
+ * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version
13
+ * @returns {Address} The predicted address of the light account calculated based on the provided parameters
14
+ */
9
15
  export declare function predictLightAccountAddress({ factoryAddress, salt, ownerAddress, version, }: PredictLightAccountAddressParams): Address;
10
16
  export type PredictMultiOwnerLightAccountAddressParams = {
11
17
  factoryAddress: Address;
12
18
  salt: bigint;
13
19
  ownerAddresses: Address[];
14
20
  };
21
+ /**
22
+ * Predicts the address of a **Multi-Owner Light Account** given the factory, salt
23
+ * and the set of owner addresses.
24
+ *
25
+ * Internally replicates the CREATE2 calculation performed by the factory so
26
+ * you can obtain the counter-factual account address before deployment (useful
27
+ * for funding or displaying to users).
28
+ *
29
+ * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:
30
+ * – `factoryAddress` Factory contract that will deploy the account.
31
+ * – `salt` Arbitrary salt used when calling the factory.
32
+ * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).
33
+ * @returns {Address} Predicted account address for the multi-owner light account.
34
+ */
15
35
  export declare function predictMultiOwnerLightAccountAddress({ factoryAddress, salt, ownerAddresses, }: PredictMultiOwnerLightAccountAddressParams): Address;
16
36
  //# sourceMappingURL=predictAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"predictAddress.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/accounts/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,OAAO,EAIb,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAK3D,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,0BAA0B,CAAC,cAAc,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EACzC,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,OAAO,GACR,EAAE,gCAAgC,GAAG,OAAO,CA2D5C;AAED,MAAM,MAAM,0CAA0C,GAAG;IACvD,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,EAAE,CAAC;CAE3B,CAAC;AAGF,wBAAgB,oCAAoC,CAAC,EACnD,cAAc,EACd,IAAI,EACJ,cAAc,GACf,EAAE,0CAA0C,GAAG,OAAO,CA6BtD"}
1
+ {"version":3,"file":"predictAddress.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/accounts/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,OAAO,EAIb,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAK3D,MAAM,MAAM,gCAAgC,GAAG;IAC7C,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,0BAA0B,CAAC,cAAc,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,OAAO,GACR,EAAE,gCAAgC,GAAG,OAAO,CA2D5C;AAED,MAAM,MAAM,0CAA0C,GAAG;IACvD,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,EAAE,CAAC;CAE3B,CAAC;AAGF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,cAAc,EACd,IAAI,EACJ,cAAc,GACf,EAAE,0CAA0C,GAAG,OAAO,CA6BtD"}
@@ -18,5 +18,23 @@ export type PredictModularAccountV2AddressParams = {
18
18
  };
19
19
  entityId: number;
20
20
  });
21
- export declare function predictModularAccountV2Address(params: PredictModularAccountV2AddressParams): Address;
21
+ /**
22
+ * Predicts the address of a modular account V2 based on the provided parameters, which include factory address, salt, and implementation address. This function supports different types of accounts including "SMA", "MA", and "WebAuthn".
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { predictModularAccountV2Address } from "@account-kit/smart-contracts";
27
+ *
28
+ * const accountAddress = predictModularAccountV2Address({
29
+ * factoryAddress: "0xFactoryAddress" as Address,
30
+ * implementationAddress: "0xImplementation" as Address,
31
+ * salt: 0n,
32
+ * type: "SMA",
33
+ * ownerAddress: "0xOwner" as Address,
34
+ * });
35
+ * ```
36
+ *
37
+ * @param {PredictModularAccountV2AddressParams} params The parameters for predicting the modular account address, including `factoryAddress`, `salt`, `implementationAddress`, and additional properties based on the account type.
38
+ * @returns {Address} The predicted address for the modular account V2.
39
+ */ export declare function predictModularAccountV2Address(params: PredictModularAccountV2AddressParams): Address;
22
40
  //# sourceMappingURL=predictAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"predictAddress.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/account/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AAEd,MAAM,MAAM,oCAAoC,GAAG;IACjD,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,CACA;IACE,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;CACvB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB,CACJ,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAoDT"}
1
+ {"version":3,"file":"predictAddress.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/account/predictAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AAEd,MAAM,MAAM,oCAAoC,GAAG;IACjD,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,CACA;IACE,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;CACvB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB,CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG,CAAC,wBAAgB,8BAA8B,CAChD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAoDT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/smart-contracts",
3
- "version": "4.43.1",
3
+ "version": "4.44.0",
4
4
  "description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "test:run": "vitest run"
53
53
  },
54
54
  "devDependencies": {
55
- "@account-kit/plugingen": "^4.43.1",
55
+ "@account-kit/plugingen": "^4.44.0",
56
56
  "change-case": "^5.1.2",
57
57
  "dedent": "^1.5.1",
58
58
  "dotenv": "^16.3.1",
@@ -70,10 +70,10 @@
70
70
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
71
71
  },
72
72
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
73
- "gitHead": "f11e22e20d988764c0431dbec6a00c921ebaabec",
73
+ "gitHead": "29c87d1385f13cffcb55e6286bfaeb26637d5fe9",
74
74
  "dependencies": {
75
- "@aa-sdk/core": "^4.43.1",
76
- "@account-kit/infra": "^4.43.1",
75
+ "@aa-sdk/core": "^4.44.0",
76
+ "@account-kit/infra": "^4.44.0",
77
77
  "webauthn-p256": "^0.0.10"
78
78
  },
79
79
  "peerDependencies": {
package/src/index.ts CHANGED
@@ -17,6 +17,8 @@ export {
17
17
  export type * from "./light-account/decorators/lightAccount.js";
18
18
  export { lightAccountClientActions } from "./light-account/decorators/lightAccount.js";
19
19
  export type * from "./light-account/types.js";
20
+ export { predictLightAccountAddress } from "./light-account/accounts/predictAddress.js";
21
+ export { predictMultiOwnerLightAccountAddress } from "./light-account/accounts/predictAddress.js";
20
22
 
21
23
  export {
22
24
  AccountVersionRegistry,
@@ -124,3 +126,4 @@ export type * from "./ma-v2/client/client.js";
124
126
  export { createModularAccountV2Client } from "./ma-v2/client/client.js";
125
127
  export type * from "./ma-v2/utils.js";
126
128
  export { getMAV2UpgradeToData } from "./ma-v2/utils.js";
129
+ export { predictModularAccountV2Address } from "./ma-v2/account/predictAddress.js";
@@ -20,6 +20,12 @@ export type PredictLightAccountAddressParams = {
20
20
  version: keyof LightAccountVersionConfigs["LightAccount"];
21
21
  };
22
22
 
23
+ /**
24
+ * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.
25
+ *
26
+ * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version
27
+ * @returns {Address} The predicted address of the light account calculated based on the provided parameters
28
+ */
23
29
  export function predictLightAccountAddress({
24
30
  factoryAddress,
25
31
  salt,
@@ -94,6 +100,20 @@ export type PredictMultiOwnerLightAccountAddressParams = {
94
100
  };
95
101
 
96
102
  // Note: assumes the owner addresses are already deduped, sorted in ascending order, and have the signer address included.
103
+ /**
104
+ * Predicts the address of a **Multi-Owner Light Account** given the factory, salt
105
+ * and the set of owner addresses.
106
+ *
107
+ * Internally replicates the CREATE2 calculation performed by the factory so
108
+ * you can obtain the counter-factual account address before deployment (useful
109
+ * for funding or displaying to users).
110
+ *
111
+ * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:
112
+ * – `factoryAddress` Factory contract that will deploy the account.
113
+ * – `salt` Arbitrary salt used when calling the factory.
114
+ * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).
115
+ * @returns {Address} Predicted account address for the multi-owner light account.
116
+ */
97
117
  export function predictMultiOwnerLightAccountAddress({
98
118
  factoryAddress,
99
119
  salt,
@@ -30,7 +30,25 @@ export type PredictModularAccountV2AddressParams = {
30
30
  }
31
31
  );
32
32
 
33
- export function predictModularAccountV2Address(
33
+ /**
34
+ * Predicts the address of a modular account V2 based on the provided parameters, which include factory address, salt, and implementation address. This function supports different types of accounts including "SMA", "MA", and "WebAuthn".
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * import { predictModularAccountV2Address } from "@account-kit/smart-contracts";
39
+ *
40
+ * const accountAddress = predictModularAccountV2Address({
41
+ * factoryAddress: "0xFactoryAddress" as Address,
42
+ * implementationAddress: "0xImplementation" as Address,
43
+ * salt: 0n,
44
+ * type: "SMA",
45
+ * ownerAddress: "0xOwner" as Address,
46
+ * });
47
+ * ```
48
+ *
49
+ * @param {PredictModularAccountV2AddressParams} params The parameters for predicting the modular account address, including `factoryAddress`, `salt`, `implementationAddress`, and additional properties based on the account type.
50
+ * @returns {Address} The predicted address for the modular account V2.
51
+ */ export function predictModularAccountV2Address(
34
52
  params: PredictModularAccountV2AddressParams,
35
53
  ): Address {
36
54
  const { factoryAddress, salt, implementationAddress } = params;