@account-kit/smart-contracts 4.0.0-alpha.1 → 4.0.0-alpha.2
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.
- package/dist/cjs/plugindefs/multi-owner/config.js +16 -17
- package/dist/cjs/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/cjs/plugindefs/multisig/config.js +15 -15
- package/dist/cjs/plugindefs/multisig/config.js.map +1 -1
- package/dist/cjs/plugindefs/session-key/config.js +17 -17
- package/dist/cjs/plugindefs/session-key/config.js.map +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
- package/dist/cjs/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/cjs/src/light-account/utils.js +20 -19
- package/dist/cjs/src/light-account/utils.js.map +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/cjs/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/cjs/src/msca/utils.js +11 -10
- package/dist/cjs/src/msca/utils.js.map +1 -1
- package/dist/esm/plugindefs/multi-owner/config.js +1 -2
- package/dist/esm/plugindefs/multi-owner/config.js.map +1 -1
- package/dist/esm/plugindefs/multisig/config.js +1 -1
- package/dist/esm/plugindefs/multisig/config.js.map +1 -1
- package/dist/esm/plugindefs/session-key/config.js +1 -1
- package/dist/esm/plugindefs/session-key/config.js.map +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/esm/src/light-account/clients/alchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
- package/dist/esm/src/light-account/clients/multiOwnerAlchemyClient.js.map +1 -1
- package/dist/esm/src/light-account/decorators/lightAccount.js.map +1 -1
- package/dist/esm/src/light-account/decorators/multiOwnerLightAccount.js.map +1 -1
- package/dist/esm/src/light-account/utils.js +2 -1
- package/dist/esm/src/light-account/utils.js.map +1 -1
- package/dist/esm/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/alchemyClient.js.map +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js +1 -1
- package/dist/esm/src/msca/client/multiSigAlchemyClient.js.map +1 -1
- package/dist/esm/src/msca/utils.js +2 -1
- package/dist/esm/src/msca/utils.js.map +1 -1
- package/dist/types/plugindefs/multi-owner/config.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts +1 -1
- package/dist/types/src/light-account/clients/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts +1 -1
- package/dist/types/src/light-account/clients/multiOwnerAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/lightAccount.d.ts +1 -1
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +1 -1
- package/dist/types/src/light-account/utils.d.ts.map +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/alchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts +1 -1
- package/dist/types/src/msca/client/multiSigAlchemyClient.d.ts.map +1 -1
- package/dist/types/src/msca/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/plugindefs/multi-owner/config.ts +1 -2
- package/plugindefs/multisig/config.ts +1 -1
- package/plugindefs/session-key/config.ts +1 -1
- package/src/light-account/clients/alchemyClient.ts +2 -2
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +2 -2
- package/src/light-account/decorators/lightAccount.ts +1 -1
- package/src/light-account/decorators/multiOwnerLightAccount.ts +1 -1
- package/src/light-account/utils.ts +2 -3
- package/src/msca/client/alchemyClient.ts +2 -2
- package/src/msca/client/multiSigAlchemyClient.ts +5 -5
- package/src/msca/utils.ts +9 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/msca/utils.ts"],"names":[],"mappings":";;;AAAA,uCAmBsB;AAEtB,+BAOc;AACd,kDAA+C;AAC/C,kGAA+F;AAC/F,sFAAmF;AACnF,yEAGwC;AACxC,+DAAmE;AAS5D,MAAM,8CAA8C,GAAG,CAC5D,KAAY,EACH,EAAE;IACX,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,cAAO,CAAC,EAAE,CAAC;QAChB,KAAK,kBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,cAAO,CAAC,EAAE,CAAC;QAChB,KAAK,cAAO,CAAC,EAAE,CAAC;QAChB,KAAK,kBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,eAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,sBAAe,CAAC,EAAE,CAAC;QACxB,KAAK,eAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,sBAAe,CAAC,EAAE,CAAC;QACxB,KAAK,WAAI,CAAC,EAAE,CAAC;QACb;YACE,OAAO,4CAA4C,CAAC;IACxD,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,8CAA8C,kDAiBzD;AASK,MAAM,gDAAgD,GAAG,CAC9D,KAAY,EACH,EAAE;IACX,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB;YACE,OAAO,4CAA4C,CAAC;IACxD,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,gDAAgD,oDAO3D;AA0BK,KAAK,UAAU,oBAAoB,CAQxC,MAAwD,EACxD,IAA6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\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport {\n custom,\n encodeAbiParameters,\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n parseAbiParameters,\n} from \"viem\";\nimport { IPluginAbi } from \"./abis/IPlugin.js\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"./abis/MultiOwnerModularAccountFactory.js\";\nimport { UpgradeableModularAccountAbi } from \"./abis/UpgradeableModularAccount.js\";\nimport {\n createMultiOwnerModularAccount,\n type MultiOwnerModularAccount,\n} from \"./account/multiOwnerAccount.js\";\nimport { MultiOwnerPlugin } from \"./plugins/multi-owner/plugin.js\";\n\n/**\n * Utility method returning the default multi sig msca factory address given a {@link Chain} object\n *\n * @param chain a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultisigModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000204327E6669f00901a57CE15aE15\";\n }\n};\n\n/**\n * Utility method returning the default multi owner msca factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n default:\n return \"0x000000e92D78D90000007F0082006FDA09BD5f11\";\n }\n};\n\nexport type GetMSCAUpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n} & GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Multi-Signature Contract Account (MSCA) and provides a method to create a Multi-Owner Modular Account.\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMSCAUpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient(...);\n * const upgradeData = await getMSCAUpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMSCAUpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Multi-Owner Modular Account\n */\nexport async function getMSCAUpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMSCAUpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>;\n }\n> {\n const { account: account_ = client.account, multiOwnerPluginAddress } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = await getMAInitializationData({\n client,\n multiOwnerPluginAddress,\n signerAddress: await account.getSigner().getAddress(),\n });\n\n return {\n ...initData,\n createMAAccount: async () =>\n createMultiOwnerModularAccount({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport type GetMAInitializationDataParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n client: SmartAccountClient<TTransport, TChain, TAccount>;\n signerAddress: Address | Address[];\n};\n\n/**\n * Retrieves the initialization data for a multi-owner modular account. Throws an error if the client's chain is not found or if the multi-owner plugin address is not retrievable.\n *\n * @example\n * ```ts\n * import { getMAInitializationData } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...);\n * const initializationData = await getMAInitializationData({\n * client,\n * signerAddress: \"0x...\", // or array of signers\n * });\n * ```\n *\n * @param {GetMAInitializationDataParams<TTransport, TChain, TAccount>} params the parameters for getting initialization data\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} params.client the smart account client\n * @param {Address | Address[]} params.signerAddress the address of the signer or an array of signer addresses\n * @param {Address} [params.multiOwnerPluginAddress] optional address of the multi-owner plugin\n * @returns {Promise<UpgradeToData>} a promise that resolves to the initialization data required for upgrading to a multi-owner modular account\n */\nexport async function getMAInitializationData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>({\n client,\n multiOwnerPluginAddress,\n signerAddress,\n}: GetMAInitializationDataParams<\n TTransport,\n TChain,\n TAccount\n>): Promise<UpgradeToData> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(\n client.chain\n );\n\n const implAddress = await client.readContract({\n abi: MultiOwnerModularAccountFactoryAbi,\n address: factoryAddress,\n functionName: \"IMPL\",\n });\n\n const multiOwnerAddress =\n multiOwnerPluginAddress ?? MultiOwnerPlugin.meta.addresses[client.chain.id];\n\n if (!multiOwnerAddress) {\n throw new Error(\"could not get multi owner plugin address\");\n }\n\n const moPluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: multiOwnerAddress,\n functionName: \"pluginManifest\",\n });\n\n const hashedMultiOwnerPluginManifest = keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: moPluginManifest,\n })\n );\n\n const encodedOwner = encodeAbiParameters(\n parseAbiParameters(\"address[]\"),\n Array.isArray(signerAddress) ? [signerAddress] : [[signerAddress]]\n );\n\n const encodedPluginInitData = encodeAbiParameters(\n parseAbiParameters(\"bytes32[], bytes[]\"),\n [[hashedMultiOwnerPluginManifest], [encodedOwner]]\n );\n\n const encodedMSCAInitializeData = encodeFunctionData({\n abi: UpgradeableModularAccountAbi,\n functionName: \"initialize\",\n args: [[multiOwnerAddress], encodedPluginInitData],\n });\n\n return {\n implAddress,\n initializationData: encodedMSCAInitializeData,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/msca/utils.ts"],"names":[],"mappings":";;;AAAA,uCASsB;AACtB,8CAW4B;AAE5B,+BAOc;AACd,kDAA+C;AAC/C,kGAA+F;AAC/F,sFAAmF;AACnF,yEAGwC;AACxC,+DAAmE;AAS5D,MAAM,8CAA8C,GAAG,CAC5D,KAAY,EACH,EAAE;IACX,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,eAAO,CAAC,EAAE,CAAC;QAChB,KAAK,mBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,eAAO,CAAC,EAAE,CAAC;QAChB,KAAK,eAAO,CAAC,EAAE,CAAC;QAChB,KAAK,mBAAW,CAAC,EAAE,CAAC;QACpB,KAAK,gBAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,uBAAe,CAAC,EAAE,CAAC;QACxB,KAAK,gBAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,uBAAe,CAAC,EAAE,CAAC;QACxB,KAAK,YAAI,CAAC,EAAE,CAAC;QACb;YACE,OAAO,4CAA4C,CAAC;IACxD,C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AkB,EAAC;QACnD,GAAG,EAAE,2DAA4B;QACjC,YAAY,EAAE,YAAY;QAC1B,IAAI,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;KACnD,CAAC,CAAC;IAEH,OAAO;QACL,WAAW;QACX,kBAAkB,EAAE,yBAAyB;KAC9C,CAAC;AACJ,CAAC;AAtED,0DAsEC","sourcesContent":["import {\n AccountNotFoundError,\n ChainNotFoundError,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n} from \"@account-kit/infra\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport {\n custom,\n encodeAbiParameters,\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n parseAbiParameters,\n} from \"viem\";\nimport { IPluginAbi } from \"./abis/IPlugin.js\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"./abis/MultiOwnerModularAccountFactory.js\";\nimport { UpgradeableModularAccountAbi } from \"./abis/UpgradeableModularAccount.js\";\nimport {\n createMultiOwnerModularAccount,\n type MultiOwnerModularAccount,\n} from \"./account/multiOwnerAccount.js\";\nimport { MultiOwnerPlugin } from \"./plugins/multi-owner/plugin.js\";\n\n/**\n * Utility method returning the default multi sig msca factory address given a {@link Chain} object\n *\n * @param chain a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultisigModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000204327E6669f00901a57CE15aE15\";\n }\n};\n\n/**\n * Utility method returning the default multi owner msca factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n default:\n return \"0x000000e92D78D90000007F0082006FDA09BD5f11\";\n }\n};\n\nexport type GetMSCAUpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n} & GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Multi-Signature Contract Account (MSCA) and provides a method to create a Multi-Owner Modular Account.\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMSCAUpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient(...);\n * const upgradeData = await getMSCAUpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMSCAUpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Multi-Owner Modular Account\n */\nexport async function getMSCAUpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMSCAUpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>;\n }\n> {\n const { account: account_ = client.account, multiOwnerPluginAddress } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = await getMAInitializationData({\n client,\n multiOwnerPluginAddress,\n signerAddress: await account.getSigner().getAddress(),\n });\n\n return {\n ...initData,\n createMAAccount: async () =>\n createMultiOwnerModularAccount({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport type GetMAInitializationDataParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n client: SmartAccountClient<TTransport, TChain, TAccount>;\n signerAddress: Address | Address[];\n};\n\n/**\n * Retrieves the initialization data for a multi-owner modular account. Throws an error if the client's chain is not found or if the multi-owner plugin address is not retrievable.\n *\n * @example\n * ```ts\n * import { getMAInitializationData } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...);\n * const initializationData = await getMAInitializationData({\n * client,\n * signerAddress: \"0x...\", // or array of signers\n * });\n * ```\n *\n * @param {GetMAInitializationDataParams<TTransport, TChain, TAccount>} params the parameters for getting initialization data\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} params.client the smart account client\n * @param {Address | Address[]} params.signerAddress the address of the signer or an array of signer addresses\n * @param {Address} [params.multiOwnerPluginAddress] optional address of the multi-owner plugin\n * @returns {Promise<UpgradeToData>} a promise that resolves to the initialization data required for upgrading to a multi-owner modular account\n */\nexport async function getMAInitializationData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>({\n client,\n multiOwnerPluginAddress,\n signerAddress,\n}: GetMAInitializationDataParams<\n TTransport,\n TChain,\n TAccount\n>): Promise<UpgradeToData> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(\n client.chain\n );\n\n const implAddress = await client.readContract({\n abi: MultiOwnerModularAccountFactoryAbi,\n address: factoryAddress,\n functionName: \"IMPL\",\n });\n\n const multiOwnerAddress =\n multiOwnerPluginAddress ?? MultiOwnerPlugin.meta.addresses[client.chain.id];\n\n if (!multiOwnerAddress) {\n throw new Error(\"could not get multi owner plugin address\");\n }\n\n const moPluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: multiOwnerAddress,\n functionName: \"pluginManifest\",\n });\n\n const hashedMultiOwnerPluginManifest = keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: moPluginManifest,\n })\n );\n\n const encodedOwner = encodeAbiParameters(\n parseAbiParameters(\"address[]\"),\n Array.isArray(signerAddress) ? [signerAddress] : [[signerAddress]]\n );\n\n const encodedPluginInitData = encodeAbiParameters(\n parseAbiParameters(\"bytes32[], bytes[]\"),\n [[hashedMultiOwnerPluginManifest], [encodedOwner]]\n );\n\n const encodedMSCAInitializeData = encodeFunctionData({\n abi: UpgradeableModularAccountAbi,\n functionName: \"initialize\",\n args: [[multiOwnerAddress], encodedPluginInitData],\n });\n\n return {\n implAddress,\n initializationData: encodedMSCAInitializeData,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "@
|
|
1
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "@account-kit/infra";
|
|
2
2
|
import { parseAbiParameters } from "viem";
|
|
3
3
|
import { MultiOwnerPluginAbi } from "./abi.js";
|
|
4
4
|
export const MultiOwnerPluginGenConfig = {
|
|
@@ -15,7 +15,6 @@ export const MultiOwnerPluginGenConfig = {
|
|
|
15
15
|
[arbitrum.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
16
16
|
[arbitrumSepolia.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
17
17
|
[base.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
18
|
-
[baseSepolia.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
19
18
|
[fraxtal.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
20
19
|
[fraxtalSepolia.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
21
20
|
[zora.id]: "0xcE0000007B008F50d762D155002600004cD6c647",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/multi-owner/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/multi-owner/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAiB;IACrD,IAAI,EAAE,kBAAkB;IACxB,GAAG,EAAE,mBAAmB;IACxB,SAAS,EAAE;QACT,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC9D,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC9D,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAChE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC3D,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAClE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC3D,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAClE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACvD,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACjE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACvD,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC9D,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;KAC3D;IACD,aAAa,EAAE;QACb,aAAa,EAAE,kBAAkB,CAAC,WAAW,CAAC;KAC/C;CACF,CAAC","sourcesContent":["import {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"@account-kit/infra\";\nimport type { PluginConfig } from \"@account-kit/plugingen\";\nimport { parseAbiParameters } from \"viem\";\nimport { MultiOwnerPluginAbi } from \"./abi.js\";\n\nexport const MultiOwnerPluginGenConfig: PluginConfig = {\n name: \"MultiOwnerPlugin\",\n abi: MultiOwnerPluginAbi,\n addresses: {\n [sepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [baseSepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [polygon.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [polygonAmoy.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [polygonMumbai.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [optimism.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [optimismSepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [arbitrum.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [arbitrumSepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [base.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [fraxtal.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [fraxtalSepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [zora.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [zoraSepolia.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n [mainnet.id]: \"0xcE0000007B008F50d762D155002600004cD6c647\",\n },\n installConfig: {\n initAbiParams: parseAbiParameters(\"address[]\"),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, zora, zoraSepolia, } from "@
|
|
1
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, zora, zoraSepolia, } from "@account-kit/infra";
|
|
2
2
|
import { parseAbiParameters } from "viem";
|
|
3
3
|
import { MultisigPluginAbi } from "./abi.js";
|
|
4
4
|
export const MultisigPluginGenConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/multisig/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/multisig/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,CAAC,MAAM,uBAAuB,GAAiB;IACnD,IAAI,EAAE,gBAAgB;IACtB,GAAG,EAAE,iBAAiB;IACtB,SAAS,EAAE;QACT,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC9D,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC9D,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC3D,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAClE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC3D,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAClE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACvD,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,4CAA4C;QAC1D,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACjE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,4CAA4C;QACvD,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,4CAA4C;KAC/D;IACD,aAAa,EAAE;QACb,aAAa,EAAE,kBAAkB,CAAC,iBAAiB,CAAC;KACrD;CACF,CAAC","sourcesContent":["import {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n zora,\n zoraSepolia,\n} from \"@account-kit/infra\";\nimport type { PluginConfig } from \"@account-kit/plugingen\";\nimport { parseAbiParameters } from \"viem\";\nimport { MultisigPluginAbi } from \"./abi.js\";\n\nexport const MultisigPluginGenConfig: PluginConfig = {\n name: \"MultisigPlugin\",\n abi: MultisigPluginAbi,\n addresses: {\n [sepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [baseSepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [polygon.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [mainnet.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [polygonAmoy.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [optimism.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [optimismSepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [arbitrum.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [arbitrumSepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [base.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [fraxtal.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [fraxtalSepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [zora.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n [zoraSepolia.id]: \"0x000000000000A53f64b7bcf4Cd59624943C43Fc7\",\n },\n installConfig: {\n initAbiParams: parseAbiParameters(\"address[], uint\"),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "@
|
|
1
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, fraxtal, fraxtalSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "@account-kit/infra";
|
|
2
2
|
import { parseAbiParameters } from "viem";
|
|
3
3
|
import { MultiOwnerPluginGenConfig } from "../multi-owner/config.js";
|
|
4
4
|
import { SessionKeyPluginAbi } from "./abi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/session-key/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../plugindefs/session-key/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,O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YACD;gBACE,MAAM,EAAE,yBAAyB;gBACjC,UAAU,EAAE,KAAK;aAClB;SACF;KACF;CACF,CAAC","sourcesContent":["import {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"@account-kit/infra\";\nimport type { PluginConfig } from \"@account-kit/plugingen\";\nimport { parseAbiParameters } from \"viem\";\nimport { MultiOwnerPluginGenConfig } from \"../multi-owner/config.js\";\nimport { SessionKeyPluginAbi } from \"./abi.js\";\n\nexport const SessionKeyPluginGenConfig: PluginConfig = {\n name: \"SessionKeyPlugin\",\n abi: SessionKeyPluginAbi,\n addresses: {\n [sepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [baseSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [polygon.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [polygonAmoy.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [polygonMumbai.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [optimism.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [optimismSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [arbitrum.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [arbitrumSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [base.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [baseSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [fraxtal.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [fraxtalSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [zora.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [zoraSepolia.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n [mainnet.id]: \"0x0000003E0000a96de4058e1E02a62FaaeCf23d8d\",\n },\n installConfig: {\n initAbiParams: parseAbiParameters(\n \"address[] initialKeys, bytes32[] tags, bytes[][] initialPermissions\"\n ),\n dependencies: [\n {\n plugin: MultiOwnerPluginGenConfig,\n functionId: \"0x0\",\n },\n {\n plugin: MultiOwnerPluginGenConfig,\n functionId: \"0x1\",\n },\n ],\n },\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateLightAccountParams, type LightAccount, type LightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, LightAccount<TSigner>, LightAccountClientActions<TSigner>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAI1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AA8ChF,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,MAAuC;IAEvC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC;QACvC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import 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 createLightAccount,\n lightAccountClientActions,\n type CreateLightAccountParams,\n type LightAccount,\n type LightAccountClientActions,\n} from \"@account-kit/smart-contracts\";\nimport { custom, type Chain, type CustomTransport, type Transport } from \"viem\";\n\nexport type AlchemyLightAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateLightAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport async function createLightAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyLightAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\n\n/**\n * Creates an Alchemy smart account client connected to a Light Account instance.\n *\n * @example\n * ```ts\n * import { createLightAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAccountClient = await createLightAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyLightAccountClientConfig} config The configuration for setting up the Alchemy Light Account Client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` object containing the created client\n */\nexport async function createLightAccountAlchemyClient(\n config: AlchemyLightAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createLightAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n }).extend(lightAccountClientActions);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & 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":"
|
|
1
|
+
{"version":3,"file":"multiOwnerAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,GAIpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAoD,MAAM,MAAM,CAAC;AAkDhF,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAC7D,MAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AAgCzC,MAAM,CAAC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra
|
|
1
|
+
{"version":3,"file":"lightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/lightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AAgCzC,MAAM,CAAC,MAAM,yBAAyB,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(lightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions\n */\nexport const lightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => LightAccountClientActions<TSigner, TAccount> = (client) => ({\n transferOwnership: async (args) => transferOwnership(client, args),\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,GAEb,MAAM,4BAA4B,CAAC;AAgCpC,MAAM,CAAC,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra
|
|
1
|
+
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/decorators/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,GAEb,MAAM,4BAA4B,CAAC;AAgCpC,MAAM,CAAC,MAAM,mCAAmC,GASc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;CACzD,CAAC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { MultiOwnerLightAccount } from \"../accounts/multiOwner\";\nimport {\n updateOwners,\n type UpdateMultiOwnerLightAccountOwnersParams,\n} from \"../actions/updateOwners.js\";\n\nexport type MultiOwnerLightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n> = {\n updateOwners: (\n args: UpdateMultiOwnerLightAccountOwnersParams<TSigner, TAccount>\n ) => Promise<Hex>;\n};\n\n/**\n * Generates client actions for a multi-owner light account, including the ability to update owners.\n *\n * @example\n * ```ts\n * import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createMultiOwnerLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(multiOwnerLightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client for interacting with the multi-owner light account\n * @returns {MultiOwnerLightAccountClientActions<TSigner, TAccount>} an object containing the client actions specifically for a multi-owner light account\n */\nexport const multiOwnerLightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends MultiOwnerLightAccount<TSigner> | undefined =\n | MultiOwnerLightAccount<TSigner>\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => MultiOwnerLightAccountClientActions<TSigner, TAccount> = (client) => ({\n updateOwners: async (args) => updateOwners(client, args),\n});\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DefaultFactoryNotDefinedError,
|
|
1
|
+
import { DefaultFactoryNotDefinedError, toRecord } from "@aa-sdk/core";
|
|
2
|
+
import { arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "@account-kit/infra";
|
|
2
3
|
import { fromHex } from "viem";
|
|
3
4
|
export const supportedChains = [
|
|
4
5
|
mainnet,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAA4B,MAAM,MAAM,CAAC;AAiBzD,MAAM,CAAC,MAAM,eAAe,GAAY;IACtC,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,aAAa;IACb,QAAQ;IACR,cAAc;IACd,eAAe;IACf,QAAQ;IACR,cAAc;IACd,eAAe;IACf,IAAI;IACJ,UAAU;IACV,WAAW;IACX,OAAO;IACP,cAAc;IACd,IAAI;IACJ,WAAW;CACZ,CAAC;A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EACzB,QAAe,eAAe,CAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,MAAM,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AACnE,CAAC","sourcesContent":["import {\n DefaultFactoryNotDefinedError,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n toRecord,\n zora,\n zoraSepolia,\n} from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n AccountVersionDef,\n GetLightAccountType,\n GetLightAccountVersion,\n GetLightAccountVersionFromAccount,\n IAccountVersionRegistry,\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionDef,\n} from \"./types\";\n\n/**\n * Light account deployed chains\n *\n */\nexport const supportedChains: Chain[] = [\n mainnet,\n sepolia,\n goerli,\n polygon,\n polygonAmoy,\n polygonMumbai,\n optimism,\n optimismGoerli,\n optimismSepolia,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n zora,\n zoraSepolia,\n];\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: IAccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": {\n type: \"LightAccount\",\n version: \"v1.0.1\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.0.2\": {\n type: \"LightAccount\",\n version: \"v1.0.2\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.1.0\": {\n type: \"LightAccount\",\n version: \"v1.1.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v2.0.0\": {\n type: \"LightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n type: \"MultiOwnerLightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @param type - the light account type to get the default version for\n * @returns the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(\n type: TLightAccountType\n): GetLightAccountVersion<TLightAccountType> =>\n (type === \"LightAccount\"\n ? \"v1.1.0\"\n : \"v2.0.0\") as GetLightAccountVersion<TLightAccountType>;\n\n/**\n * Utility method returning the default light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"LightAccount\">\n): Address => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\"LightAccount\", chain, \"0.6.0\");\n return address.factory;\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"MultiOwnerLightAccount\">\n) => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\n \"MultiOwnerLightAccount\",\n chain,\n \"0.7.0\"\n );\n return address.factory;\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) =>\n Object.values(x.address).map((addr) => addr.factory)\n ).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n>(\n account: TAccount,\n chain: Chain\n): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain: Chain\n): Promise<\n AccountVersionDef<\n TLightAccountType,\n GetLightAccountVersion<TLightAccountType>\n >\n>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<AccountVersionDef> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n GetLightAccountVersionFromAccount<TAccount>,\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].impl, version]\n : [def.address[supportedChains[0].id].impl, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n keyof IAccountVersionRegistry[typeof accountType],\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].factory, version]\n : [def.address[supportedChains[0].id].factory, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n\n/**\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n * Migrate to using getLightAccountVersionDef instead\n *\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain?: Chain\n): Promise<GetLightAccountVersion<TLightAccountType>>;\n\n/**\n * Get the light account version for the given light account and chain\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n *\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion(\n account: LightAccountBase,\n chain: Chain = supportedChains[0]\n): Promise<LightAccountVersion> {\n return (await getLightAccountVersionDef(account, chain)).version;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;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CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAGhC,CACJ,CAAC;IAEF,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,EAAE;QACnC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAa,CAAC;QAC/D,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,EAAa,CAAC,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,uBAAuB,OAAO,CAAC,MAAM,sBAAsB,KAAK,CAAC,EAAE,EAAE,CACtE,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC;AA4BD,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAyB,EACzB,QAAe,eAAe,CAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,MAAM,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AACnE,CAAC","sourcesContent":["import { DefaultFactoryNotDefinedError, toRecord } from \"@aa-sdk/core\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"@account-kit/infra\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n AccountVersionDef,\n GetLightAccountType,\n GetLightAccountVersion,\n GetLightAccountVersionFromAccount,\n IAccountVersionRegistry,\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionDef,\n} from \"./types\";\n\n/**\n * Light account deployed chains\n *\n */\nexport const supportedChains: Chain[] = [\n mainnet,\n sepolia,\n goerli,\n polygon,\n polygonAmoy,\n polygonMumbai,\n optimism,\n optimismGoerli,\n optimismSepolia,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n zora,\n zoraSepolia,\n];\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: IAccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": {\n type: \"LightAccount\",\n version: \"v1.0.1\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.0.2\": {\n type: \"LightAccount\",\n version: \"v1.0.2\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.1.0\": {\n type: \"LightAccount\",\n version: \"v1.1.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v2.0.0\": {\n type: \"LightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n type: \"MultiOwnerLightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @param type - the light account type to get the default version for\n * @returns the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(\n type: TLightAccountType\n): GetLightAccountVersion<TLightAccountType> =>\n (type === \"LightAccount\"\n ? \"v1.1.0\"\n : \"v2.0.0\") as GetLightAccountVersion<TLightAccountType>;\n\n/**\n * Utility method returning the default light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"LightAccount\">\n): Address => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\"LightAccount\", chain, \"0.6.0\");\n return address.factory;\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: GetLightAccountVersion<\"MultiOwnerLightAccount\">\n) => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id] ??\n AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\n \"MultiOwnerLightAccount\",\n chain,\n \"0.7.0\"\n );\n return address.factory;\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) =>\n Object.values(x.address).map((addr) => addr.factory)\n ).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n>(\n account: TAccount,\n chain: Chain\n): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain: Chain\n): Promise<\n AccountVersionDef<\n TLightAccountType,\n GetLightAccountVersion<TLightAccountType>\n >\n>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<AccountVersionDef> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n GetLightAccountVersionFromAccount<TAccount>,\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].impl, version]\n : [def.address[supportedChains[0].id].impl, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n keyof IAccountVersionRegistry[typeof accountType],\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].factory, version]\n : [def.address[supportedChains[0].id].factory, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n\n/**\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n * Migrate to using getLightAccountVersionDef instead\n *\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain?: Chain\n): Promise<GetLightAccountVersion<TLightAccountType>>;\n\n/**\n * Get the light account version for the given light account and chain\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n *\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion(\n account: LightAccountBase,\n chain: Chain = supportedChains[0]\n): Promise<LightAccountVersion> {\n return (await getLightAccountVersionDef(account, chain)).version;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type AccountLoupeActions, type CreateMultiOwnerModularAccountParams, type LightAccount, type MultiOwnerModularAccount, type MultiOwnerPluginActions, type PluginManagerActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyModularAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createModularAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAgDd,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type AccountLoupeActions, type CreateMultisigModularAccountParams, type LightAccount, type MultisigModularAccount, type MultisigPluginActions, type MultisigUserOperationContext, type PluginManagerActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyMultisigAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>, MultisigUserOperationContext>, "account">;
|
|
6
6
|
export declare function createMultisigAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultisigAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, MultisigUserOperationContext>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { smartAccountClientActions, } from "@aa-sdk/core";
|
|
1
2
|
import { AlchemyProviderConfigSchema, createAlchemyPublicRpcClient, createAlchemySmartAccountClientFromExisting, } from "@account-kit/infra";
|
|
2
3
|
import { accountLoupeActions, createMultisigModularAccount, multisigPluginActions, multisigSignatureMiddleware, pluginManagerActions, } from "@account-kit/smart-contracts";
|
|
3
|
-
import { smartAccountClientActions, } from "@aa-sdk/core";
|
|
4
4
|
import { custom, } from "viem";
|
|
5
5
|
export async function createMultisigAccountAlchemyClient(config) {
|
|
6
6
|
const { chain, opts, ...connectionConfig } = AlchemyProviderConfigSchema.parse(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AA0Dd,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAA0C;IAY1C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAIhD;QACA,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;QACJ,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import {\n smartAccountClientActions,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultisigModularAccount,\n multisigPluginActions,\n multisigSignatureMiddleware,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultisigModularAccountParams,\n type LightAccount,\n type MultisigModularAccount,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\n// todo: this file seems somewhat duplicated with ./modularAccountClient.ts, but that file has some multi-owner specific fields. Is there a way to refactor these two to de-dupe?\n\nexport type AlchemyMultisigAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultisigModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n LightAccount<TSigner>,\n MultisigUserOperationContext\n >,\n \"account\"\n >;\n\nexport function createMultisigAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultisigAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n MultisigUserOperationContext\n >\n>;\n\n/**\n * Creates an Alchemy client for a multisig account using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultisigAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createMultisigAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * });\n * ```\n *\n * @param {AlchemyMultisigAccountClientConfig} config The configuration for the Alchemy multisig account client\n * @returns {Promise<AlchemySmartAccountClient<Transport, Chain | undefined, MultisigModularAccount<SmartAccountSigner>, MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> & PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> & AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>, MultisigUserOperationContext>>} A promise that resolves to an Alchemy Smart Account Client for multisig accounts with extended functionalities.\n */\nexport async function createMultisigAccountAlchemyClient(\n config: AlchemyMultisigAccountClientConfig\n): Promise<\n AlchemySmartAccountClient<\n Transport,\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> &\n PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> &\n AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>,\n MultisigUserOperationContext\n >\n> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultisigModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting<\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigUserOperationContext\n >({\n ...config,\n client,\n account,\n opts,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(multisigPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AccountNotFoundError, ChainNotFoundError,
|
|
1
|
+
import { AccountNotFoundError, ChainNotFoundError, } from "@aa-sdk/core";
|
|
2
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, } from "@account-kit/infra";
|
|
2
3
|
import { custom, encodeAbiParameters, encodeFunctionData, encodeFunctionResult, keccak256, parseAbiParameters, } from "viem";
|
|
3
4
|
import { IPluginAbi } from "./abis/IPlugin.js";
|
|
4
5
|
import { MultiOwnerModularAccountFactoryAbi } from "./abis/MultiOwnerModularAccountFactory.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/msca/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,GAOR,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kCAAkC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iBAAiB;QAC1B,YAAY,EAAE,gBAAgB;KAC/B,CAAC,CAAC;IAEH,MAAM,8BAA8B,GAAG,SAAS,CAC9C,oBAAoB,CAAC;QACnB,GAAG,EAAE,UAAU;QACf,YAAY,EAAE,gBAAgB;QAC9B,MAAM,EAAE,gBAAgB;KACzB,CAAC,CACH,CAAC;IAEF,MAAM,YAAY,GAAG,mBAAmB,CACtC,kBAAkB,CAAC,WAAW,CAAC,EAC/B,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CACnE,CAAC;IAEF,MAAM,qBAAqB,GAAG,mBAAmB,CAC/C,kBAAkB,CAAC,oBAAoB,CAAC,EACxC,CAAC,CAAC,8BAA8B,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CACnD,CAAC;IAEF,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;QACnD,GAAG,EAAE,4BAA4B;QACjC,YAAY,EAAE,YAAY;QAC1B,IAAI,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;KACnD,CAAC,CAAC;IAEH,OAAO;QACL,WAAW;QACX,kBAAkB,EAAE,yBAAyB;KAC9C,CAAC;AACJ,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n ChainNotFoundError,\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport {\n custom,\n encodeAbiParameters,\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n parseAbiParameters,\n} from \"viem\";\nimport { IPluginAbi } from \"./abis/IPlugin.js\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"./abis/MultiOwnerModularAccountFactory.js\";\nimport { UpgradeableModularAccountAbi } from \"./abis/UpgradeableModularAccount.js\";\nimport {\n createMultiOwnerModularAccount,\n type MultiOwnerModularAccount,\n} from \"./account/multiOwnerAccount.js\";\nimport { MultiOwnerPlugin } from \"./plugins/multi-owner/plugin.js\";\n\n/**\n * Utility method returning the default multi sig msca factory address given a {@link Chain} object\n *\n * @param chain a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultisigModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000204327E6669f00901a57CE15aE15\";\n }\n};\n\n/**\n * Utility method returning the default multi owner msca factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n default:\n return \"0x000000e92D78D90000007F0082006FDA09BD5f11\";\n }\n};\n\nexport type GetMSCAUpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n} & GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Multi-Signature Contract Account (MSCA) and provides a method to create a Multi-Owner Modular Account.\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMSCAUpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient(...);\n * const upgradeData = await getMSCAUpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMSCAUpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Multi-Owner Modular Account\n */\nexport async function getMSCAUpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMSCAUpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>;\n }\n> {\n const { account: account_ = client.account, multiOwnerPluginAddress } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = await getMAInitializationData({\n client,\n multiOwnerPluginAddress,\n signerAddress: await account.getSigner().getAddress(),\n });\n\n return {\n ...initData,\n createMAAccount: async () =>\n createMultiOwnerModularAccount({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport type GetMAInitializationDataParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n client: SmartAccountClient<TTransport, TChain, TAccount>;\n signerAddress: Address | Address[];\n};\n\n/**\n * Retrieves the initialization data for a multi-owner modular account. Throws an error if the client's chain is not found or if the multi-owner plugin address is not retrievable.\n *\n * @example\n * ```ts\n * import { getMAInitializationData } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...);\n * const initializationData = await getMAInitializationData({\n * client,\n * signerAddress: \"0x...\", // or array of signers\n * });\n * ```\n *\n * @param {GetMAInitializationDataParams<TTransport, TChain, TAccount>} params the parameters for getting initialization data\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} params.client the smart account client\n * @param {Address | Address[]} params.signerAddress the address of the signer or an array of signer addresses\n * @param {Address} [params.multiOwnerPluginAddress] optional address of the multi-owner plugin\n * @returns {Promise<UpgradeToData>} a promise that resolves to the initialization data required for upgrading to a multi-owner modular account\n */\nexport async function getMAInitializationData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>({\n client,\n multiOwnerPluginAddress,\n signerAddress,\n}: GetMAInitializationDataParams<\n TTransport,\n TChain,\n TAccount\n>): Promise<UpgradeToData> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(\n client.chain\n );\n\n const implAddress = await client.readContract({\n abi: MultiOwnerModularAccountFactoryAbi,\n address: factoryAddress,\n functionName: \"IMPL\",\n });\n\n const multiOwnerAddress =\n multiOwnerPluginAddress ?? MultiOwnerPlugin.meta.addresses[client.chain.id];\n\n if (!multiOwnerAddress) {\n throw new Error(\"could not get multi owner plugin address\");\n }\n\n const moPluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: multiOwnerAddress,\n functionName: \"pluginManifest\",\n });\n\n const hashedMultiOwnerPluginManifest = keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: moPluginManifest,\n })\n );\n\n const encodedOwner = encodeAbiParameters(\n parseAbiParameters(\"address[]\"),\n Array.isArray(signerAddress) ? [signerAddress] : [[signerAddress]]\n );\n\n const encodedPluginInitData = encodeAbiParameters(\n parseAbiParameters(\"bytes32[], bytes[]\"),\n [[hashedMultiOwnerPluginManifest], [encodedOwner]]\n );\n\n const encodedMSCAInitializeData = encodeFunctionData({\n abi: UpgradeableModularAccountAbi,\n functionName: \"initialize\",\n args: [[multiOwnerAddress], encodedPluginInitData],\n });\n\n return {\n implAddress,\n initializationData: encodedMSCAInitializeData,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/msca/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GAOnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,GACR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EACL,8BAA8B,GAE/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AASnE,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAC5D,KAAY,EACH,EAAE;IACX,QAAQ,KAAK,CAAC,EAAE,EAAE,CAAC;QACjB,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,WAAW,CAAC,EAAE,CAAC;QACpB,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,OAAO,CAAC,EAAE,CAAC;QAChB,KAAK,WAAW,CAAC,EAAE,CAAC;QACpB,KAAK,QAAQ,CAAC,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,EAAE,CAAC;QACxB,KAAK,QAAQ,CAAC,EAAE,CAAC;Q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,kBAAkB,CAAC;QACnD,GAAG,EAAE,4BAA4B;QACjC,YAAY,EAAE,YAAY;QAC1B,IAAI,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;KACnD,CAAC,CAAC;IAEH,OAAO;QACL,WAAW;QACX,kBAAkB,EAAE,yBAAyB;KAC9C,CAAC;AACJ,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n ChainNotFoundError,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n} from \"@account-kit/infra\";\nimport type { Address, Chain, Transport } from \"viem\";\nimport {\n custom,\n encodeAbiParameters,\n encodeFunctionData,\n encodeFunctionResult,\n keccak256,\n parseAbiParameters,\n} from \"viem\";\nimport { IPluginAbi } from \"./abis/IPlugin.js\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"./abis/MultiOwnerModularAccountFactory.js\";\nimport { UpgradeableModularAccountAbi } from \"./abis/UpgradeableModularAccount.js\";\nimport {\n createMultiOwnerModularAccount,\n type MultiOwnerModularAccount,\n} from \"./account/multiOwnerAccount.js\";\nimport { MultiOwnerPlugin } from \"./plugins/multi-owner/plugin.js\";\n\n/**\n * Utility method returning the default multi sig msca factory address given a {@link Chain} object\n *\n * @param chain a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultisigModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000204327E6669f00901a57CE15aE15\";\n }\n};\n\n/**\n * Utility method returning the default multi owner msca factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultMultiOwnerModularAccountFactoryAddress = (\n chain: Chain\n): Address => {\n switch (chain.id) {\n default:\n return \"0x000000e92D78D90000007F0082006FDA09BD5f11\";\n }\n};\n\nexport type GetMSCAUpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n} & GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Multi-Signature Contract Account (MSCA) and provides a method to create a Multi-Owner Modular Account.\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMSCAUpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient(...);\n * const upgradeData = await getMSCAUpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMSCAUpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Multi-Owner Modular Account\n */\nexport async function getMSCAUpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMSCAUpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createMAAccount: () => Promise<MultiOwnerModularAccount<TSigner>>;\n }\n> {\n const { account: account_ = client.account, multiOwnerPluginAddress } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = await getMAInitializationData({\n client,\n multiOwnerPluginAddress,\n signerAddress: await account.getSigner().getAddress(),\n });\n\n return {\n ...initData,\n createMAAccount: async () =>\n createMultiOwnerModularAccount({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport type GetMAInitializationDataParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n multiOwnerPluginAddress?: Address;\n client: SmartAccountClient<TTransport, TChain, TAccount>;\n signerAddress: Address | Address[];\n};\n\n/**\n * Retrieves the initialization data for a multi-owner modular account. Throws an error if the client's chain is not found or if the multi-owner plugin address is not retrievable.\n *\n * @example\n * ```ts\n * import { getMAInitializationData } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...);\n * const initializationData = await getMAInitializationData({\n * client,\n * signerAddress: \"0x...\", // or array of signers\n * });\n * ```\n *\n * @param {GetMAInitializationDataParams<TTransport, TChain, TAccount>} params the parameters for getting initialization data\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} params.client the smart account client\n * @param {Address | Address[]} params.signerAddress the address of the signer or an array of signer addresses\n * @param {Address} [params.multiOwnerPluginAddress] optional address of the multi-owner plugin\n * @returns {Promise<UpgradeToData>} a promise that resolves to the initialization data required for upgrading to a multi-owner modular account\n */\nexport async function getMAInitializationData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>({\n client,\n multiOwnerPluginAddress,\n signerAddress,\n}: GetMAInitializationDataParams<\n TTransport,\n TChain,\n TAccount\n>): Promise<UpgradeToData> {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(\n client.chain\n );\n\n const implAddress = await client.readContract({\n abi: MultiOwnerModularAccountFactoryAbi,\n address: factoryAddress,\n functionName: \"IMPL\",\n });\n\n const multiOwnerAddress =\n multiOwnerPluginAddress ?? MultiOwnerPlugin.meta.addresses[client.chain.id];\n\n if (!multiOwnerAddress) {\n throw new Error(\"could not get multi owner plugin address\");\n }\n\n const moPluginManifest = await client.readContract({\n abi: IPluginAbi,\n address: multiOwnerAddress,\n functionName: \"pluginManifest\",\n });\n\n const hashedMultiOwnerPluginManifest = keccak256(\n encodeFunctionResult({\n abi: IPluginAbi,\n functionName: \"pluginManifest\",\n result: moPluginManifest,\n })\n );\n\n const encodedOwner = encodeAbiParameters(\n parseAbiParameters(\"address[]\"),\n Array.isArray(signerAddress) ? [signerAddress] : [[signerAddress]]\n );\n\n const encodedPluginInitData = encodeAbiParameters(\n parseAbiParameters(\"bytes32[], bytes[]\"),\n [[hashedMultiOwnerPluginManifest], [encodedOwner]]\n );\n\n const encodedMSCAInitializeData = encodeFunctionData({\n abi: UpgradeableModularAccountAbi,\n functionName: \"initialize\",\n args: [[multiOwnerAddress], encodedPluginInitData],\n });\n\n return {\n implAddress,\n initializationData: encodedMSCAInitializeData,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../plugindefs/multi-owner/config.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../plugindefs/multi-owner/config.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D,eAAO,MAAM,yBAAyB,EAAE,YAuBvC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateLightAccountParams, type LightAccount, type LightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createLightAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyLightAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, LightAccount<TSigner>, LightAccountClientActions<TSigner>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyClient.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"alchemyClient.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/clients/alchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAU,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAEhF,MAAM,MAAM,+BAA+B,CACzC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,IAAI,CACN,wBAAwB,CAAC,aAAa,EAAE,OAAO,CAAC,EAChD,WAAW,GAAG,OAAO,CACtB,GACC,IAAI,CACF,+BAA+B,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,EACxE,SAAS,CACV,CAAC;AAEJ,wBAAsB,+BAA+B,CACnD,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,MAAM,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAC/C,OAAO,CACR,yBAAyB,CACvB,eAAe,EACf,KAAK,GAAG,SAAS,EACjB,YAAY,CAAC,OAAO,CAAC,EACrB,yBAAyB,CAAC,OAAO,CAAC,CACnC,CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type CreateMultiOwnerLightAccountParams, type MultiOwnerLightAccount, type MultiOwnerLightAccountClientActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { HttpTransport, SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyMultiOwnerLightAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerLightAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & 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.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,kCAAkC,EACvC,KAAK,sBAAsB,EAC3B,KAAK,mCAAmC,EACzC,MAAM,8BAA8B,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"multiOwnerAlchemyClient.d.ts","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAIL,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,kCAAkC,EACvC,KAAK,sBAAsB,EAC3B,KAAK,mCAAmC,EACzC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAU,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAEhF,MAAM,MAAM,yCAAyC,CACnD,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,IAAI,CACN,kCAAkC,CAAC,aAAa,EAAE,OAAO,CAAC,EAC1D,WAAW,GAAG,OAAO,CACtB,GACC,IAAI,CACF,+BAA+B,CAC7B,SAAS,EACT,KAAK,EACL,sBAAsB,CAAC,OAAO,CAAC,CAChC,EACD,SAAS,CACV,CAAC;AAEJ,wBAAsB,yCAAyC,CAC7D,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,MAAM,EAAE,yCAAyC,CAAC,OAAO,CAAC,GACzD,OAAO,CACR,yBAAyB,CACvB,eAAe,EACf,KAAK,GAAG,SAAS,EACjB,sBAAsB,CAAC,OAAO,CAAC,EAC/B,mCAAmC,CAAC,OAAO,CAAC,CAC7C,CACF,CAAC"}
|
|
@@ -12,7 +12,7 @@ export type LightAccountClientActions<TSigner extends SmartAccountSigner = Smart
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* import { lightAccountClientActions, createLightAccount } from "@account-kit/smart-contracts";
|
|
14
14
|
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
15
|
-
* import { sepolia } from "@account-kit/infra
|
|
15
|
+
* import { sepolia } from "@account-kit/infra";
|
|
16
16
|
*
|
|
17
17
|
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
18
18
|
* account: await createLightAccount(...),
|
|
@@ -12,7 +12,7 @@ export type MultiOwnerLightAccountClientActions<TSigner extends SmartAccountSign
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* import { multiOwnerLightAccountClientActions, createMultiOwnerLightAccount } from "@account-kit/smart-contracts";
|
|
14
14
|
* import { createAlchemySmartAccountClient } from "@account-kit/infra";
|
|
15
|
-
* import { sepolia } from "@account-kit/infra
|
|
15
|
+
* import { sepolia } from "@account-kit/infra";
|
|
16
16
|
*
|
|
17
17
|
* const smartAccountClient = createAlchemySmartAccountClient({
|
|
18
18
|
* account: await createMultiOwnerLightAccount(...),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAW,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,MAAM,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AAE,KAAK,GACX,OAAO,CACR,iBAAiB,CACf,iBAAiB,EACjB,sBAAsB,CAAC,iBAAiB,CAAC,CAC1C,CACF,CAAC;AAgEF;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,SAAS,gBAAgB,EACjC,iBAAiB,SAAS,mBAAmB,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,QAAQ,CAAC,EAEvF,OAAO,EAAE,QAAQ,EACjB,KAAK,CAAC,EAAE,KAAK,GACZ,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type AccountLoupeActions, type CreateMultiOwnerModularAccountParams, type LightAccount, type MultiOwnerModularAccount, type MultiOwnerPluginActions, type PluginManagerActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyModularAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createModularAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
|