@account-kit/smart-contracts 4.12.1-alpha.0 → 4.13.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/src/index.d.ts +5 -0
- package/dist/esm/src/index.js +2 -0
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/ma-v2/account/common/modularAccountV2Base.d.ts +39 -0
- package/dist/esm/src/ma-v2/account/{semiModularAccountV2.js → common/modularAccountV2Base.js} +32 -61
- package/dist/esm/src/ma-v2/account/common/modularAccountV2Base.js.map +1 -0
- package/dist/esm/src/ma-v2/account/modularAccountV2.d.ts +16 -0
- package/dist/esm/src/ma-v2/account/modularAccountV2.js +113 -0
- package/dist/esm/src/ma-v2/account/modularAccountV2.js.map +1 -0
- package/dist/esm/src/ma-v2/account/nativeSMASigner.d.ts +1 -1
- package/dist/esm/src/ma-v2/account/nativeSMASigner.js +1 -1
- package/dist/esm/src/ma-v2/account/nativeSMASigner.js.map +1 -1
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.d.ts +11 -9
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.js +43 -23
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.js.map +1 -1
- package/dist/esm/src/ma-v2/client/client.d.ts +7 -6
- package/dist/esm/src/ma-v2/client/client.js +21 -18
- package/dist/esm/src/ma-v2/client/client.js.map +1 -1
- package/dist/esm/src/ma-v2/index.d.ts +0 -4
- package/dist/esm/src/ma-v2/index.js +0 -2
- package/dist/esm/src/ma-v2/index.js.map +1 -1
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.d.ts +14 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js +14 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js.map +1 -1
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.d.ts +1 -1
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js +1 -1
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js.map +1 -1
- package/dist/esm/src/ma-v2/modules/time-range-module/module.d.ts +10 -1
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js +20 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js.map +1 -1
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/ma-v2/account/common/modularAccountV2Base.d.ts +40 -0
- package/dist/types/src/ma-v2/account/common/modularAccountV2Base.d.ts.map +1 -0
- package/dist/types/src/ma-v2/account/modularAccountV2.d.ts +17 -0
- package/dist/types/src/ma-v2/account/modularAccountV2.d.ts.map +1 -0
- package/dist/types/src/ma-v2/account/nativeSMASigner.d.ts +1 -1
- package/dist/types/src/ma-v2/actions/install-validation/installValidation.d.ts +11 -9
- package/dist/types/src/ma-v2/actions/install-validation/installValidation.d.ts.map +1 -1
- package/dist/types/src/ma-v2/client/client.d.ts +7 -6
- package/dist/types/src/ma-v2/client/client.d.ts.map +1 -1
- package/dist/types/src/ma-v2/index.d.ts +0 -4
- package/dist/types/src/ma-v2/index.d.ts.map +1 -1
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts +14 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts.map +1 -1
- package/dist/types/src/ma-v2/modules/single-signer-validation/signer.d.ts +1 -1
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts +10 -1
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +7 -0
- package/src/ma-v2/account/{semiModularAccountV2.ts → common/modularAccountV2Base.ts} +62 -105
- package/src/ma-v2/account/modularAccountV2.ts +193 -0
- package/src/ma-v2/account/nativeSMASigner.ts +1 -1
- package/src/ma-v2/actions/install-validation/installValidation.ts +75 -36
- package/src/ma-v2/client/client.ts +54 -34
- package/src/ma-v2/index.ts +0 -5
- package/src/ma-v2/modules/allowlist-module/module.ts +29 -0
- package/src/ma-v2/modules/single-signer-validation/signer.ts +1 -1
- package/src/ma-v2/modules/time-range-module/module.ts +34 -1
- package/dist/esm/src/ma-v2/account/semiModularAccountV2.d.ts +0 -41
- package/dist/esm/src/ma-v2/account/semiModularAccountV2.js.map +0 -1
- package/dist/types/src/ma-v2/account/semiModularAccountV2.d.ts +0 -42
- package/dist/types/src/ma-v2/account/semiModularAccountV2.d.ts.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type SmartAccountSigner, type SmartContractAccountWithSigner, type ToSmartContractAccountParams } from "@aa-sdk/core";
|
|
2
|
+
import { type Hex, type Address, type Chain, type Transport } from "viem";
|
|
3
|
+
export declare const executeUserOpSelector: Hex;
|
|
4
|
+
export type SignerEntity = {
|
|
5
|
+
isGlobalValidation: boolean;
|
|
6
|
+
entityId: number;
|
|
7
|
+
};
|
|
8
|
+
export type ExecutionDataView = {
|
|
9
|
+
module: Address;
|
|
10
|
+
skipRuntimeValidation: boolean;
|
|
11
|
+
allowGlobalValidation: boolean;
|
|
12
|
+
executionHooks: readonly Hex[];
|
|
13
|
+
};
|
|
14
|
+
export type ValidationDataView = {
|
|
15
|
+
validationHooks: readonly Hex[];
|
|
16
|
+
executionHooks: readonly Hex[];
|
|
17
|
+
selectors: readonly Hex[];
|
|
18
|
+
validationFlags: number;
|
|
19
|
+
};
|
|
20
|
+
export type ValidationDataParams = {
|
|
21
|
+
validationModuleAddress: Address;
|
|
22
|
+
entityId?: never;
|
|
23
|
+
} | {
|
|
24
|
+
validationModuleAddress?: never;
|
|
25
|
+
entityId: number;
|
|
26
|
+
};
|
|
27
|
+
export type ModularAccountV2<TSigner extends SmartAccountSigner = SmartAccountSigner> = SmartContractAccountWithSigner<"ModularAccountV2", TSigner, "0.7.0"> & {
|
|
28
|
+
signerEntity: SignerEntity;
|
|
29
|
+
getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;
|
|
30
|
+
getValidationData: (args: ValidationDataParams) => Promise<ValidationDataView>;
|
|
31
|
+
encodeCallData: (callData: Hex) => Promise<Hex>;
|
|
32
|
+
};
|
|
33
|
+
export type CreateMAV2BaseParams<TSigner extends SmartAccountSigner = SmartAccountSigner, TTransport extends Transport = Transport> = Omit<ToSmartContractAccountParams<"ModularAccountV2", TTransport, Chain, "0.7.0">, "encodeExecute" | "encodeBatchExecute" | "getNonce" | "signMessage" | "signTypedData" | "getDummySignature"> & {
|
|
34
|
+
signer: TSigner;
|
|
35
|
+
signerEntity?: SignerEntity;
|
|
36
|
+
accountAddress: Address;
|
|
37
|
+
};
|
|
38
|
+
export type CreateMAV2BaseReturnType<TSigner extends SmartAccountSigner = SmartAccountSigner> = Promise<ModularAccountV2<TSigner>>;
|
|
39
|
+
export declare function createMAv2Base<TSigner extends SmartAccountSigner = SmartAccountSigner>(config: CreateMAV2BaseParams<TSigner>): CreateMAV2BaseReturnType<TSigner>;
|
|
40
|
+
//# sourceMappingURL=modularAccountV2Base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularAccountV2Base.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/account/common/modularAccountV2Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAClC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,SAAS,EAOf,MAAM,MAAM,CAAC;AAMd,eAAO,MAAM,qBAAqB,EAAE,GAAkB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,SAAS,GAAG,EAAE,CAAC;C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,wBAAwB,CAClC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEvC,wBAAsB,cAAc,CAClC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EACvD,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAsJ1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EntryPointDef, SmartAccountSigner, ToSmartContractAccountParams } from "@aa-sdk/core";
|
|
2
|
+
import { type Address, type Chain, type Hex, type Transport } from "viem";
|
|
3
|
+
import { type SignerEntity, type ModularAccountV2 } from "./common/modularAccountV2Base.js";
|
|
4
|
+
export type CreateModularAccountV2Params<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner> = (Pick<ToSmartContractAccountParams<"ModularAccountV2", TTransport, Chain, "0.7.0">, "transport" | "chain" | "accountAddress"> & {
|
|
5
|
+
signer: TSigner;
|
|
6
|
+
entryPoint?: EntryPointDef<"0.7.0", Chain>;
|
|
7
|
+
signerEntity?: SignerEntity;
|
|
8
|
+
}) & ({
|
|
9
|
+
mode?: "default";
|
|
10
|
+
salt?: bigint;
|
|
11
|
+
factoryAddress?: Address;
|
|
12
|
+
initCode?: Hex;
|
|
13
|
+
} | {
|
|
14
|
+
mode: "7702";
|
|
15
|
+
});
|
|
16
|
+
export declare function createModularAccountV2<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner>(config: CreateModularAccountV2Params<TTransport, TSigner>): Promise<ModularAccountV2<TSigner>>;
|
|
17
|
+
//# sourceMappingURL=modularAccountV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modularAccountV2.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/account/modularAccountV2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAQtB,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,MAAM,4BAA4B,CACtC,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,CAAC,IAAI,CACP,4BAA4B,CAAC,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,EAC5E,WAAW,GAAG,OAAO,GAAG,gBAAgB,CACzC,GAAG;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC,GACA,CACI;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CACJ,CAAC;AAEJ,wBAAsB,sBAAsB,CAC1C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,MAAM,EAAE,4BAA4B,CAAC,UAAU,EAAE,OAAO,CAAC,GACxD,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { type Hex, type SignableMessage, type TypedDataDefinition, type Chain, t
|
|
|
11
11
|
*
|
|
12
12
|
* const MNEMONIC = "...":
|
|
13
13
|
*
|
|
14
|
-
* const account =
|
|
14
|
+
* const account = createModularAccountV2({ config });
|
|
15
15
|
*
|
|
16
16
|
* const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);
|
|
17
17
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type GetEntryPointFromAccount, type SendUserOperationResult, type UserOperationOverridesParameter, type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
2
|
import { type Address, type Hex } from "viem";
|
|
3
3
|
import type { HookConfig, ValidationConfig } from "../common/types.js";
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
4
|
+
import { type ModularAccountV2Client } from "../../client/client.js";
|
|
5
|
+
import { type ModularAccountV2 } from "../../account/common/modularAccountV2Base.js";
|
|
6
6
|
export type InstallValidationParams<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
7
7
|
validationConfig: ValidationConfig;
|
|
8
8
|
selectors: Hex[];
|
|
@@ -11,28 +11,30 @@ export type InstallValidationParams<TSigner extends SmartAccountSigner = SmartAc
|
|
|
11
11
|
hookConfig: HookConfig;
|
|
12
12
|
initData: Hex;
|
|
13
13
|
}[];
|
|
14
|
-
account?:
|
|
15
|
-
} & UserOperationOverridesParameter<GetEntryPointFromAccount<
|
|
14
|
+
account?: ModularAccountV2<TSigner> | undefined;
|
|
15
|
+
} & UserOperationOverridesParameter<GetEntryPointFromAccount<ModularAccountV2<TSigner>>>;
|
|
16
16
|
export type UninstallValidationParams<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
17
17
|
moduleAddress: Address;
|
|
18
18
|
entityId: number;
|
|
19
19
|
uninstallData: Hex;
|
|
20
20
|
hookUninstallDatas: Hex[];
|
|
21
|
-
account?:
|
|
22
|
-
} & UserOperationOverridesParameter<GetEntryPointFromAccount<
|
|
21
|
+
account?: ModularAccountV2<TSigner> | undefined;
|
|
22
|
+
} & UserOperationOverridesParameter<GetEntryPointFromAccount<ModularAccountV2<TSigner>>>;
|
|
23
23
|
export type InstallValidationActions<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
24
24
|
installValidation: (args: InstallValidationParams<TSigner>) => Promise<SendUserOperationResult>;
|
|
25
|
+
encodeInstallValidation: (args: InstallValidationParams<TSigner>) => Promise<Hex>;
|
|
25
26
|
uninstallValidation: (args: UninstallValidationParams<TSigner>) => Promise<SendUserOperationResult>;
|
|
27
|
+
encodeUninstallValidation: (args: UninstallValidationParams<TSigner>) => Promise<Hex>;
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
|
|
29
31
|
*
|
|
30
32
|
* @example
|
|
31
33
|
* ```ts
|
|
32
|
-
* import {
|
|
34
|
+
* import { createModularAccountV2Client, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@account-kit/smart-contracts";
|
|
33
35
|
* import { Address } from "viem";
|
|
34
36
|
*
|
|
35
|
-
* const client = (await
|
|
37
|
+
* const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);
|
|
36
38
|
* const sessionKeyAddress: Address = "0x1234";
|
|
37
39
|
* const sessionKeyEntityId: number = 1;
|
|
38
40
|
*
|
|
@@ -68,5 +70,5 @@ export type InstallValidationActions<TSigner extends SmartAccountSigner = SmartA
|
|
|
68
70
|
* @param {object} client - The client instance which provides account and sendUserOperation functionality.
|
|
69
71
|
* @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.
|
|
70
72
|
*/
|
|
71
|
-
export declare const installValidationActions: <TSigner extends SmartAccountSigner = SmartAccountSigner>(client:
|
|
73
|
+
export declare const installValidationActions: <TSigner extends SmartAccountSigner = SmartAccountSigner>(client: ModularAccountV2Client<TSigner>) => InstallValidationActions<TSigner>;
|
|
72
74
|
//# sourceMappingURL=installValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installValidation.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/actions/install-validation/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOvE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"installValidation.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/actions/install-validation/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOvE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,MAAM,MAAM,uBAAuB,CACjC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD;IACF,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,WAAW,EAAE,GAAG,CAAC;IACjB,KAAK,EAAE;QACL,UAAU,EAAE,UAAU,CAAC;QACvB,QAAQ,EAAE,GAAG,CAAC;KACf,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACjD,GAAG,+BAA+B,CACjC,wBAAwB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CACpD,CAAC;AAEF,MAAM,MAAM,yBAAyB,CACnC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD;IACF,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC;IACnB,kBAAkB,EAAE,GAAG,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACjD,GAAG,+BAA+B,CACjC,wBAAwB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CACpD,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAClC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD;IACF,iBAAiB,EAAE,CACjB,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,KACnC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,uBAAuB,EAAE,CAEvB,IAAI,EAAE,uBAAuB,CAAC,OAAO,CAAC,KACnC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClB,mBAAmB,EAAE,CACnB,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,KACrC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtC,yBAAyB,EAAE,CACzB,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,KACrC,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,wBAAwB,EAAE,CACrC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,MAAM,EAAE,sBAAsB,CAAC,OAAO,CAAC,KACpC,wBAAwB,CAAC,OAAO,CAgIpC,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type SmartAccountClient, type SmartAccountSigner, type SmartAccountClientConfig, type NotType } from "@aa-sdk/core";
|
|
2
2
|
import { type Chain, type Transport } from "viem";
|
|
3
|
-
import { type
|
|
3
|
+
import { type CreateModularAccountV2Params } from "../account/modularAccountV2.js";
|
|
4
4
|
import { type AlchemySmartAccountClientConfig, type AlchemyTransport } from "@account-kit/infra";
|
|
5
5
|
import type { LightAccount } from "../../light-account/accounts/account.js";
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
6
|
+
import type { ModularAccountV2 } from "../account/common/modularAccountV2Base.js";
|
|
7
|
+
export type ModularAccountV2Client<TSigner extends SmartAccountSigner = SmartAccountSigner, TChain extends Chain = Chain, TTransport extends Transport | AlchemyTransport = Transport> = SmartAccountClient<TTransport, TChain, ModularAccountV2<TSigner>>;
|
|
8
|
+
export type CreateModularAccountV2ClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner> = CreateModularAccountV2Params<TTransport, TSigner> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
9
|
+
export type CreateModularAccountV2AlchemyClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner> = Omit<CreateModularAccountV2ClientParams<TTransport, TChain, TSigner>, "transport"> & Omit<AlchemySmartAccountClientConfig<TChain, LightAccount<TSigner>>, "account"> & {
|
|
9
10
|
paymasterAndData?: never;
|
|
10
11
|
dummyPaymasterAndData?: never;
|
|
11
12
|
};
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function createModularAccountV2Client<TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateModularAccountV2AlchemyClientParams<AlchemyTransport, TChain, TSigner>): Promise<ModularAccountV2Client<TSigner, TChain, AlchemyTransport>>;
|
|
14
|
+
export declare function createModularAccountV2Client<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateModularAccountV2ClientParams<TTransport, TChain, TSigner> & NotType<TTransport, AlchemyTransport>): Promise<ModularAccountV2Client<TSigner, TChain>>;
|
|
14
15
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,OAAO,EAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAIL,KAAK,+BAA+B,EACpC,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAElF,MAAM,MAAM,sBAAsB,CAChC,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EACvD,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,UAAU,SAAS,SAAS,GAAG,gBAAgB,GAAG,SAAS,IACzD,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtE,MAAM,MAAM,kCAAkC,CAC5C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,4BAA4B,CAAC,UAAU,EAAE,OAAO,CAAC,GACnD,IAAI,CACF,wBAAwB,CAAC,UAAU,EAAE,MAAM,CAAC,EAC5C,WAAW,GAAG,SAAS,GAAG,OAAO,CAClC,CAAC;AAEJ,MAAM,MAAM,yCAAyC,CACnD,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,IACrD,IAAI,CACN,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAC/D,WAAW,CACZ,GACC,IAAI,CACF,+BAA+B,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,EAC9D,SAAS,CACV,GAAG;IAAE,gBAAgB,CAAC,EAAE,KAAK,CAAC;IAAC,qBAAqB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAElE,wBAAgB,4BAA4B,CAC1C,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,IAAI,EAAE,yCAAyC,CAC7C,gBAAgB,EAChB,MAAM,EACN,OAAO,CACR,GACA,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEtE,wBAAgB,4BAA4B,CAC1C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EAEvD,IAAI,EAAE,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,GACnE,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,GACtC,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -3,15 +3,11 @@ export { modularAccountAbi } from "./abis/modularAccountAbi.js";
|
|
|
3
3
|
export { semiModularAccountBytecodeAbi } from "./abis/semiModularAccountBytecodeAbi.js";
|
|
4
4
|
export { semiModularAccountStorageAbi } from "./abis/semiModularAccountStorageAbi.js";
|
|
5
5
|
export { nativeSMASigner } from "./account/nativeSMASigner.js";
|
|
6
|
-
export type * from "./account/semiModularAccountV2.js";
|
|
7
|
-
export { createSMAV2Account } from "./account/semiModularAccountV2.js";
|
|
8
6
|
export type { ModuleEntity, ValidationConfig, HookConfig, ValidationData, } from "./actions/common/types.js";
|
|
9
7
|
export { HookType } from "./actions/common/types.js";
|
|
10
8
|
export { serializeValidationConfig, serializeHookConfig, serializeModuleEntity, } from "./actions/common/utils.js";
|
|
11
9
|
export type * from "./actions/install-validation/installValidation.js";
|
|
12
10
|
export { installValidationActions } from "./actions/install-validation/installValidation.js";
|
|
13
|
-
export type * from "./client/client.js";
|
|
14
|
-
export { createSMAV2AccountClient } from "./client/client.js";
|
|
15
11
|
export { getDefaultAllowlistModuleAddress, getDefaultNativeTokenLimitModuleAddress, getDefaultPaymasterGuardModuleAddress, getDefaultSingleSignerValidationModuleAddress, getDefaultTimeRangeModuleAddress, getDefaultWebauthnValidationModuleAddress, } from "./modules/utils.js";
|
|
16
12
|
export { allowlistModuleAbi } from "./modules/allowlist-module/abis/allowlistModuleAbi.js";
|
|
17
13
|
export { AllowlistModule } from "./modules/allowlist-module/module.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AA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|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const AllowlistModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -556,6 +557,19 @@ export declare const AllowlistModule: {
|
|
|
556
557
|
readonly name: "UnexpectedDataPassed";
|
|
557
558
|
readonly inputs: readonly [];
|
|
558
559
|
}];
|
|
560
|
+
buildHook: (installArgs: {
|
|
561
|
+
entityId: number;
|
|
562
|
+
inputs: Array<{
|
|
563
|
+
target: Address;
|
|
564
|
+
hasSelectorAllowlist: boolean;
|
|
565
|
+
hasERC20SpendLimit: boolean;
|
|
566
|
+
erc20SpendLimit: bigint;
|
|
567
|
+
selectors: Array<Hex>;
|
|
568
|
+
}>;
|
|
569
|
+
}, address: Address) => {
|
|
570
|
+
hookConfig: HookConfig;
|
|
571
|
+
initData: Hex;
|
|
572
|
+
};
|
|
559
573
|
encodeOnInstallData: (args: {
|
|
560
574
|
entityId: number;
|
|
561
575
|
inputs: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/allowlist-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEnE,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAO,CAAC;YAC9B,kBAAkB,EAAE,OAAO,CAAC;YAC5B,eAAe,EAAE,MAAM,CAAC;YACxB,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC;SACvB,CAAC,CAAC;KACJ,KAAG,GAAG;CA+BR,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { type Hex, type SignableMessage, type TypedDataDefinition, type Chain, t
|
|
|
11
11
|
*
|
|
12
12
|
* const MNEMONIC = "...":
|
|
13
13
|
*
|
|
14
|
-
* const account =
|
|
14
|
+
* const account = createModularAccountV2({ config });
|
|
15
15
|
*
|
|
16
16
|
* const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);
|
|
17
17
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Hex } from "viem";
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type HookConfig } from "../../actions/common/types.js";
|
|
2
3
|
export declare const TimeRangeModule: {
|
|
3
4
|
abi: readonly [{
|
|
4
5
|
readonly type: "function";
|
|
@@ -229,6 +230,14 @@ export declare const TimeRangeModule: {
|
|
|
229
230
|
readonly name: "UnexpectedDataPassed";
|
|
230
231
|
readonly inputs: readonly [];
|
|
231
232
|
}];
|
|
233
|
+
buildHook: (installArgs: {
|
|
234
|
+
entityId: number;
|
|
235
|
+
validUntil: number;
|
|
236
|
+
validAfter: number;
|
|
237
|
+
}, address: Address) => {
|
|
238
|
+
hookConfig: HookConfig;
|
|
239
|
+
initData: Hex;
|
|
240
|
+
};
|
|
232
241
|
encodeOnInstallData: (args: {
|
|
233
242
|
entityId: number;
|
|
234
243
|
validUntil: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/time-range-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAGnE,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAGX;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,WACQ,OAAO,KACf;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAE;gCAyBhB;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,KAAG,GAAG;kCAkBuB;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAG,GAAG;+BAY7B;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,KAAG,GAAG;CAkBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/smart-contracts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.1-alpha.0",
|
|
4
4
|
"description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test:run": "vitest run"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@account-kit/plugingen": "^4.
|
|
55
|
+
"@account-kit/plugingen": "^4.13.1-alpha.0",
|
|
56
56
|
"change-case": "^5.1.2",
|
|
57
57
|
"dedent": "^1.5.1",
|
|
58
58
|
"dotenv": "^16.3.1",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
73
73
|
},
|
|
74
74
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d026b488ed279f04424c57b745efb19b8d344056",
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@aa-sdk/core": "^4.
|
|
78
|
-
"@account-kit/infra": "^4.
|
|
77
|
+
"@aa-sdk/core": "^4.13.1-alpha.0",
|
|
78
|
+
"@account-kit/infra": "^4.13.1-alpha.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"viem": "^2.
|
|
81
|
+
"viem": "^2.22.6"
|
|
82
82
|
}
|
|
83
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -115,3 +115,10 @@ export {
|
|
|
115
115
|
getMAInitializationData,
|
|
116
116
|
getMSCAUpgradeToData,
|
|
117
117
|
} from "./msca/utils.js";
|
|
118
|
+
|
|
119
|
+
// ma v2 types
|
|
120
|
+
export type * from "./ma-v2/account/modularAccountV2.js";
|
|
121
|
+
export type * from "./ma-v2/account/common/modularAccountV2Base.js";
|
|
122
|
+
export { createModularAccountV2 } from "./ma-v2/account/modularAccountV2.js";
|
|
123
|
+
export type * from "./ma-v2/client/client.js";
|
|
124
|
+
export { createModularAccountV2Client } from "./ma-v2/client/client.js";
|
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
EntryPointDef,
|
|
3
|
-
SmartAccountSigner,
|
|
4
|
-
AccountOp,
|
|
5
|
-
SmartContractAccountWithSigner,
|
|
6
|
-
ToSmartContractAccountParams,
|
|
7
|
-
} from "@aa-sdk/core";
|
|
8
1
|
import {
|
|
9
2
|
createBundlerClient,
|
|
10
3
|
getEntryPoint,
|
|
11
|
-
toSmartContractAccount,
|
|
12
4
|
InvalidEntityIdError,
|
|
13
5
|
InvalidNonceKeyError,
|
|
14
|
-
|
|
6
|
+
toSmartContractAccount,
|
|
7
|
+
type AccountOp,
|
|
8
|
+
type SmartAccountSigner,
|
|
9
|
+
type SmartContractAccountWithSigner,
|
|
10
|
+
type ToSmartContractAccountParams,
|
|
15
11
|
} from "@aa-sdk/core";
|
|
12
|
+
import { DEFAULT_OWNER_ENTITY_ID } from "../../utils.js";
|
|
16
13
|
import {
|
|
17
|
-
|
|
18
|
-
encodeFunctionData,
|
|
19
|
-
getContract,
|
|
20
|
-
maxUint32,
|
|
21
|
-
maxUint152,
|
|
22
|
-
zeroAddress,
|
|
14
|
+
type Hex,
|
|
23
15
|
type Address,
|
|
24
16
|
type Chain,
|
|
25
|
-
type Hex,
|
|
26
17
|
type Transport,
|
|
18
|
+
encodeFunctionData,
|
|
19
|
+
maxUint32,
|
|
20
|
+
zeroAddress,
|
|
21
|
+
getContract,
|
|
22
|
+
concatHex,
|
|
23
|
+
maxUint152,
|
|
27
24
|
} from "viem";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} from "../utils.js";
|
|
33
|
-
import { singleSignerMessageSigner } from "../modules/single-signer-validation/signer.js";
|
|
34
|
-
import { nativeSMASigner } from "./nativeSMASigner.js";
|
|
35
|
-
import { modularAccountAbi } from "../abis/modularAccountAbi.js";
|
|
36
|
-
import { serializeModuleEntity } from "../actions/common/utils.js";
|
|
25
|
+
import { modularAccountAbi } from "../../abis/modularAccountAbi.js";
|
|
26
|
+
import { serializeModuleEntity } from "../../actions/common/utils.js";
|
|
27
|
+
import { nativeSMASigner } from "../nativeSMASigner.js";
|
|
28
|
+
import { singleSignerMessageSigner } from "../../modules/single-signer-validation/signer.js";
|
|
37
29
|
|
|
38
|
-
const executeUserOpSelector: Hex = "0x8DD7712F";
|
|
30
|
+
export const executeUserOpSelector: Hex = "0x8DD7712F";
|
|
39
31
|
|
|
40
32
|
export type SignerEntity = {
|
|
41
33
|
isGlobalValidation: boolean;
|
|
@@ -66,9 +58,9 @@ export type ValidationDataParams =
|
|
|
66
58
|
entityId: number;
|
|
67
59
|
};
|
|
68
60
|
|
|
69
|
-
export type
|
|
61
|
+
export type ModularAccountV2<
|
|
70
62
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
71
|
-
> = SmartContractAccountWithSigner<"
|
|
63
|
+
> = SmartContractAccountWithSigner<"ModularAccountV2", TSigner, "0.7.0"> & {
|
|
72
64
|
signerEntity: SignerEntity;
|
|
73
65
|
getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;
|
|
74
66
|
getValidationData: (
|
|
@@ -77,48 +69,35 @@ export type MAV2Account<
|
|
|
77
69
|
encodeCallData: (callData: Hex) => Promise<Hex>;
|
|
78
70
|
};
|
|
79
71
|
|
|
80
|
-
export type
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
> =
|
|
84
|
-
ToSmartContractAccountParams<"
|
|
85
|
-
|
|
72
|
+
export type CreateMAV2BaseParams<
|
|
73
|
+
TSigner extends SmartAccountSigner = SmartAccountSigner,
|
|
74
|
+
TTransport extends Transport = Transport
|
|
75
|
+
> = Omit<
|
|
76
|
+
ToSmartContractAccountParams<"ModularAccountV2", TTransport, Chain, "0.7.0">,
|
|
77
|
+
// Implements the following methods required by `toSmartContractAccount`, and passes through any other parameters.
|
|
78
|
+
| "encodeExecute"
|
|
79
|
+
| "encodeBatchExecute"
|
|
80
|
+
| "getNonce"
|
|
81
|
+
| "signMessage"
|
|
82
|
+
| "signTypedData"
|
|
83
|
+
| "getDummySignature"
|
|
86
84
|
> & {
|
|
87
85
|
signer: TSigner;
|
|
88
|
-
salt?: bigint;
|
|
89
|
-
factoryAddress?: Address;
|
|
90
|
-
initCode?: Hex;
|
|
91
|
-
initialOwner?: Address;
|
|
92
|
-
entryPoint?: EntryPointDef<"0.7.0", Chain>;
|
|
93
86
|
signerEntity?: SignerEntity;
|
|
87
|
+
accountAddress: Address;
|
|
94
88
|
};
|
|
95
89
|
|
|
96
|
-
export
|
|
97
|
-
TTransport extends Transport = Transport,
|
|
90
|
+
export type CreateMAV2BaseReturnType<
|
|
98
91
|
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
99
|
-
>
|
|
100
|
-
config: CreateSMAV2AccountParams<TTransport, TSigner>
|
|
101
|
-
): Promise<MAV2Account<TSigner>>;
|
|
92
|
+
> = Promise<ModularAccountV2<TSigner>>;
|
|
102
93
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
* @param {CreateSMAV2AccountParams} config Configuration parameters for creating an SMAV2 account. Includes chain details, signer, salt, factory address, and more.
|
|
108
|
-
* @returns {Promise<MAV2Account>} A promise that resolves to an `MAV2Account` providing methods for nonce retrieval, transaction execution, and more.
|
|
109
|
-
*/
|
|
110
|
-
export async function createSMAV2Account(
|
|
111
|
-
config: CreateSMAV2AccountParams
|
|
112
|
-
): Promise<MAV2Account> {
|
|
94
|
+
export async function createMAv2Base<
|
|
95
|
+
TSigner extends SmartAccountSigner = SmartAccountSigner
|
|
96
|
+
>(config: CreateMAV2BaseParams<TSigner>): CreateMAV2BaseReturnType<TSigner> {
|
|
113
97
|
const {
|
|
114
98
|
transport,
|
|
115
99
|
chain,
|
|
116
100
|
signer,
|
|
117
|
-
salt = 0n,
|
|
118
|
-
factoryAddress = getDefaultMAV2FactoryAddress(chain),
|
|
119
|
-
initCode,
|
|
120
|
-
initialOwner,
|
|
121
|
-
accountAddress,
|
|
122
101
|
entryPoint = getEntryPoint(chain, { version: "0.7.0" }),
|
|
123
102
|
signerEntity = {
|
|
124
103
|
isGlobalValidation: true,
|
|
@@ -128,6 +107,8 @@ export async function createSMAV2Account(
|
|
|
128
107
|
isGlobalValidation = true,
|
|
129
108
|
entityId = DEFAULT_OWNER_ENTITY_ID,
|
|
130
109
|
} = {},
|
|
110
|
+
accountAddress,
|
|
111
|
+
...remainingToSmartContractAccountParams
|
|
131
112
|
} = config;
|
|
132
113
|
|
|
133
114
|
if (entityId > Number(maxUint32)) {
|
|
@@ -139,24 +120,6 @@ export async function createSMAV2Account(
|
|
|
139
120
|
chain,
|
|
140
121
|
});
|
|
141
122
|
|
|
142
|
-
const getAccountInitCode = async () => {
|
|
143
|
-
if (initCode) {
|
|
144
|
-
return initCode;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// If an initial owner is not provided, use the signer's address
|
|
148
|
-
const ownerAddress = initialOwner ?? (await signer.getAddress());
|
|
149
|
-
|
|
150
|
-
return concatHex([
|
|
151
|
-
factoryAddress,
|
|
152
|
-
encodeFunctionData({
|
|
153
|
-
abi: accountFactoryAbi,
|
|
154
|
-
functionName: "createSemiModularAccount",
|
|
155
|
-
args: [ownerAddress, salt],
|
|
156
|
-
}),
|
|
157
|
-
]);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
123
|
const encodeExecute: (tx: AccountOp) => Promise<Hex> = async ({
|
|
161
124
|
target,
|
|
162
125
|
data,
|
|
@@ -185,29 +148,10 @@ export async function createSMAV2Account(
|
|
|
185
148
|
})
|
|
186
149
|
);
|
|
187
150
|
|
|
188
|
-
const
|
|
189
|
-
client
|
|
190
|
-
entryPoint,
|
|
191
|
-
accountAddress,
|
|
192
|
-
getAccountInitCode,
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const baseAccount = await toSmartContractAccount({
|
|
196
|
-
transport,
|
|
197
|
-
chain,
|
|
198
|
-
entryPoint,
|
|
199
|
-
accountAddress: _accountAddress,
|
|
200
|
-
source: `MAV2Account`,
|
|
201
|
-
encodeExecute,
|
|
202
|
-
encodeBatchExecute,
|
|
203
|
-
getAccountInitCode,
|
|
204
|
-
...(entityId === DEFAULT_OWNER_ENTITY_ID
|
|
205
|
-
? nativeSMASigner(signer, chain, _accountAddress)
|
|
206
|
-
: singleSignerMessageSigner(signer, chain, _accountAddress, entityId)),
|
|
207
|
-
});
|
|
208
|
-
|
|
151
|
+
const isAccountDeployed: () => Promise<boolean> = async () =>
|
|
152
|
+
!!(await client.getCode({ address: accountAddress }));
|
|
209
153
|
// TODO: add deferred action flag
|
|
210
|
-
const
|
|
154
|
+
const getNonce = async (nonceKey: bigint = 0n): Promise<bigint> => {
|
|
211
155
|
if (nonceKey > maxUint152) {
|
|
212
156
|
throw new InvalidNonceKeyError(nonceKey);
|
|
213
157
|
}
|
|
@@ -220,23 +164,23 @@ export async function createSMAV2Account(
|
|
|
220
164
|
|
|
221
165
|
const fullNonceKey: bigint =
|
|
222
166
|
(nonceKey << 40n) +
|
|
223
|
-
BigInt(entityId <<
|
|
167
|
+
(BigInt(entityId) << 8n) +
|
|
224
168
|
(isGlobalValidation ? 1n : 0n);
|
|
225
169
|
|
|
226
170
|
return entryPointContract.read.getNonce([
|
|
227
|
-
|
|
171
|
+
accountAddress,
|
|
228
172
|
fullNonceKey,
|
|
229
173
|
]) as Promise<bigint>;
|
|
230
174
|
};
|
|
231
175
|
|
|
232
176
|
const accountContract = getContract({
|
|
233
|
-
address:
|
|
177
|
+
address: accountAddress,
|
|
234
178
|
abi: modularAccountAbi,
|
|
235
179
|
client,
|
|
236
180
|
});
|
|
237
181
|
|
|
238
182
|
const getExecutionData = async (selector: Hex) => {
|
|
239
|
-
if (!(await
|
|
183
|
+
if (!(await isAccountDeployed())) {
|
|
240
184
|
return {
|
|
241
185
|
module: zeroAddress,
|
|
242
186
|
skipRuntimeValidation: false,
|
|
@@ -249,7 +193,7 @@ export async function createSMAV2Account(
|
|
|
249
193
|
};
|
|
250
194
|
|
|
251
195
|
const getValidationData = async (args: ValidationDataParams) => {
|
|
252
|
-
if (!(await
|
|
196
|
+
if (!(await isAccountDeployed())) {
|
|
253
197
|
return {
|
|
254
198
|
validationHooks: [],
|
|
255
199
|
executionHooks: [],
|
|
@@ -277,9 +221,22 @@ export async function createSMAV2Account(
|
|
|
277
221
|
: callData;
|
|
278
222
|
};
|
|
279
223
|
|
|
224
|
+
const baseAccount = await toSmartContractAccount({
|
|
225
|
+
...remainingToSmartContractAccountParams,
|
|
226
|
+
transport,
|
|
227
|
+
chain,
|
|
228
|
+
entryPoint,
|
|
229
|
+
accountAddress,
|
|
230
|
+
encodeExecute,
|
|
231
|
+
encodeBatchExecute,
|
|
232
|
+
getNonce,
|
|
233
|
+
...(entityId === DEFAULT_OWNER_ENTITY_ID
|
|
234
|
+
? nativeSMASigner(signer, chain, accountAddress)
|
|
235
|
+
: singleSignerMessageSigner(signer, chain, accountAddress, entityId)),
|
|
236
|
+
});
|
|
237
|
+
|
|
280
238
|
return {
|
|
281
239
|
...baseAccount,
|
|
282
|
-
getAccountNonce,
|
|
283
240
|
getSigner: () => signer,
|
|
284
241
|
signerEntity,
|
|
285
242
|
getExecutionData,
|