@alchemy/smart-accounts 0.0.0-alpha.4 → 0.0.0-alpha.5

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.
@@ -1,4 +1,5 @@
1
1
  export type * from "./types.js";
2
+ export { chainHas7212 } from "./utils.js";
2
3
  export type * from "./light-account/accounts/account.js";
3
4
  export { toLightAccount } from "./light-account/accounts/account.js";
4
5
  export type * from "./light-account/accounts/multi-owner-account.js";
@@ -51,7 +52,7 @@ export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/d
51
52
  export type * from "./ma-v2/utils/hooks.js";
52
53
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
53
54
  export type * from "./ma-v2/utils/signature.js";
54
- export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, } from "./ma-v2/utils/signature.js";
55
+ export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, WEBAUTHN_DUMMY_SIGNATURE, } from "./ma-v2/utils/signature.js";
55
56
  export { EntityIdOverrideError } from "./errors/EntityIdOverrideError.js";
56
57
  export { InvalidDeferredActionNonceError } from "./errors/InvalidDeferredActionNonceError.js";
57
58
  export { InvalidEntityIdError } from "./errors/InvalidEntityIdError.js";
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { chainHas7212 } from "./utils.js";
1
2
  export { toLightAccount } from "./light-account/accounts/account.js";
2
3
  export { toMultiOwnerLightAccount } from "./light-account/accounts/multi-owner-account.js";
3
4
  export { singleOwnerLightAccountActions } from "./light-account/decorators/singleOwner.js";
@@ -29,7 +30,7 @@ export { predictModularAccountV2Address } from "./ma-v2/predictAddress.js";
29
30
  export { DefaultAddress, DefaultModuleAddress, DEFAULT_OWNER_ENTITY_ID, EXECUTE_USER_OP_SELECTOR, getMAV2UpgradeToData, buildFullNonceKey, serializeModuleEntity, isModularAccountV2, } from "./ma-v2/utils/account.js";
30
31
  export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/deferredActions.js";
31
32
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
32
- export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, } from "./ma-v2/utils/signature.js";
33
+ export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, WEBAUTHN_DUMMY_SIGNATURE, } from "./ma-v2/utils/signature.js";
33
34
  // Errors
34
35
  export { EntityIdOverrideError } from "./errors/EntityIdOverrideError.js";
35
36
  export { InvalidDeferredActionNonceError } from "./errors/InvalidDeferredActionNonceError.js";
@@ -1 +1 @@
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;AAO3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAG3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAGzF,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,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAGvF,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAGrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAA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BAA4B,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\n// TODO(v5): Something to consider for v5 - can we cut the exports for the account-specific actions\n// from the public interface, and just consume these internally with account + rely on the standard\n// bundlerClient actions for performing state writes (i.e. rotating owners)? I'm not sure it's useful\n// to consumers outside of attaching to instances of a client with the right action.\nexport type * from \"./light-account/decorators/singleOwner.js\";\nexport { singleOwnerLightAccountActions } from \"./light-account/decorators/singleOwner.js\";\n\nexport type * from \"./light-account/decorators/multiOwner.js\";\nexport { multiOwnerLightAccountActions } from \"./light-account/decorators/multiOwner.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 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/decorators/multiOwner.js\";\nexport { multiOwnerModularAccountV1Actions } from \"./ma-v1/decorators/multiOwner.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\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 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 webAuthnModularAccountV2StaticImpl,\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\";\nexport { WebAuthnValidationModule } from \"./ma-v2/modules/webauthn-validation/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 toWebAuthnSignature,\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":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAO3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAG3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAGzF,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,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAGvF,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAGrF,OAAO,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAC;AAErF,OAAO,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAI5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AAM,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\nexport { chainHas7212 } from \"./utils.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\n// TODO(v5): Something to consider for v5 - can we cut the exports for the account-specific actions\n// from the public interface, and just consume these internally with account + rely on the standard\n// bundlerClient actions for performing state writes (i.e. rotating owners)? I'm not sure it's useful\n// to consumers outside of attaching to instances of a client with the right action.\nexport type * from \"./light-account/decorators/singleOwner.js\";\nexport { singleOwnerLightAccountActions } from \"./light-account/decorators/singleOwner.js\";\n\nexport type * from \"./light-account/decorators/multiOwner.js\";\nexport { multiOwnerLightAccountActions } from \"./light-account/decorators/multiOwner.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 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/decorators/multiOwner.js\";\nexport { multiOwnerModularAccountV1Actions } from \"./ma-v1/decorators/multiOwner.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\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 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 webAuthnModularAccountV2StaticImpl,\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\";\nexport { WebAuthnValidationModule } from \"./ma-v2/modules/webauthn-validation/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 toWebAuthnSignature,\n WEBAUTHN_DUMMY_SIGNATURE,\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"]}
@@ -7,7 +7,7 @@ import { modularAccountAbi } from "../abis/modularAccountAbi.js";
7
7
  import { decodeFunctionData, getAction, isAddressEqual, sliceHex, } from "viem/utils";
8
8
  import { DEFAULT_OWNER_ENTITY_ID, DefaultModuleAddress, EXECUTE_USER_OP_SELECTOR, serializeModuleEntity, } from "../utils/account.js";
9
9
  import { parseDeferredAction } from "../utils/deferredActions.js";
10
- import { pack1271Signature, toWebAuthnSignature, toReplaySafeTypedData, packUOSignature, } from "../utils/signature.js";
10
+ import { pack1271Signature, toWebAuthnSignature, toReplaySafeTypedData, packUOSignature, WEBAUTHN_DUMMY_SIGNATURE, } from "../utils/signature.js";
11
11
  import { chainHas7212 } from "../../utils.js";
12
12
  import { InvalidDeferredActionNonceError } from "../../errors/InvalidDeferredActionNonceError.js";
13
13
  import { InvalidNonceKeyError } from "../../errors/InvalidNonceKeyError.js";
@@ -250,7 +250,7 @@ export async function toModularAccountV2Base({ client, owner, accountAddress, ge
250
250
  },
251
251
  async getStubSignature() {
252
252
  if (owner.type === "webAuthn") {
253
- return "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
253
+ return WEBAUTHN_DUMMY_SIGNATURE;
254
254
  }
255
255
  const sig = packUOSignature({
256
256
  validationSignature: "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v2/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,aAAa,EAEb,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAGf,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EAGd,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,eAAe,GAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GAChB,MAAM,uBAAuB,CAAC;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B;YAChB,iBAAiB;YACjB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type Chain,\n type Client,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n concat,\n concatHex,\n encodeFunctionData,\n hashMessage,\n hashTypedData,\n type TypedDataDefinition,\n maxUint32,\n maxUint152,\n zeroAddress,\n} from \"viem\";\nimport {\n entryPoint07Abi,\n type SmartAccountImplementation,\n type SmartAccount,\n entryPoint07Address,\n getUserOperationHash,\n toSmartAccount,\n type WebAuthnAccount,\n type ToSmartAccountParameters,\n estimateUserOperationGas,\n type UserOperation,\n} from \"viem/account-abstraction\";\nimport {\n getCode,\n readContract,\n signMessage,\n signTypedData,\n} from \"viem/actions\";\nimport { assertNever, BaseError } from \"@alchemy/common\";\nimport {\n SignaturePrefix,\n type ExecutionDataView,\n type SignerEntity,\n type ValidationDataView,\n} from \"../types.js\";\nimport { modularAccountAbi } from \"../abis/modularAccountAbi.js\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport {\n decodeFunctionData,\n getAction,\n isAddressEqual,\n sliceHex,\n} from \"viem/utils\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n DefaultModuleAddress,\n EXECUTE_USER_OP_SELECTOR,\n serializeModuleEntity,\n} from \"../utils/account.js\";\nimport { parseDeferredAction } from \"../utils/deferredActions.js\";\nimport {\n pack1271Signature,\n toWebAuthnSignature,\n toReplaySafeTypedData,\n packUOSignature,\n} from \"../utils/signature.js\";\nimport { chainHas7212 } from \"../../utils.js\";\nimport { InvalidDeferredActionNonceError } from \"../../errors/InvalidDeferredActionNonceError.js\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { InvalidEntityIdError } from \"../../errors/InvalidEntityIdError.js\";\n\nexport type ValidationDataParams =\n | {\n validationModuleAddress: Address;\n entityId?: never;\n }\n | {\n validationModuleAddress?: never;\n entityId: number;\n };\n\nexport type BaseModularAccountV2Implementation = SmartAccountImplementation<\n typeof entryPoint07Abi,\n \"0.7\",\n {\n smartAccountType: \"ModularAccountV2\";\n signerEntity: SignerEntity;\n encodeCallData: (callData: Hex) => Promise<Hex>;\n getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;\n getValidationData: (\n args: ValidationDataParams,\n ) => Promise<ValidationDataView>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n boolean\n>;\n\nexport type ModularAccountV2Base =\n SmartAccount<BaseModularAccountV2Implementation>;\n\nexport type ToModularAccountV2BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n owner: JsonRpcAccount | LocalAccount | WebAuthnAccount;\n accountAddress: Address;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n signerEntity?: SignerEntity;\n deferredAction?: Hex;\n authorization?: ToSmartAccountParameters[\"authorization\"];\n};\n\n/**\n * Creates a ModularAccountV2Base instance.\n *\n * @param {ToModularAccountV2BaseParams<TTransport>} params - The parameters for creating a ModularAccountV2Base instance.\n * @returns {Promise<ModularAccountV2Base>} A promise that resolves to a ModularAccountV2Base instance.\n */\nexport async function toModularAccountV2Base<\n TTransport extends Transport = Transport,\n>({\n client,\n owner,\n accountAddress,\n getFactoryArgs,\n signerEntity = {\n isGlobalValidation: true,\n entityId: DEFAULT_OWNER_ENTITY_ID,\n },\n deferredAction,\n authorization,\n}: ToModularAccountV2BaseParams<TTransport>): Promise<ModularAccountV2Base> {\n let { isGlobalValidation, entityId } = signerEntity;\n\n const entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address as Address,\n version: \"0.7\" as const,\n };\n\n if (entityId > Number(maxUint32)) {\n throw new InvalidEntityIdError(entityId);\n }\n\n const isAccountDeployed: () => Promise<boolean> = async () => {\n const action = getAction(client, getCode, \"getCode\");\n const code = await action({ address: accountAddress });\n return code != null && code !== \"0x\";\n };\n\n // These default values signal that we should not use the set deferred action nonce\n let nonce: bigint | undefined;\n let deferredActionData: Hex | undefined;\n let hasAssociatedExecHooks: boolean = false;\n\n if (deferredAction) {\n let deferredActionNonce = 0n;\n // We always update entity id and isGlobalValidation to the deferred action value since the client could be used to send multiple calls\n ({\n entityId,\n isGlobalValidation,\n nonce: deferredActionNonce,\n } = parseDeferredAction(deferredAction));\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n // Set these values if the deferred action has not been consumed. We check this with the EP.\n const nextNonceForDeferredAction: bigint = await readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, deferredActionNonce >> 64n],\n });\n\n if (deferredActionNonce === nextNonceForDeferredAction) {\n ({ nonce, deferredActionData, hasAssociatedExecHooks } =\n parseDeferredAction(deferredAction));\n } else if (deferredActionNonce > nextNonceForDeferredAction) {\n // if nonce is greater than the next nonce, its invalid, so we throw\n throw new InvalidDeferredActionNonceError();\n }\n }\n\n const getNonce = async (\n params?: { key?: bigint | undefined } | undefined,\n ): Promise<bigint> => {\n if (nonce) {\n const tempNonce = nonce;\n nonce = undefined; // set to falsy value once used\n return tempNonce;\n }\n\n const nonceKey = params?.key ?? 0n;\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const fullNonceKey =\n (nonceKey << 40n) +\n (BigInt(entityId) << 8n) +\n (isGlobalValidation ? 1n : 0n);\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n return readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, fullNonceKey],\n });\n };\n\n const accountContract = {\n address: accountAddress,\n abi: modularAccountAbi,\n };\n\n const getExecutionData = async (selector: Hex) => {\n if (!(await isAccountDeployed())) {\n return {\n module: zeroAddress,\n skipRuntimeValidation: false,\n allowGlobalValidation: false,\n executionHooks: [],\n };\n }\n\n return readContract(client, {\n ...accountContract,\n functionName: \"getExecutionData\",\n args: [selector],\n });\n };\n\n const getValidationData = async (args: ValidationDataParams) => {\n if (!(await isAccountDeployed())) {\n return {\n validationHooks: [],\n executionHooks: [],\n selectors: [],\n validationFlags: 0,\n };\n }\n\n const { validationModuleAddress, entityId } = args;\n const readContractAction = getAction(client, readContract, \"readContract\");\n return readContractAction({\n ...accountContract,\n functionName: \"getValidationData\",\n args: [\n serializeModuleEntity({\n moduleAddress: validationModuleAddress ?? zeroAddress,\n entityId: entityId ?? Number(maxUint32),\n }),\n ],\n });\n };\n\n const encodeCallData = async (callData: Hex): Promise<Hex> => {\n const validationData = await getValidationData({\n entityId: Number(entityId),\n });\n if (hasAssociatedExecHooks) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n if (validationData.executionHooks.length) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n return callData;\n };\n\n const prepareSignature = async (\n request: SignatureRequest,\n ): Promise<Extract<SignatureRequest, { type: \"eth_signTypedData_v4\" }>> => {\n const isDeferredAction =\n request.type === \"eth_signTypedData_v4\" &&\n request.data?.primaryType === \"DeferredAction\" &&\n request.data?.domain?.verifyingContract === accountAddress;\n\n if (isDeferredAction && entityId === DEFAULT_OWNER_ENTITY_ID) {\n return request;\n }\n\n const hash =\n request.type === \"personal_sign\"\n ? hashMessage(request.data)\n : request.type === \"eth_signTypedData_v4\"\n ? hashTypedData(request.data)\n : assertNever(request, \"Unexpected signature request type\");\n\n return {\n type: \"eth_signTypedData_v4\",\n data: toReplaySafeTypedData({\n chainId: client.chain.id,\n hash,\n ...(owner.type === \"webAuthn\"\n ? {\n address: DefaultModuleAddress.WEBAUTHN_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }\n : entityId === DEFAULT_OWNER_ENTITY_ID\n ? { address: accountAddress }\n : {\n address: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }),\n }),\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return pack1271Signature({\n entityId,\n validationSignaturePrefix:\n owner.type === \"webAuthn\" ? null : SignaturePrefix.EOA,\n validationSignature: signature,\n });\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n getNonce,\n authorization,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (calls.length === 1) {\n const call = calls[0];\n\n if (isAddressEqual(call.to, accountAddress)) {\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n\n if (call.data === undefined) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return encodeCallData(call.data);\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n }),\n );\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n data: call.data ?? \"0x\",\n value: call.value ?? 0n,\n })),\n ],\n }),\n );\n },\n\n async decodeCalls(data) {\n // Inverse of `encodeCalls`.\n // Trim the EXECUTE_USER_OP_SELECTOR if it is present.\n const trimmedData = data\n .toLowerCase()\n .startsWith(EXECUTE_USER_OP_SELECTOR.toLowerCase())\n ? sliceHex(data, 4)\n : data;\n\n const decoded = decodeFunctionData({\n abi: modularAccountAbi,\n data: trimmedData,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n if (owner.type === \"webAuthn\") {\n return \"0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000\";\n }\n\n const sig = packUOSignature({\n validationSignature:\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n });\n return deferredActionData ? concatHex([deferredActionData, sig]) : sig;\n },\n\n async signMessage({ message }) {\n const { data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return formatSignature(signature);\n },\n\n async signTypedData(td) {\n const isDeferredAction =\n td.primaryType === \"DeferredAction\" &&\n td.domain &&\n typeof td.domain === \"object\" &&\n \"verifyingContract\" in td.domain &&\n td.domain.verifyingContract === accountAddress;\n\n const { data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: td as TypedDataDefinition, // TODO(v5): Try harder to satisfy this w/o casting.\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return isDeferredAction\n ? validationSignature\n : formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return isDeferredAction\n ? concat([SignaturePrefix.EOA, signature])\n : formatSignature(signature);\n },\n\n async signUserOperation(uo) {\n const hash = getUserOperationHash({\n chainId: uo.chainId ?? client.chain.id,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...uo,\n sender: accountAddress,\n },\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({\n hash: hashMessage({ raw: hash }),\n }),\n );\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, validationSignature])\n : validationSignature;\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n return concatHex([\"0xff\", signature]);\n }\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const validationSignature = await signMessageAction({\n account: owner,\n message: { raw: hash },\n });\n\n const packedSignature = packUOSignature({\n validationSignature,\n });\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, packedSignature])\n : packedSignature;\n\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n\n return signature;\n },\n\n userOperation: {\n estimateGas: async (uo) => {\n if (owner.type !== \"webAuthn\") {\n // Uses the default gas estimator.\n // Note that we get 7702 support automatically from Viem.\n return undefined;\n }\n\n const estimateGasAction = getAction(\n client,\n estimateUserOperationGas,\n \"estimateUserOperationGas\",\n );\n\n const estimate = await estimateGasAction({\n ...(uo as UserOperation<typeof entryPoint.version>),\n entryPointAddress: entryPoint.address,\n });\n\n const buffer = (await chainHas7212(client)) ? 10000n : 300000n;\n\n // TODO(v4): iterate numbers. Aim to have ~1000 gas buffer to account for longer authenticatorDatas and clientDataJSONs.\n return {\n ...estimate,\n verificationGasLimit: estimate.verificationGasLimit + buffer,\n };\n },\n },\n\n extend: {\n smartAccountType: \"ModularAccountV2\" as const,\n signerEntity: {\n entityId,\n isGlobalValidation,\n },\n encodeCallData,\n getExecutionData,\n getValidationData,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/ma-v2/accounts/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,aAAa,EAEb,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EAGf,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EAGd,wBAAwB,GAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,eAAe,GAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,C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kBAAkB;gBAClC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;gBAClD,CAAC,CAAC,eAAe,CAAC;YAEpB,kBAAkB,GAAG,SAAS,CAAC,CAAC,kBAAkB;YAClD,sBAAsB,GAAG,KAAK,CAAC,CAAC,+BAA+B;YAE/D,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,aAAa,EAAE;YACb,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;gBACxB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBAC9B,kCAAkC;oBAClC,yDAAyD;oBACzD,OAAO,SAAS,CAAC;gBACnB,CAAC;gBAED,MAAM,iBAAiB,GAAG,SAAS,CACjC,MAAM,EACN,wBAAwB,EACxB,0BAA0B,CAC3B,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC;oBACvC,GAAI,EAA+C;oBACnD,iBAAiB,EAAE,UAAU,CAAC,OAAO;iBACtC,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAG,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;gBAE/D,wHAAwH;gBACxH,OAAO;oBACL,GAAG,QAAQ;oBACX,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,GAAG,MAAM;iBAC7D,CAAC;YACJ,CAAC;SACF;QAED,MAAM,EAAE;YACN,gBAAgB,EAAE,kBAA2B;YAC7C,YAAY,EAAE;gBACZ,QAAQ;gBACR,kBAAkB;aACnB;YACD,cAAc;YACd,gBAAgB;YAChB,iBAAiB;YACjB,gBAAgB;YAChB,eAAe;SAChB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n type Address,\n type Hex,\n type Chain,\n type Client,\n type JsonRpcAccount,\n type LocalAccount,\n type Transport,\n concat,\n concatHex,\n encodeFunctionData,\n hashMessage,\n hashTypedData,\n type TypedDataDefinition,\n maxUint32,\n maxUint152,\n zeroAddress,\n} from \"viem\";\nimport {\n entryPoint07Abi,\n type SmartAccountImplementation,\n type SmartAccount,\n entryPoint07Address,\n getUserOperationHash,\n toSmartAccount,\n type WebAuthnAccount,\n type ToSmartAccountParameters,\n estimateUserOperationGas,\n type UserOperation,\n} from \"viem/account-abstraction\";\nimport {\n getCode,\n readContract,\n signMessage,\n signTypedData,\n} from \"viem/actions\";\nimport { assertNever, BaseError } from \"@alchemy/common\";\nimport {\n SignaturePrefix,\n type ExecutionDataView,\n type SignerEntity,\n type ValidationDataView,\n} from \"../types.js\";\nimport { modularAccountAbi } from \"../abis/modularAccountAbi.js\";\nimport type { SignatureRequest } from \"../../types.js\";\nimport {\n decodeFunctionData,\n getAction,\n isAddressEqual,\n sliceHex,\n} from \"viem/utils\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n DefaultModuleAddress,\n EXECUTE_USER_OP_SELECTOR,\n serializeModuleEntity,\n} from \"../utils/account.js\";\nimport { parseDeferredAction } from \"../utils/deferredActions.js\";\nimport {\n pack1271Signature,\n toWebAuthnSignature,\n toReplaySafeTypedData,\n packUOSignature,\n WEBAUTHN_DUMMY_SIGNATURE,\n} from \"../utils/signature.js\";\nimport { chainHas7212 } from \"../../utils.js\";\nimport { InvalidDeferredActionNonceError } from \"../../errors/InvalidDeferredActionNonceError.js\";\nimport { InvalidNonceKeyError } from \"../../errors/InvalidNonceKeyError.js\";\nimport { InvalidEntityIdError } from \"../../errors/InvalidEntityIdError.js\";\n\nexport type ValidationDataParams =\n | {\n validationModuleAddress: Address;\n entityId?: never;\n }\n | {\n validationModuleAddress?: never;\n entityId: number;\n };\n\nexport type BaseModularAccountV2Implementation = SmartAccountImplementation<\n typeof entryPoint07Abi,\n \"0.7\",\n {\n smartAccountType: \"ModularAccountV2\";\n signerEntity: SignerEntity;\n encodeCallData: (callData: Hex) => Promise<Hex>;\n getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;\n getValidationData: (\n args: ValidationDataParams,\n ) => Promise<ValidationDataView>;\n prepareSignature: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSignature: (signature: Hex) => Promise<Hex>;\n },\n boolean\n>;\n\nexport type ModularAccountV2Base =\n SmartAccount<BaseModularAccountV2Implementation>;\n\nexport type ToModularAccountV2BaseParams<\n TTransport extends Transport = Transport,\n> = {\n client: Client<TTransport, Chain, JsonRpcAccount | LocalAccount | undefined>;\n owner: JsonRpcAccount | LocalAccount | WebAuthnAccount;\n accountAddress: Address;\n getFactoryArgs: () => Promise<{\n factory?: Address | undefined;\n factoryData?: Hex | undefined;\n }>;\n signerEntity?: SignerEntity;\n deferredAction?: Hex;\n authorization?: ToSmartAccountParameters[\"authorization\"];\n};\n\n/**\n * Creates a ModularAccountV2Base instance.\n *\n * @param {ToModularAccountV2BaseParams<TTransport>} params - The parameters for creating a ModularAccountV2Base instance.\n * @returns {Promise<ModularAccountV2Base>} A promise that resolves to a ModularAccountV2Base instance.\n */\nexport async function toModularAccountV2Base<\n TTransport extends Transport = Transport,\n>({\n client,\n owner,\n accountAddress,\n getFactoryArgs,\n signerEntity = {\n isGlobalValidation: true,\n entityId: DEFAULT_OWNER_ENTITY_ID,\n },\n deferredAction,\n authorization,\n}: ToModularAccountV2BaseParams<TTransport>): Promise<ModularAccountV2Base> {\n let { isGlobalValidation, entityId } = signerEntity;\n\n const entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address as Address,\n version: \"0.7\" as const,\n };\n\n if (entityId > Number(maxUint32)) {\n throw new InvalidEntityIdError(entityId);\n }\n\n const isAccountDeployed: () => Promise<boolean> = async () => {\n const action = getAction(client, getCode, \"getCode\");\n const code = await action({ address: accountAddress });\n return code != null && code !== \"0x\";\n };\n\n // These default values signal that we should not use the set deferred action nonce\n let nonce: bigint | undefined;\n let deferredActionData: Hex | undefined;\n let hasAssociatedExecHooks: boolean = false;\n\n if (deferredAction) {\n let deferredActionNonce = 0n;\n // We always update entity id and isGlobalValidation to the deferred action value since the client could be used to send multiple calls\n ({\n entityId,\n isGlobalValidation,\n nonce: deferredActionNonce,\n } = parseDeferredAction(deferredAction));\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n // Set these values if the deferred action has not been consumed. We check this with the EP.\n const nextNonceForDeferredAction: bigint = await readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, deferredActionNonce >> 64n],\n });\n\n if (deferredActionNonce === nextNonceForDeferredAction) {\n ({ nonce, deferredActionData, hasAssociatedExecHooks } =\n parseDeferredAction(deferredAction));\n } else if (deferredActionNonce > nextNonceForDeferredAction) {\n // if nonce is greater than the next nonce, its invalid, so we throw\n throw new InvalidDeferredActionNonceError();\n }\n }\n\n const getNonce = async (\n params?: { key?: bigint | undefined } | undefined,\n ): Promise<bigint> => {\n if (nonce) {\n const tempNonce = nonce;\n nonce = undefined; // set to falsy value once used\n return tempNonce;\n }\n\n const nonceKey = params?.key ?? 0n;\n\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const fullNonceKey =\n (nonceKey << 40n) +\n (BigInt(entityId) << 8n) +\n (isGlobalValidation ? 1n : 0n);\n\n const readContractAction = getAction(client, readContract, \"readContract\");\n\n return readContractAction({\n ...entryPoint,\n functionName: \"getNonce\",\n args: [accountAddress, fullNonceKey],\n });\n };\n\n const accountContract = {\n address: accountAddress,\n abi: modularAccountAbi,\n };\n\n const getExecutionData = async (selector: Hex) => {\n if (!(await isAccountDeployed())) {\n return {\n module: zeroAddress,\n skipRuntimeValidation: false,\n allowGlobalValidation: false,\n executionHooks: [],\n };\n }\n\n return readContract(client, {\n ...accountContract,\n functionName: \"getExecutionData\",\n args: [selector],\n });\n };\n\n const getValidationData = async (args: ValidationDataParams) => {\n if (!(await isAccountDeployed())) {\n return {\n validationHooks: [],\n executionHooks: [],\n selectors: [],\n validationFlags: 0,\n };\n }\n\n const { validationModuleAddress, entityId } = args;\n const readContractAction = getAction(client, readContract, \"readContract\");\n return readContractAction({\n ...accountContract,\n functionName: \"getValidationData\",\n args: [\n serializeModuleEntity({\n moduleAddress: validationModuleAddress ?? zeroAddress,\n entityId: entityId ?? Number(maxUint32),\n }),\n ],\n });\n };\n\n const encodeCallData = async (callData: Hex): Promise<Hex> => {\n const validationData = await getValidationData({\n entityId: Number(entityId),\n });\n if (hasAssociatedExecHooks) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n if (validationData.executionHooks.length) {\n return concatHex([EXECUTE_USER_OP_SELECTOR, callData]);\n }\n return callData;\n };\n\n const prepareSignature = async (\n request: SignatureRequest,\n ): Promise<Extract<SignatureRequest, { type: \"eth_signTypedData_v4\" }>> => {\n const isDeferredAction =\n request.type === \"eth_signTypedData_v4\" &&\n request.data?.primaryType === \"DeferredAction\" &&\n request.data?.domain?.verifyingContract === accountAddress;\n\n if (isDeferredAction && entityId === DEFAULT_OWNER_ENTITY_ID) {\n return request;\n }\n\n const hash =\n request.type === \"personal_sign\"\n ? hashMessage(request.data)\n : request.type === \"eth_signTypedData_v4\"\n ? hashTypedData(request.data)\n : assertNever(request, \"Unexpected signature request type\");\n\n return {\n type: \"eth_signTypedData_v4\",\n data: toReplaySafeTypedData({\n chainId: client.chain.id,\n hash,\n ...(owner.type === \"webAuthn\"\n ? {\n address: DefaultModuleAddress.WEBAUTHN_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }\n : entityId === DEFAULT_OWNER_ENTITY_ID\n ? { address: accountAddress }\n : {\n address: DefaultModuleAddress.SINGLE_SIGNER_VALIDATION,\n salt: concatHex([`0x${\"00\".repeat(12)}`, accountAddress]),\n }),\n }),\n };\n };\n\n const formatSignature = async (signature: Hex): Promise<Hex> => {\n return pack1271Signature({\n entityId,\n validationSignaturePrefix:\n owner.type === \"webAuthn\" ? null : SignaturePrefix.EOA,\n validationSignature: signature,\n });\n };\n\n return await toSmartAccount({\n getFactoryArgs,\n client,\n entryPoint,\n getNonce,\n authorization,\n\n async getAddress() {\n return accountAddress;\n },\n\n async encodeCalls(calls) {\n if (calls.length === 1) {\n const call = calls[0];\n\n if (isAddressEqual(call.to, accountAddress)) {\n // If the call is to the account itself, we need to avoid wrapping it in an `execute` call.\n\n if (call.data === undefined) {\n throw new BaseError(\"Data is required for an account self-call.\");\n }\n\n return encodeCallData(call.data);\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n }),\n );\n }\n\n return encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n target: call.to,\n data: call.data ?? \"0x\",\n value: call.value ?? 0n,\n })),\n ],\n }),\n );\n },\n\n async decodeCalls(data) {\n // Inverse of `encodeCalls`.\n // Trim the EXECUTE_USER_OP_SELECTOR if it is present.\n const trimmedData = data\n .toLowerCase()\n .startsWith(EXECUTE_USER_OP_SELECTOR.toLowerCase())\n ? sliceHex(data, 4)\n : data;\n\n const decoded = decodeFunctionData({\n abi: modularAccountAbi,\n data: trimmedData,\n });\n\n if (decoded.functionName === \"execute\") {\n return [\n {\n to: decoded.args[0],\n value: decoded.args[1],\n data: decoded.args[2],\n },\n ];\n }\n\n if (decoded.functionName === \"executeBatch\") {\n return decoded.args[0].map((call) => ({\n to: call.target,\n value: call.value,\n data: call.data,\n }));\n }\n\n // If the data is not for an `execute` or `executeBatch` call, we treat it as a single call to the account itself.\n return [\n {\n to: accountAddress,\n data,\n },\n ];\n },\n\n async getStubSignature() {\n if (owner.type === \"webAuthn\") {\n return WEBAUTHN_DUMMY_SIGNATURE;\n }\n\n const sig = packUOSignature({\n validationSignature:\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n });\n return deferredActionData ? concatHex([deferredActionData, sig]) : sig;\n },\n\n async signMessage({ message }) {\n const { data } = await prepareSignature({\n type: \"personal_sign\",\n data: message,\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return formatSignature(signature);\n },\n\n async signTypedData(td) {\n const isDeferredAction =\n td.primaryType === \"DeferredAction\" &&\n td.domain &&\n typeof td.domain === \"object\" &&\n \"verifyingContract\" in td.domain &&\n td.domain.verifyingContract === accountAddress;\n\n const { data } = await prepareSignature({\n type: \"eth_signTypedData_v4\",\n data: td as TypedDataDefinition, // TODO(v5): Try harder to satisfy this w/o casting.\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({ hash: hashTypedData(data) }),\n );\n return isDeferredAction\n ? validationSignature\n : formatSignature(validationSignature);\n }\n\n const action = getAction(client, signTypedData, \"signTypedData\");\n\n const signature = await action({\n ...data,\n account: owner,\n });\n\n return isDeferredAction\n ? concat([SignaturePrefix.EOA, signature])\n : formatSignature(signature);\n },\n\n async signUserOperation(uo) {\n const hash = getUserOperationHash({\n chainId: uo.chainId ?? client.chain.id,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...uo,\n sender: accountAddress,\n },\n });\n\n if (owner.type === \"webAuthn\") {\n const validationSignature = toWebAuthnSignature(\n await owner.sign({\n hash: hashMessage({ raw: hash }),\n }),\n );\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, validationSignature])\n : validationSignature;\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n return concatHex([\"0xff\", signature]);\n }\n\n const signMessageAction = getAction(client, signMessage, \"signMessage\");\n\n const validationSignature = await signMessageAction({\n account: owner,\n message: { raw: hash },\n });\n\n const packedSignature = packUOSignature({\n validationSignature,\n });\n\n const signature = deferredActionData\n ? concatHex([deferredActionData, packedSignature])\n : packedSignature;\n\n deferredActionData = undefined; // clear once used\n hasAssociatedExecHooks = false; // set to falsy value once used\n\n return signature;\n },\n\n userOperation: {\n estimateGas: async (uo) => {\n if (owner.type !== \"webAuthn\") {\n // Uses the default gas estimator.\n // Note that we get 7702 support automatically from Viem.\n return undefined;\n }\n\n const estimateGasAction = getAction(\n client,\n estimateUserOperationGas,\n \"estimateUserOperationGas\",\n );\n\n const estimate = await estimateGasAction({\n ...(uo as UserOperation<typeof entryPoint.version>),\n entryPointAddress: entryPoint.address,\n });\n\n const buffer = (await chainHas7212(client)) ? 10000n : 300000n;\n\n // TODO(v4): iterate numbers. Aim to have ~1000 gas buffer to account for longer authenticatorDatas and clientDataJSONs.\n return {\n ...estimate,\n verificationGasLimit: estimate.verificationGasLimit + buffer,\n };\n },\n },\n\n extend: {\n smartAccountType: \"ModularAccountV2\" as const,\n signerEntity: {\n entityId,\n isGlobalValidation,\n },\n encodeCallData,\n getExecutionData,\n getValidationData,\n prepareSignature,\n formatSignature,\n },\n });\n}\n"]}
@@ -61,3 +61,7 @@ export declare function toWebAuthnSignature({ webauthn, signature, }: {
61
61
  webauthn: WebAuthnP256.SignMetadata;
62
62
  signature: Hex;
63
63
  }): `0x${string}`;
64
+ /**
65
+ * A dummy WebAuthn signature used for gas estimation.
66
+ */
67
+ export declare const WEBAUTHN_DUMMY_SIGNATURE = "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
@@ -81,4 +81,8 @@ export function toWebAuthnSignature({ webauthn, signature, }) {
81
81
  },
82
82
  ]);
83
83
  }
84
+ /**
85
+ * A dummy WebAuthn signature used for gas estimation.
86
+ */
87
+ export const WEBAUTHN_DUMMY_SIGNATURE = "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
84
88
  //# sourceMappingURL=signature.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature.js","sourceRoot":"","sources":["../../../../src/ma-v2/utils/signature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAqB,MAAM,IAAI,CAAC;AAOlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC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E;gBACV,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC5C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC3C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;gBACtC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC9B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B;SACF;KACF,EACD;QACE;YACE,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;YAC7C,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC/C,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACrC,CAAC;YACD,CAAC;SACF;KACF,CACF,CAAC;AACJ,CAAC","sourcesContent":["import {\n concatHex,\n encodeAbiParameters,\n toHex,\n type Address,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { SignaturePrefix } from \"../types.js\";\nimport { Signature, type WebAuthnP256 } from \"ox\";\n\nexport type PackUOSignatureParams = {\n // orderedHookData: HookData[];\n validationSignature: Hex;\n};\n\n/**\n * Signature packing utility for user operations.\n *\n * @param {PackUOSignatureParams} params - The parameters for packing a user operation signature.\n * @returns {Hex} The packed user operation signature.\n */\nexport const packUOSignature = ({\n // orderedHookData, TODO: integrate in next iteration of MAv2 sdk\n validationSignature,\n}: PackUOSignatureParams): Hex => {\n return concatHex([\"0xFF\", \"0x00\", validationSignature]);\n};\n\n// TODO(v4): direct call validation 1271\nexport type Pack1271SignatureParams = {\n entityId: number;\n validationSignaturePrefix: SignaturePrefix | null;\n validationSignature: Hex;\n};\n\n/**\n * Signature packing utility for 1271 signatures.\n *\n * @param {Pack1271SignatureParams} params - The parameters for packing a 1271 signature.\n * @returns {Hex} The packed 1271 signature.\n */\nexport const pack1271Signature = ({\n entityId,\n validationSignaturePrefix,\n validationSignature,\n}: Pack1271SignatureParams): Hex => {\n return concatHex([\n \"0x00\",\n toHex(entityId, { size: 4 }),\n \"0xFF\",\n ...(validationSignaturePrefix ? [validationSignaturePrefix] : []),\n validationSignature,\n ]);\n};\n\n/**\n * Converts a hash to a replay safe typed data.\n *\n * @param {ToReplaySafeTypedDataParams} params - The parameters for converting a hash to a replay safe typed data.\n * @returns {object} The replay safe typed data.\n */\nexport function toReplaySafeTypedData({\n address,\n chainId,\n hash,\n salt,\n}: {\n address: Address;\n chainId: number;\n hash: Hash;\n salt?: Hex;\n}) {\n return {\n domain: {\n chainId,\n verifyingContract: address,\n ...(salt ? { salt } : {}),\n },\n types: {\n ReplaySafeHash: [{ name: \"hash\", type: \"bytes32\" }],\n },\n message: {\n hash,\n },\n primaryType: \"ReplaySafeHash\" as const,\n };\n}\n/**\n * Wraps a P256 signature with the webauthn metadata.\n *\n * @param {ToWebAuthnSignatureParams} params - The parameters for wrapping a P256 signature with the webauthn metadata.\n * @returns {object} The wrapped P256 signature.\n */\nexport function toWebAuthnSignature({\n webauthn,\n signature,\n}: {\n webauthn: WebAuthnP256.SignMetadata;\n signature: Hex;\n}) {\n const { r, s } = Signature.fromHex(signature);\n return encodeAbiParameters(\n [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"authenticatorData\", type: \"bytes\" },\n { name: \"clientDataJSON\", type: \"string\" },\n { name: \"challengeIndex\", type: \"uint256\" },\n { name: \"typeIndex\", type: \"uint256\" },\n { name: \"r\", type: \"uint256\" },\n { name: \"s\", type: \"uint256\" },\n ],\n },\n ],\n [\n {\n authenticatorData: webauthn.authenticatorData,\n clientDataJSON: webauthn.clientDataJSON,\n challengeIndex: BigInt(webauthn.challengeIndex),\n typeIndex: BigInt(webauthn.typeIndex),\n r,\n s,\n },\n ],\n );\n}\n"]}
1
+ {"version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AAE,gBAAyB;KACvC,CAAC;AACJ,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,GAIV;IACC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,OAAO,mBAAmB,CACxB;QACE;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;YACb,UAAU,EAAE;gBACV,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC5C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1C,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC3C,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;gBACtC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC9B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;aAC/B;SACF;KACF,EACD;QACE;YACE,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;YAC7C,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YAC/C,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACrC,CAAC;YACD,CAAC;SACF;KACF,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,sgCAAsgC,CAAC","sourcesContent":["import {\n concatHex,\n encodeAbiParameters,\n toHex,\n type Address,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { SignaturePrefix } from \"../types.js\";\nimport { Signature, type WebAuthnP256 } from \"ox\";\n\nexport type PackUOSignatureParams = {\n // orderedHookData: HookData[];\n validationSignature: Hex;\n};\n\n/**\n * Signature packing utility for user operations.\n *\n * @param {PackUOSignatureParams} params - The parameters for packing a user operation signature.\n * @returns {Hex} The packed user operation signature.\n */\nexport const packUOSignature = ({\n // orderedHookData, TODO: integrate in next iteration of MAv2 sdk\n validationSignature,\n}: PackUOSignatureParams): Hex => {\n return concatHex([\"0xFF\", \"0x00\", validationSignature]);\n};\n\n// TODO(v4): direct call validation 1271\nexport type Pack1271SignatureParams = {\n entityId: number;\n validationSignaturePrefix: SignaturePrefix | null;\n validationSignature: Hex;\n};\n\n/**\n * Signature packing utility for 1271 signatures.\n *\n * @param {Pack1271SignatureParams} params - The parameters for packing a 1271 signature.\n * @returns {Hex} The packed 1271 signature.\n */\nexport const pack1271Signature = ({\n entityId,\n validationSignaturePrefix,\n validationSignature,\n}: Pack1271SignatureParams): Hex => {\n return concatHex([\n \"0x00\",\n toHex(entityId, { size: 4 }),\n \"0xFF\",\n ...(validationSignaturePrefix ? [validationSignaturePrefix] : []),\n validationSignature,\n ]);\n};\n\n/**\n * Converts a hash to a replay safe typed data.\n *\n * @param {ToReplaySafeTypedDataParams} params - The parameters for converting a hash to a replay safe typed data.\n * @returns {object} The replay safe typed data.\n */\nexport function toReplaySafeTypedData({\n address,\n chainId,\n hash,\n salt,\n}: {\n address: Address;\n chainId: number;\n hash: Hash;\n salt?: Hex;\n}) {\n return {\n domain: {\n chainId,\n verifyingContract: address,\n ...(salt ? { salt } : {}),\n },\n types: {\n ReplaySafeHash: [{ name: \"hash\", type: \"bytes32\" }],\n },\n message: {\n hash,\n },\n primaryType: \"ReplaySafeHash\" as const,\n };\n}\n/**\n * Wraps a P256 signature with the webauthn metadata.\n *\n * @param {ToWebAuthnSignatureParams} params - The parameters for wrapping a P256 signature with the webauthn metadata.\n * @returns {object} The wrapped P256 signature.\n */\nexport function toWebAuthnSignature({\n webauthn,\n signature,\n}: {\n webauthn: WebAuthnP256.SignMetadata;\n signature: Hex;\n}) {\n const { r, s } = Signature.fromHex(signature);\n return encodeAbiParameters(\n [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"authenticatorData\", type: \"bytes\" },\n { name: \"clientDataJSON\", type: \"string\" },\n { name: \"challengeIndex\", type: \"uint256\" },\n { name: \"typeIndex\", type: \"uint256\" },\n { name: \"r\", type: \"uint256\" },\n { name: \"s\", type: \"uint256\" },\n ],\n },\n ],\n [\n {\n authenticatorData: webauthn.authenticatorData,\n clientDataJSON: webauthn.clientDataJSON,\n challengeIndex: BigInt(webauthn.challengeIndex),\n typeIndex: BigInt(webauthn.typeIndex),\n r,\n s,\n },\n ],\n );\n}\n\n/**\n * A dummy WebAuthn signature used for gas estimation.\n */\nexport const WEBAUTHN_DUMMY_SIGNATURE =\n \"0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000\";\n"]}
@@ -1,5 +1,13 @@
1
1
  import { type Client, type Hex } from "viem";
2
2
  import type { UserOperation } from "viem/account-abstraction";
3
+ /**
4
+ * Checks if the current chain supports RIP-7212 (precompiled contract for secp256r1 curve operations).
5
+ * This is used to determine if the chain has native support for P256 signature verification,
6
+ * which is commonly used in WebAuthn/passkey implementations.
7
+ *
8
+ * @param {Client} client - The viem client to use for the check
9
+ * @returns {Promise<boolean>} True if the chain supports RIP-7212, false otherwise
10
+ */
3
11
  export declare const chainHas7212: (client: Client) => Promise<boolean>;
4
12
  export declare function packAccountGasLimits(data: Pick<UserOperation, "verificationGasLimit" | "callGasLimit"> | Pick<UserOperation, "maxPriorityFeePerGas" | "maxFeePerGas">): Hex;
5
13
  export declare function packPaymasterData({ paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit, paymasterData, }: Pick<UserOperation, "paymaster" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit" | "paymasterData">): Hex;
package/dist/esm/utils.js CHANGED
@@ -3,6 +3,14 @@ import { call } from "viem/actions";
3
3
  import { getAction } from "viem/utils";
4
4
  import { BaseError } from "@alchemy/common";
5
5
  const RIP_7212_CHECK_BYTECODE = "0x60806040526040517f532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25815260056020820152600160408201527f4a03ef9f92eb268cafa601072489a56380fa0dc43171d7712813b3a19a1eb5e560608201527f3e213e28a608ce9a2f4a17fd830c6654018a79b3e0263d91a8ba90622df6f2f0608082015260208160a0836101005afa503d5f823e3d81f3fe";
6
+ /**
7
+ * Checks if the current chain supports RIP-7212 (precompiled contract for secp256r1 curve operations).
8
+ * This is used to determine if the chain has native support for P256 signature verification,
9
+ * which is commonly used in WebAuthn/passkey implementations.
10
+ *
11
+ * @param {Client} client - The viem client to use for the check
12
+ * @returns {Promise<boolean>} True if the chain supports RIP-7212, false otherwise
13
+ */
6
14
  export const chainHas7212 = async (client) => {
7
15
  const callAction = getAction(client, call, "call");
8
16
  const { data } = await callAction({
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAY,KAAK,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,SAA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CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IAE/D,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;IAC1C,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;IAEhD,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,OAAO;YACV,OAAO,CAAC,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,KAAK,MAAM;YACT,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1E,KAAK,OAAO,CAAC;QACb;YACE,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { type Client, concat, type Hex, toHex } from \"viem\";\nimport { call } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\nimport type { UserOperation } from \"viem/account-abstraction\";\nimport { BaseError } from \"@alchemy/common\";\n\nconst RIP_7212_CHECK_BYTECODE =\n \"0x60806040526040517f532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25815260056020820152600160408201527f4a03ef9f92eb268cafa601072489a56380fa0dc43171d7712813b3a19a1eb5e560608201527f3e213e28a608ce9a2f4a17fd830c6654018a79b3e0263d91a8ba90622df6f2f0608082015260208160a0836101005afa503d5f823e3d81f3fe\";\n\nexport const chainHas7212 = async (client: Client): Promise<boolean> => {\n const callAction = getAction(client, call, \"call\");\n\n const { data } = await callAction({\n data: RIP_7212_CHECK_BYTECODE,\n });\n\n return data ? BigInt(data) === 1n : false;\n};\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperation, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperation, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">,\n): Hex {\n return concat(Object.values(data).map((v) => toHex(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperation,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n toHex(paymasterVerificationGasLimit, { size: 16 }),\n toHex(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport const bigIntMultiply = (\n base: number | bigint | Hex,\n multiplier: number,\n roundingMode: \"ROUND\" | \"FLOOR\" | \"CEIL\" = \"CEIL\",\n) => {\n if (Number.isInteger(multiplier)) {\n return BigInt(base) * BigInt(multiplier);\n }\n\n const multiplierStr = multiplier.toString();\n const decimalPlaces = multiplierStr.split(\".\")[1]?.length ?? 0;\n\n if (decimalPlaces > 4) {\n throw new BaseError(\"bigIntMultiply max precision is 4 decimal places.\");\n }\n\n const scale = BigInt(10 ** decimalPlaces);\n const scaledMultiplier = BigInt(multiplierStr.replace(\".\", \"\"));\n const product = BigInt(base) * scaledMultiplier;\n\n switch (roundingMode) {\n case \"ROUND\":\n return (product + scale / 2n) / scale;\n case \"CEIL\":\n return product >= 0n ? (product + scale - 1n) / scale : product / scale;\n case \"FLOOR\":\n default:\n return product >= 0n ? product / scale : (product - scale + 1n) / scale;\n }\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAY,KAAK,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,uBAAuB,GAC3B,sTAAsT,CAAC;AAEzT;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAc,EAAoB,EAAE;IACrE,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC;QAChC,IAAI,EAAE,uBAAuB;KAC9B,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAClC,IAEgE;IAEhE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM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O,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,KAAK,MAAM;YACT,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1E,KAAK,OAAO,CAAC;QACb;YACE,OAAO,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { type Client, concat, type Hex, toHex } from \"viem\";\nimport { call } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\nimport type { UserOperation } from \"viem/account-abstraction\";\nimport { BaseError } from \"@alchemy/common\";\n\nconst RIP_7212_CHECK_BYTECODE =\n \"0x60806040526040517f532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25815260056020820152600160408201527f4a03ef9f92eb268cafa601072489a56380fa0dc43171d7712813b3a19a1eb5e560608201527f3e213e28a608ce9a2f4a17fd830c6654018a79b3e0263d91a8ba90622df6f2f0608082015260208160a0836101005afa503d5f823e3d81f3fe\";\n\n/**\n * Checks if the current chain supports RIP-7212 (precompiled contract for secp256r1 curve operations).\n * This is used to determine if the chain has native support for P256 signature verification,\n * which is commonly used in WebAuthn/passkey implementations.\n *\n * @param {Client} client - The viem client to use for the check\n * @returns {Promise<boolean>} True if the chain supports RIP-7212, false otherwise\n */\nexport const chainHas7212 = async (client: Client): Promise<boolean> => {\n const callAction = getAction(client, call, \"call\");\n\n const { data } = await callAction({\n data: RIP_7212_CHECK_BYTECODE,\n });\n\n return data ? BigInt(data) === 1n : false;\n};\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperation, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperation, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">,\n): Hex {\n return concat(Object.values(data).map((v) => toHex(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperation,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n toHex(paymasterVerificationGasLimit, { size: 16 }),\n toHex(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport const bigIntMultiply = (\n base: number | bigint | Hex,\n multiplier: number,\n roundingMode: \"ROUND\" | \"FLOOR\" | \"CEIL\" = \"CEIL\",\n) => {\n if (Number.isInteger(multiplier)) {\n return BigInt(base) * BigInt(multiplier);\n }\n\n const multiplierStr = multiplier.toString();\n const decimalPlaces = multiplierStr.split(\".\")[1]?.length ?? 0;\n\n if (decimalPlaces > 4) {\n throw new BaseError(\"bigIntMultiply max precision is 4 decimal places.\");\n }\n\n const scale = BigInt(10 ** decimalPlaces);\n const scaledMultiplier = BigInt(multiplierStr.replace(\".\", \"\"));\n const product = BigInt(base) * scaledMultiplier;\n\n switch (roundingMode) {\n case \"ROUND\":\n return (product + scale / 2n) / scale;\n case \"CEIL\":\n return product >= 0n ? (product + scale - 1n) / scale : product / scale;\n case \"FLOOR\":\n default:\n return product >= 0n ? product / scale : (product - scale + 1n) / scale;\n }\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  export type * from "./types.js";
2
+ export { chainHas7212 } from "./utils.js";
2
3
  export type * from "./light-account/accounts/account.js";
3
4
  export { toLightAccount } from "./light-account/accounts/account.js";
4
5
  export type * from "./light-account/accounts/multi-owner-account.js";
@@ -51,7 +52,7 @@ export { parseDeferredAction, buildDeferredActionDigest, } from "./ma-v2/utils/d
51
52
  export type * from "./ma-v2/utils/hooks.js";
52
53
  export { serializeValidationConfig, serializeHookConfig, } from "./ma-v2/utils/hooks.js";
53
54
  export type * from "./ma-v2/utils/signature.js";
54
- export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, } from "./ma-v2/utils/signature.js";
55
+ export { packUOSignature, pack1271Signature, toReplaySafeTypedData, toWebAuthnSignature, WEBAUTHN_DUMMY_SIGNATURE, } from "./ma-v2/utils/signature.js";
55
56
  export { EntityIdOverrideError } from "./errors/EntityIdOverrideError.js";
56
57
  export { InvalidDeferredActionNonceError } from "./errors/InvalidDeferredActionNonceError.js";
57
58
  export { InvalidEntityIdError } from "./errors/InvalidEntityIdError.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;AAM3F,mBAAmB,2CAA2C,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAE3F,mBAAmB,0CAA0C,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,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,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4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BAAsB,sBAAsB,CAC1C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,EACA,MAAM,EACN,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAGC,EACD,cAAc,EACd,aAAa,GACd,EAAE,4BAA4B,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAmb1E"}
@@ -61,4 +61,8 @@ export declare function toWebAuthnSignature({ webauthn, signature, }: {
61
61
  webauthn: WebAuthnP256.SignMetadata;
62
62
  signature: Hex;
63
63
  }): `0x${string}`;
64
+ /**
65
+ * A dummy WebAuthn signature used for gas estimation.
66
+ */
67
+ export declare const WEBAUTHN_DUMMY_SIGNATURE = "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
64
68
  //# sourceMappingURL=signature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/ma-v2/utils/signature.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C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GAKG;AACH,eAAO,MAAM,eAAe,GAAI,0BAG7B,qBAAqB,KAAG,GAE1B,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB,EAAE,eAAe,GAAG,IAAI,CAAC;IAClD,mBAAmB,EAAE,GAAG,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,+DAI/B,uBAAuB,KAAG,GAQ5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,GACL,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;;;;;;;;;;;;;;;;EAeA;AACD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC;CAChB,iBA4BA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,ygCACm+B,CAAC"}
@@ -1,5 +1,13 @@
1
1
  import { type Client, type Hex } from "viem";
2
2
  import type { UserOperation } from "viem/account-abstraction";
3
+ /**
4
+ * Checks if the current chain supports RIP-7212 (precompiled contract for secp256r1 curve operations).
5
+ * This is used to determine if the chain has native support for P256 signature verification,
6
+ * which is commonly used in WebAuthn/passkey implementations.
7
+ *
8
+ * @param {Client} client - The viem client to use for the check
9
+ * @returns {Promise<boolean>} True if the chain supports RIP-7212, false otherwise
10
+ */
3
11
  export declare const chainHas7212: (client: Client) => Promise<boolean>;
4
12
  export declare function packAccountGasLimits(data: Pick<UserOperation, "verificationGasLimit" | "callGasLimit"> | Pick<UserOperation, "maxPriorityFeePerGas" | "maxFeePerGas">): Hex;
5
13
  export declare function packPaymasterData({ paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit, paymasterData, }: Pick<UserOperation, "paymaster" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit" | "paymasterData">): Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAU,KAAK,GAAG,EAAS,MAAM,MAAM,CAAC;AAG5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D,eAAO,MAAM,YAAY,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAQlE,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,IAAI,EACA,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,cAAc,CAAC,GAC5D,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,cAAc,CAAC,GAC/D,GAAG,CAEL;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GACd,EAAE,IAAI,CACL,aAAa,EACX,WAAW,GACX,+BAA+B,GAC/B,yBAAyB,GACzB,eAAe,CAClB,GAAG,GAAG,CAeN;AAED,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,EAC3B,YAAY,MAAM,EAClB,eAAc,OAAO,GAAG,OAAO,GAAG,MAAe,WA0BlD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAU,KAAK,GAAG,EAAS,MAAM,MAAM,CAAC;AAG5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAQlE,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,IAAI,EACA,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,cAAc,CAAC,GAC5D,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,cAAc,CAAC,GAC/D,GAAG,CAEL;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,6BAA6B,EAC7B,uBAAuB,EACvB,aAAa,GACd,EAAE,IAAI,CACL,aAAa,EACX,WAAW,GACX,+BAA+B,GAC/B,yBAAyB,GACzB,eAAe,CAClB,GAAG,GAAG,CAeN;AAED,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,EAC3B,YAAY,MAAM,EAClB,eAAc,OAAO,GAAG,OAAO,GAAG,MAAe,WA0BlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/smart-accounts",
3
- "version": "0.0.0-alpha.4",
3
+ "version": "0.0.0-alpha.5",
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,11 +39,11 @@
39
39
  "test:run": "vitest run"
40
40
  },
41
41
  "devDependencies": {
42
- "@alchemy/aa-infra": "0.0.0-alpha.4",
42
+ "@alchemy/aa-infra": "0.0.0-alpha.5",
43
43
  "typescript-template": "*"
44
44
  },
45
45
  "dependencies": {
46
- "@alchemy/common": "0.0.0-alpha.4",
46
+ "@alchemy/common": "0.0.0-alpha.5",
47
47
  "ox": "^0.9.6",
48
48
  "viem": "^2.32.0"
49
49
  },
@@ -59,5 +59,5 @@
59
59
  "url": "https://github.com/alchemyplatform/aa-sdk/issues"
60
60
  },
61
61
  "homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
62
- "gitHead": "3f0cb50e82c2bab35468f5b3ce3fbe700ea58a1f"
62
+ "gitHead": "ab29ae32b4dd4688a2edd348d730c7a0b6de5f40"
63
63
  }
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export type * from "./types.js";
2
2
 
3
+ export { chainHas7212 } from "./utils.js";
4
+
3
5
  // LightAccount
4
6
  export type * from "./light-account/accounts/account.js";
5
7
  export { toLightAccount } from "./light-account/accounts/account.js";
@@ -129,6 +131,7 @@ export {
129
131
  pack1271Signature,
130
132
  toReplaySafeTypedData,
131
133
  toWebAuthnSignature,
134
+ WEBAUTHN_DUMMY_SIGNATURE,
132
135
  } from "./ma-v2/utils/signature.js";
133
136
 
134
137
  // Errors
@@ -61,6 +61,7 @@ import {
61
61
  toWebAuthnSignature,
62
62
  toReplaySafeTypedData,
63
63
  packUOSignature,
64
+ WEBAUTHN_DUMMY_SIGNATURE,
64
65
  } from "../utils/signature.js";
65
66
  import { chainHas7212 } from "../../utils.js";
66
67
  import { InvalidDeferredActionNonceError } from "../../errors/InvalidDeferredActionNonceError.js";
@@ -410,7 +411,7 @@ export async function toModularAccountV2Base<
410
411
 
411
412
  async getStubSignature() {
412
413
  if (owner.type === "webAuthn") {
413
- return "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
414
+ return WEBAUTHN_DUMMY_SIGNATURE;
414
415
  }
415
416
 
416
417
  const sig = packUOSignature({
@@ -127,3 +127,9 @@ export function toWebAuthnSignature({
127
127
  ],
128
128
  );
129
129
  }
130
+
131
+ /**
132
+ * A dummy WebAuthn signature used for gas estimation.
133
+ */
134
+ export const WEBAUTHN_DUMMY_SIGNATURE =
135
+ "0xff000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000";
package/src/utils.ts CHANGED
@@ -7,6 +7,14 @@ import { BaseError } from "@alchemy/common";
7
7
  const RIP_7212_CHECK_BYTECODE =
8
8
  "0x60806040526040517f532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25815260056020820152600160408201527f4a03ef9f92eb268cafa601072489a56380fa0dc43171d7712813b3a19a1eb5e560608201527f3e213e28a608ce9a2f4a17fd830c6654018a79b3e0263d91a8ba90622df6f2f0608082015260208160a0836101005afa503d5f823e3d81f3fe";
9
9
 
10
+ /**
11
+ * Checks if the current chain supports RIP-7212 (precompiled contract for secp256r1 curve operations).
12
+ * This is used to determine if the chain has native support for P256 signature verification,
13
+ * which is commonly used in WebAuthn/passkey implementations.
14
+ *
15
+ * @param {Client} client - The viem client to use for the check
16
+ * @returns {Promise<boolean>} True if the chain supports RIP-7212, false otherwise
17
+ */
10
18
  export const chainHas7212 = async (client: Client): Promise<boolean> => {
11
19
  const callAction = getAction(client, call, "call");
12
20