@account-kit/smart-contracts 4.25.1 → 4.27.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.
Files changed (29) hide show
  1. package/dist/esm/src/ma-v2/account/common/modularAccountV2Base.js +29 -17
  2. package/dist/esm/src/ma-v2/account/common/modularAccountV2Base.js.map +1 -1
  3. package/dist/esm/src/ma-v2/account/nativeSMASigner.js +6 -2
  4. package/dist/esm/src/ma-v2/account/nativeSMASigner.js.map +1 -1
  5. package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js +6 -2
  6. package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js.map +1 -1
  7. package/dist/esm/src/ma-v2/permissionBuilder.js +8 -1
  8. package/dist/esm/src/ma-v2/permissionBuilder.js.map +1 -1
  9. package/dist/esm/src/ma-v2/permissionBuilderErrors.d.ts +22 -11
  10. package/dist/esm/src/ma-v2/permissionBuilderErrors.js +29 -11
  11. package/dist/esm/src/ma-v2/permissionBuilderErrors.js.map +1 -1
  12. package/dist/esm/src/ma-v2/utils.d.ts +2 -0
  13. package/dist/esm/src/ma-v2/utils.js +4 -1
  14. package/dist/esm/src/ma-v2/utils.js.map +1 -1
  15. package/dist/types/src/ma-v2/account/common/modularAccountV2Base.d.ts.map +1 -1
  16. package/dist/types/src/ma-v2/account/nativeSMASigner.d.ts.map +1 -1
  17. package/dist/types/src/ma-v2/modules/single-signer-validation/signer.d.ts.map +1 -1
  18. package/dist/types/src/ma-v2/permissionBuilder.d.ts.map +1 -1
  19. package/dist/types/src/ma-v2/permissionBuilderErrors.d.ts +22 -11
  20. package/dist/types/src/ma-v2/permissionBuilderErrors.d.ts.map +1 -1
  21. package/dist/types/src/ma-v2/utils.d.ts +2 -0
  22. package/dist/types/src/ma-v2/utils.d.ts.map +1 -1
  23. package/package.json +5 -5
  24. package/src/ma-v2/account/common/modularAccountV2Base.ts +29 -18
  25. package/src/ma-v2/account/nativeSMASigner.ts +7 -2
  26. package/src/ma-v2/modules/single-signer-validation/signer.ts +7 -2
  27. package/src/ma-v2/permissionBuilder.ts +9 -0
  28. package/src/ma-v2/permissionBuilderErrors.ts +26 -11
  29. package/src/ma-v2/utils.ts +8 -1
@@ -1,5 +1,7 @@
1
1
  import { BaseError } from "@aa-sdk/core";
2
- export class RootPermissionOnlyError extends BaseError {
2
+ export class PermissionBuilderError extends BaseError {
3
+ }
4
+ export class RootPermissionOnlyError extends PermissionBuilderError {
3
5
  /**
4
6
  * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
5
7
  *
@@ -15,7 +17,7 @@ export class RootPermissionOnlyError extends BaseError {
15
17
  });
16
18
  }
17
19
  }
18
- export class AccountAddressAsTargetError extends BaseError {
20
+ export class AccountAddressAsTargetError extends PermissionBuilderError {
19
21
  /**
20
22
  * Constructor for initializing an error message indicating that account address is used as target.
21
23
  *
@@ -31,7 +33,7 @@ export class AccountAddressAsTargetError extends BaseError {
31
33
  });
32
34
  }
33
35
  }
34
- export class DuplicateTargetAddressError extends BaseError {
36
+ export class DuplicateTargetAddressError extends PermissionBuilderError {
35
37
  /**
36
38
  * Constructor for initializing an error message indicating duplicate target address in permissions.
37
39
  *
@@ -48,7 +50,7 @@ export class DuplicateTargetAddressError extends BaseError {
48
50
  });
49
51
  }
50
52
  }
51
- export class NoFunctionsProvidedError extends BaseError {
53
+ export class NoFunctionsProvidedError extends PermissionBuilderError {
52
54
  /**
53
55
  * Constructor for initializing an error message indicating no functions were provided.
54
56
  *
@@ -64,7 +66,7 @@ export class NoFunctionsProvidedError extends BaseError {
64
66
  });
65
67
  }
66
68
  }
67
- export class ExpiredDeadlineError extends BaseError {
69
+ export class ExpiredDeadlineError extends PermissionBuilderError {
68
70
  /**
69
71
  * Constructor for initializing an error message indicating the deadline has expired.
70
72
  *
@@ -81,7 +83,7 @@ export class ExpiredDeadlineError extends BaseError {
81
83
  });
82
84
  }
83
85
  }
84
- export class DeadlineOverLimitError extends BaseError {
86
+ export class DeadlineOverLimitError extends PermissionBuilderError {
85
87
  /**
86
88
  * Constructor for initializing an error message indicating the deadline has expired.
87
89
  *
@@ -97,7 +99,7 @@ export class DeadlineOverLimitError extends BaseError {
97
99
  });
98
100
  }
99
101
  }
100
- export class ValidationConfigUnsetError extends BaseError {
102
+ export class ValidationConfigUnsetError extends PermissionBuilderError {
101
103
  /**
102
104
  * Constructor for initializing an error message indicating the validation config is unset.
103
105
  */
@@ -111,7 +113,7 @@ export class ValidationConfigUnsetError extends BaseError {
111
113
  });
112
114
  }
113
115
  }
114
- export class MultipleNativeTokenTransferError extends BaseError {
116
+ export class MultipleNativeTokenTransferError extends PermissionBuilderError {
115
117
  /**
116
118
  * Constructor for initializing an error message indicating multiple native token transfer permissions.
117
119
  *
@@ -127,7 +129,7 @@ export class MultipleNativeTokenTransferError extends BaseError {
127
129
  });
128
130
  }
129
131
  }
130
- export class ZeroAddressError extends BaseError {
132
+ export class ZeroAddressError extends PermissionBuilderError {
131
133
  /**
132
134
  * Constructor for initializing an error message indicating zero address was provided.
133
135
  *
@@ -143,7 +145,7 @@ export class ZeroAddressError extends BaseError {
143
145
  });
144
146
  }
145
147
  }
146
- export class MultipleGasLimitError extends BaseError {
148
+ export class MultipleGasLimitError extends PermissionBuilderError {
147
149
  /**
148
150
  * Constructor for initializing an error message indicating multiple gas limit permissions.
149
151
  *
@@ -159,7 +161,7 @@ export class MultipleGasLimitError extends BaseError {
159
161
  });
160
162
  }
161
163
  }
162
- export class UnsupportedPermissionTypeError extends BaseError {
164
+ export class UnsupportedPermissionTypeError extends PermissionBuilderError {
163
165
  /**
164
166
  * Constructor for initializing an error message indicating an unsupported permission type.
165
167
  */
@@ -173,4 +175,20 @@ export class UnsupportedPermissionTypeError extends BaseError {
173
175
  });
174
176
  }
175
177
  }
178
+ export class SelectorNotAllowed extends PermissionBuilderError {
179
+ /**
180
+ * Constructor for initializing an error message indicating that the selector being added is not allowed.
181
+ *
182
+ * @param {string} functionName The function name of the selector that is being added.
183
+ */
184
+ constructor(functionName) {
185
+ super(`Cannot add ${functionName} on the account`);
186
+ Object.defineProperty(this, "name", {
187
+ enumerable: true,
188
+ configurable: true,
189
+ writable: true,
190
+ value: "SelectorNotAllowed"
191
+ });
192
+ }
193
+ }
176
194
  //# sourceMappingURL=permissionBuilderErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissionBuilderErrors.js","sourceRoot":"","sources":["../../../../src/ma-v2/permissionBuilderErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAGvD,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAGpD;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,UAAU,UAAU,+CAA+C,CAAC,CAAC;QARpE;;;;mBAAO,4CAA4C;WAAC;IAS7D,CAAC;CACF;AAED,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CACH,GAAG,UAAU,CAAC,IAAI,wEAAwE,CAC3F,CAAC;QAVK;;;;mBAAO,gDAAgD;WAAC;IAWjE,CAAC;CACF;AAED,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;;;;OAKG;IACH,YAAY,UAAsB,EAAE,aAAsB;QACxD,KAAK,CACH,GAAG,UAAU,CAAC,IAAI,aAAa,aAAa,kIAAkI,CAC/K,CAAC;QAXK;;;;mBAAO,gDAAgD;WAAC;IAYjE,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IAGrD;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,yBAAyB,CAAC,CAAC;QAR5C;;;;mBAAO,6CAA6C;WAAC;IAS9D,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,WAAmB;QAC/C,KAAK,CACH,+BAA+B,QAAQ,0BAA0B,WAAW,GAAG,CAChF,CAAC;QAXK;;;;mBAAO,yCAAyC;WAAC;IAY1D,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGnD;;;;OAIG;IACH,YAAY,QAAgB;QAC1B,KAAK,CACH,+BAA+B,QAAQ,oCAAoC,CAC5E,CAAC;QAVK;;;;mBAAO,2CAA2C;WAAC;IAW5D,CAAC;CACF;AAED,MAAM,OAAO,0BAA2B,SAAQ,SAAS;IAGvD;;OAEG;IACH;QACE,KAAK,CAAC,+DAA+D,CAAC,CAAC;QANhE;;;;mBAAO,+CAA+C;WAAC;IAOhE,CAAC;CACF;AAED,MAAM,OAAO,gCAAiC,SAAQ,SAAS;IAG7D;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CACH,GAAG,UAAU,CAAC,IAAI,0DAA0D,CAC7E,CAAC;QAVK;;;;mBAAO,qDAAqD;WAAC;IAWtE,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAG7C;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,yBAAyB,CAAC,CAAC;QAR5C;;;;mBAAO,qCAAqC;WAAC;IAStD,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAGlD;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,8CAA8C,CAAC,CAAC;QARjE;;;;mBAAO,0CAA0C;WAAC;IAS3D,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,SAAS;IAG3D;;OAEG;IACH;QACE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAN9B;;;;mBAAO,mDAAmD;WAAC;IAOpE,CAAC;CACF","sourcesContent":["import { BaseError, type Address } from \"@aa-sdk/core\";\nimport type { Permission } from \"./permissionBuilder\";\n\nexport class RootPermissionOnlyError extends BaseError {\n override name = \"PermissionBuilder: RootPermissionOnlyError\";\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n *\n * @param {Permission} permission The permission trying to be added atop the root permission\n */\n constructor(permission: Permission) {\n super(`Adding ${permission}: Cannot add permissions with ROOT permission`);\n }\n}\n\nexport class AccountAddressAsTargetError extends BaseError {\n override name = \"PermissionBuilder: AccountAddressAsTargetError\";\n\n /**\n * Constructor for initializing an error message indicating that account address is used as target.\n *\n * @param {Permission} permission The permission with account address as target\n */\n constructor(permission: Permission) {\n super(\n `${permission.type}: Account address as target, use ACCOUNT_FUNCTIONS for account address`\n );\n }\n}\n\nexport class DuplicateTargetAddressError extends BaseError {\n override name = \"PermissionBuilder: DuplicateTargetAddressError\";\n\n /**\n * Constructor for initializing an error message indicating duplicate target address in permissions.\n *\n * @param {Permission} permission The permission with duplicate target address\n * @param {Address} targetAddress The duplicate target address\n */\n constructor(permission: Permission, targetAddress: Address) {\n super(\n `${permission.type}: Address ${targetAddress} already has a permission. Cannot add multiple CONTRACT_ACCESS or FUNCTIONS_ON_CONTRACT permissions for the same target address.`\n );\n }\n}\n\nexport class NoFunctionsProvidedError extends BaseError {\n override name = \"PermissionBuilder: NoFunctionsProvidedError\";\n\n /**\n * Constructor for initializing an error message indicating no functions were provided.\n *\n * @param {Permission} permission The permission missing functions\n */\n constructor(permission: Permission) {\n super(`${permission.type}: No functions provided`);\n }\n}\n\nexport class ExpiredDeadlineError extends BaseError {\n override name = \"PermissionBuilder: ExpiredDeadlineError\";\n\n /**\n * Constructor for initializing an error message indicating the deadline has expired.\n *\n * @param {number} deadline The expired deadline timestamp\n * @param {number} currentTime The current timestamp\n */\n constructor(deadline: number, currentTime: number) {\n super(\n `compileDeferred(): deadline ${deadline} cannot be before now (${currentTime})`\n );\n }\n}\n\nexport class DeadlineOverLimitError extends BaseError {\n override name = \"PermissionBuilder: DeadlineOverLimitError\";\n\n /**\n * Constructor for initializing an error message indicating the deadline has expired.\n *\n * @param {number} deadline The expired deadline timestamp\n */\n constructor(deadline: number) {\n super(\n `compileDeferred(): deadline ${deadline} cannot be > max uint48 (2^48 - 1)`\n );\n }\n}\n\nexport class ValidationConfigUnsetError extends BaseError {\n override name = \"PermissionBuilder: ValidationConfigUnsetError\";\n\n /**\n * Constructor for initializing an error message indicating the validation config is unset.\n */\n constructor() {\n super(\"Validation config unset, use permissionBuilder.configure(...)\");\n }\n}\n\nexport class MultipleNativeTokenTransferError extends BaseError {\n override name = \"PermissionBuilder: MultipleNativeTokenTransferError\";\n\n /**\n * Constructor for initializing an error message indicating multiple native token transfer permissions.\n *\n * @param {Permission} permission The duplicate native token transfer permission\n */\n constructor(permission: Permission) {\n super(\n `${permission.type}: Must have at most ONE native token transfer permission`\n );\n }\n}\n\nexport class ZeroAddressError extends BaseError {\n override name = \"PermissionBuilder: ZeroAddressError\";\n\n /**\n * Constructor for initializing an error message indicating zero address was provided.\n *\n * @param {Permission} permission The permission with zero address\n */\n constructor(permission: Permission) {\n super(`${permission.type}: Zero address provided`);\n }\n}\n\nexport class MultipleGasLimitError extends BaseError {\n override name = \"PermissionBuilder: MultipleGasLimitError\";\n\n /**\n * Constructor for initializing an error message indicating multiple gas limit permissions.\n *\n * @param {Permission} permission The duplicate gas limit permission\n */\n constructor(permission: Permission) {\n super(`${permission.type}: Must have at most ONE gas limit permission`);\n }\n}\n\nexport class UnsupportedPermissionTypeError extends BaseError {\n override name = \"PermissionBuilder: UnsupportedPermissionTypeError\";\n\n /**\n * Constructor for initializing an error message indicating an unsupported permission type.\n */\n constructor() {\n super(`Unsupported permission type`);\n }\n}\n"]}
1
+ {"version":3,"file":"permissionBuilderErrors.js","sourceRoot":"","sources":["../../../../src/ma-v2/permissionBuilderErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAGvD,MAAM,OAAgB,sBAAuB,SAAQ,SAAS;CAAG;AAEjE,MAAM,OAAO,uBAAwB,SAAQ,sBAAsB;IAGjE;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAA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,SAAQ,sBAAsB;IAG1E;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CACH,GAAG,UAAU,CAAC,IAAI,0DAA0D,CAC7E,CAAC;QAVK;;;;mBAAO,qDAAqD;WAAC;IAWtE,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,sBAAsB;IAG1D;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,yBAAyB,CAAC,CAAC;QAR5C;;;;mBAAO,qCAAqC;WAAC;IAStD,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAG/D;;;;OAIG;IACH,YAAY,UAAsB;QAChC,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,8CAA8C,CAAC,CAAC;QARjE;;;;mBAAO,0CAA0C;WAAC;IAS3D,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IAGxE;;OAEG;IACH;QACE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAN9B;;;;mBAAO,mDAAmD;WAAC;IAOpE,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAG5D;;;;OAIG;IACH,YAAY,YAAoB;QAC9B,KAAK,CAAC,cAAc,YAAY,iBAAiB,CAAC,CAAC;QAR5C;;;;mBAAO,oBAAoB;WAAC;IASrC,CAAC;CACF","sourcesContent":["import { BaseError, type Address } from \"@aa-sdk/core\";\nimport type { Permission } from \"./permissionBuilder\";\n\nexport abstract class PermissionBuilderError extends BaseError {}\n\nexport class RootPermissionOnlyError extends PermissionBuilderError {\n override name = \"PermissionBuilder: RootPermissionOnlyError\";\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n *\n * @param {Permission} permission The permission trying to be added atop the root permission\n */\n constructor(permission: Permission) {\n super(`Adding ${permission}: Cannot add permissions with ROOT permission`);\n }\n}\n\nexport class AccountAddressAsTargetError extends PermissionBuilderError {\n override name = \"PermissionBuilder: AccountAddressAsTargetError\";\n\n /**\n * Constructor for initializing an error message indicating that account address is used as target.\n *\n * @param {Permission} permission The permission with account address as target\n */\n constructor(permission: Permission) {\n super(\n `${permission.type}: Account address as target, use ACCOUNT_FUNCTIONS for account address`\n );\n }\n}\n\nexport class DuplicateTargetAddressError extends PermissionBuilderError {\n override name = \"PermissionBuilder: DuplicateTargetAddressError\";\n\n /**\n * Constructor for initializing an error message indicating duplicate target address in permissions.\n *\n * @param {Permission} permission The permission with duplicate target address\n * @param {Address} targetAddress The duplicate target address\n */\n constructor(permission: Permission, targetAddress: Address) {\n super(\n `${permission.type}: Address ${targetAddress} already has a permission. Cannot add multiple CONTRACT_ACCESS or FUNCTIONS_ON_CONTRACT permissions for the same target address.`\n );\n }\n}\n\nexport class NoFunctionsProvidedError extends PermissionBuilderError {\n override name = \"PermissionBuilder: NoFunctionsProvidedError\";\n\n /**\n * Constructor for initializing an error message indicating no functions were provided.\n *\n * @param {Permission} permission The permission missing functions\n */\n constructor(permission: Permission) {\n super(`${permission.type}: No functions provided`);\n }\n}\n\nexport class ExpiredDeadlineError extends PermissionBuilderError {\n override name = \"PermissionBuilder: ExpiredDeadlineError\";\n\n /**\n * Constructor for initializing an error message indicating the deadline has expired.\n *\n * @param {number} deadline The expired deadline timestamp\n * @param {number} currentTime The current timestamp\n */\n constructor(deadline: number, currentTime: number) {\n super(\n `compileDeferred(): deadline ${deadline} cannot be before now (${currentTime})`\n );\n }\n}\n\nexport class DeadlineOverLimitError extends PermissionBuilderError {\n override name = \"PermissionBuilder: DeadlineOverLimitError\";\n\n /**\n * Constructor for initializing an error message indicating the deadline has expired.\n *\n * @param {number} deadline The expired deadline timestamp\n */\n constructor(deadline: number) {\n super(\n `compileDeferred(): deadline ${deadline} cannot be > max uint48 (2^48 - 1)`\n );\n }\n}\n\nexport class ValidationConfigUnsetError extends PermissionBuilderError {\n override name = \"PermissionBuilder: ValidationConfigUnsetError\";\n\n /**\n * Constructor for initializing an error message indicating the validation config is unset.\n */\n constructor() {\n super(\"Validation config unset, use permissionBuilder.configure(...)\");\n }\n}\n\nexport class MultipleNativeTokenTransferError extends PermissionBuilderError {\n override name = \"PermissionBuilder: MultipleNativeTokenTransferError\";\n\n /**\n * Constructor for initializing an error message indicating multiple native token transfer permissions.\n *\n * @param {Permission} permission The duplicate native token transfer permission\n */\n constructor(permission: Permission) {\n super(\n `${permission.type}: Must have at most ONE native token transfer permission`\n );\n }\n}\n\nexport class ZeroAddressError extends PermissionBuilderError {\n override name = \"PermissionBuilder: ZeroAddressError\";\n\n /**\n * Constructor for initializing an error message indicating zero address was provided.\n *\n * @param {Permission} permission The permission with zero address\n */\n constructor(permission: Permission) {\n super(`${permission.type}: Zero address provided`);\n }\n}\n\nexport class MultipleGasLimitError extends PermissionBuilderError {\n override name = \"PermissionBuilder: MultipleGasLimitError\";\n\n /**\n * Constructor for initializing an error message indicating multiple gas limit permissions.\n *\n * @param {Permission} permission The duplicate gas limit permission\n */\n constructor(permission: Permission) {\n super(`${permission.type}: Must have at most ONE gas limit permission`);\n }\n}\n\nexport class UnsupportedPermissionTypeError extends PermissionBuilderError {\n override name = \"PermissionBuilder: UnsupportedPermissionTypeError\";\n\n /**\n * Constructor for initializing an error message indicating an unsupported permission type.\n */\n constructor() {\n super(`Unsupported permission type`);\n }\n}\n\nexport class SelectorNotAllowed extends PermissionBuilderError {\n override name = \"SelectorNotAllowed\";\n\n /**\n * Constructor for initializing an error message indicating that the selector being added is not allowed.\n *\n * @param {string} functionName The function name of the selector that is being added.\n */\n constructor(functionName: string) {\n super(`Cannot add ${functionName} on the account`);\n }\n}\n"]}
@@ -83,6 +83,8 @@ export type BuildNonceParams = {
83
83
  };
84
84
  export declare const buildFullNonceKey: ({ nonceKey, entityId, isGlobalValidation, isDeferredAction, }: BuildNonceParams) => bigint;
85
85
  export declare const parseDeferredAction: (deferredAction: Hex) => {
86
+ entityId: number;
87
+ isGlobalValidation: boolean;
86
88
  nonce: bigint;
87
89
  deferredActionData: Hex;
88
90
  hasAssociatedExecHooks: boolean;
@@ -1,4 +1,4 @@
1
- import { concat, toHex, custom, encodeFunctionData, parseAbi, size, concatHex, } from "viem";
1
+ import { concat, toHex, custom, encodeFunctionData, parseAbi, size, concatHex, hexToNumber, } from "viem";
2
2
  import { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia, } from "@account-kit/infra";
3
3
  import { createModularAccountV2 } from "./account/modularAccountV2.js";
4
4
  import {} from "./account/common/modularAccountV2Base.js";
@@ -163,7 +163,10 @@ export const buildFullNonceKey = ({ nonceKey = 0n, entityId = 0, isGlobalValidat
163
163
  };
164
164
  // Parses out the 3 components from a deferred action
165
165
  export const parseDeferredAction = (deferredAction) => {
166
+ // 2 for 0x, 2 for 00/01, 38 for parallel nonce, 8 for entity id, 2 for options byte, 16 for parallel nonce
166
167
  return {
168
+ entityId: hexToNumber(`0x${deferredAction.slice(42, 50)}`),
169
+ isGlobalValidation: hexToNumber(`0x${deferredAction.slice(50, 52)}`) % 2 === 1,
167
170
  nonce: BigInt(`0x${deferredAction.slice(4, 68)}`),
168
171
  deferredActionData: `0x${deferredAction.slice(68)}`,
169
172
  hasAssociatedExecHooks: deferredAction[3] === "1",
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,kBAAkB,EAKlB,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,MAAM,MAAM,CAAC;AACd,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,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C,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/B,CAAC;AACJ,CAAC,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,cAAmB,EAKnB,EAAE;IACF,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QACjD,kBAAkB,EAAE,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;QACnD,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG;KAClD,CAAC;AACJ,CAAC,CAAC;AAMF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,oCAAoC,EACpC,GAAG,GAC6B,EAAO,EAAE;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5B,MAAM,WAAW,GAAG,SAAS,CAAC;QAC5B,oCAAoC;QACpC,KAAK,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7B,GAAG;KACJ,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n concat,\n toHex,\n custom,\n encodeFunctionData,\n type Hex,\n type Chain,\n type Address,\n type Transport,\n parseAbi,\n size,\n concatHex,\n} from \"viem\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n} from \"@account-kit/infra\";\nimport { createModularAccountV2 } from \"./account/modularAccountV2.js\";\nimport { type ModularAccountV2 } from \"./account/common/modularAccountV2Base.js\";\nimport { semiModularAccountStorageAbi } from \"./abis/semiModularAccountStorageAbi.js\";\nimport {\n AccountNotFoundError,\n ChainNotFoundError,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\n\nexport const DEFAULT_OWNER_ENTITY_ID = 0;\n\nexport type PackUOSignatureParams = {\n // orderedHookData: HookData[];\n validationSignature: Hex;\n};\n\n// TODO: direct call validation 1271\nexport type Pack1271SignatureParams = {\n validationSignature: Hex;\n entityId: number;\n};\n\n// Signature packing utility for user operations\nexport const packUOSignature = ({\n // orderedHookData, TODO: integrate in next iteration of MAv2 sdk\n validationSignature,\n}: PackUOSignatureParams): Hex => {\n return concat([\"0xFF\", \"0x00\", validationSignature]);\n};\n\n// Signature packing utility for 1271 signatures\nexport const pack1271Signature = ({\n validationSignature,\n entityId,\n}: Pack1271SignatureParams): Hex => {\n return concat([\n \"0x00\",\n toHex(entityId, { size: 4 }),\n \"0xFF\",\n \"0x00\", // EOA type signature\n validationSignature,\n ]);\n};\n\nexport const getDefaultMAV2FactoryAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x00000000000017c61b5bEe81050EC8eFc9c6fecd\";\n }\n};\n\nexport const getDefaultSMAV2BytecodeAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000c5A9089039570Dd36455b5C07383\";\n }\n};\n\nexport const getDefaultSMAV2StorageAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x0000000000006E2f9d80CaEc0Da6500f005EB25A\";\n }\n};\n\nexport const getDefaultSMAV27702Address = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x69007702764179f14F51cdce752f4f775d74E139\";\n }\n};\n\nexport const getDefaultMAV2Address = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x00000000000002377B26b1EdA7b0BC371C60DD4f\";\n }\n};\n\nexport type GetMAV2UpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Modular Account V2 (MA v2).\n * Note that the upgrade will be to the Semi Modular Account Storage variant\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMAV2UpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient({});\n * const upgradeData = await getMAV2UpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMAV2UpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createModularAccountV2FromExisting: () => Promise<ModularAccountV2<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Modular Account V2\n */\nexport async function getMAV2UpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMAV2UpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createModularAccountV2FromExisting: () => Promise<\n ModularAccountV2<TSigner>\n >;\n }\n> {\n const { account: account_ = client.account } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = encodeFunctionData({\n abi: semiModularAccountStorageAbi,\n functionName: \"initialize\",\n args: [await account.getSigner().getAddress()],\n });\n\n return {\n implAddress: getDefaultSMAV2StorageAddress(chain),\n initializationData: initData,\n createModularAccountV2FromExisting: async () =>\n createModularAccountV2({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport const entityIdAndNonceReaderBytecode =\n \"0x608060405234801561001057600080fd5b506040516104f13803806104f183398101604081905261002f916101e5565b60006008826001600160c01b0316901c90506000808263ffffffff1611610057576001610059565b815b90506001600160a01b0385163b15610133575b60006001600160a01b03861663d31b575b6bffffffff0000000000000000604085901b166040516001600160e01b031960e084901b1681526001600160401b03199091166004820152602401600060405180830381865afa1580156100d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526100fd91908101906103c6565b805190915060ff161580156101155750606081015151155b156101205750610133565b8161012a816104a4565b9250505061006c565b604051631aab3f0d60e11b81526001600160a01b03868116600483015264ffffffff01600160c01b038516600884901b64ffffffff0016176024830152600091908616906335567e1a90604401602060405180830381865afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c191906104d7565b90508060005260206000f35b6001600160a01b03811681146101e257600080fd5b50565b6000806000606084860312156101fa57600080fd5b8351610205816101cd565b6020850151909350610216816101cd565b60408501519092506001600160c01b038116811461023357600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156102765761027661023e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156102a4576102a461023e565b604052919050565b60006001600160401b038211156102c5576102c561023e565b5060051b60200190565b600082601f8301126102e057600080fd5b81516102f36102ee826102ac565b61027c565b8082825260208201915060208360051b86010192508583111561031557600080fd5b602085015b8381101561034857805166ffffffffffffff198116811461033a57600080fd5b83526020928301920161031a565b5095945050505050565b600082601f83011261036357600080fd5b81516103716102ee826102ac565b8082825260208201915060208360051b86010192508583111561039357600080fd5b602085015b838110156103485780516001600160e01b0319811681146103b857600080fd5b835260209283019201610398565b6000602082840312156103d857600080fd5b81516001600160401b038111156103ee57600080fd5b82016080818503121561040057600080fd5b610408610254565b815160ff8116811461041957600080fd5b815260208201516001600160401b0381111561043457600080fd5b610440868285016102cf565b60208301525060408201516001600160401b0381111561045f57600080fd5b61046b868285016102cf565b60408301525060608201516001600160401b0381111561048a57600080fd5b61049686828501610352565b606083015250949350505050565b600063ffffffff821663ffffffff81036104ce57634e487b7160e01b600052601160045260246000fd5b60010192915050565b6000602082840312156104e957600080fd5b505191905056fe\";\n\nexport const mintableERC20Bytecode =\n \"0x608060405234801561000f575f80fd5b506040518060400160405280600d81526020016c26b4b73a30b13632aa37b5b2b760991b81525060405180604001604052806002815260200161135560f21b8152508160039081610060919061010d565b50600461006d828261010d565b5050506101c7565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061009d57607f821691505b6020821081036100bb57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561010857805f5260205f20601f840160051c810160208510156100e65750805b601f840160051c820191505b81811015610105575f81556001016100f2565b50505b505050565b81516001600160401b0381111561012657610126610075565b61013a816101348454610089565b846100c1565b6020601f82116001811461016c575f83156101555750848201515b5f19600385901b1c1916600184901b178455610105565b5f84815260208120601f198516915b8281101561019b578785015182556020948501946001909201910161017b565b50848210156101b857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b610737806101d45f395ff3fe608060405234801561000f575f80fd5b506004361061008c575f3560e01c806306fdde0314610090578063095ea7b3146100ae57806318160ddd146100d157806323b872dd146100e3578063313ce567146100f657806340c10f191461010557806370a082311461011a57806395d89b4114610142578063a9059cbb1461014a578063dd62ed3e1461015d575b5f80fd5b610098610170565b6040516100a59190610572565b60405180910390f35b6100c16100bc3660046105c2565b610200565b60405190151581526020016100a5565b6002545b6040519081526020016100a5565b6100c16100f13660046105ea565b610219565b604051601281526020016100a5565b6101186101133660046105c2565b61023c565b005b6100d5610128366004610624565b6001600160a01b03165f9081526020819052604090205490565b61009861024a565b6100c16101583660046105c2565b610259565b6100d561016b366004610644565b610266565b60606003805461017f90610675565b80601f01602080910402602001604051908101604052809291908181526020018280546101ab90610675565b80156101f65780601f106101cd576101008083540402835291602001916101f6565b820191905f5260205f20905b8154815290600101906020018083116101d957829003601f168201915b5050505050905090565b5f3361020d818585610290565b60019150505b92915050565b5f336102268582856102a2565b6102318585856102fc565b506001949350505050565b6102468282610359565b5050565b60606004805461017f90610675565b5f3361020d8185856102fc565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b61029d838383600161038d565b505050565b5f6102ad8484610266565b90505f198110156102f657818110156102e857828183604051637dc7a0d960e11b81526004016102df939291906106ad565b60405180910390fd5b6102f684848484035f61038d565b50505050565b6001600160a01b038316610325575f604051634b637e8f60e11b81526004016102df91906106ce565b6001600160a01b03821661034e575f60405163ec442f0560e01b81526004016102df91906106ce565b61029d83838361045f565b6001600160a01b038216610382575f60405163ec442f0560e01b81526004016102df91906106ce565b6102465f838361045f565b6001600160a01b0384166103b6575f60405163e602df0560e01b81526004016102df91906106ce565b6001600160a01b0383166103df575f604051634a1406b160e11b81526004016102df91906106ce565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156102f657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161045191815260200190565b60405180910390a350505050565b6001600160a01b038316610489578060025f82825461047e91906106e2565b909155506104e69050565b6001600160a01b0383165f90815260208190526040902054818110156104c85783818360405163391434e360e21b81526004016102df939291906106ad565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661050257600280548290039055610520565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161056591815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146105bd575f80fd5b919050565b5f80604083850312156105d3575f80fd5b6105dc836105a7565b946020939093013593505050565b5f805f606084860312156105fc575f80fd5b610605846105a7565b9250610613602085016105a7565b929592945050506040919091013590565b5f60208284031215610634575f80fd5b61063d826105a7565b9392505050565b5f8060408385031215610655575f80fd5b61065e836105a7565b915061066c602084016105a7565b90509250929050565b600181811c9082168061068957607f821691505b6020821081036106a757634e487b7160e01b5f52602260045260245ffd5b50919050565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0391909116815260200190565b8082018082111561021357634e487b7160e01b5f52601160045260245ffdfea2646970667358221220f9ae46a2e15270bfb77fe3d4d0ee0e45b749e3dde93805ee2cf795cb800244e664736f6c634300081a0033\";\n\nexport const mintableERC20Abi = parseAbi([\n \"function transfer(address to, uint256 amount) external\",\n \"function mint(address to, uint256 amount) external\",\n \"function balanceOf(address target) external returns (uint256)\",\n]);\n\nexport type BuildNonceParams = {\n nonceKey?: bigint;\n entityId?: number;\n isGlobalValidation?: boolean;\n isDeferredAction?: boolean;\n isDirectCallValidation?: boolean;\n};\n\nexport const buildFullNonceKey = ({\n nonceKey = 0n,\n entityId = 0,\n isGlobalValidation = true,\n isDeferredAction = false,\n}: BuildNonceParams): bigint => {\n return (\n (nonceKey << 40n) +\n BigInt(entityId << 8) +\n (isDeferredAction ? 2n : 0n) +\n (isGlobalValidation ? 1n : 0n)\n );\n};\n\n// Parses out the 3 components from a deferred action\nexport const parseDeferredAction = (\n deferredAction: Hex\n): {\n nonce: bigint;\n deferredActionData: Hex;\n hasAssociatedExecHooks: boolean;\n} => {\n return {\n nonce: BigInt(`0x${deferredAction.slice(4, 68)}`),\n deferredActionData: `0x${deferredAction.slice(68)}`,\n hasAssociatedExecHooks: deferredAction[3] === \"1\",\n };\n};\nexport type BuildDeferredActionDigestParams = {\n fullPreSignatureDeferredActionDigest: Hex;\n sig: Hex;\n};\n\n/**\n * Creates the digest which must be prepended to the userOp signature.\n *\n * Assumption: The client this extends is used to sign the typed data.\n *\n * @param {object} args The argument object containing the following:\n * @param {Hex} args.fullPreSignatureDeferredActionDigest The The data to append the signature and length to\n * @param {Hex} args.sig The signature to include in the digest\n * @returns {Hex} The encoded digest to be prepended to the userOp signature\n */\nexport const buildDeferredActionDigest = ({\n fullPreSignatureDeferredActionDigest,\n sig,\n}: BuildDeferredActionDigestParams): Hex => {\n const sigLength = size(sig);\n\n const encodedData = concatHex([\n fullPreSignatureDeferredActionDigest,\n toHex(sigLength, { size: 4 }),\n sig,\n ]);\n return encodedData;\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,kBAAkB,EAKlB,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,WAAW,EACX,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACP,WAAW,EACX,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EACL,oBAAoB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AAC,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,cAAmB,EAOnB,EAAE;IACF,2GAA2G;IAC3G,OAAO;QACL,QAAQ,EAAE,WAAW,CAAC,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1D,kBAAkB,EAChB,WAAW,CAAC,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;QAC5D,KAAK,EAAE,MAAM,CAAC,KAAK,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QACjD,kBAAkB,EAAE,KAAK,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,EAAmB;QACpE,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG;KAClD,CAAC;AACJ,CAAC,CAAC;AAMF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,oCAAoC,EACpC,GAAG,GAC6B,EAAO,EAAE;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5B,MAAM,WAAW,GAAG,SAAS,CAAC;QAC5B,oCAAoC;QACpC,KAAK,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7B,GAAG;KACJ,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n concat,\n toHex,\n custom,\n encodeFunctionData,\n type Hex,\n type Chain,\n type Address,\n type Transport,\n parseAbi,\n size,\n concatHex,\n hexToNumber,\n} from \"viem\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n sepolia,\n} from \"@account-kit/infra\";\nimport { createModularAccountV2 } from \"./account/modularAccountV2.js\";\nimport { type ModularAccountV2 } from \"./account/common/modularAccountV2Base.js\";\nimport { semiModularAccountStorageAbi } from \"./abis/semiModularAccountStorageAbi.js\";\nimport {\n AccountNotFoundError,\n ChainNotFoundError,\n type GetAccountParameter,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartContractAccountWithSigner,\n type UpgradeToData,\n} from \"@aa-sdk/core\";\n\nexport const DEFAULT_OWNER_ENTITY_ID = 0;\n\nexport type PackUOSignatureParams = {\n // orderedHookData: HookData[];\n validationSignature: Hex;\n};\n\n// TODO: direct call validation 1271\nexport type Pack1271SignatureParams = {\n validationSignature: Hex;\n entityId: number;\n};\n\n// Signature packing utility for user operations\nexport const packUOSignature = ({\n // orderedHookData, TODO: integrate in next iteration of MAv2 sdk\n validationSignature,\n}: PackUOSignatureParams): Hex => {\n return concat([\"0xFF\", \"0x00\", validationSignature]);\n};\n\n// Signature packing utility for 1271 signatures\nexport const pack1271Signature = ({\n validationSignature,\n entityId,\n}: Pack1271SignatureParams): Hex => {\n return concat([\n \"0x00\",\n toHex(entityId, { size: 4 }),\n \"0xFF\",\n \"0x00\", // EOA type signature\n validationSignature,\n ]);\n};\n\nexport const getDefaultMAV2FactoryAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x00000000000017c61b5bEe81050EC8eFc9c6fecd\";\n }\n};\n\nexport const getDefaultSMAV2BytecodeAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x000000000000c5A9089039570Dd36455b5C07383\";\n }\n};\n\nexport const getDefaultSMAV2StorageAddress = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x0000000000006E2f9d80CaEc0Da6500f005EB25A\";\n }\n};\n\nexport const getDefaultSMAV27702Address = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x69007702764179f14F51cdce752f4f775d74E139\";\n }\n};\n\nexport const getDefaultMAV2Address = (chain: Chain): Address => {\n switch (chain.id) {\n // TODO: case mekong.id:\n case sepolia.id:\n case baseSepolia.id:\n case polygon.id:\n case mainnet.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n default:\n return \"0x00000000000002377B26b1EdA7b0BC371C60DD4f\";\n }\n};\n\nexport type GetMAV2UpgradeToData<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n> = GetAccountParameter<TAccount>;\n\n/**\n * Retrieves the data necessary to upgrade to a Modular Account V2 (MA v2).\n * Note that the upgrade will be to the Semi Modular Account Storage variant\n *\n * @example\n * ```ts\n * import { createLightAccountClient, getMAV2UpgradeToData } from \"@account-kit/smart-contracts\";\n *\n * const client = createLightAccountClient({});\n * const upgradeData = await getMAV2UpgradeToData(client, {});\n * ```\n *\n * @param {SmartAccountClient<TTransport, TChain, TAccount>} client The smart account client\n * @param {GetMAV2UpgradeToData<TSigner, TAccount>} args The arguments required for the upgrade\n * @returns {Promise<UpgradeToData & { createModularAccountV2FromExisting: () => Promise<ModularAccountV2<TSigner>>}>} A promise that resolves to upgrade data augmented with a function to create a Modular Account V2\n */\nexport async function getMAV2UpgradeToData<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends\n | SmartContractAccountWithSigner<string, TSigner>\n | undefined = SmartContractAccountWithSigner<string, TSigner> | undefined\n>(\n client: SmartAccountClient<TTransport, TChain, TAccount>,\n args: GetMAV2UpgradeToData<TSigner, TAccount>\n): Promise<\n UpgradeToData & {\n createModularAccountV2FromExisting: () => Promise<\n ModularAccountV2<TSigner>\n >;\n }\n> {\n const { account: account_ = client.account } = args;\n\n if (!account_) {\n throw new AccountNotFoundError();\n }\n const account = account_ as SmartContractAccountWithSigner<string, TSigner>;\n\n const chain = client.chain;\n if (!chain) {\n throw new ChainNotFoundError();\n }\n\n const initData = encodeFunctionData({\n abi: semiModularAccountStorageAbi,\n functionName: \"initialize\",\n args: [await account.getSigner().getAddress()],\n });\n\n return {\n implAddress: getDefaultSMAV2StorageAddress(chain),\n initializationData: initData,\n createModularAccountV2FromExisting: async () =>\n createModularAccountV2({\n transport: custom(client.transport),\n chain: chain as Chain,\n signer: account.getSigner(),\n accountAddress: account.address,\n }),\n };\n}\n\nexport const entityIdAndNonceReaderBytecode =\n \"0x608060405234801561001057600080fd5b506040516104f13803806104f183398101604081905261002f916101e5565b60006008826001600160c01b0316901c90506000808263ffffffff1611610057576001610059565b815b90506001600160a01b0385163b15610133575b60006001600160a01b03861663d31b575b6bffffffff0000000000000000604085901b166040516001600160e01b031960e084901b1681526001600160401b03199091166004820152602401600060405180830381865afa1580156100d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526100fd91908101906103c6565b805190915060ff161580156101155750606081015151155b156101205750610133565b8161012a816104a4565b9250505061006c565b604051631aab3f0d60e11b81526001600160a01b03868116600483015264ffffffff01600160c01b038516600884901b64ffffffff0016176024830152600091908616906335567e1a90604401602060405180830381865afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c191906104d7565b90508060005260206000f35b6001600160a01b03811681146101e257600080fd5b50565b6000806000606084860312156101fa57600080fd5b8351610205816101cd565b6020850151909350610216816101cd565b60408501519092506001600160c01b038116811461023357600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156102765761027661023e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156102a4576102a461023e565b604052919050565b60006001600160401b038211156102c5576102c561023e565b5060051b60200190565b600082601f8301126102e057600080fd5b81516102f36102ee826102ac565b61027c565b8082825260208201915060208360051b86010192508583111561031557600080fd5b602085015b8381101561034857805166ffffffffffffff198116811461033a57600080fd5b83526020928301920161031a565b5095945050505050565b600082601f83011261036357600080fd5b81516103716102ee826102ac565b8082825260208201915060208360051b86010192508583111561039357600080fd5b602085015b838110156103485780516001600160e01b0319811681146103b857600080fd5b835260209283019201610398565b6000602082840312156103d857600080fd5b81516001600160401b038111156103ee57600080fd5b82016080818503121561040057600080fd5b610408610254565b815160ff8116811461041957600080fd5b815260208201516001600160401b0381111561043457600080fd5b610440868285016102cf565b60208301525060408201516001600160401b0381111561045f57600080fd5b61046b868285016102cf565b60408301525060608201516001600160401b0381111561048a57600080fd5b61049686828501610352565b606083015250949350505050565b600063ffffffff821663ffffffff81036104ce57634e487b7160e01b600052601160045260246000fd5b60010192915050565b6000602082840312156104e957600080fd5b505191905056fe\";\n\nexport const mintableERC20Bytecode =\n \"0x608060405234801561000f575f80fd5b506040518060400160405280600d81526020016c26b4b73a30b13632aa37b5b2b760991b81525060405180604001604052806002815260200161135560f21b8152508160039081610060919061010d565b50600461006d828261010d565b5050506101c7565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061009d57607f821691505b6020821081036100bb57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561010857805f5260205f20601f840160051c810160208510156100e65750805b601f840160051c820191505b81811015610105575f81556001016100f2565b50505b505050565b81516001600160401b0381111561012657610126610075565b61013a816101348454610089565b846100c1565b6020601f82116001811461016c575f83156101555750848201515b5f19600385901b1c1916600184901b178455610105565b5f84815260208120601f198516915b8281101561019b578785015182556020948501946001909201910161017b565b50848210156101b857868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b610737806101d45f395ff3fe608060405234801561000f575f80fd5b506004361061008c575f3560e01c806306fdde0314610090578063095ea7b3146100ae57806318160ddd146100d157806323b872dd146100e3578063313ce567146100f657806340c10f191461010557806370a082311461011a57806395d89b4114610142578063a9059cbb1461014a578063dd62ed3e1461015d575b5f80fd5b610098610170565b6040516100a59190610572565b60405180910390f35b6100c16100bc3660046105c2565b610200565b60405190151581526020016100a5565b6002545b6040519081526020016100a5565b6100c16100f13660046105ea565b610219565b604051601281526020016100a5565b6101186101133660046105c2565b61023c565b005b6100d5610128366004610624565b6001600160a01b03165f9081526020819052604090205490565b61009861024a565b6100c16101583660046105c2565b610259565b6100d561016b366004610644565b610266565b60606003805461017f90610675565b80601f01602080910402602001604051908101604052809291908181526020018280546101ab90610675565b80156101f65780601f106101cd576101008083540402835291602001916101f6565b820191905f5260205f20905b8154815290600101906020018083116101d957829003601f168201915b5050505050905090565b5f3361020d818585610290565b60019150505b92915050565b5f336102268582856102a2565b6102318585856102fc565b506001949350505050565b6102468282610359565b5050565b60606004805461017f90610675565b5f3361020d8185856102fc565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b61029d838383600161038d565b505050565b5f6102ad8484610266565b90505f198110156102f657818110156102e857828183604051637dc7a0d960e11b81526004016102df939291906106ad565b60405180910390fd5b6102f684848484035f61038d565b50505050565b6001600160a01b038316610325575f604051634b637e8f60e11b81526004016102df91906106ce565b6001600160a01b03821661034e575f60405163ec442f0560e01b81526004016102df91906106ce565b61029d83838361045f565b6001600160a01b038216610382575f60405163ec442f0560e01b81526004016102df91906106ce565b6102465f838361045f565b6001600160a01b0384166103b6575f60405163e602df0560e01b81526004016102df91906106ce565b6001600160a01b0383166103df575f604051634a1406b160e11b81526004016102df91906106ce565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156102f657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161045191815260200190565b60405180910390a350505050565b6001600160a01b038316610489578060025f82825461047e91906106e2565b909155506104e69050565b6001600160a01b0383165f90815260208190526040902054818110156104c85783818360405163391434e360e21b81526004016102df939291906106ad565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661050257600280548290039055610520565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161056591815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146105bd575f80fd5b919050565b5f80604083850312156105d3575f80fd5b6105dc836105a7565b946020939093013593505050565b5f805f606084860312156105fc575f80fd5b610605846105a7565b9250610613602085016105a7565b929592945050506040919091013590565b5f60208284031215610634575f80fd5b61063d826105a7565b9392505050565b5f8060408385031215610655575f80fd5b61065e836105a7565b915061066c602084016105a7565b90509250929050565b600181811c9082168061068957607f821691505b6020821081036106a757634e487b7160e01b5f52602260045260245ffd5b50919050565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0391909116815260200190565b8082018082111561021357634e487b7160e01b5f52601160045260245ffdfea2646970667358221220f9ae46a2e15270bfb77fe3d4d0ee0e45b749e3dde93805ee2cf795cb800244e664736f6c634300081a0033\";\n\nexport const mintableERC20Abi = parseAbi([\n \"function transfer(address to, uint256 amount) external\",\n \"function mint(address to, uint256 amount) external\",\n \"function balanceOf(address target) external returns (uint256)\",\n]);\n\nexport type BuildNonceParams = {\n nonceKey?: bigint;\n entityId?: number;\n isGlobalValidation?: boolean;\n isDeferredAction?: boolean;\n isDirectCallValidation?: boolean;\n};\n\nexport const buildFullNonceKey = ({\n nonceKey = 0n,\n entityId = 0,\n isGlobalValidation = true,\n isDeferredAction = false,\n}: BuildNonceParams): bigint => {\n return (\n (nonceKey << 40n) +\n BigInt(entityId << 8) +\n (isDeferredAction ? 2n : 0n) +\n (isGlobalValidation ? 1n : 0n)\n );\n};\n\n// Parses out the 3 components from a deferred action\nexport const parseDeferredAction = (\n deferredAction: Hex\n): {\n entityId: number;\n isGlobalValidation: boolean;\n nonce: bigint;\n deferredActionData: Hex;\n hasAssociatedExecHooks: boolean;\n} => {\n // 2 for 0x, 2 for 00/01, 38 for parallel nonce, 8 for entity id, 2 for options byte, 16 for parallel nonce\n return {\n entityId: hexToNumber(`0x${deferredAction.slice(42, 50)}`),\n isGlobalValidation:\n hexToNumber(`0x${deferredAction.slice(50, 52)}`) % 2 === 1,\n nonce: BigInt(`0x${deferredAction.slice(4, 68)}`),\n deferredActionData: `0x${deferredAction.slice(68)}` as `0x${string}`,\n hasAssociatedExecHooks: deferredAction[3] === \"1\",\n };\n};\nexport type BuildDeferredActionDigestParams = {\n fullPreSignatureDeferredActionDigest: Hex;\n sig: Hex;\n};\n\n/**\n * Creates the digest which must be prepended to the userOp signature.\n *\n * Assumption: The client this extends is used to sign the typed data.\n *\n * @param {object} args The argument object containing the following:\n * @param {Hex} args.fullPreSignatureDeferredActionDigest The The data to append the signature and length to\n * @param {Hex} args.sig The signature to include in the digest\n * @returns {Hex} The encoded digest to be prepended to the userOp signature\n */\nexport const buildDeferredActionDigest = ({\n fullPreSignatureDeferredActionDigest,\n sig,\n}: BuildDeferredActionDigestParams): Hex => {\n const sigLength = size(sig);\n\n const encodedData = concatHex([\n fullPreSignatureDeferredActionDigest,\n toHex(sigLength, { size: 4 }),\n sig,\n ]);\n return encodedData;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"modularAccountV2Base.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/account/common/modularAccountV2Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL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CAAC,kBAAkB,CAAC,CAAC;IACjC,cAAc,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,OAAO,SAAS,kBAAkB,GAAG,kBAAkB,EACvD,UAAU,SAAS,SAAS,GAAG,SAAS,IACtC,IAAI,CACN,4BAA4B,CAAC,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,EAE1E,eAAe,GACf,oBAAoB,GACpB,UAAU,GACV,aAAa,GACb,eAAe,GACf,mBAAmB,CACtB,GAAG;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,GAAG,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,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,CA0L1E"}
1
+ {"version":3,"file":"modularAccountV2Base.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/account/common/modularAccountV2Base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,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,Q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;;;;;;;;;;;;;oJA4BvE,QAAQ,GAAG,CAAC;CA6BlB,CAAC"}
1
+ {"version":3,"file":"nativeSMASigner.d.ts","sourceRoot":"","sources":["../../../../../src/ma-v2/account/nativeSMASigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,OAAO,EAGb,MAAM,MAAM,CAAC;AAQd;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe,WAClB,kBAAkB,SACnB,KAAK,kBACI,OAAO,uBACF,GAAG;6BAGC,GAAG;oCAUY,GAAG,KAAG,QAAQ,GAAG,CAAC;;iBAmBd,eAAe;QAAK,QAAQ,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oJA4BvE,QAAQ,GAAG,CAAC;CA6BlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../../../../src/ma-v2/modules/single-signer-validation/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAIL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AAOd;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB,WAC5B,kBAAkB,SACnB,KAAK,kBACI,OA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AC;IAkDI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAqB1B,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAY5D,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,oBAAoB;IAoO5B,OAAO,CAAC,QAAQ;CAqCjB;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,GAAG,KAAK,CAEhD"}
@@ -1,6 +1,8 @@
1
1
  import { BaseError, type Address } from "@aa-sdk/core";
2
2
  import type { Permission } from "./permissionBuilder";
3
- export declare class RootPermissionOnlyError extends BaseError {
3
+ export declare abstract class PermissionBuilderError extends BaseError {
4
+ }
5
+ export declare class RootPermissionOnlyError extends PermissionBuilderError {
4
6
  name: string;
5
7
  /**
6
8
  * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
@@ -9,7 +11,7 @@ export declare class RootPermissionOnlyError extends BaseError {
9
11
  */
10
12
  constructor(permission: Permission);
11
13
  }
12
- export declare class AccountAddressAsTargetError extends BaseError {
14
+ export declare class AccountAddressAsTargetError extends PermissionBuilderError {
13
15
  name: string;
14
16
  /**
15
17
  * Constructor for initializing an error message indicating that account address is used as target.
@@ -18,7 +20,7 @@ export declare class AccountAddressAsTargetError extends BaseError {
18
20
  */
19
21
  constructor(permission: Permission);
20
22
  }
21
- export declare class DuplicateTargetAddressError extends BaseError {
23
+ export declare class DuplicateTargetAddressError extends PermissionBuilderError {
22
24
  name: string;
23
25
  /**
24
26
  * Constructor for initializing an error message indicating duplicate target address in permissions.
@@ -28,7 +30,7 @@ export declare class DuplicateTargetAddressError extends BaseError {
28
30
  */
29
31
  constructor(permission: Permission, targetAddress: Address);
30
32
  }
31
- export declare class NoFunctionsProvidedError extends BaseError {
33
+ export declare class NoFunctionsProvidedError extends PermissionBuilderError {
32
34
  name: string;
33
35
  /**
34
36
  * Constructor for initializing an error message indicating no functions were provided.
@@ -37,7 +39,7 @@ export declare class NoFunctionsProvidedError extends BaseError {
37
39
  */
38
40
  constructor(permission: Permission);
39
41
  }
40
- export declare class ExpiredDeadlineError extends BaseError {
42
+ export declare class ExpiredDeadlineError extends PermissionBuilderError {
41
43
  name: string;
42
44
  /**
43
45
  * Constructor for initializing an error message indicating the deadline has expired.
@@ -47,7 +49,7 @@ export declare class ExpiredDeadlineError extends BaseError {
47
49
  */
48
50
  constructor(deadline: number, currentTime: number);
49
51
  }
50
- export declare class DeadlineOverLimitError extends BaseError {
52
+ export declare class DeadlineOverLimitError extends PermissionBuilderError {
51
53
  name: string;
52
54
  /**
53
55
  * Constructor for initializing an error message indicating the deadline has expired.
@@ -56,14 +58,14 @@ export declare class DeadlineOverLimitError extends BaseError {
56
58
  */
57
59
  constructor(deadline: number);
58
60
  }
59
- export declare class ValidationConfigUnsetError extends BaseError {
61
+ export declare class ValidationConfigUnsetError extends PermissionBuilderError {
60
62
  name: string;
61
63
  /**
62
64
  * Constructor for initializing an error message indicating the validation config is unset.
63
65
  */
64
66
  constructor();
65
67
  }
66
- export declare class MultipleNativeTokenTransferError extends BaseError {
68
+ export declare class MultipleNativeTokenTransferError extends PermissionBuilderError {
67
69
  name: string;
68
70
  /**
69
71
  * Constructor for initializing an error message indicating multiple native token transfer permissions.
@@ -72,7 +74,7 @@ export declare class MultipleNativeTokenTransferError extends BaseError {
72
74
  */
73
75
  constructor(permission: Permission);
74
76
  }
75
- export declare class ZeroAddressError extends BaseError {
77
+ export declare class ZeroAddressError extends PermissionBuilderError {
76
78
  name: string;
77
79
  /**
78
80
  * Constructor for initializing an error message indicating zero address was provided.
@@ -81,7 +83,7 @@ export declare class ZeroAddressError extends BaseError {
81
83
  */
82
84
  constructor(permission: Permission);
83
85
  }
84
- export declare class MultipleGasLimitError extends BaseError {
86
+ export declare class MultipleGasLimitError extends PermissionBuilderError {
85
87
  name: string;
86
88
  /**
87
89
  * Constructor for initializing an error message indicating multiple gas limit permissions.
@@ -90,11 +92,20 @@ export declare class MultipleGasLimitError extends BaseError {
90
92
  */
91
93
  constructor(permission: Permission);
92
94
  }
93
- export declare class UnsupportedPermissionTypeError extends BaseError {
95
+ export declare class UnsupportedPermissionTypeError extends PermissionBuilderError {
94
96
  name: string;
95
97
  /**
96
98
  * Constructor for initializing an error message indicating an unsupported permission type.
97
99
  */
98
100
  constructor();
99
101
  }
102
+ export declare class SelectorNotAllowed extends PermissionBuilderError {
103
+ name: string;
104
+ /**
105
+ * Constructor for initializing an error message indicating that the selector being added is not allowed.
106
+ *
107
+ * @param {string} functionName The function name of the selector that is being added.
108
+ */
109
+ constructor(functionName: string);
110
+ }
100
111
  //# sourceMappingURL=permissionBuilderErrors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissionBuilderErrors.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/permissionBuilderErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,uBAAwB,SAAQ,SAAS;IAC3C,IAAI,SAAgD;IAE7D;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAGnC;AAED,qBAAa,2BAA4B,SAAQ,SAAS;IAC/C,IAAI,SAAoD;IAEjE;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAKnC;AAED,qBAAa,2BAA4B,SAAQ,SAAS;IAC/C,IAAI,SAAoD;IAEjE;;;;;OAKG;gBACS,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO;CAK3D;AAED,qBAAa,wBAAyB,SAAQ,SAAS;IAC5C,IAAI,SAAiD;IAE9D;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAGnC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IACxC,IAAI,SAA6C;IAE1D;;;;;OAKG;gBACS,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAKlD;AAED,qBAAa,sBAAuB,SAAQ,SAAS;IAC1C,IAAI,SAA+C;IA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,SAAQ,sBAAsB;IACrD,IAAI,SAA6C;IAE1D;;;;;OAKG;gBACS,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAKlD;AAED,qBAAa,sBAAuB,SAAQ,sBAAsB;IACvD,IAAI,SAA+C;IAE5D;;;;OAIG;gBACS,QAAQ,EAAE,MAAM;CAK7B;AAED,qBAAa,0BAA2B,SAAQ,sBAAsB;IAC3D,IAAI,SAAmD;IAEhE;;OAEG;;CAIJ;AAED,qBAAa,gCAAiC,SAAQ,sBAAsB;IACjE,IAAI,SAAyD;IAEtE;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAKnC;AAED,qBAAa,gBAAiB,SAAQ,sBAAsB;IACjD,IAAI,SAAyC;IAEtD;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAGnC;AAED,qBAAa,qBAAsB,SAAQ,sBAAsB;IACtD,IAAI,SAA8C;IAE3D;;;;OAIG;gBACS,UAAU,EAAE,UAAU;CAGnC;AAED,qBAAa,8BAA+B,SAAQ,sBAAsB;IAC/D,IAAI,SAAuD;IAEpE;;OAEG;;CAIJ;AAED,qBAAa,kBAAmB,SAAQ,sBAAsB;IACnD,IAAI,SAAwB;IAErC;;;;OAIG;gBACS,YAAY,EAAE,MAAM;CAGjC"}
@@ -83,6 +83,8 @@ export type BuildNonceParams = {
83
83
  };
84
84
  export declare const buildFullNonceKey: ({ nonceKey, entityId, isGlobalValidation, isDeferredAction, }: BuildNonceParams) => bigint;
85
85
  export declare const parseDeferredAction: (deferredAction: Hex) => {
86
+ entityId: number;
87
+ isGlobalValidation: boolean;
86
88
  nonce: bigint;
87
89
  deferredActionData: Hex;
88
90
  hasAssociatedExecHooks: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EAIf,MA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,EAAE,GAAG,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;CAWjC,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,oCAAoC,EAAE,GAAG,CAAC;IAC1C,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,mDAGnC,+BAA+B,KAAG,GASpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@account-kit/smart-contracts",
3
- "version": "4.25.1",
3
+ "version": "4.27.0",
4
4
  "description": "aa-sdk compatible interfaces for Alchemy Smart Accounts",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  "test:run": "vitest run"
54
54
  },
55
55
  "devDependencies": {
56
- "@account-kit/plugingen": "^4.25.1",
56
+ "@account-kit/plugingen": "^4.27.0",
57
57
  "change-case": "^5.1.2",
58
58
  "dedent": "^1.5.1",
59
59
  "dotenv": "^16.3.1",
@@ -73,10 +73,10 @@
73
73
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
74
74
  },
75
75
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
76
- "gitHead": "a9fea72b02f77909ca0dfc9cdecda7af6de0b17d",
76
+ "gitHead": "19b59caa4fcb4e057f8e84a81f77843650fcab25",
77
77
  "dependencies": {
78
- "@aa-sdk/core": "^4.25.1",
79
- "@account-kit/infra": "^4.25.1"
78
+ "@aa-sdk/core": "^4.27.0",
79
+ "@account-kit/infra": "^4.27.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "viem": "^2.22.6"
@@ -96,7 +96,7 @@ export type CreateMAV2BaseReturnType<
96
96
  export async function createMAv2Base<
97
97
  TSigner extends SmartAccountSigner = SmartAccountSigner
98
98
  >(config: CreateMAV2BaseParams<TSigner>): CreateMAV2BaseReturnType<TSigner> {
99
- const {
99
+ let {
100
100
  transport,
101
101
  chain,
102
102
  signer,
@@ -129,26 +129,32 @@ export async function createMAv2Base<
129
129
  client,
130
130
  });
131
131
 
132
- let useDeferredAction: boolean = false;
133
- let nonce: bigint = 0n;
134
- let deferredActionData: Hex = "0x";
132
+ // These default values signal that we should not use the set deferred action nonce
133
+ let nonce: bigint | undefined;
134
+ let deferredActionData: Hex | undefined;
135
135
  let hasAssociatedExecHooks: boolean = false;
136
136
 
137
137
  if (deferredAction) {
138
- ({ nonce, deferredActionData, hasAssociatedExecHooks } =
139
- parseDeferredAction(deferredAction));
138
+ let deferredActionNonce: bigint = 0n;
139
+ // We always update entity id and isGlobalValidation to the deferred action value since the client could be used to send multiple calls
140
+ ({
141
+ entityId,
142
+ isGlobalValidation,
143
+ nonce: deferredActionNonce,
144
+ } = parseDeferredAction(deferredAction));
140
145
 
141
146
  // Set these values if the deferred action has not been consumed. We check this with the EP
142
147
  const nextNonceForDeferredAction: bigint =
143
148
  (await entryPointContract.read.getNonce([
144
149
  accountAddress,
145
- nonce >> 64n,
150
+ deferredActionNonce >> 64n,
146
151
  ])) as bigint;
147
152
 
148
- // we only add the deferred action in if the nonce has not been consumed
149
- if (nonce === nextNonceForDeferredAction) {
150
- useDeferredAction = true;
151
- } else if (nonce > nextNonceForDeferredAction) {
153
+ if (deferredActionNonce === nextNonceForDeferredAction) {
154
+ ({ nonce, deferredActionData, hasAssociatedExecHooks } =
155
+ parseDeferredAction(deferredAction));
156
+ } else if (deferredActionNonce > nextNonceForDeferredAction) {
157
+ // if nonce is greater than the next nonce, its invalid, so we throw
152
158
  throw new InvalidDeferredActionNonce();
153
159
  }
154
160
  }
@@ -185,8 +191,10 @@ export async function createMAv2Base<
185
191
  !!(await client.getCode({ address: accountAddress }));
186
192
 
187
193
  const getNonce = async (nonceKey: bigint = 0n): Promise<bigint> => {
188
- if (useDeferredAction) {
189
- return nonce;
194
+ if (nonce) {
195
+ const tempNonce = nonce;
196
+ nonce = undefined; // set to falsy value once used
197
+ return tempNonce;
190
198
  }
191
199
 
192
200
  if (nonceKey > maxUint152) {
@@ -246,11 +254,14 @@ export async function createMAv2Base<
246
254
  const validationData = await getValidationData({
247
255
  entityId: Number(entityId),
248
256
  });
249
-
250
- return (useDeferredAction && hasAssociatedExecHooks) ||
251
- validationData.executionHooks.length
252
- ? concatHex([executeUserOpSelector, callData])
253
- : callData;
257
+ if (hasAssociatedExecHooks) {
258
+ hasAssociatedExecHooks = false; // set to falsy value once used
259
+ return concatHex([executeUserOpSelector, callData]);
260
+ }
261
+ if (validationData.executionHooks.length) {
262
+ return concatHex([executeUserOpSelector, callData]);
263
+ }
264
+ return callData;
254
265
  };
255
266
 
256
267
  const baseAccount = await toSmartContractAccount({
@@ -59,7 +59,7 @@ export const nativeSMASigner = (
59
59
  },
60
60
 
61
61
  signUserOperationHash: async (uoHash: Hex): Promise<Hex> => {
62
- const sig = await signer
62
+ let sig = await signer
63
63
  .signMessage({ raw: uoHash })
64
64
  .then((signature: Hex) =>
65
65
  packUOSignature({
@@ -68,7 +68,12 @@ export const nativeSMASigner = (
68
68
  })
69
69
  );
70
70
 
71
- return deferredActionData ? concatHex([deferredActionData, sig]) : sig;
71
+ if (deferredActionData) {
72
+ sig = concatHex([deferredActionData, sig]);
73
+ deferredActionData = undefined;
74
+ }
75
+
76
+ return sig;
72
77
  },
73
78
 
74
79
  // we apply the expected 1271 packing here since the account contract will expect it