@alchemy/smart-accounts 0.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/esm/errors/EntityIdOverrideError.d.ts +11 -0
- package/dist/esm/errors/EntityIdOverrideError.js +19 -0
- package/dist/esm/errors/EntityIdOverrideError.js.map +1 -0
- package/dist/esm/errors/InvalidDeferredActionNonceError.d.ts +11 -0
- package/dist/esm/errors/InvalidDeferredActionNonceError.js +19 -0
- package/dist/esm/errors/InvalidDeferredActionNonceError.js.map +1 -0
- package/dist/esm/errors/InvalidEntityIdError.d.ts +13 -0
- package/dist/esm/errors/InvalidEntityIdError.js +21 -0
- package/dist/esm/errors/InvalidEntityIdError.js.map +1 -0
- package/dist/esm/errors/InvalidNonceKeyError.d.ts +13 -0
- package/dist/esm/errors/InvalidNonceKeyError.js +21 -0
- package/dist/esm/errors/InvalidNonceKeyError.js.map +1 -0
- package/dist/esm/errors/InvalidOwnerError.d.ts +13 -0
- package/dist/esm/errors/InvalidOwnerError.js +21 -0
- package/dist/esm/errors/InvalidOwnerError.js.map +1 -0
- package/dist/esm/errors/permissionBuilderErrors.d.ts +150 -0
- package/dist/esm/errors/permissionBuilderErrors.js +233 -0
- package/dist/esm/errors/permissionBuilderErrors.js.map +1 -0
- package/dist/esm/index.d.ts +59 -0
- package/dist/esm/index.js +40 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v1.d.ts +532 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v1.js +379 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v1.js.map +1 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v2.d.ts +491 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v2.js +355 -0
- package/dist/esm/light-account/abis/LightAccountAbi_v2.js.map +1 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v1.d.ts +55 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v1.js +75 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v1.js.map +1 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v2.d.ts +256 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v2.js +210 -0
- package/dist/esm/light-account/abis/LightAccountFactoryAbi_v2.js.map +1 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountAbi.d.ts +507 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountAbi.js +372 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountAbi.js.map +1 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountFactoryAbi.d.ts +286 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountFactoryAbi.js +229 -0
- package/dist/esm/light-account/abis/MultiOwnerLightAccountFactoryAbi.js.map +1 -0
- package/dist/esm/light-account/abis/OZ_ERC1967Proxy.d.ts +13 -0
- package/dist/esm/light-account/abis/OZ_ERC1967Proxy.js +20 -0
- package/dist/esm/light-account/abis/OZ_ERC1967Proxy.js.map +1 -0
- package/dist/esm/light-account/accounts/account.d.ts +22 -0
- package/dist/esm/light-account/accounts/account.js +86 -0
- package/dist/esm/light-account/accounts/account.js.map +1 -0
- package/dist/esm/light-account/accounts/base.d.ts +28 -0
- package/dist/esm/light-account/accounts/base.js +170 -0
- package/dist/esm/light-account/accounts/base.js.map +1 -0
- package/dist/esm/light-account/accounts/calldataCodec.d.ts +3 -0
- package/dist/esm/light-account/accounts/calldataCodec.js +74 -0
- package/dist/esm/light-account/accounts/calldataCodec.js.map +1 -0
- package/dist/esm/light-account/accounts/multi-owner-account.d.ts +20 -0
- package/dist/esm/light-account/accounts/multi-owner-account.js +79 -0
- package/dist/esm/light-account/accounts/multi-owner-account.js.map +1 -0
- package/dist/esm/light-account/decorators/multiOwner.d.ts +17 -0
- package/dist/esm/light-account/decorators/multiOwner.js +38 -0
- package/dist/esm/light-account/decorators/multiOwner.js.map +1 -0
- package/dist/esm/light-account/decorators/singleOwner.d.ts +16 -0
- package/dist/esm/light-account/decorators/singleOwner.js +35 -0
- package/dist/esm/light-account/decorators/singleOwner.js.map +1 -0
- package/dist/esm/light-account/lightAccountStaticImpl.d.ts +24 -0
- package/dist/esm/light-account/lightAccountStaticImpl.js +112 -0
- package/dist/esm/light-account/lightAccountStaticImpl.js.map +1 -0
- package/dist/esm/light-account/predictAddress.d.ts +35 -0
- package/dist/esm/light-account/predictAddress.js +113 -0
- package/dist/esm/light-account/predictAddress.js.map +1 -0
- package/dist/esm/light-account/registry.d.ts +7115 -0
- package/dist/esm/light-account/registry.js +18 -0
- package/dist/esm/light-account/registry.js.map +1 -0
- package/dist/esm/light-account/utils.d.ts +1454 -0
- package/dist/esm/light-account/utils.js +65 -0
- package/dist/esm/light-account/utils.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.js +8 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/ma-v1/abis/IStandardExecutor.d.ts +50 -0
- package/dist/esm/ma-v1/abis/IStandardExecutor.js +32 -0
- package/dist/esm/ma-v1/abis/IStandardExecutor.js.map +1 -0
- package/dist/esm/ma-v1/abis/MultiOwnerModularAccountFactory.d.ts +234 -0
- package/dist/esm/ma-v1/abis/MultiOwnerModularAccountFactory.js +191 -0
- package/dist/esm/ma-v1/abis/MultiOwnerModularAccountFactory.js.map +1 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPlugin.d.ts +698 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPlugin.js +529 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPlugin.js.map +1 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPluginExecutionFunction.d.ts +67 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPluginExecutionFunction.js +38 -0
- package/dist/esm/ma-v1/abis/MultiOwnerPluginExecutionFunction.js.map +1 -0
- package/dist/esm/ma-v1/abis/UpgradeableModularAccount.d.ts +880 -0
- package/dist/esm/ma-v1/abis/UpgradeableModularAccount.js +646 -0
- package/dist/esm/ma-v1/abis/UpgradeableModularAccount.js.map +1 -0
- package/dist/esm/ma-v1/account.d.ts +16 -0
- package/dist/esm/ma-v1/account.js +17 -0
- package/dist/esm/ma-v1/account.js.map +1 -0
- package/dist/esm/ma-v1/accounts/base.d.ts +29 -0
- package/dist/esm/ma-v1/accounts/base.js +150 -0
- package/dist/esm/ma-v1/accounts/base.js.map +1 -0
- package/dist/esm/ma-v1/accounts/multi-owner-account.d.ts +22 -0
- package/dist/esm/ma-v1/accounts/multi-owner-account.js +101 -0
- package/dist/esm/ma-v1/accounts/multi-owner-account.js.map +1 -0
- package/dist/esm/ma-v1/decorators/multiOwner.d.ts +17 -0
- package/dist/esm/ma-v1/decorators/multiOwner.js +38 -0
- package/dist/esm/ma-v1/decorators/multiOwner.js.map +1 -0
- package/dist/esm/ma-v1/mav1StaticImpl.d.ts +15 -0
- package/dist/esm/ma-v1/mav1StaticImpl.js +38 -0
- package/dist/esm/ma-v1/mav1StaticImpl.js.map +1 -0
- package/dist/esm/ma-v1/predictAddress.d.ts +28 -0
- package/dist/esm/ma-v1/predictAddress.js +51 -0
- package/dist/esm/ma-v1/predictAddress.js.map +1 -0
- package/dist/esm/ma-v2/abis/accountFactoryAbi.d.ts +348 -0
- package/dist/esm/ma-v2/abis/accountFactoryAbi.js +645 -0
- package/dist/esm/ma-v2/abis/accountFactoryAbi.js.map +1 -0
- package/dist/esm/ma-v2/abis/entityIdAndNonceReader.d.ts +9 -0
- package/dist/esm/ma-v2/abis/entityIdAndNonceReader.js +24 -0
- package/dist/esm/ma-v2/abis/entityIdAndNonceReader.js.map +1 -0
- package/dist/esm/ma-v2/abis/modularAccountAbi.d.ts +954 -0
- package/dist/esm/ma-v2/abis/modularAccountAbi.js +1242 -0
- package/dist/esm/ma-v2/abis/modularAccountAbi.js.map +1 -0
- package/dist/esm/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts +991 -0
- package/dist/esm/ma-v2/abis/semiModularAccountBytecodeAbi.js +1289 -0
- package/dist/esm/ma-v2/abis/semiModularAccountBytecodeAbi.js.map +1 -0
- package/dist/esm/ma-v2/abis/semiModularAccountStorageAbi.d.ts +1001 -0
- package/dist/esm/ma-v2/abis/semiModularAccountStorageAbi.js +1302 -0
- package/dist/esm/ma-v2/abis/semiModularAccountStorageAbi.js.map +1 -0
- package/dist/esm/ma-v2/abis/webAuthnFactoryAbi.d.ts +330 -0
- package/dist/esm/ma-v2/abis/webAuthnFactoryAbi.js +260 -0
- package/dist/esm/ma-v2/abis/webAuthnFactoryAbi.js.map +1 -0
- package/dist/esm/ma-v2/accounts/account.d.ts +32 -0
- package/dist/esm/ma-v2/accounts/account.js +134 -0
- package/dist/esm/ma-v2/accounts/account.js.map +1 -0
- package/dist/esm/ma-v2/accounts/base.d.ts +40 -0
- package/dist/esm/ma-v2/accounts/base.js +371 -0
- package/dist/esm/ma-v2/accounts/base.js.map +1 -0
- package/dist/esm/ma-v2/decorators/deferralActions.d.ts +51 -0
- package/dist/esm/ma-v2/decorators/deferralActions.js +100 -0
- package/dist/esm/ma-v2/decorators/deferralActions.js.map +1 -0
- package/dist/esm/ma-v2/decorators/installValidation.d.ts +71 -0
- package/dist/esm/ma-v2/decorators/installValidation.js +137 -0
- package/dist/esm/ma-v2/decorators/installValidation.js.map +1 -0
- package/dist/esm/ma-v2/mav2StaticImpl.d.ts +37 -0
- package/dist/esm/ma-v2/mav2StaticImpl.js +88 -0
- package/dist/esm/ma-v2/mav2StaticImpl.js.map +1 -0
- package/dist/esm/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts +556 -0
- package/dist/esm/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.js +716 -0
- package/dist/esm/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/allowlist-module/module.d.ts +593 -0
- package/dist/esm/ma-v2/modules/allowlist-module/module.js +70 -0
- package/dist/esm/ma-v2/modules/allowlist-module/module.js.map +1 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts +312 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js +404 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/module.d.ts +322 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/module.js +14 -0
- package/dist/esm/ma-v2/modules/native-token-limit-module/module.js.map +1 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts +186 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js +242 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/module.d.ts +196 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/module.js +25 -0
- package/dist/esm/ma-v2/modules/paymaster-guard-module/module.js.map +1 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts +45 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js +331 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/module.d.ts +10 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/module.js +16 -0
- package/dist/esm/ma-v2/modules/single-signer-validation/module.js.map +1 -0
- package/dist/esm/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts +229 -0
- package/dist/esm/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.js +296 -0
- package/dist/esm/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/time-range-module/module.d.ts +254 -0
- package/dist/esm/ma-v2/modules/time-range-module/module.js +62 -0
- package/dist/esm/ma-v2/modules/time-range-module/module.js.map +1 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts +287 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.js +374 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.js.map +1 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/module.d.ts +11 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/module.js +16 -0
- package/dist/esm/ma-v2/modules/webauthn-validation/module.js.map +1 -0
- package/dist/esm/ma-v2/permissionBuilder.d.ts +158 -0
- package/dist/esm/ma-v2/permissionBuilder.js +557 -0
- package/dist/esm/ma-v2/permissionBuilder.js.map +1 -0
- package/dist/esm/ma-v2/predictAddress.d.ts +37 -0
- package/dist/esm/ma-v2/predictAddress.js +73 -0
- package/dist/esm/ma-v2/predictAddress.js.map +1 -0
- package/dist/esm/ma-v2/types.d.ts +57 -0
- package/dist/esm/ma-v2/types.js +9 -0
- package/dist/esm/ma-v2/types.js.map +1 -0
- package/dist/esm/ma-v2/utils/account.d.ts +85 -0
- package/dist/esm/ma-v2/utils/account.js +96 -0
- package/dist/esm/ma-v2/utils/account.js.map +1 -0
- package/dist/esm/ma-v2/utils/deferredActions.d.ts +29 -0
- package/dist/esm/ma-v2/utils/deferredActions.js +38 -0
- package/dist/esm/ma-v2/utils/deferredActions.js.map +1 -0
- package/dist/esm/ma-v2/utils/hooks.d.ts +55 -0
- package/dist/esm/ma-v2/utils/hooks.js +78 -0
- package/dist/esm/ma-v2/utils/hooks.js.map +1 -0
- package/dist/esm/ma-v2/utils/signature.d.ts +63 -0
- package/dist/esm/ma-v2/utils/signature.js +84 -0
- package/dist/esm/ma-v2/utils/signature.js.map +1 -0
- package/dist/esm/test-utils/getAccountAddressViaEntryPoint.d.ts +18 -0
- package/dist/esm/test-utils/getAccountAddressViaEntryPoint.js +31 -0
- package/dist/esm/test-utils/getAccountAddressViaEntryPoint.js.map +1 -0
- package/dist/esm/types.d.ts +30 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.d.ts +6 -0
- package/dist/esm/utils.js +52 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +4 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/errors/EntityIdOverrideError.d.ts +12 -0
- package/dist/types/errors/EntityIdOverrideError.d.ts.map +1 -0
- package/dist/types/errors/InvalidDeferredActionNonceError.d.ts +12 -0
- package/dist/types/errors/InvalidDeferredActionNonceError.d.ts.map +1 -0
- package/dist/types/errors/InvalidEntityIdError.d.ts +14 -0
- package/dist/types/errors/InvalidEntityIdError.d.ts.map +1 -0
- package/dist/types/errors/InvalidNonceKeyError.d.ts +14 -0
- package/dist/types/errors/InvalidNonceKeyError.d.ts.map +1 -0
- package/dist/types/errors/InvalidOwnerError.d.ts +14 -0
- package/dist/types/errors/InvalidOwnerError.d.ts.map +1 -0
- package/dist/types/errors/permissionBuilderErrors.d.ts +151 -0
- package/dist/types/errors/permissionBuilderErrors.d.ts.map +1 -0
- package/dist/types/index.d.ts +60 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/light-account/abis/LightAccountAbi_v1.d.ts +533 -0
- package/dist/types/light-account/abis/LightAccountAbi_v1.d.ts.map +1 -0
- package/dist/types/light-account/abis/LightAccountAbi_v2.d.ts +492 -0
- package/dist/types/light-account/abis/LightAccountAbi_v2.d.ts.map +1 -0
- package/dist/types/light-account/abis/LightAccountFactoryAbi_v1.d.ts +56 -0
- package/dist/types/light-account/abis/LightAccountFactoryAbi_v1.d.ts.map +1 -0
- package/dist/types/light-account/abis/LightAccountFactoryAbi_v2.d.ts +257 -0
- package/dist/types/light-account/abis/LightAccountFactoryAbi_v2.d.ts.map +1 -0
- package/dist/types/light-account/abis/MultiOwnerLightAccountAbi.d.ts +508 -0
- package/dist/types/light-account/abis/MultiOwnerLightAccountAbi.d.ts.map +1 -0
- package/dist/types/light-account/abis/MultiOwnerLightAccountFactoryAbi.d.ts +287 -0
- package/dist/types/light-account/abis/MultiOwnerLightAccountFactoryAbi.d.ts.map +1 -0
- package/dist/types/light-account/abis/OZ_ERC1967Proxy.d.ts +14 -0
- package/dist/types/light-account/abis/OZ_ERC1967Proxy.d.ts.map +1 -0
- package/dist/types/light-account/accounts/account.d.ts +23 -0
- package/dist/types/light-account/accounts/account.d.ts.map +1 -0
- package/dist/types/light-account/accounts/base.d.ts +29 -0
- package/dist/types/light-account/accounts/base.d.ts.map +1 -0
- package/dist/types/light-account/accounts/calldataCodec.d.ts +4 -0
- package/dist/types/light-account/accounts/calldataCodec.d.ts.map +1 -0
- package/dist/types/light-account/accounts/multi-owner-account.d.ts +21 -0
- package/dist/types/light-account/accounts/multi-owner-account.d.ts.map +1 -0
- package/dist/types/light-account/decorators/multiOwner.d.ts +18 -0
- package/dist/types/light-account/decorators/multiOwner.d.ts.map +1 -0
- package/dist/types/light-account/decorators/singleOwner.d.ts +17 -0
- package/dist/types/light-account/decorators/singleOwner.d.ts.map +1 -0
- package/dist/types/light-account/lightAccountStaticImpl.d.ts +25 -0
- package/dist/types/light-account/lightAccountStaticImpl.d.ts.map +1 -0
- package/dist/types/light-account/predictAddress.d.ts +36 -0
- package/dist/types/light-account/predictAddress.d.ts.map +1 -0
- package/dist/types/light-account/registry.d.ts +7116 -0
- package/dist/types/light-account/registry.d.ts.map +1 -0
- package/dist/types/light-account/utils.d.ts +1455 -0
- package/dist/types/light-account/utils.d.ts.map +1 -0
- package/dist/types/logger.d.ts +3 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/ma-v1/abis/IStandardExecutor.d.ts +51 -0
- package/dist/types/ma-v1/abis/IStandardExecutor.d.ts.map +1 -0
- package/dist/types/ma-v1/abis/MultiOwnerModularAccountFactory.d.ts +235 -0
- package/dist/types/ma-v1/abis/MultiOwnerModularAccountFactory.d.ts.map +1 -0
- package/dist/types/ma-v1/abis/MultiOwnerPlugin.d.ts +699 -0
- package/dist/types/ma-v1/abis/MultiOwnerPlugin.d.ts.map +1 -0
- package/dist/types/ma-v1/abis/MultiOwnerPluginExecutionFunction.d.ts +68 -0
- package/dist/types/ma-v1/abis/MultiOwnerPluginExecutionFunction.d.ts.map +1 -0
- package/dist/types/ma-v1/abis/UpgradeableModularAccount.d.ts +881 -0
- package/dist/types/ma-v1/abis/UpgradeableModularAccount.d.ts.map +1 -0
- package/dist/types/ma-v1/account.d.ts +17 -0
- package/dist/types/ma-v1/account.d.ts.map +1 -0
- package/dist/types/ma-v1/accounts/base.d.ts +30 -0
- package/dist/types/ma-v1/accounts/base.d.ts.map +1 -0
- package/dist/types/ma-v1/accounts/multi-owner-account.d.ts +23 -0
- package/dist/types/ma-v1/accounts/multi-owner-account.d.ts.map +1 -0
- package/dist/types/ma-v1/decorators/multiOwner.d.ts +18 -0
- package/dist/types/ma-v1/decorators/multiOwner.d.ts.map +1 -0
- package/dist/types/ma-v1/mav1StaticImpl.d.ts +16 -0
- package/dist/types/ma-v1/mav1StaticImpl.d.ts.map +1 -0
- package/dist/types/ma-v1/predictAddress.d.ts +29 -0
- package/dist/types/ma-v1/predictAddress.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/accountFactoryAbi.d.ts +349 -0
- package/dist/types/ma-v2/abis/accountFactoryAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/entityIdAndNonceReader.d.ts +10 -0
- package/dist/types/ma-v2/abis/entityIdAndNonceReader.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/modularAccountAbi.d.ts +955 -0
- package/dist/types/ma-v2/abis/modularAccountAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts +992 -0
- package/dist/types/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/semiModularAccountStorageAbi.d.ts +1002 -0
- package/dist/types/ma-v2/abis/semiModularAccountStorageAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/abis/webAuthnFactoryAbi.d.ts +331 -0
- package/dist/types/ma-v2/abis/webAuthnFactoryAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/accounts/account.d.ts +33 -0
- package/dist/types/ma-v2/accounts/account.d.ts.map +1 -0
- package/dist/types/ma-v2/accounts/base.d.ts +41 -0
- package/dist/types/ma-v2/accounts/base.d.ts.map +1 -0
- package/dist/types/ma-v2/decorators/deferralActions.d.ts +52 -0
- package/dist/types/ma-v2/decorators/deferralActions.d.ts.map +1 -0
- package/dist/types/ma-v2/decorators/installValidation.d.ts +72 -0
- package/dist/types/ma-v2/decorators/installValidation.d.ts.map +1 -0
- package/dist/types/ma-v2/mav2StaticImpl.d.ts +38 -0
- package/dist/types/ma-v2/mav2StaticImpl.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts +557 -0
- package/dist/types/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/allowlist-module/module.d.ts +594 -0
- package/dist/types/ma-v2/modules/allowlist-module/module.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts +313 -0
- package/dist/types/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/native-token-limit-module/module.d.ts +323 -0
- package/dist/types/ma-v2/modules/native-token-limit-module/module.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts +187 -0
- package/dist/types/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/paymaster-guard-module/module.d.ts +197 -0
- package/dist/types/ma-v2/modules/paymaster-guard-module/module.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts +46 -0
- package/dist/types/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/single-signer-validation/module.d.ts +11 -0
- package/dist/types/ma-v2/modules/single-signer-validation/module.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts +230 -0
- package/dist/types/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/time-range-module/module.d.ts +255 -0
- package/dist/types/ma-v2/modules/time-range-module/module.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts +288 -0
- package/dist/types/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts.map +1 -0
- package/dist/types/ma-v2/modules/webauthn-validation/module.d.ts +12 -0
- package/dist/types/ma-v2/modules/webauthn-validation/module.d.ts.map +1 -0
- package/dist/types/ma-v2/permissionBuilder.d.ts +159 -0
- package/dist/types/ma-v2/permissionBuilder.d.ts.map +1 -0
- package/dist/types/ma-v2/predictAddress.d.ts +38 -0
- package/dist/types/ma-v2/predictAddress.d.ts.map +1 -0
- package/dist/types/ma-v2/types.d.ts +58 -0
- package/dist/types/ma-v2/types.d.ts.map +1 -0
- package/dist/types/ma-v2/utils/account.d.ts +86 -0
- package/dist/types/ma-v2/utils/account.d.ts.map +1 -0
- package/dist/types/ma-v2/utils/deferredActions.d.ts +30 -0
- package/dist/types/ma-v2/utils/deferredActions.d.ts.map +1 -0
- package/dist/types/ma-v2/utils/hooks.d.ts +56 -0
- package/dist/types/ma-v2/utils/hooks.d.ts.map +1 -0
- package/dist/types/ma-v2/utils/signature.d.ts +64 -0
- package/dist/types/ma-v2/utils/signature.d.ts.map +1 -0
- package/dist/types/test-utils/getAccountAddressViaEntryPoint.d.ts +19 -0
- package/dist/types/test-utils/getAccountAddressViaEntryPoint.d.ts.map +1 -0
- package/dist/types/types.d.ts +31 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils.d.ts +7 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +63 -0
- package/src/errors/EntityIdOverrideError.ts +15 -0
- package/src/errors/InvalidDeferredActionNonceError.ts +15 -0
- package/src/errors/InvalidEntityIdError.ts +19 -0
- package/src/errors/InvalidNonceKeyError.ts +19 -0
- package/src/errors/InvalidOwnerError.ts +17 -0
- package/src/errors/permissionBuilderErrors.ts +212 -0
- package/src/index.ts +152 -0
- package/src/light-account/abis/LightAccountAbi_v1.ts +378 -0
- package/src/light-account/abis/LightAccountAbi_v2.ts +354 -0
- package/src/light-account/abis/LightAccountFactoryAbi_v1.ts +74 -0
- package/src/light-account/abis/LightAccountFactoryAbi_v2.ts +209 -0
- package/src/light-account/abis/MultiOwnerLightAccountAbi.ts +371 -0
- package/src/light-account/abis/MultiOwnerLightAccountFactoryAbi.ts +228 -0
- package/src/light-account/abis/OZ_ERC1967Proxy.ts +19 -0
- package/src/light-account/accounts/account.ts +154 -0
- package/src/light-account/accounts/base.ts +340 -0
- package/src/light-account/accounts/calldataCodec.ts +101 -0
- package/src/light-account/accounts/multi-owner-account.ts +138 -0
- package/src/light-account/decorators/multiOwner.ts +69 -0
- package/src/light-account/decorators/singleOwner.ts +61 -0
- package/src/light-account/lightAccountStaticImpl.ts +172 -0
- package/src/light-account/predictAddress.ts +174 -0
- package/src/light-account/registry.ts +72 -0
- package/src/light-account/utils.ts +95 -0
- package/src/logger.ts +9 -0
- package/src/ma-v1/abis/IStandardExecutor.ts +31 -0
- package/src/ma-v1/abis/MultiOwnerModularAccountFactory.ts +190 -0
- package/src/ma-v1/abis/MultiOwnerPlugin.ts +528 -0
- package/src/ma-v1/abis/MultiOwnerPluginExecutionFunction.ts +37 -0
- package/src/ma-v1/abis/UpgradeableModularAccount.ts +645 -0
- package/src/ma-v1/account.ts +19 -0
- package/src/ma-v1/accounts/base.ts +245 -0
- package/src/ma-v1/accounts/multi-owner-account.ts +162 -0
- package/src/ma-v1/decorators/multiOwner.ts +69 -0
- package/src/ma-v1/mav1StaticImpl.ts +53 -0
- package/src/ma-v1/predictAddress.ts +85 -0
- package/src/ma-v2/abis/accountFactoryAbi.ts +644 -0
- package/src/ma-v2/abis/entityIdAndNonceReader.ts +23 -0
- package/src/ma-v2/abis/modularAccountAbi.ts +1241 -0
- package/src/ma-v2/abis/semiModularAccountBytecodeAbi.ts +1288 -0
- package/src/ma-v2/abis/semiModularAccountStorageAbi.ts +1301 -0
- package/src/ma-v2/abis/webAuthnFactoryAbi.ts +259 -0
- package/src/ma-v2/accounts/account.ts +211 -0
- package/src/ma-v2/accounts/base.ts +569 -0
- package/src/ma-v2/decorators/deferralActions.ts +193 -0
- package/src/ma-v2/decorators/installValidation.ts +257 -0
- package/src/ma-v2/mav2StaticImpl.ts +134 -0
- package/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.ts +715 -0
- package/src/ma-v2/modules/allowlist-module/module.ts +116 -0
- package/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.ts +403 -0
- package/src/ma-v2/modules/native-token-limit-module/module.ts +21 -0
- package/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.ts +241 -0
- package/src/ma-v2/modules/paymaster-guard-module/module.ts +35 -0
- package/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.ts +330 -0
- package/src/ma-v2/modules/single-signer-validation/module.ts +24 -0
- package/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.ts +295 -0
- package/src/ma-v2/modules/time-range-module/module.ts +96 -0
- package/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.ts +373 -0
- package/src/ma-v2/modules/webauthn-validation/module.ts +28 -0
- package/src/ma-v2/permissionBuilder.ts +761 -0
- package/src/ma-v2/predictAddress.ts +149 -0
- package/src/ma-v2/types.ts +73 -0
- package/src/ma-v2/utils/account.ts +137 -0
- package/src/ma-v2/utils/deferredActions.ts +66 -0
- package/src/ma-v2/utils/hooks.ts +79 -0
- package/src/ma-v2/utils/signature.ts +129 -0
- package/src/test-utils/getAccountAddressViaEntryPoint.ts +43 -0
- package/src/types.ts +58 -0
- package/src/utils.ts +85 -0
- package/src/version.ts +3 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Address, type Client, type Hex, type IsUndefined, type Chain, type Transport } from "viem";
|
|
2
|
+
import type { HookConfig, ValidationConfig } from "../types.js";
|
|
3
|
+
import type { ModularAccountV2 } from "../accounts/account.js";
|
|
4
|
+
import type { GetAccountParameter } from "../../types.js";
|
|
5
|
+
import { type SmartAccount } from "viem/account-abstraction";
|
|
6
|
+
export type InstallValidationParams<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
7
|
+
validationConfig: ValidationConfig;
|
|
8
|
+
selectors: Hex[];
|
|
9
|
+
installData: Hex;
|
|
10
|
+
hooks: {
|
|
11
|
+
hookConfig: HookConfig;
|
|
12
|
+
initData: Hex;
|
|
13
|
+
}[];
|
|
14
|
+
} & GetAccountParameter<TAccount, ModularAccountV2>;
|
|
15
|
+
export type UninstallValidationParams<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
16
|
+
moduleAddress: Address;
|
|
17
|
+
entityId: number;
|
|
18
|
+
uninstallData: Hex;
|
|
19
|
+
hookUninstallDatas: Hex[];
|
|
20
|
+
} & GetAccountParameter<TAccount, ModularAccountV2>;
|
|
21
|
+
export type InstallValidationActions<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
22
|
+
encodeInstallValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;
|
|
23
|
+
installValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;
|
|
24
|
+
encodeUninstallValidation: (args: UninstallValidationParams<TAccount>) => Promise<Hex>;
|
|
25
|
+
uninstallValidation: (args: UninstallValidationParams<TAccount>) => Promise<Hex>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { createModularAccountV2Client, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@alchemy/smart-accounts";
|
|
33
|
+
* import { Address } from "viem";
|
|
34
|
+
*
|
|
35
|
+
* const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);
|
|
36
|
+
* const sessionKeyAddress: Address = "0x1234";
|
|
37
|
+
* const sessionKeyEntityId: number = 1;
|
|
38
|
+
*
|
|
39
|
+
* await client.installValidation({
|
|
40
|
+
* validationConfig: {
|
|
41
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
42
|
+
* client.chain
|
|
43
|
+
* ),
|
|
44
|
+
* entityId: sessionKeyEntityId,
|
|
45
|
+
* isGlobal: true,
|
|
46
|
+
* isSignatureValidation: false,
|
|
47
|
+
* isUserOpValidation: true,
|
|
48
|
+
* },
|
|
49
|
+
* selectors: [],
|
|
50
|
+
* installData: SingleSignerValidationModule.encodeOnInstallData({
|
|
51
|
+
* entityId: sessionKeyEntityId,
|
|
52
|
+
* signer: sessionKeyAddress,
|
|
53
|
+
* }),
|
|
54
|
+
* hooks: [],
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* await client.uninstallValidation({
|
|
58
|
+
* moduleAddress: sessionKeyAddress,
|
|
59
|
+
* entityId: sessionKeyEntityId,
|
|
60
|
+
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
61
|
+
* entityId: sessionKeyEntityId,
|
|
62
|
+
* }),
|
|
63
|
+
* hookUninstallDatas: [],
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {object} client - The client instance which provides account and sendUserOperation functionality.
|
|
69
|
+
* @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function installValidationActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined>(client: Client<TTransport, TChain, TAccount>): InstallValidationActions<IsUndefined<TAccount> extends true ? undefined : ModularAccountV2>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { zeroAddress, concatHex, encodeFunctionData, } from "viem";
|
|
2
|
+
import { semiModularAccountBytecodeAbi } from "../abis/semiModularAccountBytecodeAbi.js";
|
|
3
|
+
import { sendUserOperation } from "viem/account-abstraction";
|
|
4
|
+
import { getAction } from "viem/utils";
|
|
5
|
+
import { AccountNotFoundError } from "@alchemy/common";
|
|
6
|
+
import { EntityIdOverrideError } from "../../errors/EntityIdOverrideError.js";
|
|
7
|
+
import { serializeHookConfig, serializeValidationConfig, } from "../utils/hooks.js";
|
|
8
|
+
import { DEFAULT_OWNER_ENTITY_ID, isModularAccountV2, serializeModuleEntity, } from "../utils/account.js";
|
|
9
|
+
// TODO(v5): update jsdoc
|
|
10
|
+
/**
|
|
11
|
+
* Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { createModularAccountV2Client, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@alchemy/smart-accounts";
|
|
16
|
+
* import { Address } from "viem";
|
|
17
|
+
*
|
|
18
|
+
* const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);
|
|
19
|
+
* const sessionKeyAddress: Address = "0x1234";
|
|
20
|
+
* const sessionKeyEntityId: number = 1;
|
|
21
|
+
*
|
|
22
|
+
* await client.installValidation({
|
|
23
|
+
* validationConfig: {
|
|
24
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
25
|
+
* client.chain
|
|
26
|
+
* ),
|
|
27
|
+
* entityId: sessionKeyEntityId,
|
|
28
|
+
* isGlobal: true,
|
|
29
|
+
* isSignatureValidation: false,
|
|
30
|
+
* isUserOpValidation: true,
|
|
31
|
+
* },
|
|
32
|
+
* selectors: [],
|
|
33
|
+
* installData: SingleSignerValidationModule.encodeOnInstallData({
|
|
34
|
+
* entityId: sessionKeyEntityId,
|
|
35
|
+
* signer: sessionKeyAddress,
|
|
36
|
+
* }),
|
|
37
|
+
* hooks: [],
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* await client.uninstallValidation({
|
|
41
|
+
* moduleAddress: sessionKeyAddress,
|
|
42
|
+
* entityId: sessionKeyEntityId,
|
|
43
|
+
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
44
|
+
* entityId: sessionKeyEntityId,
|
|
45
|
+
* }),
|
|
46
|
+
* hookUninstallDatas: [],
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param {object} client - The client instance which provides account and sendUserOperation functionality.
|
|
52
|
+
* @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.
|
|
53
|
+
*/
|
|
54
|
+
export function installValidationActions(client) {
|
|
55
|
+
const encodeInstallValidation = async (args) => {
|
|
56
|
+
const { validationConfig, selectors, installData, hooks, account = client.account, } = args;
|
|
57
|
+
if (!account || !isModularAccountV2(account)) {
|
|
58
|
+
throw new AccountNotFoundError();
|
|
59
|
+
}
|
|
60
|
+
// An entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation.
|
|
61
|
+
if (validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&
|
|
62
|
+
validationConfig.moduleAddress !== zeroAddress) {
|
|
63
|
+
throw new EntityIdOverrideError();
|
|
64
|
+
}
|
|
65
|
+
return account.encodeCallData(encodeFunctionData({
|
|
66
|
+
abi: semiModularAccountBytecodeAbi,
|
|
67
|
+
functionName: "installValidation",
|
|
68
|
+
args: [
|
|
69
|
+
serializeValidationConfig(validationConfig),
|
|
70
|
+
selectors,
|
|
71
|
+
installData,
|
|
72
|
+
hooks.map((hook) => concatHex([serializeHookConfig(hook.hookConfig), hook.initData])),
|
|
73
|
+
],
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
const encodeUninstallValidation = async (args) => {
|
|
77
|
+
const { moduleAddress, entityId, uninstallData, hookUninstallDatas, account = client.account, } = args;
|
|
78
|
+
if (!account || !isModularAccountV2(account)) {
|
|
79
|
+
throw new AccountNotFoundError();
|
|
80
|
+
}
|
|
81
|
+
return account.encodeCallData(encodeFunctionData({
|
|
82
|
+
abi: semiModularAccountBytecodeAbi,
|
|
83
|
+
functionName: "uninstallValidation",
|
|
84
|
+
args: [
|
|
85
|
+
serializeModuleEntity({
|
|
86
|
+
moduleAddress,
|
|
87
|
+
entityId,
|
|
88
|
+
}),
|
|
89
|
+
uninstallData,
|
|
90
|
+
hookUninstallDatas,
|
|
91
|
+
],
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
encodeInstallValidation,
|
|
96
|
+
encodeUninstallValidation,
|
|
97
|
+
installValidation: async (args) => {
|
|
98
|
+
const { validationConfig, selectors, installData, hooks, account = client.account, } = args;
|
|
99
|
+
if (!account || !isModularAccountV2(account)) {
|
|
100
|
+
throw new AccountNotFoundError();
|
|
101
|
+
}
|
|
102
|
+
const callData = await encodeInstallValidation({
|
|
103
|
+
validationConfig,
|
|
104
|
+
selectors,
|
|
105
|
+
installData,
|
|
106
|
+
hooks,
|
|
107
|
+
account,
|
|
108
|
+
});
|
|
109
|
+
const action = getAction(client, sendUserOperation, "sendUserOperation");
|
|
110
|
+
const result = await action({
|
|
111
|
+
callData,
|
|
112
|
+
account,
|
|
113
|
+
});
|
|
114
|
+
return result;
|
|
115
|
+
},
|
|
116
|
+
uninstallValidation: async (args) => {
|
|
117
|
+
const { moduleAddress, entityId, uninstallData, hookUninstallDatas, account = client.account, } = args;
|
|
118
|
+
if (!account || !isModularAccountV2(account)) {
|
|
119
|
+
throw new AccountNotFoundError();
|
|
120
|
+
}
|
|
121
|
+
const callData = await encodeUninstallValidation({
|
|
122
|
+
moduleAddress,
|
|
123
|
+
entityId,
|
|
124
|
+
uninstallData,
|
|
125
|
+
hookUninstallDatas,
|
|
126
|
+
account,
|
|
127
|
+
});
|
|
128
|
+
const action = getAction(client, sendUserOperation, "sendUserOperation");
|
|
129
|
+
const result = await action({
|
|
130
|
+
callData,
|
|
131
|
+
account,
|
|
132
|
+
});
|
|
133
|
+
return result;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=installValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installValidation.js","sourceRoot":"","sources":["../../../../src/ma-v2/decorators/installValidation.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n type Address,\n type Client,\n type Hex,\n type IsUndefined,\n type Chain,\n type Transport,\n zeroAddress,\n concatHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { HookConfig, ValidationConfig } from \"../types.js\";\nimport type { ModularAccountV2 } from \"../accounts/account.js\";\nimport type { GetAccountParameter } from \"../../types.js\";\nimport { semiModularAccountBytecodeAbi } from \"../abis/semiModularAccountBytecodeAbi.js\";\nimport { type SmartAccount, sendUserOperation } from \"viem/account-abstraction\";\nimport { getAction } from \"viem/utils\";\nimport { AccountNotFoundError } from \"@alchemy/common\";\nimport { EntityIdOverrideError } from \"../../errors/EntityIdOverrideError.js\";\nimport {\n serializeHookConfig,\n serializeValidationConfig,\n} from \"../utils/hooks.js\";\nimport {\n DEFAULT_OWNER_ENTITY_ID,\n isModularAccountV2,\n serializeModuleEntity,\n} from \"../utils/account.js\";\n\nexport type InstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n validationConfig: ValidationConfig;\n selectors: Hex[];\n installData: Hex;\n hooks: {\n hookConfig: HookConfig;\n initData: Hex;\n }[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type UninstallValidationParams<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n moduleAddress: Address;\n entityId: number;\n uninstallData: Hex;\n hookUninstallDatas: Hex[];\n} & GetAccountParameter<TAccount, ModularAccountV2>;\n\nexport type InstallValidationActions<\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n> = {\n encodeInstallValidation: (\n args: InstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n installValidation: (args: InstallValidationParams<TAccount>) => Promise<Hex>;\n encodeUninstallValidation: (\n args: UninstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n uninstallValidation: (\n args: UninstallValidationParams<TAccount>,\n ) => Promise<Hex>;\n};\n\n// TODO(v5): update jsdoc\n/**\n * Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.\n *\n * @example\n * ```ts\n * import { createModularAccountV2Client, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from \"@alchemy/smart-accounts\";\n * import { Address } from \"viem\";\n *\n * const client = (await createModularAccountV2Client({ ... })).extend(installValidationActions);\n * const sessionKeyAddress: Address = \"0x1234\";\n * const sessionKeyEntityId: number = 1;\n *\n * await client.installValidation({\n * validationConfig: {\n * moduleAddress: getDefaultSingleSignerValidationModuleAddress(\n * client.chain\n * ),\n * entityId: sessionKeyEntityId,\n * isGlobal: true,\n * isSignatureValidation: false,\n * isUserOpValidation: true,\n * },\n * selectors: [],\n * installData: SingleSignerValidationModule.encodeOnInstallData({\n * entityId: sessionKeyEntityId,\n * signer: sessionKeyAddress,\n * }),\n * hooks: [],\n * });\n *\n * await client.uninstallValidation({\n * moduleAddress: sessionKeyAddress,\n * entityId: sessionKeyEntityId,\n * uninstallData: SingleSignerValidationModule.encodeOnUninstallData({\n * entityId: sessionKeyEntityId,\n * }),\n * hookUninstallDatas: [],\n * });\n *\n * ```\n *\n * @param {object} client - The client instance which provides account and sendUserOperation functionality.\n * @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.\n */\nexport function installValidationActions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartAccount | undefined = SmartAccount | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): InstallValidationActions<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n> {\n const encodeInstallValidation = async (\n args: InstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n // An entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation.\n if (\n validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&\n validationConfig.moduleAddress !== zeroAddress\n ) {\n throw new EntityIdOverrideError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"installValidation\",\n args: [\n serializeValidationConfig(validationConfig),\n selectors,\n installData,\n hooks.map((hook: { hookConfig: HookConfig; initData: Hex }) =>\n concatHex([serializeHookConfig(hook.hookConfig), hook.initData]),\n ),\n ],\n }),\n );\n };\n\n const encodeUninstallValidation = async (\n args: UninstallValidationParams<\n IsUndefined<TAccount> extends true ? undefined : ModularAccountV2\n >,\n ) => {\n const {\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n return account.encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"uninstallValidation\",\n args: [\n serializeModuleEntity({\n moduleAddress,\n entityId,\n }),\n uninstallData,\n hookUninstallDatas,\n ],\n }),\n );\n };\n\n return {\n encodeInstallValidation,\n encodeUninstallValidation,\n installValidation: async (args) => {\n const {\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const callData = await encodeInstallValidation({\n validationConfig,\n selectors,\n installData,\n hooks,\n account,\n });\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n callData,\n account,\n });\n\n return result;\n },\n\n uninstallValidation: async (args) => {\n const {\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n } = args;\n\n if (!account || !isModularAccountV2(account)) {\n throw new AccountNotFoundError();\n }\n\n const callData = await encodeUninstallValidation({\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account,\n });\n\n const action = getAction(client, sendUserOperation, \"sendUserOperation\");\n const result = await action({\n callData,\n account,\n });\n\n return result;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { entryPoint07Abi } from "viem/account-abstraction";
|
|
3
|
+
import type { StaticSmartAccountImplementation } from "../types.js";
|
|
4
|
+
import { semiModularAccountBytecodeAbi } from "./abis/semiModularAccountBytecodeAbi.js";
|
|
5
|
+
import { accountFactoryAbi } from "./abis/accountFactoryAbi.js";
|
|
6
|
+
import { webAuthnFactoryAbi } from "./abis/webAuthnFactoryAbi.js";
|
|
7
|
+
import { modularAccountAbi } from "./abis/modularAccountAbi.js";
|
|
8
|
+
export type SemiModularAccountV2FactoryArgs = {
|
|
9
|
+
owner: Address;
|
|
10
|
+
salt: bigint;
|
|
11
|
+
};
|
|
12
|
+
export type SemiModularAccountV2StaticImpl = StaticSmartAccountImplementation<false, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
13
|
+
/**
|
|
14
|
+
* Static implementation logic for SemiModularAccountV2.
|
|
15
|
+
*
|
|
16
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
17
|
+
*/
|
|
18
|
+
export declare const semiModularAccountV2StaticImpl: SemiModularAccountV2StaticImpl;
|
|
19
|
+
export type SemiModularAccount7702StaticImpl = StaticSmartAccountImplementation<true, "0.7", SemiModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof semiModularAccountBytecodeAbi, typeof accountFactoryAbi>;
|
|
20
|
+
/**
|
|
21
|
+
* Static implementation logic for SemiModularAccount7702.
|
|
22
|
+
*
|
|
23
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
24
|
+
*/
|
|
25
|
+
export declare const semiModularAccount7702StaticImpl: SemiModularAccount7702StaticImpl;
|
|
26
|
+
export type WebAuthnModularAccountV2FactoryArgs = {
|
|
27
|
+
ownerPublicKey: Hex;
|
|
28
|
+
salt: bigint;
|
|
29
|
+
entityId: number;
|
|
30
|
+
};
|
|
31
|
+
export type WebAuthnModularAccountV2StaticImpl = StaticSmartAccountImplementation<false, "0.7", WebAuthnModularAccountV2FactoryArgs, typeof entryPoint07Abi, typeof modularAccountAbi, typeof webAuthnFactoryAbi>;
|
|
32
|
+
/**
|
|
33
|
+
* Static implementation logic for WebAuthnModularAccountV2.
|
|
34
|
+
*
|
|
35
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
36
|
+
*/
|
|
37
|
+
export declare const webAuthnModularAccountV2StaticImpl: WebAuthnModularAccountV2StaticImpl;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { encodeFunctionData } from "viem";
|
|
2
|
+
import { entryPoint07Abi, entryPoint07Address } from "viem/account-abstraction";
|
|
3
|
+
import { lowerAddress } from "@alchemy/common";
|
|
4
|
+
import { semiModularAccountBytecodeAbi } from "./abis/semiModularAccountBytecodeAbi.js";
|
|
5
|
+
import { accountFactoryAbi } from "./abis/accountFactoryAbi.js";
|
|
6
|
+
import { webAuthnFactoryAbi } from "./abis/webAuthnFactoryAbi.js";
|
|
7
|
+
import { DefaultAddress as DefaultMAV2Address } from "./utils/account.js";
|
|
8
|
+
import { predictModularAccountV2Address } from "./predictAddress.js";
|
|
9
|
+
import { modularAccountAbi } from "./abis/modularAccountAbi.js";
|
|
10
|
+
import { parsePublicKey } from "webauthn-p256";
|
|
11
|
+
// Shared entryPoint configuration across all modular account v2 implementations
|
|
12
|
+
const entryPoint = {
|
|
13
|
+
abi: entryPoint07Abi,
|
|
14
|
+
address: entryPoint07Address,
|
|
15
|
+
version: "0.7",
|
|
16
|
+
};
|
|
17
|
+
// Shared base for semi-modular account implementations (SMA and 7702)
|
|
18
|
+
const semiModularAccountBase = {
|
|
19
|
+
entryPoint,
|
|
20
|
+
accountAbi: semiModularAccountBytecodeAbi,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Static implementation logic for SemiModularAccountV2.
|
|
24
|
+
*
|
|
25
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
26
|
+
*/
|
|
27
|
+
export const semiModularAccountV2StaticImpl = {
|
|
28
|
+
...semiModularAccountBase,
|
|
29
|
+
accountImplementation: lowerAddress(DefaultMAV2Address.SMAV2_BYTECODE),
|
|
30
|
+
factoryAddress: lowerAddress(DefaultMAV2Address.MAV2_FACTORY),
|
|
31
|
+
factoryAbi: accountFactoryAbi,
|
|
32
|
+
getFactoryData: (args) => {
|
|
33
|
+
return encodeFunctionData({
|
|
34
|
+
abi: accountFactoryAbi,
|
|
35
|
+
functionName: "createSemiModularAccount",
|
|
36
|
+
args: [args.owner, args.salt],
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
predictAccountAddress: (args) => {
|
|
40
|
+
return predictModularAccountV2Address({
|
|
41
|
+
factoryAddress: DefaultMAV2Address.MAV2_FACTORY,
|
|
42
|
+
implementationAddress: DefaultMAV2Address.SMAV2_BYTECODE,
|
|
43
|
+
type: "SMA",
|
|
44
|
+
salt: args.salt,
|
|
45
|
+
ownerAddress: args.owner,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Static implementation logic for SemiModularAccount7702.
|
|
51
|
+
*
|
|
52
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
53
|
+
*/
|
|
54
|
+
export const semiModularAccount7702StaticImpl = {
|
|
55
|
+
...semiModularAccountBase,
|
|
56
|
+
delegationAddress: lowerAddress(DefaultMAV2Address.SMAV2_7702),
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Static implementation logic for WebAuthnModularAccountV2.
|
|
60
|
+
*
|
|
61
|
+
* TODO(v5): update JSDoc format when doc-gen supports structs or records.
|
|
62
|
+
*/
|
|
63
|
+
export const webAuthnModularAccountV2StaticImpl = {
|
|
64
|
+
entryPoint,
|
|
65
|
+
accountAbi: modularAccountAbi,
|
|
66
|
+
accountImplementation: lowerAddress(DefaultMAV2Address.MAV2),
|
|
67
|
+
factoryAddress: lowerAddress(DefaultMAV2Address.MAV2_FACTORY_WEBAUTHN),
|
|
68
|
+
factoryAbi: webAuthnFactoryAbi,
|
|
69
|
+
getFactoryData: (args) => {
|
|
70
|
+
const { x, y } = parsePublicKey(args.ownerPublicKey);
|
|
71
|
+
return encodeFunctionData({
|
|
72
|
+
abi: webAuthnFactoryAbi,
|
|
73
|
+
functionName: "createWebAuthnAccount",
|
|
74
|
+
args: [x, y, args.salt, args.entityId],
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
predictAccountAddress: (args) => {
|
|
78
|
+
return predictModularAccountV2Address({
|
|
79
|
+
factoryAddress: DefaultMAV2Address.MAV2_FACTORY_WEBAUTHN,
|
|
80
|
+
implementationAddress: DefaultMAV2Address.MAV2,
|
|
81
|
+
type: "WebAuthn",
|
|
82
|
+
salt: args.salt,
|
|
83
|
+
ownerPublicKey: args.ownerPublicKey,
|
|
84
|
+
entityId: args.entityId,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=mav2StaticImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mav2StaticImpl.js","sourceRoot":"","sources":["../../../src/ma-v2/mav2StaticImpl.ts"],"names":[],"mappings":"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","sourcesContent":["import { encodeFunctionData, type Address, type Hex } from \"viem\";\nimport { entryPoint07Abi, entryPoint07Address } from \"viem/account-abstraction\";\nimport { lowerAddress } from \"@alchemy/common\";\nimport type { StaticSmartAccountImplementation } from \"../types.js\";\nimport { semiModularAccountBytecodeAbi } from \"./abis/semiModularAccountBytecodeAbi.js\";\nimport { accountFactoryAbi } from \"./abis/accountFactoryAbi.js\";\nimport { webAuthnFactoryAbi } from \"./abis/webAuthnFactoryAbi.js\";\nimport { DefaultAddress as DefaultMAV2Address } from \"./utils/account.js\";\nimport { predictModularAccountV2Address } from \"./predictAddress.js\";\nimport { modularAccountAbi } from \"./abis/modularAccountAbi.js\";\nimport { parsePublicKey } from \"webauthn-p256\";\n\nexport type SemiModularAccountV2FactoryArgs = {\n owner: Address;\n salt: bigint;\n};\n\nexport type SemiModularAccountV2StaticImpl = StaticSmartAccountImplementation<\n false,\n \"0.7\",\n SemiModularAccountV2FactoryArgs,\n typeof entryPoint07Abi,\n typeof semiModularAccountBytecodeAbi,\n typeof accountFactoryAbi\n>;\n\n// Shared entryPoint configuration across all modular account v2 implementations\nconst entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address,\n version: \"0.7\",\n} as const;\n\n// Shared base for semi-modular account implementations (SMA and 7702)\nconst semiModularAccountBase = {\n entryPoint,\n accountAbi: semiModularAccountBytecodeAbi,\n} satisfies Partial<SemiModularAccountV2StaticImpl>;\n\n/**\n * Static implementation logic for SemiModularAccountV2.\n *\n * TODO(v5): update JSDoc format when doc-gen supports structs or records.\n */\nexport const semiModularAccountV2StaticImpl: SemiModularAccountV2StaticImpl = {\n ...semiModularAccountBase,\n accountImplementation: lowerAddress(DefaultMAV2Address.SMAV2_BYTECODE),\n factoryAddress: lowerAddress(DefaultMAV2Address.MAV2_FACTORY),\n factoryAbi: accountFactoryAbi,\n getFactoryData: (args: SemiModularAccountV2FactoryArgs) => {\n return encodeFunctionData({\n abi: accountFactoryAbi,\n functionName: \"createSemiModularAccount\",\n args: [args.owner, args.salt],\n });\n },\n predictAccountAddress: (args: SemiModularAccountV2FactoryArgs) => {\n return predictModularAccountV2Address({\n factoryAddress: DefaultMAV2Address.MAV2_FACTORY,\n implementationAddress: DefaultMAV2Address.SMAV2_BYTECODE,\n type: \"SMA\",\n salt: args.salt,\n ownerAddress: args.owner,\n });\n },\n};\n\nexport type SemiModularAccount7702StaticImpl = StaticSmartAccountImplementation<\n true,\n \"0.7\",\n SemiModularAccountV2FactoryArgs,\n typeof entryPoint07Abi,\n typeof semiModularAccountBytecodeAbi,\n typeof accountFactoryAbi\n>;\n\n/**\n * Static implementation logic for SemiModularAccount7702.\n *\n * TODO(v5): update JSDoc format when doc-gen supports structs or records.\n */\nexport const semiModularAccount7702StaticImpl: SemiModularAccount7702StaticImpl =\n {\n ...semiModularAccountBase,\n delegationAddress: lowerAddress(DefaultMAV2Address.SMAV2_7702),\n };\n\nexport type WebAuthnModularAccountV2FactoryArgs = {\n ownerPublicKey: Hex;\n salt: bigint;\n entityId: number;\n};\n\nexport type WebAuthnModularAccountV2StaticImpl =\n StaticSmartAccountImplementation<\n false,\n \"0.7\",\n WebAuthnModularAccountV2FactoryArgs,\n typeof entryPoint07Abi,\n typeof modularAccountAbi,\n typeof webAuthnFactoryAbi\n >;\n\n/**\n * Static implementation logic for WebAuthnModularAccountV2.\n *\n * TODO(v5): update JSDoc format when doc-gen supports structs or records.\n */\nexport const webAuthnModularAccountV2StaticImpl: WebAuthnModularAccountV2StaticImpl =\n {\n entryPoint,\n accountAbi: modularAccountAbi,\n accountImplementation: lowerAddress(DefaultMAV2Address.MAV2),\n factoryAddress: lowerAddress(DefaultMAV2Address.MAV2_FACTORY_WEBAUTHN),\n factoryAbi: webAuthnFactoryAbi,\n getFactoryData: (args: WebAuthnModularAccountV2FactoryArgs) => {\n const { x, y } = parsePublicKey(args.ownerPublicKey);\n return encodeFunctionData({\n abi: webAuthnFactoryAbi,\n functionName: \"createWebAuthnAccount\",\n args: [x, y, args.salt, args.entityId],\n });\n },\n predictAccountAddress: (args: WebAuthnModularAccountV2FactoryArgs) => {\n return predictModularAccountV2Address({\n factoryAddress: DefaultMAV2Address.MAV2_FACTORY_WEBAUTHN,\n implementationAddress: DefaultMAV2Address.MAV2,\n type: \"WebAuthn\",\n salt: args.salt,\n ownerPublicKey: args.ownerPublicKey,\n entityId: args.entityId,\n });\n },\n };\n"]}
|