@alchemy/smart-accounts 5.0.0-beta.21 → 5.0.0-beta.23

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.
@@ -43,7 +43,7 @@ export type * from "./ma-v2/types.js";
43
43
  export type * from "./ma-v2/utils/account.js";
44
44
  export { DefaultAddress, DefaultModuleAddress, DEFAULT_OWNER_ENTITY_ID, EXECUTE_USER_OP_SELECTOR, getMAV2UpgradeToData, buildFullNonceKey, serializeModuleEntity, isModularAccountV2, } from "./ma-v2/utils/account.js";
45
45
  export type * from "./ma-v2/utils/deferredActions.js";
46
- export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/deferredActions.js";
46
+ export { parseDeferredAction, encodeDeferredActionWithSignature, } from "./ma-v2/utils/deferredActions.js";
47
47
  export type * from "./ma-v2/utils/hooks.js";
48
48
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
49
49
  export type * from "./ma-v2/utils/signature.js";
package/dist/esm/index.js CHANGED
@@ -26,7 +26,7 @@ export { TimeRangeModule } from "./ma-v2/modules/time-range-module/module.js";
26
26
  export { PermissionBuilder, PermissionType, } from "./ma-v2/permissionBuilder.js";
27
27
  export { predictModularAccountV2Address } from "./ma-v2/predictAddress.js";
28
28
  export { DefaultAddress, DefaultModuleAddress, DEFAULT_OWNER_ENTITY_ID, EXECUTE_USER_OP_SELECTOR, getMAV2UpgradeToData, buildFullNonceKey, serializeModuleEntity, isModularAccountV2, } from "./ma-v2/utils/account.js";
29
- export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/deferredActions.js";
29
+ export { parseDeferredAction, encodeDeferredActionWithSignature, } from "./ma-v2/utils/deferredActions.js";
30
30
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
31
31
  export { packUOSignature, pack1271Signature, toReplaySafeTypedData, } from "./ma-v2/utils/signature.js";
32
32
  // Errors
@@ -1 +1 @@
1
- {"version":3,"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,kBAAkB,GACnB,MAAM,qCAAqC,CAAC","sourcesContent":["export type * from \"./types.js\";\n\n// LightAccount\nexport type * from \"./light-account/accounts/account.js\";\nexport { toLightAccount } from \"./light-account/accounts/account.js\";\n\nexport type * from \"./light-account/accounts/multi-owner-account.js\";\nexport { toMultiOwnerLightAccount } from \"./light-account/accounts/multi-owner-account.js\";\n\nexport type * from \"./light-account/predictAddress.js\";\nexport {\n predictLightAccountAddress,\n predictMultiOwnerLightAccountAddress,\n} from \"./light-account/predictAddress.js\";\n\nexport { AccountVersionRegistry } from \"./light-account/registry.js\";\nexport type * from \"./light-account/registry.js\";\nexport {\n defaultLightAccountVersion,\n getLightAccountImplAddress,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n} from \"./light-account/utils.js\";\n\nexport {\n encodeCallsLA,\n decodeCallsLA,\n} from \"./light-account/accounts/calldataCodec.js\";\n\nexport {\n lightAccountStaticImplV1_0_1,\n lightAccountStaticImplV1_0_2,\n lightAccountStaticImplV1_1_0,\n lightAccountStaticImplV2_0_0,\n multiOwnerLightAccountStaticImplV2_0_0,\n} from \"./light-account/lightAccountStaticImpl.js\";\n\n// ModularAccountV1\nexport type * from \"./ma-v1/accounts/base.js\";\nexport { toModularAccountV1Base } from \"./ma-v1/accounts/base.js\";\n\nexport type * from \"./ma-v1/accounts/multi-owner-account.js\";\nexport { toMultiOwnerModularAccountV1 } from \"./ma-v1/accounts/multi-owner-account.js\";\n\nexport type * from \"./ma-v1/predictAddress.js\";\nexport { predictMultiOwnerModularAccountV1Address } from \"./ma-v1/predictAddress.js\";\n\nexport { multiOwnerModularAccountStaticImpl } from \"./ma-v1/mav1StaticImpl.js\";\n\nexport {\n DefaultMaV1Address,\n DefaultMaV1PluginAddress,\n} from \"./ma-v1/account.js\";\n\nexport {\n encodeCallsMAv1,\n decodeCallsMAv1,\n} from \"./ma-v1/accounts/calldataCodec.js\";\n\n// ModularAccountV2\nexport type * from \"./ma-v2/accounts/account.js\";\nexport { toModularAccountV2 } from \"./ma-v2/accounts/account.js\";\n\nexport type * from \"./ma-v2/accounts/base.js\";\nexport { toModularAccountV2Base } from \"./ma-v2/accounts/base.js\";\n\nexport {\n encodeCallsMAv2,\n decodeCallsMAv2,\n} from \"./ma-v2/accounts/calldataCodec.js\";\n\nexport type * from \"./ma-v2/decorators/deferralActions.js\";\nexport { deferralActions } from \"./ma-v2/decorators/deferralActions.js\";\n\nexport type * from \"./ma-v2/decorators/installValidation.js\";\nexport { installValidationActions } from \"./ma-v2/decorators/installValidation.js\";\n\nexport {\n semiModularAccountV2StaticImpl,\n semiModularAccount7702StaticImpl,\n} from \"./ma-v2/mav2StaticImpl.js\";\nexport type * from \"./ma-v2/mav2StaticImpl.js\";\n\n// Modules\nexport { AllowlistModule } from \"./ma-v2/modules/allowlist-module/module.js\";\nexport { NativeTokenLimitModule } from \"./ma-v2/modules/native-token-limit-module/module.js\";\nexport { PaymasterGuardModule } from \"./ma-v2/modules/paymaster-guard-module/module.js\";\nexport { SingleSignerValidationModule } from \"./ma-v2/modules/single-signer-validation/module.js\";\nexport { TimeRangeModule } from \"./ma-v2/modules/time-range-module/module.js\";\n\nexport type * from \"./ma-v2/permissionBuilder.js\";\nexport {\n PermissionBuilder,\n PermissionType,\n} from \"./ma-v2/permissionBuilder.js\";\n\nexport type * from \"./ma-v2/predictAddress.js\";\nexport { predictModularAccountV2Address } from \"./ma-v2/predictAddress.js\";\n\nexport type * from \"./ma-v2/types.js\";\n\nexport type * from \"./ma-v2/utils/account.js\";\nexport {\n DefaultAddress,\n DefaultModuleAddress,\n DEFAULT_OWNER_ENTITY_ID,\n EXECUTE_USER_OP_SELECTOR,\n getMAV2UpgradeToData,\n buildFullNonceKey,\n serializeModuleEntity,\n isModularAccountV2,\n} from \"./ma-v2/utils/account.js\";\n\nexport type * from \"./ma-v2/utils/deferredActions.js\";\nexport {\n parseDeferredAction,\n buildDeferredActionDigest,\n} from \"./ma-v2/utils/deferredActions.js\";\n\nexport type * from \"./ma-v2/utils/hooks.js\";\nexport {\n serializeValidationConfig,\n serializeHookConfig,\n} from \"./ma-v2/utils/hooks.js\";\n\nexport type * from \"./ma-v2/utils/signature.js\";\nexport {\n packUOSignature,\n pack1271Signature,\n toReplaySafeTypedData,\n} from \"./ma-v2/utils/signature.js\";\n\n// Errors\nexport { EntityIdOverrideError } from \"./errors/EntityIdOverrideError.js\";\nexport { InvalidDeferredActionNonceError } from \"./errors/InvalidDeferredActionNonceError.js\";\nexport { InvalidEntityIdError } from \"./errors/InvalidEntityIdError.js\";\nexport { InvalidNonceKeyError } from \"./errors/InvalidNonceKeyError.js\";\nexport { InvalidOwnerError } from \"./errors/InvalidOwnerError.js\";\nexport {\n PermissionBuilderError,\n RootPermissionOnlyError,\n AccountAddressAsTargetError,\n DuplicateTargetAddressError,\n NoFunctionsProvidedError,\n ExpiredDeadlineError,\n DeadlineOverLimitError,\n ValidationConfigUnsetError,\n MultipleNativeTokenTransferError,\n ZeroAddressError,\n MultipleGasLimitError,\n UnsupportedPermissionTypeError,\n SelectorNotAllowed,\n} from \"./errors/permissionBuilderErrors.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,aAAa,GACd,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,M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,0BAA0B,CAAC;AAGlC,OAAO,EACL,mBAAmB,EACnB,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,SAAS;AACT,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,gCAAgC,EAChC,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,EAC9B,kBAAkB,GACnB,MAAM,qCAAqC,CAAC","sourcesContent":["export type * from \"./types.js\";\n\n// LightAccount\nexport type * from \"./light-account/accounts/account.js\";\nexport { toLightAccount } from \"./light-account/accounts/account.js\";\n\nexport type * from \"./light-account/accounts/multi-owner-account.js\";\nexport { toMultiOwnerLightAccount } from \"./light-account/accounts/multi-owner-account.js\";\n\nexport type * from \"./light-account/predictAddress.js\";\nexport {\n predictLightAccountAddress,\n predictMultiOwnerLightAccountAddress,\n} from \"./light-account/predictAddress.js\";\n\nexport { AccountVersionRegistry } from \"./light-account/registry.js\";\nexport type * from \"./light-account/registry.js\";\nexport {\n defaultLightAccountVersion,\n getLightAccountImplAddress,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n} from \"./light-account/utils.js\";\n\nexport {\n encodeCallsLA,\n decodeCallsLA,\n} from \"./light-account/accounts/calldataCodec.js\";\n\nexport {\n lightAccountStaticImplV1_0_1,\n lightAccountStaticImplV1_0_2,\n lightAccountStaticImplV1_1_0,\n lightAccountStaticImplV2_0_0,\n multiOwnerLightAccountStaticImplV2_0_0,\n} from \"./light-account/lightAccountStaticImpl.js\";\n\n// ModularAccountV1\nexport type * from \"./ma-v1/accounts/base.js\";\nexport { toModularAccountV1Base } from \"./ma-v1/accounts/base.js\";\n\nexport type * from \"./ma-v1/accounts/multi-owner-account.js\";\nexport { toMultiOwnerModularAccountV1 } from \"./ma-v1/accounts/multi-owner-account.js\";\n\nexport type * from \"./ma-v1/predictAddress.js\";\nexport { predictMultiOwnerModularAccountV1Address } from \"./ma-v1/predictAddress.js\";\n\nexport { multiOwnerModularAccountStaticImpl } from \"./ma-v1/mav1StaticImpl.js\";\n\nexport {\n DefaultMaV1Address,\n DefaultMaV1PluginAddress,\n} from \"./ma-v1/account.js\";\n\nexport {\n encodeCallsMAv1,\n decodeCallsMAv1,\n} from \"./ma-v1/accounts/calldataCodec.js\";\n\n// ModularAccountV2\nexport type * from \"./ma-v2/accounts/account.js\";\nexport { toModularAccountV2 } from \"./ma-v2/accounts/account.js\";\n\nexport type * from \"./ma-v2/accounts/base.js\";\nexport { toModularAccountV2Base } from \"./ma-v2/accounts/base.js\";\n\nexport {\n encodeCallsMAv2,\n decodeCallsMAv2,\n} from \"./ma-v2/accounts/calldataCodec.js\";\n\nexport type * from \"./ma-v2/decorators/deferralActions.js\";\nexport { deferralActions } from \"./ma-v2/decorators/deferralActions.js\";\n\nexport type * from \"./ma-v2/decorators/installValidation.js\";\nexport { installValidationActions } from \"./ma-v2/decorators/installValidation.js\";\n\nexport {\n semiModularAccountV2StaticImpl,\n semiModularAccount7702StaticImpl,\n} from \"./ma-v2/mav2StaticImpl.js\";\nexport type * from \"./ma-v2/mav2StaticImpl.js\";\n\n// Modules\nexport { AllowlistModule } from \"./ma-v2/modules/allowlist-module/module.js\";\nexport { NativeTokenLimitModule } from \"./ma-v2/modules/native-token-limit-module/module.js\";\nexport { PaymasterGuardModule } from \"./ma-v2/modules/paymaster-guard-module/module.js\";\nexport { SingleSignerValidationModule } from \"./ma-v2/modules/single-signer-validation/module.js\";\nexport { TimeRangeModule } from \"./ma-v2/modules/time-range-module/module.js\";\n\nexport type * from \"./ma-v2/permissionBuilder.js\";\nexport {\n PermissionBuilder,\n PermissionType,\n} from \"./ma-v2/permissionBuilder.js\";\n\nexport type * from \"./ma-v2/predictAddress.js\";\nexport { predictModularAccountV2Address } from \"./ma-v2/predictAddress.js\";\n\nexport type * from \"./ma-v2/types.js\";\n\nexport type * from \"./ma-v2/utils/account.js\";\nexport {\n DefaultAddress,\n DefaultModuleAddress,\n DEFAULT_OWNER_ENTITY_ID,\n EXECUTE_USER_OP_SELECTOR,\n getMAV2UpgradeToData,\n buildFullNonceKey,\n serializeModuleEntity,\n isModularAccountV2,\n} from \"./ma-v2/utils/account.js\";\n\nexport type * from \"./ma-v2/utils/deferredActions.js\";\nexport {\n parseDeferredAction,\n encodeDeferredActionWithSignature,\n} from \"./ma-v2/utils/deferredActions.js\";\n\nexport type * from \"./ma-v2/utils/hooks.js\";\nexport {\n serializeValidationConfig,\n serializeHookConfig,\n} from \"./ma-v2/utils/hooks.js\";\n\nexport type * from \"./ma-v2/utils/signature.js\";\nexport {\n packUOSignature,\n pack1271Signature,\n toReplaySafeTypedData,\n} from \"./ma-v2/utils/signature.js\";\n\n// Errors\nexport { EntityIdOverrideError } from \"./errors/EntityIdOverrideError.js\";\nexport { InvalidDeferredActionNonceError } from \"./errors/InvalidDeferredActionNonceError.js\";\nexport { InvalidEntityIdError } from \"./errors/InvalidEntityIdError.js\";\nexport { InvalidNonceKeyError } from \"./errors/InvalidNonceKeyError.js\";\nexport { InvalidOwnerError } from \"./errors/InvalidOwnerError.js\";\nexport {\n PermissionBuilderError,\n RootPermissionOnlyError,\n AccountAddressAsTargetError,\n DuplicateTargetAddressError,\n NoFunctionsProvidedError,\n ExpiredDeadlineError,\n DeadlineOverLimitError,\n ValidationConfigUnsetError,\n MultipleNativeTokenTransferError,\n ZeroAddressError,\n MultipleGasLimitError,\n UnsupportedPermissionTypeError,\n SelectorNotAllowed,\n} from \"./errors/permissionBuilderErrors.js\";\n"]}
@@ -25,7 +25,7 @@ export type CreateDeferredActionTypedDataParams = {
25
25
  deadline: number;
26
26
  nonce: bigint;
27
27
  };
28
- export type BuildPreSignatureDeferredActionDigestParams = {
28
+ export type BuildPreSignatureDeferredActionPayloadParams = {
29
29
  typedData: DeferredActionTypedData;
30
30
  };
31
31
  export type EntityIdAndNonceParams = {
@@ -36,7 +36,7 @@ export type EntityIdAndNonceParams = {
36
36
  };
37
37
  export type DeferralActions = {
38
38
  createDeferredActionTypedDataObject: (args: CreateDeferredActionTypedDataParams) => Promise<DeferredActionReturnData>;
39
- buildPreSignatureDeferredActionDigest: (args: BuildPreSignatureDeferredActionDigestParams) => Hex;
39
+ buildPreSignatureDeferredActionPayload: (args: BuildPreSignatureDeferredActionPayloadParams) => Hex;
40
40
  getEntityIdAndNonce: (args: EntityIdAndNonceParams) => Promise<{
41
41
  nonce: bigint;
42
42
  entityId: number;
@@ -46,6 +46,6 @@ export type DeferralActions = {
46
46
  * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
47
47
  *
48
48
  * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.
49
- * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildDeferredActionDigest`, and `buildUserOperationWithDeferredAction`.
49
+ * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildPreSignatureDeferredActionPayload`, and `buildUserOperationWithDeferredAction`.
50
50
  */
51
51
  export declare const deferralActions: <TTransport extends Transport = Transport, TChain extends Chain = Chain, TAccount extends SmartAccount = SmartAccount>(client: Client<TTransport, TChain, TAccount>) => DeferralActions;
@@ -10,7 +10,7 @@ export const ENTITY_ID_AND_NONCE_READER_BYTECODE = "0x60806040523480156100105760
10
10
  * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
11
11
  *
12
12
  * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.
13
- * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildDeferredActionDigest`, and `buildUserOperationWithDeferredAction`.
13
+ * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildPreSignatureDeferredActionPayload`, and `buildUserOperationWithDeferredAction`.
14
14
  */
15
15
  export const deferralActions = (client) => {
16
16
  const createDeferredActionTypedDataObject = async ({ callData, deadline, nonce, }) => {
@@ -40,7 +40,7 @@ export const deferralActions = (client) => {
40
40
  },
41
41
  };
42
42
  };
43
- const buildPreSignatureDeferredActionDigest = ({ typedData, }) => {
43
+ const buildPreSignatureDeferredActionPayload = ({ typedData, }) => {
44
44
  const account = client.account;
45
45
  if (!account || !isModularAccountV2(account)) {
46
46
  throw new AccountNotFoundError();
@@ -93,7 +93,7 @@ export const deferralActions = (client) => {
93
93
  };
94
94
  return {
95
95
  createDeferredActionTypedDataObject,
96
- buildPreSignatureDeferredActionDigest,
96
+ buildPreSignatureDeferredActionPayload,
97
97
  getEntityIdAndNonce,
98
98
  };
99
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"deferralActions.js","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/deferralActions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,GAEN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,kBA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Q,EAAE,mCAAmC;YAC7C,IAAI,EAAE;gBACJ,OAAO,CAAC,OAAO;gBACf,OAAO,CAAC,UAAU,CAAC,OAAO;gBAC1B,iBAAiB,CAAC;oBAChB,QAAQ;oBACR,QAAQ;oBACR,kBAAkB;oBAClB,gBAAgB;iBACjB,CAAC;aACH;SACF,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC;YACnB,QAAQ,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,mCAAmC;QACnC,qCAAqC;QACrC,mBAAmB;KACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n concatHex,\n type Hex,\n type Client,\n type Chain,\n type Transport,\n encodePacked,\n size,\n toHex,\n maxUint152,\n encodeDeployData,\n hexToNumber,\n isHex,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport { entityIdAndNonceReaderAbi } from \"../abis/entityIdAndNonceReader.js\";\nimport { getAction } from \"viem/utils\";\nimport { call } from \"viem/actions\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { buildFullNonceKey, isModularAccountV2 } from \"../utils/account.js\";\nimport { AccountNotFoundError, BaseError } from \"@alchemy/common\";\n\nexport const ENTITY_ID_AND_NONCE_READER_BYTECODE =\n \"0x608060405234801561001057600080fd5b506040516104f13803806104f183398101604081905261002f916101e5565b60006008826001600160c01b0316901c90506000808263ffffffff1611610057576001610059565b815b90506001600160a01b0385163b15610133575b60006001600160a01b03861663d31b575b6bffffffff0000000000000000604085901b166040516001600160e01b031960e084901b1681526001600160401b03199091166004820152602401600060405180830381865afa1580156100d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526100fd91908101906103c6565b805190915060ff161580156101155750606081015151155b156101205750610133565b8161012a816104a4565b9250505061006c565b604051631aab3f0d60e11b81526001600160a01b03868116600483015264ffffffff01600160c01b038516600884901b64ffffffff0016176024830152600091908616906335567e1a90604401602060405180830381865afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c191906104d7565b90508060005260206000f35b6001600160a01b03811681146101e257600080fd5b50565b6000806000606084860312156101fa57600080fd5b8351610205816101cd565b6020850151909350610216816101cd565b60408501519092506001600160c01b038116811461023357600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156102765761027661023e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156102a4576102a461023e565b604052919050565b60006001600160401b038211156102c5576102c561023e565b5060051b60200190565b600082601f8301126102e057600080fd5b81516102f36102ee826102ac565b61027c565b8082825260208201915060208360051b86010192508583111561031557600080fd5b602085015b8381101561034857805166ffffffffffffff198116811461033a57600080fd5b83526020928301920161031a565b5095945050505050565b600082601f83011261036357600080fd5b81516103716102ee826102ac565b8082825260208201915060208360051b86010192508583111561039357600080fd5b602085015b838110156103485780516001600160e01b0319811681146103b857600080fd5b835260209283019201610398565b6000602082840312156103d857600080fd5b81516001600160401b038111156103ee57600080fd5b82016080818503121561040057600080fd5b610408610254565b815160ff8116811461041957600080fd5b815260208201516001600160401b0381111561043457600080fd5b610440868285016102cf565b60208301525060408201516001600160401b0381111561045f57600080fd5b61046b868285016102cf565b60408301525060608201516001600160401b0381111561048a57600080fd5b61049686828501610352565b606083015250949350505050565b600063ffffffff821663ffffffff81036104ce57634e487b7160e01b600052601160045260246000fd5b60010192915050565b6000602082840312156104e957600080fd5b505191905056fe\";\n\nexport type DeferredActionTypedData = TypedDataDefinition<\n {\n DeferredAction: [\n { name: \"nonce\"; type: \"uint256\" },\n { name: \"deadline\"; type: \"uint48\" },\n { name: \"call\"; type: \"bytes\" },\n ];\n },\n \"DeferredAction\"\n>;\n\nexport type DeferredActionReturnData = {\n typedData: DeferredActionTypedData;\n};\n\nexport type CreateDeferredActionTypedDataParams = {\n callData: Hex;\n deadline: number;\n nonce: bigint;\n};\n\nexport type BuildPreSignatureDeferredActionDigestParams = {\n typedData: DeferredActionTypedData;\n};\n\nexport type EntityIdAndNonceParams = {\n entityId?: number;\n nonceKey?: bigint;\n isGlobalValidation: boolean;\n isDeferredAction?: boolean;\n};\n\nexport type DeferralActions = {\n createDeferredActionTypedDataObject: (\n args: CreateDeferredActionTypedDataParams,\n ) => Promise<DeferredActionReturnData>;\n buildPreSignatureDeferredActionDigest: (\n args: BuildPreSignatureDeferredActionDigestParams,\n ) => Hex;\n getEntityIdAndNonce: (\n args: EntityIdAndNonceParams,\n ) => Promise<{ nonce: bigint; entityId: number }>;\n};\n\n/**\n * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.\n *\n * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.\n * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildDeferredActionDigest`, and `buildUserOperationWithDeferredAction`.\n */\nexport const deferralActions = <\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TAccount extends SmartAccount = SmartAccount,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): DeferralActions => {\n const createDeferredActionTypedDataObject = async ({\n callData,\n deadline,\n nonce,\n }: CreateDeferredActionTypedDataParams): Promise<DeferredActionReturnData> => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n return {\n typedData: {\n domain: {\n chainId: client.chain.id,\n verifyingContract: client.account.address,\n },\n types: {\n DeferredAction: [\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint48\" },\n { name: \"call\", type: \"bytes\" },\n ],\n },\n primaryType: \"DeferredAction\",\n message: {\n nonce: nonce,\n deadline: deadline,\n call: callData,\n },\n },\n };\n };\n\n const buildPreSignatureDeferredActionDigest = ({\n typedData,\n }: BuildPreSignatureDeferredActionDigestParams): Hex => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const signerEntity = account.signerEntity;\n const validationLocator =\n (BigInt(signerEntity.entityId) << 8n) |\n (signerEntity.isGlobalValidation ? 1n : 0n);\n\n const encodedCallData = encodePacked(\n [\"uint168\", \"uint48\", \"bytes\"],\n [validationLocator, typedData.message.deadline, typedData.message.call],\n );\n\n const encodedDataLength = size(encodedCallData);\n const encodedData = concatHex([\n toHex(encodedDataLength, { size: 4 }),\n encodedCallData,\n ]);\n return encodedData;\n };\n\n const getEntityIdAndNonce = async ({\n entityId = 1,\n nonceKey = 0n,\n isGlobalValidation,\n isDeferredAction = true,\n }: EntityIdAndNonceParams) => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const bytecode = encodeDeployData({\n abi: entityIdAndNonceReaderAbi,\n bytecode: ENTITY_ID_AND_NONCE_READER_BYTECODE,\n args: [\n account.address,\n account.entryPoint.address,\n buildFullNonceKey({\n nonceKey,\n entityId,\n isGlobalValidation,\n isDeferredAction,\n }),\n ],\n });\n\n const action = getAction(client, call, \"call\");\n const { data } = await action({ data: bytecode });\n if (!data) {\n throw new BaseError(\"No data returned from contract call\");\n }\n if (!isHex(data)) {\n throw new BaseError(\"Expected hex data from contract call\");\n }\n\n return {\n nonce: BigInt(data),\n entityId: hexToNumber(`0x${data.slice(40, 48)}`),\n };\n };\n\n return {\n createDeferredActionTypedDataObject,\n buildPreSignatureDeferredActionDigest,\n getEntityIdAndNonce,\n };\n};\n"]}
1
+ {"version":3,"file":"deferralActions.js","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/deferralActions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,KAAK,GAEN,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,CAAC,MAAM,mCAAmC,GAC9C,s+EAAs+E,CAAC;AA8Cz+E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAK7B,MAA4C,EAC3B,EAAE;IACnB,MAAM,mCAAmC,GAAG,KAAK,EAAE,EACjD,QAAQ,EACR,QAAQ,EACR,KAAK,GAC+B,EAAqC,EAAE;QAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,oBAAoB,EAAE,CAAC;QACnC,CAAC;QAED,OAAO;YACL,SAAS,EAAE;gBACT,MAAM,EAAE;oBACN,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE;oBACxB,iBAAiB,EAAE,M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,EAAE,MAAM,CAAC,IAAI,CAAC;YACnB,QAAQ,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,mCAAmC;QACnC,sCAAsC;QACtC,mBAAmB;KACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n concatHex,\n type Hex,\n type Client,\n type Chain,\n type Transport,\n encodePacked,\n size,\n toHex,\n maxUint152,\n encodeDeployData,\n hexToNumber,\n isHex,\n type TypedDataDefinition,\n} from \"viem\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport { entityIdAndNonceReaderAbi } from \"../abis/entityIdAndNonceReader.js\";\nimport { getAction } from \"viem/utils\";\nimport { call } from \"viem/actions\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { buildFullNonceKey, isModularAccountV2 } from \"../utils/account.js\";\nimport { AccountNotFoundError, BaseError } from \"@alchemy/common\";\n\nexport const ENTITY_ID_AND_NONCE_READER_BYTECODE =\n \"0x608060405234801561001057600080fd5b506040516104f13803806104f183398101604081905261002f916101e5565b60006008826001600160c01b0316901c90506000808263ffffffff1611610057576001610059565b815b90506001600160a01b0385163b15610133575b60006001600160a01b03861663d31b575b6bffffffff0000000000000000604085901b166040516001600160e01b031960e084901b1681526001600160401b03199091166004820152602401600060405180830381865afa1580156100d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526100fd91908101906103c6565b805190915060ff161580156101155750606081015151155b156101205750610133565b8161012a816104a4565b9250505061006c565b604051631aab3f0d60e11b81526001600160a01b03868116600483015264ffffffff01600160c01b038516600884901b64ffffffff0016176024830152600091908616906335567e1a90604401602060405180830381865afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c191906104d7565b90508060005260206000f35b6001600160a01b03811681146101e257600080fd5b50565b6000806000606084860312156101fa57600080fd5b8351610205816101cd565b6020850151909350610216816101cd565b60408501519092506001600160c01b038116811461023357600080fd5b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156102765761027661023e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156102a4576102a461023e565b604052919050565b60006001600160401b038211156102c5576102c561023e565b5060051b60200190565b600082601f8301126102e057600080fd5b81516102f36102ee826102ac565b61027c565b8082825260208201915060208360051b86010192508583111561031557600080fd5b602085015b8381101561034857805166ffffffffffffff198116811461033a57600080fd5b83526020928301920161031a565b5095945050505050565b600082601f83011261036357600080fd5b81516103716102ee826102ac565b8082825260208201915060208360051b86010192508583111561039357600080fd5b602085015b838110156103485780516001600160e01b0319811681146103b857600080fd5b835260209283019201610398565b6000602082840312156103d857600080fd5b81516001600160401b038111156103ee57600080fd5b82016080818503121561040057600080fd5b610408610254565b815160ff8116811461041957600080fd5b815260208201516001600160401b0381111561043457600080fd5b610440868285016102cf565b60208301525060408201516001600160401b0381111561045f57600080fd5b61046b868285016102cf565b60408301525060608201516001600160401b0381111561048a57600080fd5b61049686828501610352565b606083015250949350505050565b600063ffffffff821663ffffffff81036104ce57634e487b7160e01b600052601160045260246000fd5b60010192915050565b6000602082840312156104e957600080fd5b505191905056fe\";\n\nexport type DeferredActionTypedData = TypedDataDefinition<\n {\n DeferredAction: [\n { name: \"nonce\"; type: \"uint256\" },\n { name: \"deadline\"; type: \"uint48\" },\n { name: \"call\"; type: \"bytes\" },\n ];\n },\n \"DeferredAction\"\n>;\n\nexport type DeferredActionReturnData = {\n typedData: DeferredActionTypedData;\n};\n\nexport type CreateDeferredActionTypedDataParams = {\n callData: Hex;\n deadline: number;\n nonce: bigint;\n};\n\nexport type BuildPreSignatureDeferredActionPayloadParams = {\n typedData: DeferredActionTypedData;\n};\n\nexport type EntityIdAndNonceParams = {\n entityId?: number;\n nonceKey?: bigint;\n isGlobalValidation: boolean;\n isDeferredAction?: boolean;\n};\n\nexport type DeferralActions = {\n createDeferredActionTypedDataObject: (\n args: CreateDeferredActionTypedDataParams,\n ) => Promise<DeferredActionReturnData>;\n buildPreSignatureDeferredActionPayload: (\n args: BuildPreSignatureDeferredActionPayloadParams,\n ) => Hex;\n getEntityIdAndNonce: (\n args: EntityIdAndNonceParams,\n ) => Promise<{ nonce: bigint; entityId: number }>;\n};\n\n/**\n * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.\n *\n * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.\n * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildPreSignatureDeferredActionPayload`, and `buildUserOperationWithDeferredAction`.\n */\nexport const deferralActions = <\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TAccount extends SmartAccount = SmartAccount,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): DeferralActions => {\n const createDeferredActionTypedDataObject = async ({\n callData,\n deadline,\n nonce,\n }: CreateDeferredActionTypedDataParams): Promise<DeferredActionReturnData> => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n return {\n typedData: {\n domain: {\n chainId: client.chain.id,\n verifyingContract: client.account.address,\n },\n types: {\n DeferredAction: [\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint48\" },\n { name: \"call\", type: \"bytes\" },\n ],\n },\n primaryType: \"DeferredAction\",\n message: {\n nonce: nonce,\n deadline: deadline,\n call: callData,\n },\n },\n };\n };\n\n const buildPreSignatureDeferredActionPayload = ({\n typedData,\n }: BuildPreSignatureDeferredActionPayloadParams): Hex => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const signerEntity = account.signerEntity;\n const validationLocator =\n (BigInt(signerEntity.entityId) << 8n) |\n (signerEntity.isGlobalValidation ? 1n : 0n);\n\n const encodedCallData = encodePacked(\n [\"uint168\", \"uint48\", \"bytes\"],\n [validationLocator, typedData.message.deadline, typedData.message.call],\n );\n\n const encodedDataLength = size(encodedCallData);\n const encodedData = concatHex([\n toHex(encodedDataLength, { size: 4 }),\n encodedCallData,\n ]);\n return encodedData;\n };\n\n const getEntityIdAndNonce = async ({\n entityId = 1,\n nonceKey = 0n,\n isGlobalValidation,\n isDeferredAction = true,\n }: EntityIdAndNonceParams) => {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const bytecode = encodeDeployData({\n abi: entityIdAndNonceReaderAbi,\n bytecode: ENTITY_ID_AND_NONCE_READER_BYTECODE,\n args: [\n account.address,\n account.entryPoint.address,\n buildFullNonceKey({\n nonceKey,\n entityId,\n isGlobalValidation,\n isDeferredAction,\n }),\n ],\n });\n\n const action = getAction(client, call, \"call\");\n const { data } = await action({ data: bytecode });\n if (!data) {\n throw new BaseError(\"No data returned from contract call\");\n }\n if (!isHex(data)) {\n throw new BaseError(\"Expected hex data from contract call\");\n }\n\n return {\n nonce: BigInt(data),\n entityId: hexToNumber(`0x${data.slice(40, 48)}`),\n };\n };\n\n return {\n createDeferredActionTypedDataObject,\n buildPreSignatureDeferredActionPayload,\n getEntityIdAndNonce,\n };\n};\n"]}
@@ -133,11 +133,11 @@ export declare class PermissionBuilder {
133
133
  /**
134
134
  * Compiles the deferred action typed data to sign.
135
135
  *
136
- * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionDigest: Hex}>} The deferred action typed data and the full pre-signature deferred action digest.
136
+ * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionPayload: Hex}>} The deferred action typed data and the full pre-signature deferred action payload.
137
137
  */
138
138
  compileDeferred(): Promise<{
139
139
  typedData: DeferredActionTypedData;
140
- fullPreSignatureDeferredActionDigest: Hex;
140
+ fullPreSignatureDeferredActionPayload: Hex;
141
141
  }>;
142
142
  /**
143
143
  * Compiles the raw install arguments for the installValidation function.
@@ -222,7 +222,7 @@ export class PermissionBuilder {
222
222
  /**
223
223
  * Compiles the deferred action typed data to sign.
224
224
  *
225
- * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionDigest: Hex}>} The deferred action typed data and the full pre-signature deferred action digest.
225
+ * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionPayload: Hex}>} The deferred action typed data and the full pre-signature deferred action payload.
226
226
  */
227
227
  async compileDeferred() {
228
228
  // Add time range module hook via expiry
@@ -245,14 +245,14 @@ export class PermissionBuilder {
245
245
  deadline: this.deadline,
246
246
  nonce: this.nonce,
247
247
  });
248
- const preSignatureDigest = deferralActions(this.client).buildPreSignatureDeferredActionDigest({ typedData });
249
- // Encode additional information to build the full pre-signature digest
250
- const fullPreSignatureDeferredActionDigest = `0x0${this.hasAssociatedExecHooks ? "1" : "0"}${toHex(this.nonce, {
248
+ const preSignaturePayload = deferralActions(this.client).buildPreSignatureDeferredActionPayload({ typedData });
249
+ // Encode additional information to build the full pre-signature payload
250
+ const fullPreSignatureDeferredActionPayload = `0x0${this.hasAssociatedExecHooks ? "1" : "0"}${toHex(this.nonce, {
251
251
  size: 32,
252
- }).slice(2)}${preSignatureDigest.slice(2)}`;
252
+ }).slice(2)}${preSignaturePayload.slice(2)}`;
253
253
  return {
254
254
  typedData,
255
- fullPreSignatureDeferredActionDigest,
255
+ fullPreSignatureDeferredActionPayload,
256
256
  };
257
257
  }
258
258
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"permissionBuilder.js","sourceRoot":"","sources":["../../../src/ma-v2/permissionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,WAAW,GAMZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MA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AAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QAC5D,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,UAAU,EAAE,EAAE,CAAC,UAAU;gBACzB,QAAQ,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,CAAC,QAAQ,CAAC;aAClE,CAAC,CAAC;QACL,CAAC;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC;aAClE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n maxUint48,\n toHex,\n zeroAddress,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { NativeTokenLimitModule } from \"./modules/native-token-limit-module/module.js\";\nimport { SingleSignerValidationModule } from \"./modules/single-signer-validation/module.js\";\nimport { AllowlistModule } from \"./modules/allowlist-module/module.js\";\nimport { TimeRangeModule } from \"./modules/time-range-module/module.js\";\nimport { HookType, type HookConfig, type ValidationConfig } from \"./types.js\";\nimport {\n deferralActions,\n type DeferredActionTypedData,\n} from \"./decorators/deferralActions.js\";\nimport {\n installValidationActions,\n type InstallValidationParams,\n} from \"./decorators/installValidation.js\";\nimport { assertNever, AccountNotFoundError } from \"@alchemy/common\";\nimport {\n AccountAddressAsTargetError,\n DeadlineOverLimitError,\n DuplicateTargetAddressError,\n ExpiredDeadlineError,\n MultipleGasLimitError,\n MultipleNativeTokenTransferError,\n NoFunctionsProvidedError,\n RootPermissionOnlyError,\n SelectorNotAllowed,\n ValidationConfigUnsetError,\n ZeroAddressError,\n} from \"../errors/permissionBuilderErrors.js\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport { DefaultModuleAddress, isModularAccountV2 } from \"./utils/account.js\";\n\n// We use this to offset the ERC20 spend limit entityId\nconst HALF_UINT32 = 2147483647;\nconst ERC20_APPROVE_SELECTOR = \"0x095ea7b3\";\nconst ERC20_TRANSFER_SELECTOR = \"0xa9059cbb\";\nconst ACCOUNT_EXECUTE_SELECTOR = \"0xb61d27f6\";\nconst ACCOUNT_EXECUTEBATCH_SELECTOR = \"0x34fcd5be\";\n\n/**\n * A pseudo-enum for permission types.\n */\nexport const PermissionType = {\n NATIVE_TOKEN_TRANSFER: \"native-token-transfer\",\n ERC20_TOKEN_TRANSFER: \"erc20-token-transfer\",\n // ERC721_TOKEN_TRANSFER : \"erc721-token-transfer\", // Unimplemented\n // ERC1155_TOKEN_TRANSFER : \"erc1155-token-transfer\", // Unimplemented\n GAS_LIMIT: \"gas-limit\",\n // CALL_LIMIT : \"call-limit\", //Unimplemented\n // RATE_LIMIT : \"rate-limit\", //Unimplemented\n CONTRACT_ACCESS: \"contract-access\",\n ACCOUNT_FUNCTIONS: \"account-functions\",\n FUNCTIONS_ON_ALL_CONTRACTS: \"functions-on-all-contracts\",\n FUNCTIONS_ON_CONTRACT: \"functions-on-contract\",\n ROOT: \"root\",\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type PermissionType =\n (typeof PermissionType)[keyof typeof PermissionType];\n\n/**\n * A pseudo-enum for hook identifiers.\n */\nexport const HookIdentifier = {\n NATIVE_TOKEN_TRANSFER: \"native-token-transfer\",\n ERC20_TOKEN_TRANSFER: \"erc20-token-transfer\",\n GAS_LIMIT: \"gas-limit\",\n PREVAL_ALLOWLIST: \"preval-allowlist\", // aggregate of CONTRACT_ACCESS, ACCOUNT_FUNCTIONS, FUNCTIONS_ON_ALL_CONTRACTS, FUNCTIONS_ON_CONTRACT\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type HookIdentifier =\n (typeof HookIdentifier)[keyof typeof HookIdentifier];\n\ntype PreExecutionHookConfig = {\n address: Address;\n entityId: number;\n hookType: typeof HookType.EXECUTION;\n hasPreHooks: true;\n hasPostHooks: false;\n};\n\ntype PreValidationHookConfig = {\n address: Address;\n entityId: number;\n hookType: typeof HookType.VALIDATION;\n hasPreHooks: true;\n hasPostHooks: false;\n};\n\ntype RawHooks = {\n [HookIdentifier.NATIVE_TOKEN_TRANSFER]:\n | {\n hookConfig: PreExecutionHookConfig;\n initData: {\n entityId: number;\n spendLimit: bigint;\n };\n }\n | undefined;\n [HookIdentifier.ERC20_TOKEN_TRANSFER]:\n | {\n hookConfig: PreExecutionHookConfig;\n initData: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n };\n }\n | undefined;\n [HookIdentifier.GAS_LIMIT]:\n | {\n hookConfig: PreValidationHookConfig;\n initData: {\n entityId: number;\n spendLimit: bigint;\n };\n }\n | undefined;\n [HookIdentifier.PREVAL_ALLOWLIST]:\n | {\n hookConfig: PreValidationHookConfig;\n\n initData: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n };\n }\n | undefined;\n};\n\ntype Key = {\n publicKey: Hex;\n type: \"secp256k1\" | \"contract\";\n};\n\nexport type Permission =\n | {\n // this permission allows transfer of native tokens from the account\n type: typeof PermissionType.NATIVE_TOKEN_TRANSFER;\n data: {\n allowance: Hex;\n };\n }\n | {\n // this permission allows transfer or approval of erc20 tokens from the account\n type: typeof PermissionType.ERC20_TOKEN_TRANSFER;\n data: {\n address: Address; // erc20 token contract address\n allowance: Hex;\n };\n }\n | {\n // this permissions allows the key to spend gas for UOs\n type: typeof PermissionType.GAS_LIMIT;\n data: {\n limit: Hex;\n };\n }\n | {\n // this permission grants access to all functions in a contract\n type: typeof PermissionType.CONTRACT_ACCESS;\n data: {\n address: Address;\n };\n }\n | {\n // this permission grants access to functions in the account\n type: typeof PermissionType.ACCOUNT_FUNCTIONS;\n data: {\n functions: Hex[]; // function signatures\n };\n }\n | {\n // this permission grants access to a function selector in any address or contract\n type: typeof PermissionType.FUNCTIONS_ON_ALL_CONTRACTS;\n data: {\n functions: Hex[]; // function signatures\n };\n }\n | {\n // this permission grants access to specified functions on a specific contract\n type: typeof PermissionType.FUNCTIONS_ON_CONTRACT;\n data: {\n address: Address;\n functions: Hex[];\n };\n }\n | {\n // this permission grants full access to everything\n type: typeof PermissionType.ROOT;\n data?: never;\n };\n\ntype Hook = {\n hookConfig: HookConfig;\n initData: Hex;\n};\n\n/**\n * A builder for constructing a Permission object.\n */\nexport class PermissionBuilder {\n private client: Client<Transport, Chain, SmartAccount>;\n private validationConfig: ValidationConfig = {\n moduleAddress: zeroAddress,\n entityId: 0, // uint32\n isGlobal: false,\n isSignatureValidation: false,\n isUserOpValidation: false,\n };\n private selectors: Hex[] = [];\n private installData: Hex = \"0x\";\n private permissions: Permission[] = [];\n private hooks: Hook[] = [];\n private nonce: bigint = 0n;\n private hasAssociatedExecHooks: boolean = false;\n private deadline: number = 0;\n\n /**\n * Creates a PermissionBuilder instance.\n *\n * @param {PermissionBuilderParams} params - The parameters for creating a PermissionBuilder instance.\n */\n constructor({\n client,\n key,\n entityId,\n nonce,\n selectors,\n hooks,\n deadline,\n }: {\n client: Client<Transport, Chain, SmartAccount>;\n key: Key;\n entityId: number;\n nonce: bigint;\n selectors?: Hex[];\n hooks?: Hook[];\n deadline?: number;\n }) {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n this.client = client;\n this.validationConfig = {\n moduleAddress: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n entityId,\n isUserOpValidation: true,\n isGlobal: false,\n isSignatureValidation: false,\n };\n this.installData = SingleSignerValidationModule.encodeOnInstallData({\n entityId: entityId,\n signer: key.publicKey,\n });\n this.nonce = nonce;\n if (selectors) this.selectors = selectors;\n if (hooks) this.hooks = hooks;\n if (deadline) this.deadline = deadline;\n }\n\n /**\n * Adds a selector to the permission builder.\n *\n * @param {Hex} selector - The selector to add.\n * @returns {this} The permission builder instance.\n */\n addSelector({ selector }: { selector: Hex }): this {\n this.selectors.push(selector);\n return this;\n }\n\n /**\n * Adds a permission to the permission builder.\n *\n * @param {Permission} permission - The permission to add.\n * @returns {this} The permission builder instance.\n */\n addPermission({ permission }: { permission: Permission }): this {\n // Check 1: If we're adding root, we can't have any other permissions\n if (permission.type === PermissionType.ROOT) {\n if (this.permissions.length !== 0) {\n throw new RootPermissionOnlyError(permission);\n }\n this.permissions.push(permission);\n // Set isGlobal to true\n this.validationConfig.isGlobal = true;\n return this;\n }\n\n // Check 2: If the permission is NOT ROOT (guaranteed), ensure there is no ROOT permission set\n // Will resolve to undefined if ROOT is not found\n // NOTE: Technically this could be replaced by checking permissions[0] since it should not be possible\n // to have >1 permission with root among them\n if (this.permissions.find((p) => p.type === PermissionType.ROOT)) {\n throw new RootPermissionOnlyError(permission);\n }\n\n // Check 3: If the permission is either CONTRACT_ACCESS or FUNCTIONS_ON_CONTRACT, ensure it doesn't collide with another like it.\n if (\n permission.type === PermissionType.CONTRACT_ACCESS ||\n permission.type === PermissionType.FUNCTIONS_ON_CONTRACT\n ) {\n // Check 3.1: address must not be the account address, or the user should use the ACCOUNT_FUNCTIONS permission\n if (permission.data.address === this.client.account.address) {\n throw new AccountAddressAsTargetError(permission);\n }\n\n // Check 3.2: there must not be an existing permission with this address as a target\n const targetAddress = permission.data.address;\n const existingPermissionWithSameAddress = this.permissions.find(\n (p) =>\n (p.type === PermissionType.CONTRACT_ACCESS &&\n \"address\" in p.data &&\n p.data.address === targetAddress) ||\n (p.type === PermissionType.FUNCTIONS_ON_CONTRACT &&\n \"address\" in p.data &&\n p.data.address === targetAddress),\n );\n\n if (existingPermissionWithSameAddress) {\n throw new DuplicateTargetAddressError(permission, targetAddress);\n }\n }\n\n // Check 4: If the permission is ACCOUNT_FUNCTIONS, add selectors\n if (permission.type === PermissionType.ACCOUNT_FUNCTIONS) {\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n // Explicitly disallow adding execute & executeBatch\n if (permission.data.functions.includes(ACCOUNT_EXECUTE_SELECTOR)) {\n throw new SelectorNotAllowed(\"execute\");\n } else if (\n permission.data.functions.includes(ACCOUNT_EXECUTEBATCH_SELECTOR)\n ) {\n throw new SelectorNotAllowed(\"executeBatch\");\n }\n this.selectors = [...this.selectors, ...permission.data.functions];\n }\n\n this.permissions.push(permission);\n return this;\n }\n\n /**\n * Adds multiple permissions to the permission builder.\n *\n * @param {Permission[]} permissions - The permissions to add.\n * @returns {this} The permission builder instance.\n */\n addPermissions({ permissions }: { permissions: Permission[] }): this {\n // We could validate each permission here, but for simplicity we'll just add them\n // A better approach would be to call addPermission for each one\n permissions.forEach((permission) => {\n this.addPermission({ permission });\n });\n return this;\n }\n\n /**\n * Compiles the deferred action typed data to sign.\n *\n * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionDigest: Hex}>} The deferred action typed data and the full pre-signature deferred action digest.\n */\n async compileDeferred(): Promise<{\n typedData: DeferredActionTypedData;\n fullPreSignatureDeferredActionDigest: Hex;\n }> {\n // Add time range module hook via expiry\n if (this.deadline !== 0) {\n if (this.deadline < Date.now() / 1000) {\n throw new ExpiredDeadlineError(this.deadline, Date.now() / 1000);\n }\n if (this.deadline > maxUint48) {\n throw new DeadlineOverLimitError(this.deadline);\n }\n\n this.hooks.push(\n TimeRangeModule.buildHook(\n {\n entityId: this.validationConfig.entityId,\n validUntil: this.deadline,\n validAfter: 0,\n },\n DefaultModuleAddress.TIME_RANGE,\n ),\n );\n }\n\n const installValidationCall = await this.compileRaw();\n\n const { typedData } = await deferralActions(\n this.client,\n ).createDeferredActionTypedDataObject({\n callData: installValidationCall,\n deadline: this.deadline,\n nonce: this.nonce,\n });\n\n const preSignatureDigest = deferralActions(\n this.client,\n ).buildPreSignatureDeferredActionDigest({ typedData });\n\n // Encode additional information to build the full pre-signature digest\n const fullPreSignatureDeferredActionDigest: `0x${string}` = `0x0${\n this.hasAssociatedExecHooks ? \"1\" : \"0\"\n }${toHex(this.nonce, {\n size: 32,\n }).slice(2)}${preSignatureDigest.slice(2)}`;\n\n return {\n typedData,\n fullPreSignatureDeferredActionDigest,\n };\n }\n\n /**\n * Compiles the raw install arguments for the installValidation function.\n *\n * @returns {Promise<Hex>} The raw install arguments.\n */\n async compileRaw(): Promise<Hex> {\n const account = this.client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n // Translate all permissions into raw hooks if >0\n if (this.permissions.length > 0) {\n const rawHooks = this.translatePermissions(\n this.validationConfig.entityId,\n );\n // Add the translated permissions as hooks\n this.addHooks(rawHooks);\n }\n this.validateConfiguration();\n\n return await installValidationActions(this.client).encodeInstallValidation({\n validationConfig: this.validationConfig,\n selectors: this.selectors,\n installData: this.installData,\n hooks: this.hooks,\n account,\n });\n }\n\n /**\n * Compiles the install arguments for the installValidation function.\n *\n * @returns {Promise<InstallValidationParams>} The install arguments.\n */\n async compileInstallArgs(): Promise<InstallValidationParams> {\n const account = this.client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n this.validateConfiguration();\n\n return {\n validationConfig: this.validationConfig,\n selectors: this.selectors,\n installData: this.installData,\n hooks: this.hooks,\n account,\n };\n }\n\n private validateConfiguration(): void {\n if (\n this.validationConfig.isGlobal === false &&\n this.selectors.length === 0\n ) {\n throw new ValidationConfigUnsetError();\n }\n }\n\n // Used to translate consolidated permissions into raw unencoded hooks\n // Note entityId will be a member object later\n private translatePermissions(entityId: number): RawHooks {\n const rawHooks: RawHooks = {\n [HookIdentifier.NATIVE_TOKEN_TRANSFER]: undefined,\n [HookIdentifier.ERC20_TOKEN_TRANSFER]: undefined,\n [HookIdentifier.GAS_LIMIT]: undefined,\n [HookIdentifier.PREVAL_ALLOWLIST]: undefined,\n };\n\n this.permissions.forEach((permission) => {\n switch (permission.type) {\n case PermissionType.NATIVE_TOKEN_TRANSFER:\n // Should never be added twice, check is on addPermission(s) too\n if (rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER] !== undefined) {\n throw new MultipleNativeTokenTransferError(permission);\n }\n rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER] = {\n hookConfig: {\n address: DefaultModuleAddress.NATIVE_TOKEN_LIMIT,\n entityId,\n hookType: HookType.EXECUTION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n spendLimit: BigInt(permission.data.allowance),\n },\n };\n this.hasAssociatedExecHooks = true;\n break;\n case PermissionType.ERC20_TOKEN_TRANSFER:\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId: entityId + HALF_UINT32,\n hookType: HookType.EXECUTION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId: entityId + HALF_UINT32,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: true,\n erc20SpendLimit: BigInt(permission.data.allowance),\n selectors: [],\n },\n ],\n },\n };\n this.hasAssociatedExecHooks = true;\n // Also allow `approve` and `transfer` for the erc20\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: true,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: [ERC20_APPROVE_SELECTOR, ERC20_TRANSFER_SELECTOR], // approve, transfer\n },\n ],\n },\n };\n break;\n case PermissionType.GAS_LIMIT:\n // Should only ever be added once, check is also on addPermission(s)\n if (rawHooks[HookIdentifier.GAS_LIMIT] !== undefined) {\n throw new MultipleGasLimitError(permission);\n }\n rawHooks[HookIdentifier.GAS_LIMIT] = {\n hookConfig: {\n address: DefaultModuleAddress.NATIVE_TOKEN_LIMIT,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n spendLimit: BigInt(permission.data.limit),\n },\n };\n break;\n case PermissionType.CONTRACT_ACCESS:\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: [],\n },\n ],\n },\n };\n break;\n case PermissionType.ACCOUNT_FUNCTIONS:\n // This is handled in add permissions\n break;\n case PermissionType.FUNCTIONS_ON_ALL_CONTRACTS:\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: zeroAddress,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: permission.data.functions,\n },\n ],\n },\n };\n break;\n case PermissionType.FUNCTIONS_ON_CONTRACT:\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: true,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: permission.data.functions,\n },\n ],\n },\n };\n break;\n case PermissionType.ROOT:\n // Root permission handled in addPermission\n break;\n default:\n return assertNever(permission, \"Unexpected permission type\");\n }\n\n // isGlobal guaranteed to be false since it's only set with root permissions,\n // we must add access to execute & executeBatch if there's a preVal allowlist hook set.\n if (rawHooks[HookIdentifier.PREVAL_ALLOWLIST] !== undefined) {\n const selectorsToAdd: `0x${string}`[] = [\n ACCOUNT_EXECUTE_SELECTOR,\n ACCOUNT_EXECUTEBATCH_SELECTOR,\n ]; // execute, executeBatch\n\n // Only add the selectors if they aren't already in this.selectors\n const newSelectors = selectorsToAdd.filter(\n (selector) => !this.selectors.includes(selector),\n );\n\n this.selectors = [...this.selectors, ...newSelectors];\n }\n });\n\n return rawHooks;\n }\n\n private addHooks(rawHooks: RawHooks) {\n const ntt = rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER];\n if (ntt) {\n this.hooks.push({\n hookConfig: ntt.hookConfig,\n initData: NativeTokenLimitModule.encodeOnInstallData(ntt.initData),\n });\n }\n\n const erc20 = rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER];\n if (erc20) {\n this.hooks.push({\n hookConfig: erc20.hookConfig,\n initData: AllowlistModule.encodeOnInstallData(erc20.initData),\n });\n }\n\n const gl = rawHooks[HookIdentifier.GAS_LIMIT];\n if (gl) {\n this.hooks.push({\n hookConfig: gl.hookConfig,\n initData: NativeTokenLimitModule.encodeOnInstallData(gl.initData),\n });\n }\n\n const allowlist = rawHooks[HookIdentifier.PREVAL_ALLOWLIST];\n if (allowlist) {\n this.hooks.push({\n hookConfig: allowlist.hookConfig,\n initData: AllowlistModule.encodeOnInstallData(allowlist.initData),\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"permissionBuilder.js","sourceRoot":"","sources":["../../../src/ma-v2/permissionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,WAAW,GAMZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAA0C,MAAM,YAAY,CAAC;AAC9E,OAAO,EACL,eAAe,GAEhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,wBAAwB,GAEzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,W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,EAAE,eAAe,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC;aAC9D,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,UAAU,EAAE,EAAE,CAAC,UAAU;gBACzB,QAAQ,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,CAAC,QAAQ,CAAC;aAClE,CAAC,CAAC;QACL,CAAC;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACd,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,SAAS,CAAC,QAAQ,CAAC;aAClE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n maxUint48,\n toHex,\n zeroAddress,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { NativeTokenLimitModule } from \"./modules/native-token-limit-module/module.js\";\nimport { SingleSignerValidationModule } from \"./modules/single-signer-validation/module.js\";\nimport { AllowlistModule } from \"./modules/allowlist-module/module.js\";\nimport { TimeRangeModule } from \"./modules/time-range-module/module.js\";\nimport { HookType, type HookConfig, type ValidationConfig } from \"./types.js\";\nimport {\n deferralActions,\n type DeferredActionTypedData,\n} from \"./decorators/deferralActions.js\";\nimport {\n installValidationActions,\n type InstallValidationParams,\n} from \"./decorators/installValidation.js\";\nimport { assertNever, AccountNotFoundError } from \"@alchemy/common\";\nimport {\n AccountAddressAsTargetError,\n DeadlineOverLimitError,\n DuplicateTargetAddressError,\n ExpiredDeadlineError,\n MultipleGasLimitError,\n MultipleNativeTokenTransferError,\n NoFunctionsProvidedError,\n RootPermissionOnlyError,\n SelectorNotAllowed,\n ValidationConfigUnsetError,\n ZeroAddressError,\n} from \"../errors/permissionBuilderErrors.js\";\nimport type { SmartAccount } from \"viem/account-abstraction\";\nimport { DefaultModuleAddress, isModularAccountV2 } from \"./utils/account.js\";\n\n// We use this to offset the ERC20 spend limit entityId\nconst HALF_UINT32 = 2147483647;\nconst ERC20_APPROVE_SELECTOR = \"0x095ea7b3\";\nconst ERC20_TRANSFER_SELECTOR = \"0xa9059cbb\";\nconst ACCOUNT_EXECUTE_SELECTOR = \"0xb61d27f6\";\nconst ACCOUNT_EXECUTEBATCH_SELECTOR = \"0x34fcd5be\";\n\n/**\n * A pseudo-enum for permission types.\n */\nexport const PermissionType = {\n NATIVE_TOKEN_TRANSFER: \"native-token-transfer\",\n ERC20_TOKEN_TRANSFER: \"erc20-token-transfer\",\n // ERC721_TOKEN_TRANSFER : \"erc721-token-transfer\", // Unimplemented\n // ERC1155_TOKEN_TRANSFER : \"erc1155-token-transfer\", // Unimplemented\n GAS_LIMIT: \"gas-limit\",\n // CALL_LIMIT : \"call-limit\", //Unimplemented\n // RATE_LIMIT : \"rate-limit\", //Unimplemented\n CONTRACT_ACCESS: \"contract-access\",\n ACCOUNT_FUNCTIONS: \"account-functions\",\n FUNCTIONS_ON_ALL_CONTRACTS: \"functions-on-all-contracts\",\n FUNCTIONS_ON_CONTRACT: \"functions-on-contract\",\n ROOT: \"root\",\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type PermissionType =\n (typeof PermissionType)[keyof typeof PermissionType];\n\n/**\n * A pseudo-enum for hook identifiers.\n */\nexport const HookIdentifier = {\n NATIVE_TOKEN_TRANSFER: \"native-token-transfer\",\n ERC20_TOKEN_TRANSFER: \"erc20-token-transfer\",\n GAS_LIMIT: \"gas-limit\",\n PREVAL_ALLOWLIST: \"preval-allowlist\", // aggregate of CONTRACT_ACCESS, ACCOUNT_FUNCTIONS, FUNCTIONS_ON_ALL_CONTRACTS, FUNCTIONS_ON_CONTRACT\n} as const;\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type HookIdentifier =\n (typeof HookIdentifier)[keyof typeof HookIdentifier];\n\ntype PreExecutionHookConfig = {\n address: Address;\n entityId: number;\n hookType: typeof HookType.EXECUTION;\n hasPreHooks: true;\n hasPostHooks: false;\n};\n\ntype PreValidationHookConfig = {\n address: Address;\n entityId: number;\n hookType: typeof HookType.VALIDATION;\n hasPreHooks: true;\n hasPostHooks: false;\n};\n\ntype RawHooks = {\n [HookIdentifier.NATIVE_TOKEN_TRANSFER]:\n | {\n hookConfig: PreExecutionHookConfig;\n initData: {\n entityId: number;\n spendLimit: bigint;\n };\n }\n | undefined;\n [HookIdentifier.ERC20_TOKEN_TRANSFER]:\n | {\n hookConfig: PreExecutionHookConfig;\n initData: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n };\n }\n | undefined;\n [HookIdentifier.GAS_LIMIT]:\n | {\n hookConfig: PreValidationHookConfig;\n initData: {\n entityId: number;\n spendLimit: bigint;\n };\n }\n | undefined;\n [HookIdentifier.PREVAL_ALLOWLIST]:\n | {\n hookConfig: PreValidationHookConfig;\n\n initData: {\n entityId: number;\n inputs: Array<{\n target: Address;\n hasSelectorAllowlist: boolean;\n hasERC20SpendLimit: boolean;\n erc20SpendLimit: bigint;\n selectors: Array<Hex>;\n }>;\n };\n }\n | undefined;\n};\n\ntype Key = {\n publicKey: Hex;\n type: \"secp256k1\" | \"contract\";\n};\n\nexport type Permission =\n | {\n // this permission allows transfer of native tokens from the account\n type: typeof PermissionType.NATIVE_TOKEN_TRANSFER;\n data: {\n allowance: Hex;\n };\n }\n | {\n // this permission allows transfer or approval of erc20 tokens from the account\n type: typeof PermissionType.ERC20_TOKEN_TRANSFER;\n data: {\n address: Address; // erc20 token contract address\n allowance: Hex;\n };\n }\n | {\n // this permissions allows the key to spend gas for UOs\n type: typeof PermissionType.GAS_LIMIT;\n data: {\n limit: Hex;\n };\n }\n | {\n // this permission grants access to all functions in a contract\n type: typeof PermissionType.CONTRACT_ACCESS;\n data: {\n address: Address;\n };\n }\n | {\n // this permission grants access to functions in the account\n type: typeof PermissionType.ACCOUNT_FUNCTIONS;\n data: {\n functions: Hex[]; // function signatures\n };\n }\n | {\n // this permission grants access to a function selector in any address or contract\n type: typeof PermissionType.FUNCTIONS_ON_ALL_CONTRACTS;\n data: {\n functions: Hex[]; // function signatures\n };\n }\n | {\n // this permission grants access to specified functions on a specific contract\n type: typeof PermissionType.FUNCTIONS_ON_CONTRACT;\n data: {\n address: Address;\n functions: Hex[];\n };\n }\n | {\n // this permission grants full access to everything\n type: typeof PermissionType.ROOT;\n data?: never;\n };\n\ntype Hook = {\n hookConfig: HookConfig;\n initData: Hex;\n};\n\n/**\n * A builder for constructing a Permission object.\n */\nexport class PermissionBuilder {\n private client: Client<Transport, Chain, SmartAccount>;\n private validationConfig: ValidationConfig = {\n moduleAddress: zeroAddress,\n entityId: 0, // uint32\n isGlobal: false,\n isSignatureValidation: false,\n isUserOpValidation: false,\n };\n private selectors: Hex[] = [];\n private installData: Hex = \"0x\";\n private permissions: Permission[] = [];\n private hooks: Hook[] = [];\n private nonce: bigint = 0n;\n private hasAssociatedExecHooks: boolean = false;\n private deadline: number = 0;\n\n /**\n * Creates a PermissionBuilder instance.\n *\n * @param {PermissionBuilderParams} params - The parameters for creating a PermissionBuilder instance.\n */\n constructor({\n client,\n key,\n entityId,\n nonce,\n selectors,\n hooks,\n deadline,\n }: {\n client: Client<Transport, Chain, SmartAccount>;\n key: Key;\n entityId: number;\n nonce: bigint;\n selectors?: Hex[];\n hooks?: Hook[];\n deadline?: number;\n }) {\n const account = client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n this.client = client;\n this.validationConfig = {\n moduleAddress: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n entityId,\n isUserOpValidation: true,\n isGlobal: false,\n isSignatureValidation: false,\n };\n this.installData = SingleSignerValidationModule.encodeOnInstallData({\n entityId: entityId,\n signer: key.publicKey,\n });\n this.nonce = nonce;\n if (selectors) this.selectors = selectors;\n if (hooks) this.hooks = hooks;\n if (deadline) this.deadline = deadline;\n }\n\n /**\n * Adds a selector to the permission builder.\n *\n * @param {Hex} selector - The selector to add.\n * @returns {this} The permission builder instance.\n */\n addSelector({ selector }: { selector: Hex }): this {\n this.selectors.push(selector);\n return this;\n }\n\n /**\n * Adds a permission to the permission builder.\n *\n * @param {Permission} permission - The permission to add.\n * @returns {this} The permission builder instance.\n */\n addPermission({ permission }: { permission: Permission }): this {\n // Check 1: If we're adding root, we can't have any other permissions\n if (permission.type === PermissionType.ROOT) {\n if (this.permissions.length !== 0) {\n throw new RootPermissionOnlyError(permission);\n }\n this.permissions.push(permission);\n // Set isGlobal to true\n this.validationConfig.isGlobal = true;\n return this;\n }\n\n // Check 2: If the permission is NOT ROOT (guaranteed), ensure there is no ROOT permission set\n // Will resolve to undefined if ROOT is not found\n // NOTE: Technically this could be replaced by checking permissions[0] since it should not be possible\n // to have >1 permission with root among them\n if (this.permissions.find((p) => p.type === PermissionType.ROOT)) {\n throw new RootPermissionOnlyError(permission);\n }\n\n // Check 3: If the permission is either CONTRACT_ACCESS or FUNCTIONS_ON_CONTRACT, ensure it doesn't collide with another like it.\n if (\n permission.type === PermissionType.CONTRACT_ACCESS ||\n permission.type === PermissionType.FUNCTIONS_ON_CONTRACT\n ) {\n // Check 3.1: address must not be the account address, or the user should use the ACCOUNT_FUNCTIONS permission\n if (permission.data.address === this.client.account.address) {\n throw new AccountAddressAsTargetError(permission);\n }\n\n // Check 3.2: there must not be an existing permission with this address as a target\n const targetAddress = permission.data.address;\n const existingPermissionWithSameAddress = this.permissions.find(\n (p) =>\n (p.type === PermissionType.CONTRACT_ACCESS &&\n \"address\" in p.data &&\n p.data.address === targetAddress) ||\n (p.type === PermissionType.FUNCTIONS_ON_CONTRACT &&\n \"address\" in p.data &&\n p.data.address === targetAddress),\n );\n\n if (existingPermissionWithSameAddress) {\n throw new DuplicateTargetAddressError(permission, targetAddress);\n }\n }\n\n // Check 4: If the permission is ACCOUNT_FUNCTIONS, add selectors\n if (permission.type === PermissionType.ACCOUNT_FUNCTIONS) {\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n // Explicitly disallow adding execute & executeBatch\n if (permission.data.functions.includes(ACCOUNT_EXECUTE_SELECTOR)) {\n throw new SelectorNotAllowed(\"execute\");\n } else if (\n permission.data.functions.includes(ACCOUNT_EXECUTEBATCH_SELECTOR)\n ) {\n throw new SelectorNotAllowed(\"executeBatch\");\n }\n this.selectors = [...this.selectors, ...permission.data.functions];\n }\n\n this.permissions.push(permission);\n return this;\n }\n\n /**\n * Adds multiple permissions to the permission builder.\n *\n * @param {Permission[]} permissions - The permissions to add.\n * @returns {this} The permission builder instance.\n */\n addPermissions({ permissions }: { permissions: Permission[] }): this {\n // We could validate each permission here, but for simplicity we'll just add them\n // A better approach would be to call addPermission for each one\n permissions.forEach((permission) => {\n this.addPermission({ permission });\n });\n return this;\n }\n\n /**\n * Compiles the deferred action typed data to sign.\n *\n * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionPayload: Hex}>} The deferred action typed data and the full pre-signature deferred action payload.\n */\n async compileDeferred(): Promise<{\n typedData: DeferredActionTypedData;\n fullPreSignatureDeferredActionPayload: Hex;\n }> {\n // Add time range module hook via expiry\n if (this.deadline !== 0) {\n if (this.deadline < Date.now() / 1000) {\n throw new ExpiredDeadlineError(this.deadline, Date.now() / 1000);\n }\n if (this.deadline > maxUint48) {\n throw new DeadlineOverLimitError(this.deadline);\n }\n\n this.hooks.push(\n TimeRangeModule.buildHook(\n {\n entityId: this.validationConfig.entityId,\n validUntil: this.deadline,\n validAfter: 0,\n },\n DefaultModuleAddress.TIME_RANGE,\n ),\n );\n }\n\n const installValidationCall = await this.compileRaw();\n\n const { typedData } = await deferralActions(\n this.client,\n ).createDeferredActionTypedDataObject({\n callData: installValidationCall,\n deadline: this.deadline,\n nonce: this.nonce,\n });\n\n const preSignaturePayload = deferralActions(\n this.client,\n ).buildPreSignatureDeferredActionPayload({ typedData });\n\n // Encode additional information to build the full pre-signature payload\n const fullPreSignatureDeferredActionPayload: `0x${string}` = `0x0${\n this.hasAssociatedExecHooks ? \"1\" : \"0\"\n }${toHex(this.nonce, {\n size: 32,\n }).slice(2)}${preSignaturePayload.slice(2)}`;\n\n return {\n typedData,\n fullPreSignatureDeferredActionPayload,\n };\n }\n\n /**\n * Compiles the raw install arguments for the installValidation function.\n *\n * @returns {Promise<Hex>} The raw install arguments.\n */\n async compileRaw(): Promise<Hex> {\n const account = this.client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n // Translate all permissions into raw hooks if >0\n if (this.permissions.length > 0) {\n const rawHooks = this.translatePermissions(\n this.validationConfig.entityId,\n );\n // Add the translated permissions as hooks\n this.addHooks(rawHooks);\n }\n this.validateConfiguration();\n\n return await installValidationActions(this.client).encodeInstallValidation({\n validationConfig: this.validationConfig,\n selectors: this.selectors,\n installData: this.installData,\n hooks: this.hooks,\n account,\n });\n }\n\n /**\n * Compiles the install arguments for the installValidation function.\n *\n * @returns {Promise<InstallValidationParams>} The install arguments.\n */\n async compileInstallArgs(): Promise<InstallValidationParams> {\n const account = this.client.account;\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n this.validateConfiguration();\n\n return {\n validationConfig: this.validationConfig,\n selectors: this.selectors,\n installData: this.installData,\n hooks: this.hooks,\n account,\n };\n }\n\n private validateConfiguration(): void {\n if (\n this.validationConfig.isGlobal === false &&\n this.selectors.length === 0\n ) {\n throw new ValidationConfigUnsetError();\n }\n }\n\n // Used to translate consolidated permissions into raw unencoded hooks\n // Note entityId will be a member object later\n private translatePermissions(entityId: number): RawHooks {\n const rawHooks: RawHooks = {\n [HookIdentifier.NATIVE_TOKEN_TRANSFER]: undefined,\n [HookIdentifier.ERC20_TOKEN_TRANSFER]: undefined,\n [HookIdentifier.GAS_LIMIT]: undefined,\n [HookIdentifier.PREVAL_ALLOWLIST]: undefined,\n };\n\n this.permissions.forEach((permission) => {\n switch (permission.type) {\n case PermissionType.NATIVE_TOKEN_TRANSFER:\n // Should never be added twice, check is on addPermission(s) too\n if (rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER] !== undefined) {\n throw new MultipleNativeTokenTransferError(permission);\n }\n rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER] = {\n hookConfig: {\n address: DefaultModuleAddress.NATIVE_TOKEN_LIMIT,\n entityId,\n hookType: HookType.EXECUTION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n spendLimit: BigInt(permission.data.allowance),\n },\n };\n this.hasAssociatedExecHooks = true;\n break;\n case PermissionType.ERC20_TOKEN_TRANSFER:\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId: entityId + HALF_UINT32,\n hookType: HookType.EXECUTION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId: entityId + HALF_UINT32,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: true,\n erc20SpendLimit: BigInt(permission.data.allowance),\n selectors: [],\n },\n ],\n },\n };\n this.hasAssociatedExecHooks = true;\n // Also allow `approve` and `transfer` for the erc20\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: true,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: [ERC20_APPROVE_SELECTOR, ERC20_TRANSFER_SELECTOR], // approve, transfer\n },\n ],\n },\n };\n break;\n case PermissionType.GAS_LIMIT:\n // Should only ever be added once, check is also on addPermission(s)\n if (rawHooks[HookIdentifier.GAS_LIMIT] !== undefined) {\n throw new MultipleGasLimitError(permission);\n }\n rawHooks[HookIdentifier.GAS_LIMIT] = {\n hookConfig: {\n address: DefaultModuleAddress.NATIVE_TOKEN_LIMIT,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n spendLimit: BigInt(permission.data.limit),\n },\n };\n break;\n case PermissionType.CONTRACT_ACCESS:\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: [],\n },\n ],\n },\n };\n break;\n case PermissionType.ACCOUNT_FUNCTIONS:\n // This is handled in add permissions\n break;\n case PermissionType.FUNCTIONS_ON_ALL_CONTRACTS:\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: zeroAddress,\n hasSelectorAllowlist: false,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: permission.data.functions,\n },\n ],\n },\n };\n break;\n case PermissionType.FUNCTIONS_ON_CONTRACT:\n if (permission.data.functions.length === 0) {\n throw new NoFunctionsProvidedError(permission);\n }\n if (permission.data.address === zeroAddress) {\n throw new ZeroAddressError(permission);\n }\n rawHooks[HookIdentifier.PREVAL_ALLOWLIST] = {\n hookConfig: {\n address: DefaultModuleAddress.ALLOWLIST,\n entityId,\n hookType: HookType.VALIDATION,\n hasPreHooks: true,\n hasPostHooks: false,\n },\n initData: {\n entityId,\n inputs: [\n // Add previous inputs if they exist\n ...(rawHooks[HookIdentifier.PREVAL_ALLOWLIST]?.initData\n .inputs || []),\n {\n target: permission.data.address,\n hasSelectorAllowlist: true,\n hasERC20SpendLimit: false,\n erc20SpendLimit: 0n,\n selectors: permission.data.functions,\n },\n ],\n },\n };\n break;\n case PermissionType.ROOT:\n // Root permission handled in addPermission\n break;\n default:\n return assertNever(permission, \"Unexpected permission type\");\n }\n\n // isGlobal guaranteed to be false since it's only set with root permissions,\n // we must add access to execute & executeBatch if there's a preVal allowlist hook set.\n if (rawHooks[HookIdentifier.PREVAL_ALLOWLIST] !== undefined) {\n const selectorsToAdd: `0x${string}`[] = [\n ACCOUNT_EXECUTE_SELECTOR,\n ACCOUNT_EXECUTEBATCH_SELECTOR,\n ]; // execute, executeBatch\n\n // Only add the selectors if they aren't already in this.selectors\n const newSelectors = selectorsToAdd.filter(\n (selector) => !this.selectors.includes(selector),\n );\n\n this.selectors = [...this.selectors, ...newSelectors];\n }\n });\n\n return rawHooks;\n }\n\n private addHooks(rawHooks: RawHooks) {\n const ntt = rawHooks[HookIdentifier.NATIVE_TOKEN_TRANSFER];\n if (ntt) {\n this.hooks.push({\n hookConfig: ntt.hookConfig,\n initData: NativeTokenLimitModule.encodeOnInstallData(ntt.initData),\n });\n }\n\n const erc20 = rawHooks[HookIdentifier.ERC20_TOKEN_TRANSFER];\n if (erc20) {\n this.hooks.push({\n hookConfig: erc20.hookConfig,\n initData: AllowlistModule.encodeOnInstallData(erc20.initData),\n });\n }\n\n const gl = rawHooks[HookIdentifier.GAS_LIMIT];\n if (gl) {\n this.hooks.push({\n hookConfig: gl.hookConfig,\n initData: NativeTokenLimitModule.encodeOnInstallData(gl.initData),\n });\n }\n\n const allowlist = rawHooks[HookIdentifier.PREVAL_ALLOWLIST];\n if (allowlist) {\n this.hooks.push({\n hookConfig: allowlist.hookConfig,\n initData: AllowlistModule.encodeOnInstallData(allowlist.initData),\n });\n }\n }\n}\n"]}
@@ -13,17 +13,17 @@ export declare const parseDeferredAction: (deferredAction: Hex) => {
13
13
  deferredActionData: Hex;
14
14
  hasAssociatedExecHooks: boolean;
15
15
  };
16
- export type BuildDeferredActionDigestParams = {
17
- fullPreSignatureDeferredActionDigest: Hex;
16
+ export type EncodeDeferredActionWithSignatureParams = {
17
+ fullPreSignatureDeferredActionPayload: Hex;
18
18
  sig: Hex;
19
19
  signaturePrefix?: SignaturePrefix;
20
20
  };
21
21
  /**
22
- * Creates the digest which must be prepended to the userOp signature.
22
+ * Encodes the deferred action with its signature, producing the payload to prepend to the userOp signature.
23
23
  *
24
24
  * Assumption: The client this extends is used to sign the typed data.
25
25
  *
26
- * @param {BuildDeferredActionDigestParams} params - The parameters for building the deferred action digest.
27
- * @returns {Hex} The encoded digest to be prepended to the userOp signature.
26
+ * @param {EncodeDeferredActionWithSignatureParams} params - The parameters for encoding the deferred action with its signature.
27
+ * @returns {Hex} The encoded payload to be prepended to the userOp signature.
28
28
  */
29
- export declare const buildDeferredActionDigest: ({ fullPreSignatureDeferredActionDigest, sig, }: BuildDeferredActionDigestParams) => Hex;
29
+ export declare const encodeDeferredActionWithSignature: ({ fullPreSignatureDeferredActionPayload, sig, }: EncodeDeferredActionWithSignatureParams) => Hex;
@@ -17,19 +17,19 @@ export const parseDeferredAction = (deferredAction) => {
17
17
  };
18
18
  };
19
19
  /**
20
- * Creates the digest which must be prepended to the userOp signature.
20
+ * Encodes the deferred action with its signature, producing the payload to prepend to the userOp signature.
21
21
  *
22
22
  * Assumption: The client this extends is used to sign the typed data.
23
23
  *
24
- * @param {BuildDeferredActionDigestParams} params - The parameters for building the deferred action digest.
25
- * @returns {Hex} The encoded digest to be prepended to the userOp signature.
24
+ * @param {EncodeDeferredActionWithSignatureParams} params - The parameters for encoding the deferred action with its signature.
25
+ * @returns {Hex} The encoded payload to be prepended to the userOp signature.
26
26
  */
27
- export const buildDeferredActionDigest = ({ fullPreSignatureDeferredActionDigest, sig, }) => {
27
+ export const encodeDeferredActionWithSignature = ({ fullPreSignatureDeferredActionPayload, sig, }) => {
28
28
  // 6492 sigs don't work here.
29
29
  const _sig = parseErc6492Signature(sig).signature;
30
30
  const sigLength = size(_sig);
31
31
  const encodedData = concatHex([
32
- fullPreSignatureDeferredActionDigest,
32
+ fullPreSignatureDeferredActionPayload,
33
33
  toHex(sigLength, { size: 4 }),
34
34
  _sig,
35
35
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"deferredActions.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils/deferredActions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,KAAK,GAEN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,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,EAAS;QAC1D,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG;KAClD,CAAC;AACJ,CAAC,CAAC;AAQF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,oCAAoC,EACpC,GAAG,GAC6B,EAAO,EAAE;IACzC,6BAA6B;IAC7B,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;IAElD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7B,MAAM,WAAW,GAAG,SAAS,CAAC;QAC5B,oCAAoC;QACpC,KAAK,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7B,IAAI;KACL,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n concatHex,\n hexToNumber,\n parseErc6492Signature,\n size,\n toHex,\n type Hex,\n} from \"viem\";\nimport { SignaturePrefix } from \"../types.js\";\n\n/**\n * Parses out the 3 components from a deferred action.\n *\n * @param {Hex} deferredAction - The deferred action to parse.\n * @returns {object} The parsed deferred action.\n */\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 Hex,\n hasAssociatedExecHooks: deferredAction[3] === \"1\",\n };\n};\n\nexport type BuildDeferredActionDigestParams = {\n fullPreSignatureDeferredActionDigest: Hex;\n sig: Hex;\n signaturePrefix?: SignaturePrefix;\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 {BuildDeferredActionDigestParams} params - The parameters for building the deferred action 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 // 6492 sigs don't work here.\n const _sig = parseErc6492Signature(sig).signature;\n\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":"deferredActions.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils/deferredActions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,KAAK,GAEN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,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,EAAS;QAC1D,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG;KAClD,CAAC;AACJ,CAAC,CAAC;AAQF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,EAChD,qCAAqC,EACrC,GAAG,GACqC,EAAO,EAAE;IACjD,6BAA6B;IAC7B,MAAM,IAAI,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;IAElD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7B,MAAM,WAAW,GAAG,SAAS,CAAC;QAC5B,qCAAqC;QACrC,KAAK,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7B,IAAI;KACL,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC","sourcesContent":["import {\n concatHex,\n hexToNumber,\n parseErc6492Signature,\n size,\n toHex,\n type Hex,\n} from \"viem\";\nimport { SignaturePrefix } from \"../types.js\";\n\n/**\n * Parses out the 3 components from a deferred action.\n *\n * @param {Hex} deferredAction - The deferred action to parse.\n * @returns {object} The parsed deferred action.\n */\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 Hex,\n hasAssociatedExecHooks: deferredAction[3] === \"1\",\n };\n};\n\nexport type EncodeDeferredActionWithSignatureParams = {\n fullPreSignatureDeferredActionPayload: Hex;\n sig: Hex;\n signaturePrefix?: SignaturePrefix;\n};\n\n/**\n * Encodes the deferred action with its signature, producing the payload to prepend to the userOp signature.\n *\n * Assumption: The client this extends is used to sign the typed data.\n *\n * @param {EncodeDeferredActionWithSignatureParams} params - The parameters for encoding the deferred action with its signature.\n * @returns {Hex} The encoded payload to be prepended to the userOp signature.\n */\nexport const encodeDeferredActionWithSignature = ({\n fullPreSignatureDeferredActionPayload,\n sig,\n}: EncodeDeferredActionWithSignatureParams): Hex => {\n // 6492 sigs don't work here.\n const _sig = parseErc6492Signature(sig).signature;\n\n const sigLength = size(_sig);\n\n const encodedData = concatHex([\n fullPreSignatureDeferredActionPayload,\n toHex(sigLength, { size: 4 }),\n _sig,\n ]);\n return encodedData;\n};\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "5.0.0-beta.20";
1
+ export declare const VERSION = "5.0.0-beta.22";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "5.0.0-beta.20";
3
+ export const VERSION = "5.0.0-beta.22";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.20\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.22\";\n"]}
@@ -43,7 +43,7 @@ export type * from "./ma-v2/types.js";
43
43
  export type * from "./ma-v2/utils/account.js";
44
44
  export { DefaultAddress, DefaultModuleAddress, DEFAULT_OWNER_ENTITY_ID, EXECUTE_USER_OP_SELECTOR, getMAV2UpgradeToData, buildFullNonceKey, serializeModuleEntity, isModularAccountV2, } from "./ma-v2/utils/account.js";
45
45
  export type * from "./ma-v2/utils/deferredActions.js";
46
- export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/deferredActions.js";
46
+ export { parseDeferredAction, encodeDeferredActionWithSignature, } from "./ma-v2/utils/deferredActions.js";
47
47
  export type * from "./ma-v2/utils/hooks.js";
48
48
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
49
49
  export type * from "./ma-v2/utils/signature.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAGhC,mBAAmB,qCAAqC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,mBAAmB,iDAAiD,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,mBAAmB,mCAAmC,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,mBAAmB,6BAA6B,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,aAAa,GACd,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,M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AAiB,EACjB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,gCAAgC,EAChC,gBAAgB,EAChB,qBAAqB,EACrB,8BAA8B,EAC9B,kBAAkB,GACnB,MAAM,qCAAqC,CAAC"}
@@ -25,7 +25,7 @@ export type CreateDeferredActionTypedDataParams = {
25
25
  deadline: number;
26
26
  nonce: bigint;
27
27
  };
28
- export type BuildPreSignatureDeferredActionDigestParams = {
28
+ export type BuildPreSignatureDeferredActionPayloadParams = {
29
29
  typedData: DeferredActionTypedData;
30
30
  };
31
31
  export type EntityIdAndNonceParams = {
@@ -36,7 +36,7 @@ export type EntityIdAndNonceParams = {
36
36
  };
37
37
  export type DeferralActions = {
38
38
  createDeferredActionTypedDataObject: (args: CreateDeferredActionTypedDataParams) => Promise<DeferredActionReturnData>;
39
- buildPreSignatureDeferredActionDigest: (args: BuildPreSignatureDeferredActionDigestParams) => Hex;
39
+ buildPreSignatureDeferredActionPayload: (args: BuildPreSignatureDeferredActionPayloadParams) => Hex;
40
40
  getEntityIdAndNonce: (args: EntityIdAndNonceParams) => Promise<{
41
41
  nonce: bigint;
42
42
  entityId: number;
@@ -46,7 +46,7 @@ export type DeferralActions = {
46
46
  * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
47
47
  *
48
48
  * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.
49
- * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildDeferredActionDigest`, and `buildUserOperationWithDeferredAction`.
49
+ * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildPreSignatureDeferredActionPayload`, and `buildUserOperationWithDeferredAction`.
50
50
  */
51
51
  export declare const deferralActions: <TTransport extends Transport = Transport, TChain extends Chain = Chain, TAccount extends SmartAccount = SmartAccount>(client: Client<TTransport, TChain, TAccount>) => DeferralActions;
52
52
  //# sourceMappingURL=deferralActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deferralActions.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/deferralActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,SAAS,EAQd,KAAK,mBAAmB,EACzB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQ7D,eAAO,MAAM,mCAAmC,y+EACw7E,CAAC;AAEz+E,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CACvD;IACE,cAAc,EAAE;QACd;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,IAAI,EAAE,SAAS,CAAA;SAAE;QAClC;YAAE,IAAI,EAAE,UAAU,CAAC;YAAC,IAAI,EAAE,QAAQ,CAAA;SAAE;QACpC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,OAAO,CAAA;SAAE;KAChC,CAAC;CACH,EACD,gBAAgB,CACjB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,uBAAuB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MA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AAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,KAC3C,eA8GF,CAAC"}
@@ -133,11 +133,11 @@ export declare class PermissionBuilder {
133
133
  /**
134
134
  * Compiles the deferred action typed data to sign.
135
135
  *
136
- * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionDigest: Hex}>} The deferred action typed data and the full pre-signature deferred action digest.
136
+ * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionPayload: Hex}>} The deferred action typed data and the full pre-signature deferred action payload.
137
137
  */
138
138
  compileDeferred(): Promise<{
139
139
  typedData: DeferredActionTypedData;
140
- fullPreSignatureDeferredActionDigest: Hex;
140
+ fullPreSignatureDeferredActionPayload: Hex;
141
141
  }>;
142
142
  /**
143
143
  * Compiles the raw install arguments for the installValidation function.
@@ -1 +1 @@
1
- {"version":3,"file":"permissionBuilder.d.ts","sourceRoot":"","sources":["../../../src/ma-v2/permissionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,SAAS,EACf,MAAM,MAAM,CAAC;AAKd,OAAO,EAAY,KAAK,UAAU,EAAyB,MAAM,YAAY,CAAC;AAC9E,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAe3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAU7D;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;CAajB,CAAC;AAGX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAGX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,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AAkB;IAChD,OAAO,CAAC,QAAQ,CAAa;IAE7B;;;;OAIG;gBACS,EACV,MAAM,EACN,GAAG,EACH,QAAQ,EACR,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;QAC/C,GAAG,EAAE,GAAG,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;QAClB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAwBD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI;IAKlD;;;;;OAKG;IACH,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI;IAmE/D;;;;;OAKG;IACH,cAAc,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,UAAU,EAAE,CAAA;KAAE,GAAG,IAAI;IASpE;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC;QAC/B,SAAS,EAAE,uBAAuB,CAAC;QACnC,qCAAqC,EAAE,GAAG,CAAC;KAC5C,CAAC;IAiDF;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAyBhC;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAiB5D,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,oBAAoB;IAgO5B,OAAO,CAAC,QAAQ;CAiCjB"}
@@ -13,18 +13,18 @@ export declare const parseDeferredAction: (deferredAction: Hex) => {
13
13
  deferredActionData: Hex;
14
14
  hasAssociatedExecHooks: boolean;
15
15
  };
16
- export type BuildDeferredActionDigestParams = {
17
- fullPreSignatureDeferredActionDigest: Hex;
16
+ export type EncodeDeferredActionWithSignatureParams = {
17
+ fullPreSignatureDeferredActionPayload: Hex;
18
18
  sig: Hex;
19
19
  signaturePrefix?: SignaturePrefix;
20
20
  };
21
21
  /**
22
- * Creates the digest which must be prepended to the userOp signature.
22
+ * Encodes the deferred action with its signature, producing the payload to prepend to the userOp signature.
23
23
  *
24
24
  * Assumption: The client this extends is used to sign the typed data.
25
25
  *
26
- * @param {BuildDeferredActionDigestParams} params - The parameters for building the deferred action digest.
27
- * @returns {Hex} The encoded digest to be prepended to the userOp signature.
26
+ * @param {EncodeDeferredActionWithSignatureParams} params - The parameters for encoding the deferred action with its signature.
27
+ * @returns {Hex} The encoded payload to be prepended to the userOp signature.
28
28
  */
29
- export declare const buildDeferredActionDigest: ({ fullPreSignatureDeferredActionDigest, sig, }: BuildDeferredActionDigestParams) => Hex;
29
+ export declare const encodeDeferredActionWithSignature: ({ fullPreSignatureDeferredActionPayload, sig, }: EncodeDeferredActionWithSignatureParams) => Hex;
30
30
  //# sourceMappingURL=deferredActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deferredActions.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/utils/deferredActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,GAAG,KAClB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,GAAG,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;CAWjC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,oCAAoC,EAAE,GAAG,CAAC;IAC1C,GAAG,EAAE,GAAG,CAAC;IACT,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,gDAGvC,+BAA+B,KAAG,GAYpC,CAAC"}
1
+ {"version":3,"file":"deferredActions.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/utils/deferredActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,GAAG,KAClB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,GAAG,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;CAWjC,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACpD,qCAAqC,EAAE,GAAG,CAAC;IAC3C,GAAG,EAAE,GAAG,CAAC;IACT,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,GAAI,iDAG/C,uCAAuC,KAAG,GAY5C,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "5.0.0-beta.20";
1
+ export declare const VERSION = "5.0.0-beta.22";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/smart-accounts",
3
- "version": "5.0.0-beta.21",
3
+ "version": "5.0.0-beta.23",
4
4
  "description": "This package contains all of the viem interfaces for Alchemy's Smart Contract Accounts",
5
5
  "author": "Alchemy",
6
6
  "license": "MIT",
@@ -39,12 +39,12 @@
39
39
  "test:run": "vitest run"
40
40
  },
41
41
  "devDependencies": {
42
- "@alchemy/aa-infra": "5.0.0-beta.21",
42
+ "@alchemy/aa-infra": "5.0.0-beta.23",
43
43
  "typescript-template": "workspace:*",
44
44
  "viem": "^2.45.0"
45
45
  },
46
46
  "dependencies": {
47
- "@alchemy/common": "5.0.0-beta.21"
47
+ "@alchemy/common": "5.0.0-beta.23"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "viem": "^2.45.0"
@@ -61,5 +61,5 @@
61
61
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
62
62
  },
63
63
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
64
- "gitHead": "f7b6c8132c10a86488ea3ebbe73dce14965fe669"
64
+ "gitHead": "1354e8caf42c7f7bf389320f75f2920c6c00876b"
65
65
  }
package/src/index.ts CHANGED
@@ -114,7 +114,7 @@ export {
114
114
  export type * from "./ma-v2/utils/deferredActions.js";
115
115
  export {
116
116
  parseDeferredAction,
117
- buildDeferredActionDigest,
117
+ encodeDeferredActionWithSignature,
118
118
  } from "./ma-v2/utils/deferredActions.js";
119
119
 
120
120
  export type * from "./ma-v2/utils/hooks.js";
@@ -45,7 +45,7 @@ export type CreateDeferredActionTypedDataParams = {
45
45
  nonce: bigint;
46
46
  };
47
47
 
48
- export type BuildPreSignatureDeferredActionDigestParams = {
48
+ export type BuildPreSignatureDeferredActionPayloadParams = {
49
49
  typedData: DeferredActionTypedData;
50
50
  };
51
51
 
@@ -60,8 +60,8 @@ export type DeferralActions = {
60
60
  createDeferredActionTypedDataObject: (
61
61
  args: CreateDeferredActionTypedDataParams,
62
62
  ) => Promise<DeferredActionReturnData>;
63
- buildPreSignatureDeferredActionDigest: (
64
- args: BuildPreSignatureDeferredActionDigestParams,
63
+ buildPreSignatureDeferredActionPayload: (
64
+ args: BuildPreSignatureDeferredActionPayloadParams,
65
65
  ) => Hex;
66
66
  getEntityIdAndNonce: (
67
67
  args: EntityIdAndNonceParams,
@@ -72,7 +72,7 @@ export type DeferralActions = {
72
72
  * Provides deferred action functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
73
73
  *
74
74
  * @param {ModularAccountV2Client} client - The client instance which provides account and sendUserOperation functionality.
75
- * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildDeferredActionDigest`, and `buildUserOperationWithDeferredAction`.
75
+ * @returns {object} - An object containing three methods: `createDeferredActionTypedDataObject`, `buildPreSignatureDeferredActionPayload`, and `buildUserOperationWithDeferredAction`.
76
76
  */
77
77
  export const deferralActions = <
78
78
  TTransport extends Transport = Transport,
@@ -114,9 +114,9 @@ export const deferralActions = <
114
114
  };
115
115
  };
116
116
 
117
- const buildPreSignatureDeferredActionDigest = ({
117
+ const buildPreSignatureDeferredActionPayload = ({
118
118
  typedData,
119
- }: BuildPreSignatureDeferredActionDigestParams): Hex => {
119
+ }: BuildPreSignatureDeferredActionPayloadParams): Hex => {
120
120
  const account = client.account;
121
121
  if (!account || !isModularAccountV2(account)) {
122
122
  throw new AccountNotFoundError();
@@ -187,7 +187,7 @@ export const deferralActions = <
187
187
 
188
188
  return {
189
189
  createDeferredActionTypedDataObject,
190
- buildPreSignatureDeferredActionDigest,
190
+ buildPreSignatureDeferredActionPayload,
191
191
  getEntityIdAndNonce,
192
192
  };
193
193
  };
@@ -384,11 +384,11 @@ export class PermissionBuilder {
384
384
  /**
385
385
  * Compiles the deferred action typed data to sign.
386
386
  *
387
- * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionDigest: Hex}>} The deferred action typed data and the full pre-signature deferred action digest.
387
+ * @returns {Promise<{typedData: DeferredActionTypedData, fullPreSignatureDeferredActionPayload: Hex}>} The deferred action typed data and the full pre-signature deferred action payload.
388
388
  */
389
389
  async compileDeferred(): Promise<{
390
390
  typedData: DeferredActionTypedData;
391
- fullPreSignatureDeferredActionDigest: Hex;
391
+ fullPreSignatureDeferredActionPayload: Hex;
392
392
  }> {
393
393
  // Add time range module hook via expiry
394
394
  if (this.deadline !== 0) {
@@ -421,20 +421,20 @@ export class PermissionBuilder {
421
421
  nonce: this.nonce,
422
422
  });
423
423
 
424
- const preSignatureDigest = deferralActions(
424
+ const preSignaturePayload = deferralActions(
425
425
  this.client,
426
- ).buildPreSignatureDeferredActionDigest({ typedData });
426
+ ).buildPreSignatureDeferredActionPayload({ typedData });
427
427
 
428
- // Encode additional information to build the full pre-signature digest
429
- const fullPreSignatureDeferredActionDigest: `0x${string}` = `0x0${
428
+ // Encode additional information to build the full pre-signature payload
429
+ const fullPreSignatureDeferredActionPayload: `0x${string}` = `0x0${
430
430
  this.hasAssociatedExecHooks ? "1" : "0"
431
431
  }${toHex(this.nonce, {
432
432
  size: 32,
433
- }).slice(2)}${preSignatureDigest.slice(2)}`;
433
+ }).slice(2)}${preSignaturePayload.slice(2)}`;
434
434
 
435
435
  return {
436
436
  typedData,
437
- fullPreSignatureDeferredActionDigest,
437
+ fullPreSignatureDeferredActionPayload,
438
438
  };
439
439
  }
440
440
 
@@ -34,31 +34,31 @@ export const parseDeferredAction = (
34
34
  };
35
35
  };
36
36
 
37
- export type BuildDeferredActionDigestParams = {
38
- fullPreSignatureDeferredActionDigest: Hex;
37
+ export type EncodeDeferredActionWithSignatureParams = {
38
+ fullPreSignatureDeferredActionPayload: Hex;
39
39
  sig: Hex;
40
40
  signaturePrefix?: SignaturePrefix;
41
41
  };
42
42
 
43
43
  /**
44
- * Creates the digest which must be prepended to the userOp signature.
44
+ * Encodes the deferred action with its signature, producing the payload to prepend to the userOp signature.
45
45
  *
46
46
  * Assumption: The client this extends is used to sign the typed data.
47
47
  *
48
- * @param {BuildDeferredActionDigestParams} params - The parameters for building the deferred action digest.
49
- * @returns {Hex} The encoded digest to be prepended to the userOp signature.
48
+ * @param {EncodeDeferredActionWithSignatureParams} params - The parameters for encoding the deferred action with its signature.
49
+ * @returns {Hex} The encoded payload to be prepended to the userOp signature.
50
50
  */
51
- export const buildDeferredActionDigest = ({
52
- fullPreSignatureDeferredActionDigest,
51
+ export const encodeDeferredActionWithSignature = ({
52
+ fullPreSignatureDeferredActionPayload,
53
53
  sig,
54
- }: BuildDeferredActionDigestParams): Hex => {
54
+ }: EncodeDeferredActionWithSignatureParams): Hex => {
55
55
  // 6492 sigs don't work here.
56
56
  const _sig = parseErc6492Signature(sig).signature;
57
57
 
58
58
  const sigLength = size(_sig);
59
59
 
60
60
  const encodedData = concatHex([
61
- fullPreSignatureDeferredActionDigest,
61
+ fullPreSignatureDeferredActionPayload,
62
62
  toHex(sigLength, { size: 4 }),
63
63
  _sig,
64
64
  ]);
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "5.0.0-beta.21";
3
+ export const VERSION = "5.0.0-beta.23";