@account-kit/smart-contracts 4.0.0-alpha.0 → 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/index.d.ts +3 -3
- package/dist/cjs/src/index.js +15 -15
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/account.js +1 -1
- package/dist/cjs/src/light-account/accounts/account.js.map +1 -1
- package/dist/cjs/src/light-account/accounts/multiOwner.js +2 -4
- package/dist/cjs/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.d.ts +1 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.js +2 -1
- package/dist/cjs/src/light-account/actions/transferOwnership.js.map +1 -1
- package/dist/cjs/src/light-account/actions/updateOwners.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/client.js +2 -1
- package/dist/cjs/src/light-account/clients/client.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/clients/multiOwnerLightAccount.js +2 -1
- package/dist/cjs/src/light-account/clients/multiOwnerLightAccount.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.d.ts +3 -2
- package/dist/cjs/src/light-account/utils.js +34 -24
- package/dist/cjs/src/light-account/utils.js.map +1 -1
- package/dist/cjs/src/msca/account/multiOwnerAccount.js +2 -1
- package/dist/cjs/src/msca/account/multiOwnerAccount.js.map +1 -1
- package/dist/cjs/src/msca/account/multisigAccount.js +4 -3
- package/dist/cjs/src/msca/account/multisigAccount.js.map +1 -1
- package/dist/cjs/src/msca/account-loupe/decorator.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/client.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/errors.js.map +1 -1
- package/dist/cjs/src/msca/plugin-manager/decorator.d.ts +1 -1
- package/dist/cjs/src/msca/plugin-manager/decorator.js +6 -4
- package/dist/cjs/src/msca/plugin-manager/decorator.js.map +1 -1
- package/dist/cjs/src/msca/plugin-manager/installPlugin.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.js +2 -1
- package/dist/cjs/src/msca/plugins/multi-owner/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js +2 -2
- package/dist/cjs/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
- package/dist/cjs/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/cjs/src/msca/plugins/multisig/index.js +1 -16
- package/dist/cjs/src/msca/plugins/multisig/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js +1 -1
- package/dist/cjs/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
- package/dist/cjs/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
- package/dist/cjs/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/cjs/src/msca/plugins/multisig/utils/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/extension.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/cjs/src/msca/plugins/session-key/index.js +3 -1
- package/dist/cjs/src/msca/plugins/session-key/index.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/cjs/src/msca/plugins/session-key/utils.d.ts +4 -2
- package/dist/cjs/src/msca/plugins/session-key/utils.js +3 -2
- package/dist/cjs/src/msca/plugins/session-key/utils.js.map +1 -1
- package/dist/cjs/src/msca/utils.d.ts +6 -4
- 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/index.d.ts +3 -3
- package/dist/esm/src/index.js +2 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/light-account/accounts/account.js +2 -2
- package/dist/esm/src/light-account/accounts/account.js.map +1 -1
- package/dist/esm/src/light-account/accounts/multiOwner.js +3 -5
- package/dist/esm/src/light-account/accounts/multiOwner.js.map +1 -1
- package/dist/esm/src/light-account/actions/transferOwnership.d.ts +1 -1
- package/dist/esm/src/light-account/actions/transferOwnership.js +2 -1
- package/dist/esm/src/light-account/actions/transferOwnership.js.map +1 -1
- package/dist/esm/src/light-account/actions/updateOwners.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/client.js +2 -1
- package/dist/esm/src/light-account/clients/client.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/clients/multiOwnerLightAccount.js +2 -1
- package/dist/esm/src/light-account/clients/multiOwnerLightAccount.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.d.ts +3 -2
- package/dist/esm/src/light-account/utils.js +14 -5
- package/dist/esm/src/light-account/utils.js.map +1 -1
- package/dist/esm/src/msca/account/multiOwnerAccount.js +2 -1
- package/dist/esm/src/msca/account/multiOwnerAccount.js.map +1 -1
- package/dist/esm/src/msca/account/multisigAccount.js +4 -3
- package/dist/esm/src/msca/account/multisigAccount.js.map +1 -1
- package/dist/esm/src/msca/account-loupe/decorator.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/client.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/errors.js.map +1 -1
- package/dist/esm/src/msca/plugin-manager/decorator.d.ts +1 -1
- package/dist/esm/src/msca/plugin-manager/decorator.js +6 -4
- package/dist/esm/src/msca/plugin-manager/decorator.js.map +1 -1
- package/dist/esm/src/msca/plugin-manager/installPlugin.js.map +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.js +1 -1
- package/dist/esm/src/msca/plugins/multi-owner/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/proposeUserOperation.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js +1 -1
- package/dist/esm/src/msca/plugins/multisig/actions/signMultisigUserOperation.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/esm/src/msca/plugins/multisig/index.js +0 -7
- package/dist/esm/src/msca/plugins/multisig/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js +2 -1
- package/dist/esm/src/msca/plugins/multisig/middleware.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.d.ts +3 -2
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js +2 -2
- package/dist/esm/src/msca/plugins/multisig/utils/combineSignatures.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.d.ts +2 -2
- package/dist/esm/src/msca/plugins/multisig/utils/getSignerType.js.map +1 -1
- package/dist/esm/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/esm/src/msca/plugins/multisig/utils/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/extension.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.js +1 -1
- package/dist/esm/src/msca/plugins/session-key/index.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/permissions.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/signer.js.map +1 -1
- package/dist/esm/src/msca/plugins/session-key/utils.d.ts +4 -2
- package/dist/esm/src/msca/plugins/session-key/utils.js +3 -2
- package/dist/esm/src/msca/plugins/session-key/utils.js.map +1 -1
- package/dist/esm/src/msca/utils.d.ts +6 -4
- 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/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/account.d.ts.map +1 -1
- package/dist/types/src/light-account/accounts/multiOwner.d.ts.map +1 -1
- package/dist/types/src/light-account/actions/transferOwnership.d.ts +26 -1
- package/dist/types/src/light-account/actions/transferOwnership.d.ts.map +1 -1
- package/dist/types/src/light-account/actions/updateOwners.d.ts +24 -0
- package/dist/types/src/light-account/actions/updateOwners.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 +19 -0
- package/dist/types/src/light-account/decorators/lightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts +19 -0
- package/dist/types/src/light-account/decorators/multiOwnerLightAccount.d.ts.map +1 -1
- package/dist/types/src/light-account/utils.d.ts +11 -4
- package/dist/types/src/light-account/utils.d.ts.map +1 -1
- package/dist/types/src/msca/account/multisigAccount.d.ts.map +1 -1
- package/dist/types/src/msca/account-loupe/decorator.d.ts +15 -0
- package/dist/types/src/msca/account-loupe/decorator.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/client.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/errors.d.ts +12 -0
- package/dist/types/src/msca/errors.d.ts.map +1 -1
- package/dist/types/src/msca/plugin-manager/decorator.d.ts +16 -1
- package/dist/types/src/msca/plugin-manager/decorator.d.ts.map +1 -1
- package/dist/types/src/msca/plugin-manager/installPlugin.d.ts +21 -0
- package/dist/types/src/msca/plugin-manager/installPlugin.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multi-owner/extension.d.ts +15 -0
- package/dist/types/src/msca/plugins/multi-owner/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multi-owner/index.d.ts +1 -1
- package/dist/types/src/msca/plugins/multi-owner/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/actions/proposeUserOperation.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/actions/signMultisigUserOperation.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/extension.d.ts +13 -0
- package/dist/types/src/msca/plugins/multisig/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/index.d.ts +1 -8
- package/dist/types/src/msca/plugins/multisig/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts +1 -1
- package/dist/types/src/msca/plugins/multisig/middleware.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts +28 -2
- package/dist/types/src/msca/plugins/multisig/utils/combineSignatures.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts +21 -2
- package/dist/types/src/msca/plugins/multisig/utils/getSignerType.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/multisig/utils/index.d.ts +4 -0
- package/dist/types/src/msca/plugins/multisig/utils/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/extension.d.ts +13 -0
- package/dist/types/src/msca/plugins/session-key/extension.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/index.d.ts +1 -1
- package/dist/types/src/msca/plugins/session-key/index.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts +3 -0
- package/dist/types/src/msca/plugins/session-key/permissions.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts +1 -1
- package/dist/types/src/msca/plugins/session-key/signer.d.ts.map +1 -1
- package/dist/types/src/msca/plugins/session-key/utils.d.ts +22 -2
- package/dist/types/src/msca/plugins/session-key/utils.d.ts.map +1 -1
- package/dist/types/src/msca/utils.d.ts +43 -5
- 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/index.ts +2 -3
- package/src/light-account/accounts/account.ts +22 -3
- package/src/light-account/accounts/multiOwner.ts +26 -5
- package/src/light-account/actions/transferOwnership.ts +28 -5
- package/src/light-account/actions/updateOwners.ts +24 -0
- package/src/light-account/clients/alchemyClient.ts +21 -1
- package/src/light-account/clients/client.ts +27 -6
- package/src/light-account/clients/multiOwnerAlchemyClient.ts +21 -1
- package/src/light-account/clients/multiOwnerLightAccount.ts +27 -6
- package/src/light-account/decorators/lightAccount.ts +19 -0
- package/src/light-account/decorators/multiOwnerLightAccount.ts +19 -0
- package/src/light-account/utils.ts +31 -9
- package/src/msca/account/multiOwnerAccount.ts +36 -11
- package/src/msca/account/multisigAccount.ts +40 -14
- package/src/msca/account-loupe/decorator.ts +15 -0
- package/src/msca/client/alchemyClient.ts +21 -1
- package/src/msca/client/client.ts +46 -0
- package/src/msca/client/multiSigAlchemyClient.ts +26 -4
- package/src/msca/errors.ts +12 -0
- package/src/msca/plugin-manager/decorator.ts +22 -5
- package/src/msca/plugin-manager/installPlugin.ts +21 -0
- package/src/msca/plugins/multi-owner/extension.ts +15 -0
- package/src/msca/plugins/multi-owner/index.ts +3 -0
- package/src/msca/plugins/multisig/actions/proposeUserOperation.ts +1 -1
- package/src/msca/plugins/multisig/actions/signMultisigUserOperation.ts +1 -1
- package/src/msca/plugins/multisig/extension.ts +13 -0
- package/src/msca/plugins/multisig/index.ts +1 -12
- package/src/msca/plugins/multisig/middleware.ts +2 -2
- package/src/msca/plugins/multisig/utils/combineSignatures.ts +36 -9
- package/src/msca/plugins/multisig/utils/getSignerType.ts +23 -4
- package/src/msca/plugins/multisig/utils/index.ts +4 -0
- package/src/msca/plugins/session-key/extension.ts +13 -0
- package/src/msca/plugins/session-key/index.ts +7 -1
- package/src/msca/plugins/session-key/permissions.ts +3 -0
- package/src/msca/plugins/session-key/signer.ts +1 -2
- package/src/msca/plugins/session-key/utils.ts +33 -12
- package/src/msca/utils.ts +73 -16
|
@@ -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"]}
|
|
@@ -2,7 +2,8 @@ import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
|
2
2
|
import {} from "viem";
|
|
3
3
|
import { createMultiOwnerLightAccount, } from "../accounts/multiOwner.js";
|
|
4
4
|
import { multiOwnerLightAccountClientActions, } from "../decorators/multiOwnerLightAccount.js";
|
|
5
|
-
export async function createMultiOwnerLightAccountClient(
|
|
5
|
+
export async function createMultiOwnerLightAccountClient(params) {
|
|
6
|
+
const { account, transport, chain, ...clientConfig } = params;
|
|
6
7
|
const lightAccount = await createMultiOwnerLightAccount({
|
|
7
8
|
...account,
|
|
8
9
|
transport,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,GAEpC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"multiOwnerLightAccount.js","sourceRoot":"","sources":["../../../../../src/light-account/clients/multiOwnerLightAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAMzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mCAAmC,GAEpC,MAAM,yCAAyC,CAAC;AA6DjD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAgD;IAEhD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,MAAM,CAAC;IAE9D,MAAM,YAAY,GAAG,MAAM,4BAA4B,CAAC;QACtD,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,YAAY;QACf,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createMultiOwnerLightAccount,\n type CreateMultiOwnerLightAccountParams,\n type MultiOwnerLightAccount,\n} from \"../accounts/multiOwner.js\";\nimport {\n multiOwnerLightAccountClientActions,\n type MultiOwnerLightAccountClientActions,\n} from \"../decorators/multiOwnerLightAccount.js\";\n\nexport type CreateMultiOwnerLightAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n transport: CreateMultiOwnerLightAccountParams<\n TTransport,\n TSigner\n >[\"transport\"];\n chain: CreateMultiOwnerLightAccountParams<TTransport, TSigner>[\"chain\"];\n account: Omit<\n CreateMultiOwnerLightAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n>;\n\nexport function createMultiOwnerLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerLightAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerLightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n MultiOwnerLightAccountClientActions<\n TSigner,\n MultiOwnerLightAccount<TSigner>\n >\n >\n>;\n\n/**\n * Creates a multi-owner light account client using the provided parameters. It first creates a multi-owner light account and then creates a smart account client with the provided configurations.\n *\n * @example\n * ```ts\n * import { createMultiOwnerLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * }\n * });\n * ```\n *\n * @param {CreateMultiOwnerLightAccountClientParams} params the configuration for creating the multi-owner light account client\n * @returns {Promise<SmartAccountClient>} a promise that resolves to a `SmartAccountClient` containing the created account client and relevant methods\n */\nexport async function createMultiOwnerLightAccountClient(\n params: CreateMultiOwnerLightAccountClientParams\n): Promise<SmartAccountClient> {\n const { account, transport, chain, ...clientConfig } = params;\n\n const lightAccount = await createMultiOwnerLightAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain: chain,\n account: lightAccount,\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;
|
|
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;
|
|
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,10 +1,11 @@
|
|
|
1
1
|
import { type Address, type Chain } from "viem";
|
|
2
2
|
import type { LightAccountBase } from "./accounts/base";
|
|
3
|
-
import type { AccountVersionDef, GetLightAccountType, GetLightAccountVersion, IAccountVersionRegistry,
|
|
3
|
+
import type { AccountVersionDef, GetLightAccountType, GetLightAccountVersion, IAccountVersionRegistry, LightAccountVersionDef } from "./types";
|
|
4
4
|
export declare const supportedChains: Chain[];
|
|
5
5
|
export declare const AccountVersionRegistry: IAccountVersionRegistry;
|
|
6
6
|
export declare const defaultLightAccountVersion: <TLightAccountType extends keyof IAccountVersionRegistry>(type: TLightAccountType) => keyof IAccountVersionRegistry[TLightAccountType];
|
|
7
|
-
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version
|
|
7
|
+
export declare const getDefaultLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"LightAccount">) => Address;
|
|
8
|
+
export declare const getDefaultMultiOwnerLightAccountFactoryAddress: (chain: Chain, version: GetLightAccountVersion<"MultiOwnerLightAccount">) => `0x${string}`;
|
|
8
9
|
export declare const LightAccountUnsupported1271Impls: (AccountVersionDef<"LightAccount", "v1.0.1", "0.6.0"> | AccountVersionDef<"LightAccount", "v1.0.2", "0.6.0">)[];
|
|
9
10
|
export declare const LightAccountUnsupported1271Factories: Set<`0x${string}`>;
|
|
10
11
|
export declare function getLightAccountVersionDef<TAccount extends LightAccountBase, TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>, TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>>(account: TAccount, chain: Chain): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;
|
|
@@ -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,
|
|
@@ -75,12 +76,20 @@ export const AccountVersionRegistry = {
|
|
|
75
76
|
export const defaultLightAccountVersion = (type) => (type === "LightAccount"
|
|
76
77
|
? "v1.1.0"
|
|
77
78
|
: "v2.0.0");
|
|
78
|
-
export const getDefaultLightAccountFactoryAddress = (chain, version
|
|
79
|
-
const address = AccountVersionRegistry.LightAccount[version].address[chain.id]
|
|
79
|
+
export const getDefaultLightAccountFactoryAddress = (chain, version) => {
|
|
80
|
+
const address = AccountVersionRegistry.LightAccount[version].address[chain.id] ??
|
|
81
|
+
AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
|
|
80
82
|
if (!address)
|
|
81
83
|
throw new DefaultFactoryNotDefinedError("LightAccount", chain, "0.6.0");
|
|
82
84
|
return address.factory;
|
|
83
85
|
};
|
|
86
|
+
export const getDefaultMultiOwnerLightAccountFactoryAddress = (chain, version) => {
|
|
87
|
+
const address = AccountVersionRegistry.LightAccount[version].address[chain.id] ??
|
|
88
|
+
AccountVersionRegistry.LightAccount[version].address[supportedChains[0].id];
|
|
89
|
+
if (!address)
|
|
90
|
+
throw new DefaultFactoryNotDefinedError("MultiOwnerLightAccount", chain, "0.7.0");
|
|
91
|
+
return address.factory;
|
|
92
|
+
};
|
|
84
93
|
export const LightAccountUnsupported1271Impls = [
|
|
85
94
|
AccountVersionRegistry.LightAccount["v1.0.1"],
|
|
86
95
|
AccountVersionRegistry.LightAccount["v1.0.2"],
|
|
@@ -95,7 +104,7 @@ export async function getLightAccountVersionDef(account, chain) {
|
|
|
95
104
|
const [version, def] = pair;
|
|
96
105
|
return chain.id in def.address
|
|
97
106
|
? [def.address[chain.id].impl, version]
|
|
98
|
-
: [
|
|
107
|
+
: [def.address[supportedChains[0].id].impl, version];
|
|
99
108
|
})
|
|
100
109
|
.filter(([impl]) => impl !== null));
|
|
101
110
|
const factoryToVersion = new Map(Object.entries(AccountVersionRegistry[accountType])
|
|
@@ -103,7 +112,7 @@ export async function getLightAccountVersionDef(account, chain) {
|
|
|
103
112
|
const [version, def] = pair;
|
|
104
113
|
return chain.id in def.address
|
|
105
114
|
? [def.address[chain.id].factory, version]
|
|
106
|
-
: [
|
|
115
|
+
: [def.address[supportedChains[0].id].factory, version];
|
|
107
116
|
})
|
|
108
117
|
.filter(([impl]) => impl !== null));
|
|
109
118
|
const version = fromHex(implAddress, "bigint") === 0n
|
|
@@ -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,EAC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AE,EAAE;QACZ,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,IAGtB,CAAC;QACF,OAAO,KAAK,CAAC,EAAE,IAAI,GAAG,CAAC,OAAO;YAC5B,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;YAC1C,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,IAAI,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 {\n DefaultFactoryNotDefinedError,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n toRecord,\n zora,\n zoraSepolia,\n} from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n AccountVersionDef,\n GetLightAccountType,\n GetLightAccountVersion,\n GetLightAccountVersionFromAccount,\n IAccountVersionRegistry,\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionDef,\n} from \"./types\";\n\n/**\n * Light account deployed chains\n *\n */\nexport const supportedChains: Chain[] = [\n mainnet,\n sepolia,\n goerli,\n polygon,\n polygonAmoy,\n polygonMumbai,\n optimism,\n optimismGoerli,\n optimismSepolia,\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n zora,\n zoraSepolia,\n];\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: IAccountVersionRegistry = {\n LightAccount: {\n \"v1.0.1\": {\n type: \"LightAccount\",\n version: \"v1.0.1\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.0.2\": {\n type: \"LightAccount\",\n version: \"v1.0.2\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v1.1.0\": {\n type: \"LightAccount\",\n version: \"v1.1.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.6.0\",\n },\n \"v2.0.0\": {\n type: \"LightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n type: \"MultiOwnerLightAccount\",\n version: \"v2.0.0\",\n address: toRecord<Chain, \"id\", { factory: Address; impl: Address }>(\n supportedChains,\n \"id\",\n () => ({\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n })\n ),\n entryPointVersion: \"0.7.0\",\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @param type - the light account type to get the default version for\n * @returns the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType\n>(\n type: TLightAccountType\n): GetLightAccountVersion<TLightAccountType> =>\n (type === \"LightAccount\"\n ? \"v1.1.0\"\n : \"v2.0.0\") as GetLightAccountVersion<TLightAccountType>;\n\n/**\n * Utility method returning the default light account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - the version of the light account to get the factory address for\n * @returns a {@link Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion = \"v1.1.0\"\n): Address => {\n const address =\n AccountVersionRegistry.LightAccount[version].address[chain.id];\n if (!address)\n throw new DefaultFactoryNotDefinedError(\"LightAccount\", chain, \"0.6.0\");\n return address.factory;\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n *\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n *\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) =>\n Object.values(x.address).map((addr) => addr.factory)\n ).flat()\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @template {GetLightAccountVersion<TLightAccountType>} TLightAccountVersion\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>,\n TLightAccountVersion extends GetLightAccountVersion<TLightAccountType> = GetLightAccountVersion<TLightAccountType>\n>(\n account: TAccount,\n chain: Chain\n): Promise<LightAccountVersionDef<TLightAccountType, TLightAccountVersion>>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @template {GetLightAccountType<TAccount>} TLightAccountType\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain: Chain\n): Promise<\n AccountVersionDef<\n TLightAccountType,\n GetLightAccountVersion<TLightAccountType>\n >\n>;\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionDef<\n TAccount extends LightAccountBase\n>(account: TAccount, chain: Chain): Promise<AccountVersionDef> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n GetLightAccountVersionFromAccount<TAccount>,\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].impl, version]\n : [null, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType])\n .map((pair) => {\n const [version, def] = pair as [\n keyof IAccountVersionRegistry[typeof accountType],\n LightAccountVersionDef\n ];\n return chain.id in def.address\n ? [def.address[chain.id].factory, version]\n : [null, version];\n })\n .filter(([impl]) => impl !== null) as [\n Address,\n keyof IAccountVersionRegistry[typeof accountType]\n ][]\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n\n/**\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n * Migrate to using getLightAccountVersionDef instead\n *\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion<\n TAccount extends LightAccountBase,\n TLightAccountType extends GetLightAccountType<TAccount> = GetLightAccountType<TAccount>\n>(\n account: TAccount,\n chain?: Chain\n): Promise<GetLightAccountVersion<TLightAccountType>>;\n\n/**\n * Get the light account version for the given light account and chain\n *\n * @deprecated don't use this function as this function is replaced with getLightAccountVersionDef.\n *\n * @param account - the light account to get the version for\n * @param chain - the chain to get the version for\n * @returns the light account version for the given light account and chain\n */\nexport async function getLightAccountVersion(\n account: LightAccountBase,\n chain: Chain = supportedChains[0]\n): Promise<LightAccountVersion> {\n return (await getLightAccountVersionDef(account, chain)).version;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/light-account/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EACL,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,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAA4B,MAAM,MAAM,CAAC;AAiBzD,MAAM,CAAC,MAAM,eAAe,GAAY;IACtC,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IACX,aAAa;IACb,QAAQ;IACR,cAAc;IACd,eAAe;IACf,QAAQ;IACR,cAAc;IACd,eAAe;IACf,IAAI;IACJ,UAAU;IACV,WAAW;IACX,OAAO;IACP,cAAc;IACd,IAAI;IACJ,WAAW;CACZ,CAAC;AAOF,MAAM,CAAC,MAAM,sBAAsB,GAA4B;IAC7D,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,QAAQ,CACf,eAAe,EACf,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;gBACL,OAAO,EACL,4CAA4C,CAAC,WAAW,EAAa;gBACv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\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"]}
|
|
@@ -4,7 +4,8 @@ import { MultiOwnerModularAccountFactoryAbi } from "../abis/MultiOwnerModularAcc
|
|
|
4
4
|
import { multiOwnerMessageSigner } from "../plugins/multi-owner/signer.js";
|
|
5
5
|
import { getDefaultMultiOwnerModularAccountFactoryAddress } from "../utils.js";
|
|
6
6
|
import { standardExecutor } from "./standardExecutor.js";
|
|
7
|
-
export async function createMultiOwnerModularAccount(
|
|
7
|
+
export async function createMultiOwnerModularAccount(config) {
|
|
8
|
+
const { transport, chain, signer, accountAddress, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain), owners = [], salt = 0n, } = config;
|
|
8
9
|
const client = createBundlerClient({
|
|
9
10
|
transport,
|
|
10
11
|
chain,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiOwnerAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multiOwnerAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gDAAgD,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"multiOwnerAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multiOwnerAccount.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gDAAgD,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA6DzD,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,MAA4C;IAE5C,MAAM,EACJ,SAAS,EACT,KAAK,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,UAAU,GAAG,aAAa,CAAC,K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V,cAAc;QACd,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC/C,SAAS;QACT,KAAK;QACL,UAAU;QACV,cAAc,EAAE,eAAe;QAC/B,MAAM,EAAE,0BAA0B;QAClC,kBAAkB;QAClB,GAAG,gBAAgB;QACnB,GAAG,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;KAClE,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,WAAW;QACd,SAAS,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;QACpC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EntryPointParameter,\n SmartAccountSigner,\n SmartContractAccountWithSigner,\n ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultiOwnerModularAccountFactoryAbi } from \"../abis/MultiOwnerModularAccountFactory.js\";\nimport { multiOwnerMessageSigner } from \"../plugins/multi-owner/signer.js\";\nimport { getDefaultMultiOwnerModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport type MultiOwnerModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n \"MultiOwnerModularAccount\",\n TSigner,\n \"0.6.0\"\n>;\n\n// [!region CreateMultiOwnerModularAccountParams]\nexport type CreateMultiOwnerModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultiOwnerModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n// [!endregion CreateMultiOwnerModularAccountParams]\n\nexport async function createMultiOwnerModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultiOwnerModularAccountParams<TTransport, TSigner>\n): Promise<MultiOwnerModularAccount<TSigner>>;\n\n/**\n * Creates a multi-owner modular account with the given parameters, including transport, chain, signer, account address, initialization code, entry point, factory address, owners, and salt.\n * Ensures that the owners are unique, ordered, and non-zero.\n *\n * @example\n * ```ts\n * import { createMultiOwnerModularAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultiOwnerModularAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateMultiOwnerModularAccountParams} config Configuration parameters for creating a multi-owner modular account\n * @returns {Promise<MultiOwnerModularAccount>} A promise that resolves to a `MultiOwnerModularAccount` object containing the created account information and methods\n */\nexport async function createMultiOwnerModularAccount(\n config: CreateMultiOwnerModularAccountParams\n): Promise<MultiOwnerModularAccount> {\n const {\n transport,\n chain,\n signer,\n accountAddress,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultiOwnerModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n } = config;\n\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the owners as well\n const ownerAddress = await signer.getAddress();\n // owners need to be dedupe + ordered in ascending order and not == to zero address\n const owners_ = Array.from(new Set([...owners, ownerAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultiOwnerModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, owners_],\n }),\n ]);\n };\n\n const _accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress: _accountAddress,\n source: `MultiOwnerModularAccount`,\n getAccountInitCode,\n ...standardExecutor,\n ...multiOwnerMessageSigner(client, _accountAddress, () => signer),\n });\n\n return {\n ...baseAccount,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n"]}
|
|
@@ -5,7 +5,8 @@ import { multisigSignMethods } from "../plugins/multisig/signer.js";
|
|
|
5
5
|
import { getDefaultMultisigModularAccountFactoryAddress } from "../utils.js";
|
|
6
6
|
import { standardExecutor } from "./standardExecutor.js";
|
|
7
7
|
export const MULTISIG_ACCOUNT_SOURCE = "MultisigModularAccount";
|
|
8
|
-
export async function createMultisigModularAccount(
|
|
8
|
+
export async function createMultisigModularAccount(config) {
|
|
9
|
+
const { transport, chain, signer, accountAddress: accountAddress_, initCode, entryPoint = getEntryPoint(chain, { version: "0.6.0" }), factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain), owners = [], salt = 0n, threshold, } = config;
|
|
9
10
|
const client = createBundlerClient({
|
|
10
11
|
transport,
|
|
11
12
|
chain,
|
|
@@ -31,10 +32,10 @@ export async function createMultisigModularAccount({ transport, chain, signer, a
|
|
|
31
32
|
}),
|
|
32
33
|
]);
|
|
33
34
|
};
|
|
34
|
-
accountAddress = await getAccountAddress({
|
|
35
|
+
const accountAddress = await getAccountAddress({
|
|
35
36
|
client,
|
|
36
37
|
entryPoint,
|
|
37
|
-
accountAddress:
|
|
38
|
+
accountAddress: accountAddress_,
|
|
38
39
|
getAccountInitCode,
|
|
39
40
|
});
|
|
40
41
|
const baseAccount = await toSmartContractAccount({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multisigAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multisigAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GAOvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAIZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,8CAA8C,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"multisigAccount.js","sourceRoot":"","sources":["../../../../../src/msca/account/multisigAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,sBAAsB,GAOvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,GAIZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,8CAA8C,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AA+DhE,MAAM,CAAC,KAAK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EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC;aAC/B,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC;QAC7C,MAAM;QACN,UAAU;QACV,cAAc,EAAE,eAAe;QAC/B,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC;QAC/C,SAAS;QACT,KAAK;QACL,UAAU;QACV,cAAc;QACd,MAAM,EAAE,uBAAuB;QAC/B,kBAAkB;QAClB,GAAG,gBAAgB;QACnB,GAAG,mBAAmB,CAAC;YACrB,MAAM;YACN,cAAc;YACd,SAAS;YACT,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;SACrB,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,WAAW;QACd,iBAAiB,EAAE,GAAG,EAAE,CAAC,SAAS;QAClC,SAAS,EAAE,MAAM,MAAM,CAAC,UAAU,EAAE;QACpC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,IAA0B,EACM,EAAE;IAClC,OAAO,IAAI,CAAC,MAAM,KAAK,uBAAuB,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import {\n createBundlerClient,\n getAccountAddress,\n getEntryPoint,\n toSmartContractAccount,\n type Address,\n type EntryPointParameter,\n type SmartAccountSigner,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n hexToBigInt,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { MultisigModularAccountFactoryAbi } from \"../abis/MultisigModularAccountFactory.js\";\nimport { multisigSignMethods } from \"../plugins/multisig/signer.js\";\nimport { getDefaultMultisigModularAccountFactoryAddress } from \"../utils.js\";\nimport { standardExecutor } from \"./standardExecutor.js\";\n\nexport const MULTISIG_ACCOUNT_SOURCE = \"MultisigModularAccount\";\n\nexport type MultisigModularAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\n typeof MULTISIG_ACCOUNT_SOURCE,\n TSigner,\n \"0.6.0\"\n> & {\n getLocalThreshold: () => bigint;\n};\n\nexport type CreateMultisigModularAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends \"0.6.0\" = \"0.6.0\"\n> = Pick<\n ToSmartContractAccountParams<\n \"MultisigModularAccount\",\n TTransport,\n Chain,\n TEntryPointVersion\n >,\n \"transport\" | \"chain\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n threshold: bigint;\n owners?: Address[];\n accountAddress?: Address;\n} & EntryPointParameter<TEntryPointVersion, Chain>;\n\nexport async function createMultisigModularAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateMultisigModularAccountParams<TTransport, TSigner>\n): Promise<MultisigModularAccount<TSigner>>;\n\n/**\n * Creates a multisig modular account using the provided parameters, including transport, chain, signer, account address, and other account settings. It configures the account with multiple owners and the specified threshold.\n *\n * @example\n * ```ts\n * import { createMultisigModularAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createMultisigModularAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * });\n * ```\n *\n * @param {CreateMultisigModularAccountParams} config The parameters for creating a multisig modular account.\n * @returns {Promise<MultisigModularAccount>} A promise that resolves to a `MultisigModularAccount` object containing the created account information and methods.\n */\nexport async function createMultisigModularAccount(\n config: CreateMultisigModularAccountParams\n): Promise<MultisigModularAccount> {\n const {\n transport,\n chain,\n signer,\n accountAddress: accountAddress_,\n initCode,\n entryPoint = getEntryPoint(chain, { version: \"0.6.0\" }),\n factoryAddress = getDefaultMultisigModularAccountFactoryAddress(chain),\n owners = [],\n salt = 0n,\n threshold,\n } = config;\n\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // NOTE: the current signer connected will be one of the sigs as well\n const sigAddress = await signer.getAddress();\n // sigs need to be deduped + ordered in ascending order and !== to zero address\n const sigs_ = Array.from(new Set([...owners, sigAddress]))\n .filter((x) => hexToBigInt(x) !== 0n)\n .sort((a, b) => {\n const bigintA = hexToBigInt(a);\n const bigintB = hexToBigInt(b);\n\n return bigintA < bigintB ? -1 : bigintA > bigintB ? 1 : 0;\n });\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: MultisigModularAccountFactoryAbi,\n functionName: \"createAccount\",\n args: [salt, sigs_, threshold],\n }),\n ]);\n };\n\n const accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress: accountAddress_,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: MULTISIG_ACCOUNT_SOURCE,\n getAccountInitCode,\n ...standardExecutor,\n ...multisigSignMethods({\n client,\n accountAddress,\n threshold,\n signer: () => signer,\n }),\n });\n\n return {\n ...baseAccount,\n getLocalThreshold: () => threshold,\n publicKey: await signer.getAddress(),\n getSigner: () => signer,\n };\n}\n\nexport const isMultisigModularAccount = (\n acct: SmartContractAccount\n): acct is MultisigModularAccount => {\n return acct.source === MULTISIG_ACCOUNT_SOURCE;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/account-loupe/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EAC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ACrB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Address, Chain, Client, Hash, Transport } from \"viem\";\nimport { IAccountLoupeAbi } from \"../abis/IAccountLoupe.js\";\nimport type {\n ExecutionFunctionConfig,\n ExecutionHooks,\n FunctionReference,\n PreValidationHooks,\n} from \"./types.js\";\n\nexport type AccountLoupeActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n> = {\n /// @notice Gets the validation functions and plugin address for a selector\n /// @dev If the selector is a native function, the plugin address will be the address of the account\n /// @param selector The selector to get the configuration for\n /// @return The configuration for this selector\n getExecutionFunctionConfig(\n args: { selector: FunctionReference } & GetAccountParameter<TAccount>\n ): Promise<ExecutionFunctionConfig>;\n\n /// @notice Gets the pre and post execution hooks for a selector\n /// @param selector The selector to get the hooks for\n /// @return The pre and post execution hooks for this selector\n getExecutionHooks(\n args: {\n selector: FunctionReference;\n } & GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<ExecutionHooks>>;\n\n /// @notice Gets the pre user op and runtime validation hooks associated with a selector\n /// @param selector The selector to get the hooks for\n /// @return preUserOpValidationHooks The pre user op validation hooks for this selector\n /// @return preRuntimeValidationHooks The pre runtime validation hooks for this selector\n getPreValidationHooks(\n args: { selector: Hash } & GetAccountParameter<TAccount>\n ): Promise<Readonly<PreValidationHooks>>;\n\n /// @notice Gets an array of all installed plugins\n /// @return The addresses of all installed plugins\n getInstalledPlugins(\n args: GetAccountParameter<TAccount>\n ): Promise<ReadonlyArray<Address>>;\n};\n\n/**\n * Provides a set of actions for account loupe operations using the specified client.\n * NOTE: this is already added to the client when using any of the Modular Account Clients.\n *\n * @example\n * ```ts\n * import { accountLoupeActions } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...).extend(accountLoupeActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the client to be used for executing the account loupe actions\n * @returns {AccountLoupeActions<TAccount>} an object containing account loupe actions like `getExecutionFunctionConfig`, `getExecutionHooks`, `getPreValidationHooks`, and `getInstalledPlugins`\n */\nexport const accountLoupeActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n) => AccountLoupeActions<TAccount> = (client) => ({\n getExecutionFunctionConfig: async ({\n selector,\n account = client.account,\n }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionFunctionConfig\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionFunctionConfig\",\n args: [selector],\n });\n },\n\n getExecutionHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getExecutionHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getExecutionHooks\",\n args: [selector],\n });\n },\n\n getPreValidationHooks: async ({ selector, account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getPreValidationHooks\",\n client\n );\n }\n\n return client.readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getPreValidationHooks\",\n args: [selector],\n });\n },\n\n getInstalledPlugins: async ({ account = client.account }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"getInstalledPlugins\",\n client\n );\n }\n\n return client\n .readContract({\n address: account.address,\n abi: IAccountLoupeAbi,\n functionName: \"getInstalledPlugins\",\n })\n .catch(() => []);\n },\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type AccountLoupeActions, type CreateMultiOwnerModularAccountParams, type LightAccount, type MultiOwnerModularAccount, type MultiOwnerPluginActions, type PluginManagerActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import type { SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyModularAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>, "account">;
|
|
6
6
|
export declare function createModularAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyModularAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultiOwnerModularAccount<TSigner>, MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> & PluginManagerActions<MultiOwnerModularAccount<TSigner>> & AccountLoupeActions<MultiOwnerModularAccount<TSigner>>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/alchemyClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,oBAAoB,GAOrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AAgDd,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,MAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,8BAA8B,CAAC;QACnD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAAC;QACjD,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;KACL,CAAC;SACC,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultiOwnerModularAccount,\n multiOwnerPluginActions,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultiOwnerModularAccountParams,\n type LightAccount,\n type MultiOwnerModularAccount,\n type MultiOwnerPluginActions,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\nexport type AlchemyModularAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultiOwnerModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>>,\n \"account\"\n >;\n\nexport function createModularAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyModularAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a modular account Alchemy client with the provided configuration.\n *\n * @example\n * ```ts\n * import { createModularAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createModularAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {AlchemyModularAccountClientConfig} config The configuration for creating the Alchemy client\n * @returns {Promise<AlchemySmartAccountClient>} A promise that resolves to an `AlchemySmartAccountClient` configured with the desired plugins and actions\n */\nexport async function createModularAccountAlchemyClient(\n config: AlchemyModularAccountClientConfig\n): Promise<AlchemySmartAccountClient> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultiOwnerModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting({\n ...config,\n client,\n account,\n opts,\n })\n .extend(multiOwnerPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/msca/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EACL,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,8BAA8B,GAG/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,4BAA4B,GAG7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,oBAAoB,GAErB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,GAGtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/msca/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAoD,MAAM,MAAM,CAAC;AAExE,OAAO,EACL,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,8BAA8B,GAG/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,4BAA4B,GAG7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,oBAAoB,GAErB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,GAGtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAoEhF,MAAM,CAAC,KAAK,UAAU,oCAAoC,CAAC,EACzD,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EAC4B;IAC3C,MAAM,cAAc,GAAG,MAAM,8BAA8B,CAAC;QAC1D,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,wBAAwB,CAAC;QAC9B,GAAG,YAAY;QACf,SAAS;QACT,KAAK;QACL,OAAO,EAAE,cAAc;KACxB,CAAC;SACC,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,uBAAuB,CAAC;SAC/B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC;AA4CD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,EACvD,OAAO,EACP,SAAS,EACT,KAAK,EACL,GAAG,YAAY,EAC0B;IAUzC,MAAM,cAAc,GAAG,MAAM,4BAA4B,CAAC;QACxD,GAAG,OAAO;QACV,SAAS;QACT,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACtC,GAAG,YAAY;QACf,SAAS;QACT,KAAK;QACL,OAAO,EAAE,cAAc;QACvB,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n smartAccountClientActions,\n type SmartAccountClient,\n type SmartAccountClientRpcSchema,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport type { CreateLightAccountClientParams } from \"../../light-account/clients/client.js\";\nimport {\n accountLoupeActions,\n type AccountLoupeActions,\n} from \"../account-loupe/decorator.js\";\nimport {\n createMultiOwnerModularAccount,\n type CreateMultiOwnerModularAccountParams,\n type MultiOwnerModularAccount,\n} from \"../account/multiOwnerAccount.js\";\nimport {\n createMultisigModularAccount,\n type CreateMultisigModularAccountParams,\n type MultisigModularAccount,\n} from \"../account/multisigAccount.js\";\nimport {\n pluginManagerActions,\n type PluginManagerActions,\n} from \"../plugin-manager/decorator.js\";\nimport {\n multiOwnerPluginActions,\n type MultiOwnerPluginActions,\n} from \"../plugins/multi-owner/index.js\";\nimport {\n multisigPluginActions,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n} from \"../plugins/multisig/index.js\";\nimport { multisigSignatureMiddleware } from \"../plugins/multisig/middleware.js\";\n\nexport type CreateMultiOwnerModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultiOwnerModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport type CreateMultisigModularAccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n account: Omit<\n CreateMultisigModularAccountParams<TTransport, TSigner>,\n \"transport\" | \"chain\"\n >;\n} & Omit<\n CreateLightAccountClientParams<TTransport, TChain, TSigner>,\n \"account\"\n>;\n\nexport function createMultiOwnerModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultiOwnerModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultiOwnerModularAccount<TSigner>,\n MultiOwnerPluginActions<MultiOwnerModularAccount<TSigner>> &\n PluginManagerActions<MultiOwnerModularAccount<TSigner>> &\n AccountLoupeActions<MultiOwnerModularAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a multi-owner modular account client with the provided parameters including account, transport, chain, and additional client configuration. This function uses a modular account and extends it with various plugin actions.\n *\n * @example\n * ```ts\n * import { createMultiOwnerModularAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const accountClient = await createMultiOwnerModularAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * }\n * });\n * ```\n *\n * @param {CreateMultiOwnerModularAccountClientParams} config The parameters for creating the multi-owner modular account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance with extended plugin actions\n */\nexport async function createMultiOwnerModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultiOwnerModularAccountClientParams): Promise<SmartAccountClient> {\n const modularAccount = await createMultiOwnerModularAccount({\n ...account,\n transport,\n chain,\n });\n\n return createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n })\n .extend(pluginManagerActions)\n .extend(multiOwnerPluginActions)\n .extend(accountLoupeActions);\n}\n\nexport function createMultisigModularAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateMultisigModularAccountClientParams<Transport, TChain, TSigner>\n): Promise<\n SmartAccountClient<\n CustomTransport,\n Chain,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n>;\n\n/**\n * Creates a multisig modular account client using the provided parameters including account details, transport, chain, and additional client configuration. This function constructs the multisig modular account and extends it with various actions to create a comprehensive client.\n *\n * @example\n * ```ts\n * import { createMultisigModularAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const accountClient = await createMultisigModularAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * account: {\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * }\n * });\n * ```\n *\n * @param {CreateMultisigModularAccountClientParams} config the parameters for configuring the multisig modular account client\n * @returns {Promise<SmartAccountClient<Transport, Chain, MultisigModularAccount<SmartAccountSigner>, {}, SmartAccountClientRpcSchema, MultisigUserOperationContext>>} a promise that resolves to a `SmartAccountClient` object extended with the multisig modular account and additional actions\n */\nexport async function createMultisigModularAccountClient({\n account,\n transport,\n chain,\n ...clientConfig\n}: CreateMultisigModularAccountClientParams): Promise<\n SmartAccountClient<\n Transport,\n Chain,\n MultisigModularAccount<SmartAccountSigner>,\n {},\n SmartAccountClientRpcSchema,\n MultisigUserOperationContext\n >\n> {\n const modularAccount = await createMultisigModularAccount({\n ...account,\n transport,\n chain,\n });\n\n const client = createSmartAccountClient({\n ...clientConfig,\n transport,\n chain,\n account: modularAccount,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(pluginManagerActions)\n .extend(multisigPluginActions)\n .extend(accountLoupeActions);\n\n return client;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
1
2
|
import { type AlchemySmartAccountClient, type AlchemySmartAccountClientConfig } from "@account-kit/infra";
|
|
2
3
|
import { type AccountLoupeActions, type CreateMultisigModularAccountParams, type LightAccount, type MultisigModularAccount, type MultisigPluginActions, type MultisigUserOperationContext, type PluginManagerActions } from "@account-kit/smart-contracts";
|
|
3
|
-
import { type SmartAccountSigner } from "@aa-sdk/core";
|
|
4
4
|
import { type Chain, type CustomTransport, type HttpTransport, type Transport } from "viem";
|
|
5
5
|
export type AlchemyMultisigAccountClientConfig<TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateMultisigModularAccountParams<HttpTransport, TSigner>, "transport" | "chain"> & Omit<AlchemySmartAccountClientConfig<Transport, Chain, LightAccount<TSigner>, MultisigUserOperationContext>, "account">;
|
|
6
6
|
export declare function createMultisigAccountAlchemyClient<TSigner extends SmartAccountSigner = SmartAccountSigner>(params: AlchemyMultisigAccountClientConfig<TSigner>): Promise<AlchemySmartAccountClient<CustomTransport, Chain | undefined, MultisigModularAccount<TSigner>, MultisigPluginActions<MultisigModularAccount<TSigner>> & PluginManagerActions<MultisigModularAccount<TSigner>> & AccountLoupeActions<MultisigModularAccount<TSigner>>, MultisigUserOperationContext>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { smartAccountClientActions, } from "@aa-sdk/core";
|
|
1
2
|
import { AlchemyProviderConfigSchema, createAlchemyPublicRpcClient, createAlchemySmartAccountClientFromExisting, } from "@account-kit/infra";
|
|
2
3
|
import { accountLoupeActions, createMultisigModularAccount, multisigPluginActions, multisigSignatureMiddleware, pluginManagerActions, } from "@account-kit/smart-contracts";
|
|
3
|
-
import { smartAccountClientActions, } from "@aa-sdk/core";
|
|
4
4
|
import { custom, } from "viem";
|
|
5
5
|
export async function createMultisigAccountAlchemyClient(config) {
|
|
6
6
|
const { chain, opts, ...connectionConfig } = AlchemyProviderConfigSchema.parse(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"multiSigAlchemyClient.js","sourceRoot":"","sources":["../../../../../src/msca/client/multiSigAlchemyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAE1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,2CAA2C,GAG5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GAQrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,MAAM,GAKP,MAAM,MAAM,CAAC;AA0Dd,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAA0C;IAY1C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAE,GACxC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,4BAA4B,CAAC;QAC1C,KAAK;QACL,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,4BAA4B,CAAC;QACjD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO,2CAA2C,CAIhD;QACA,GAAG,MAAM;QACT,MAAM;QACN,OAAO;QACP,IAAI;QACJ,iBAAiB,EAAE,2BAA2B;KAC/C,CAAC;SACC,MAAM,CAAC,yBAAyB,CAAC;SACjC,MAAM,CAAC,qBAAqB,CAAC;SAC7B,MAAM,CAAC,oBAAoB,CAAC;SAC5B,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import {\n smartAccountClientActions,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n AlchemyProviderConfigSchema,\n createAlchemyPublicRpcClient,\n createAlchemySmartAccountClientFromExisting,\n type AlchemySmartAccountClient,\n type AlchemySmartAccountClientConfig,\n} from \"@account-kit/infra\";\nimport {\n accountLoupeActions,\n createMultisigModularAccount,\n multisigPluginActions,\n multisigSignatureMiddleware,\n pluginManagerActions,\n type AccountLoupeActions,\n type CreateMultisigModularAccountParams,\n type LightAccount,\n type MultisigModularAccount,\n type MultisigPluginActions,\n type MultisigUserOperationContext,\n type PluginManagerActions,\n} from \"@account-kit/smart-contracts\";\nimport {\n custom,\n type Chain,\n type CustomTransport,\n type HttpTransport,\n type Transport,\n} from \"viem\";\n\n// todo: this file seems somewhat duplicated with ./modularAccountClient.ts, but that file has some multi-owner specific fields. Is there a way to refactor these two to de-dupe?\n\nexport type AlchemyMultisigAccountClientConfig<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Omit<\n CreateMultisigModularAccountParams<HttpTransport, TSigner>,\n \"transport\" | \"chain\"\n> &\n Omit<\n AlchemySmartAccountClientConfig<\n Transport,\n Chain,\n LightAccount<TSigner>,\n MultisigUserOperationContext\n >,\n \"account\"\n >;\n\nexport function createMultisigAccountAlchemyClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n params: AlchemyMultisigAccountClientConfig<TSigner>\n): Promise<\n AlchemySmartAccountClient<\n CustomTransport,\n Chain | undefined,\n MultisigModularAccount<TSigner>,\n MultisigPluginActions<MultisigModularAccount<TSigner>> &\n PluginManagerActions<MultisigModularAccount<TSigner>> &\n AccountLoupeActions<MultisigModularAccount<TSigner>>,\n MultisigUserOperationContext\n >\n>;\n\n/**\n * Creates an Alchemy client for a multisig account using the provided configuration.\n *\n * @example\n * ```ts\n * import { createMultisigAccountAlchemyClient } from \"@account-kit/smart-contracts\";\n * import { sepolia } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const alchemyAccountClient = await createMultisigAccountAlchemyClient({\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),\n * owners: [...], // other owners on the account\n * threshold: 2, // 2 of N signatures\n * });\n * ```\n *\n * @param {AlchemyMultisigAccountClientConfig} config The configuration for the Alchemy multisig account client\n * @returns {Promise<AlchemySmartAccountClient<Transport, Chain | undefined, MultisigModularAccount<SmartAccountSigner>, MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> & PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> & AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>, MultisigUserOperationContext>>} A promise that resolves to an Alchemy Smart Account Client for multisig accounts with extended functionalities.\n */\nexport async function createMultisigAccountAlchemyClient(\n config: AlchemyMultisigAccountClientConfig\n): Promise<\n AlchemySmartAccountClient<\n Transport,\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigPluginActions<MultisigModularAccount<SmartAccountSigner>> &\n PluginManagerActions<MultisigModularAccount<SmartAccountSigner>> &\n AccountLoupeActions<MultisigModularAccount<SmartAccountSigner>>,\n MultisigUserOperationContext\n >\n> {\n const { chain, opts, ...connectionConfig } =\n AlchemyProviderConfigSchema.parse(config);\n\n const client = createAlchemyPublicRpcClient({\n chain,\n connectionConfig,\n });\n\n const account = await createMultisigModularAccount({\n transport: custom(client),\n ...config,\n });\n\n return createAlchemySmartAccountClientFromExisting<\n Chain | undefined,\n MultisigModularAccount<SmartAccountSigner>,\n MultisigUserOperationContext\n >({\n ...config,\n client,\n account,\n opts,\n signUserOperation: multisigSignatureMiddleware,\n })\n .extend(smartAccountClientActions)\n .extend(multisigPluginActions)\n .extend(pluginManagerActions)\n .extend(accountLoupeActions);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/msca/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/msca/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAE5D;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAF/B;;;;mBAAO,iCAAiC;WAAC;IAGlD,CAAC;CACF;AAKD,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAFhD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAKD,MAAM,OAAO,4BAA6B,SAAQ,SAAS;IAEzD;QACE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAFpD;;;;mBAAO,8BAA8B;WAAC;IAG/C,CAAC;CACF;AAKD,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAE1D;QACE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QAFlD;;;;mBAAO,+BAA+B;WAAC;IAGhD,CAAC;CACF","sourcesContent":["import { BaseError } from \"@aa-sdk/core\";\n\n/**\n * Error thrown when the aggregated signature is invalid\n */\nexport class InvalidAggregatedSignatureError extends BaseError {\n override name = \"InvalidAggregatedSignatureError\";\n constructor() {\n super(\"Invalid aggregated signature\");\n }\n}\n\n/**\n * Error thrown when the context signature is invalid\n */\nexport class InvalidContextSignatureError extends BaseError {\n override name = \"InvalidContextSignatureError\";\n constructor() {\n super(\"Expected context.signature to be a hex string\");\n }\n}\n\n/**\n * Error thrown when the expected account is not a multisig modular account\n */\nexport class MultisigAccountExpectedError extends BaseError {\n override name = \"MultisigAccountExpectedError\";\n constructor() {\n super(\"Expected account to be a multisig modular account\");\n }\n}\n\n/**\n * Error thrown when a multisig user op is missing a signature\n */\nexport class MultisigMissingSignatureError extends BaseError {\n override name = \"MultisigMissingSignatureError\";\n constructor() {\n super(\"UserOp must have at least one signature already\");\n }\n}\n"]}
|
|
@@ -8,4 +8,4 @@ export type PluginManagerActions<TAccount extends SmartContractAccount | undefin
|
|
|
8
8
|
installPlugin: (params: InstallPluginParams<TAccount>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
9
9
|
uninstallPlugin: (params: UninstallPluginParams<TAccount>) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
10
10
|
};
|
|
11
|
-
export declare
|
|
11
|
+
export declare function pluginManagerActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>): PluginManagerActions<TAccount>;
|
|
@@ -2,8 +2,10 @@ import { installPlugin } from "./installPlugin.js";
|
|
|
2
2
|
import { uninstallPlugin, } from "./uninstallPlugin.js";
|
|
3
3
|
export {} from "./installPlugin.js";
|
|
4
4
|
export {} from "./uninstallPlugin.js";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export function pluginManagerActions(client) {
|
|
6
|
+
return {
|
|
7
|
+
installPlugin: async (params) => installPlugin(client, params),
|
|
8
|
+
uninstallPlugin: async (params) => uninstallPlugin(client, params),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
9
11
|
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAA8B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../../../src/msca/plugin-manager/decorator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAA4B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAA8B,MAAM,sBAAsB,CAAC;AA+BlE,MAAM,UAAU,oBAAoB,CAOlC,MAA4C;IAE5C,OAAO;QACL,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;QAC9D,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC","sourcesContent":["import type {\n GetEntryPointFromAccount,\n SendUserOperationResult,\n SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { installPlugin, type InstallPluginParams } from \"./installPlugin.js\";\nimport {\n uninstallPlugin,\n type UninstallPluginParams,\n} from \"./uninstallPlugin.js\";\n\nexport { type InstallPluginParams } from \"./installPlugin.js\";\nexport { type UninstallPluginParams } from \"./uninstallPlugin.js\";\n\nexport type PluginManagerActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n installPlugin: (\n params: InstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n uninstallPlugin: (\n params: UninstallPluginParams<TAccount>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n};\n\n/**\n * Provides actions for managing plugins on a given client, including installing and uninstalling plugins.\n * NOTE: this is provided by default when using a modular account client\n *\n * @example\n * ```ts\n * import { pluginManagerActions } from \"@account-kit/smart-contracts\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient(...).extend(pluginManagerActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance on which to manage plugins\n * @returns {PluginManagerActions<TAccount>} An object containing functions to install and uninstall plugins\n */\nexport function pluginManagerActions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): PluginManagerActions<TAccount> {\n return {\n installPlugin: async (params) => installPlugin(client, params),\n uninstallPlugin: async (params) => uninstallPlugin(client, params),\n };\n}\n"]}
|