From 3f44dddc37affc92ba1b391df807af2040ea297c Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:57:50 +0000 Subject: [PATCH 01/12] feat: add all mav2 contract addrs, abis (#1207) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Checklist - [x] Did you add new tests and confirm existing tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)) - [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`) - [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)? --- ## PR-Codex overview This PR focuses on renaming and restructuring several ABI files and exports in the smart contracts directory, enhancing clarity and consistency in the codebase. ### Detailed summary - Renamed `MAV2FactoryAbi` to `accountFactoryAbi` in `accountFactoryAbi.ts`. - Renamed `smaV2Abi` to `semiModularAccountBytecodeAbi` in `semiModularAccountBytecodeAbi.ts`. - Renamed `singleSignerValidationAbi` to `singleSignerValidationModuleAbi` in `singleSignerValidationModule.ts`. - Updated import statements to reflect the new names. - Added a new `addresses` export containing various module addresses in `utils.ts`. - Introduced new ABI definitions for `paymasterGuardModule`, `timeRangeModule`, `webauthnValidationModule`, `nativeTokenLimitModule`, and `allowlistModule`. - Added ABI definitions for events and error types in the newly created ABI files. > The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../{maV2Factory.ts => accountFactoryAbi.ts} | 2 +- .../src/ma-v2/abis/modularAccountAbi.ts | 1241 ++++++++++++++++ ...V2.ts => semiModularAccountBytecodeAbi.ts} | 2 +- .../abis/semiModularAccountStorageAbi.ts | 1301 +++++++++++++++++ .../src/ma-v2/account/account.ts | 0 .../allowlist-module/abis/allowlistModule.ts | 715 +++++++++ .../abis/nativeTokenLimitModule.ts | 403 +++++ .../abis/paymasterGuardModule.ts | 241 +++ ...ion.ts => singleSignerValidationModule.ts} | 2 +- .../single-signer-validation/module.ts | 4 +- .../time-range-module/abis/timeRangeModule.ts | 295 ++++ .../abis/webauthnValidation.ts | 373 +++++ .../smart-contracts/src/ma-v2/utils.ts | 28 + 13 files changed, 4602 insertions(+), 5 deletions(-) rename account-kit/smart-contracts/src/ma-v2/abis/{maV2Factory.ts => accountFactoryAbi.ts} (99%) create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/modularAccountAbi.ts rename account-kit/smart-contracts/src/ma-v2/abis/{smaV2.ts => semiModularAccountBytecodeAbi.ts} (99%) create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/account/account.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/allowlist-module/abis/allowlistModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModule.ts rename account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/{singleSignerValidation.ts => singleSignerValidationModule.ts} (99%) create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/time-range-module/abis/timeRangeModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/webauthn-validation/abis/webauthnValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/accountFactoryAbi.ts similarity index 99% rename from account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts rename to account-kit/smart-contracts/src/ma-v2/abis/accountFactoryAbi.ts index e9fa4e35ff..cb3ca8194b 100644 --- a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts +++ b/account-kit/smart-contracts/src/ma-v2/abis/accountFactoryAbi.ts @@ -1,4 +1,4 @@ -export const MAV2FactoryAbi = [ +export const accountFactoryAbi = [ { type: "constructor", inputs: [ diff --git a/account-kit/smart-contracts/src/ma-v2/abis/modularAccountAbi.ts b/account-kit/smart-contracts/src/ma-v2/abis/modularAccountAbi.ts new file mode 100644 index 0000000000..7919fe6bb3 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/modularAccountAbi.ts @@ -0,0 +1,1241 @@ +export const modularAccountAbi = [ + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initializeWithValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountBytecodeAbi.ts similarity index 99% rename from account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts rename to account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountBytecodeAbi.ts index d48a15a770..8f2c3dd7cd 100644 --- a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts +++ b/account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountBytecodeAbi.ts @@ -1,4 +1,4 @@ -export const smaV2Abi = [ +export const semiModularAccountBytecodeAbi = [ { type: "constructor", inputs: [ diff --git a/account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts b/account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts new file mode 100644 index 0000000000..aa320f38ab --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts @@ -0,0 +1,1301 @@ +export const semiModularAccountStorageAbi = [ + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getFallbackSignerData", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { + name: "initialSigner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateFallbackSignerData", + inputs: [ + { + name: "fallbackSigner", + type: "address", + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FallbackSignerUpdated", + inputs: [ + { + name: "newFallbackSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "FallbackSignerDisabled", + inputs: [], + }, + { + type: "error", + name: "FallbackSignerMismatch", + inputs: [], + }, + { + type: "error", + name: "FallbackValidationInstallationNotAllowed", + inputs: [], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/account/account.ts b/account-kit/smart-contracts/src/ma-v2/account/account.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/account-kit/smart-contracts/src/ma-v2/modules/allowlist-module/abis/allowlistModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/allowlist-module/abis/allowlistModule.ts new file mode 100644 index 0000000000..270e36dc13 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/allowlist-module/abis/allowlistModule.ts @@ -0,0 +1,715 @@ +export const allowlistModuleAbi = [ + { + type: "function", + name: "addressAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "checkAllowlistCalldata", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "deleteAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "inputs", + type: "tuple[]", + internalType: "struct AllowlistModule.AllowlistInput[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "erc20SpendLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "erc20SpendLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "postExecutionHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preExecutionHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "selectorAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "setAddressAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setSelectorAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "updateAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "inputs", + type: "tuple[]", + internalType: "struct AllowlistModule.AllowlistInput[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "erc20SpendLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "newLimit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "AddressAllowlistUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "target", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entry", + type: "tuple", + indexed: false, + internalType: "struct AllowlistModule.AddressAllowlistEntry", + components: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ERC20SpendLimitUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SelectorAllowlistUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "targetAndSelector", + type: "bytes24", + indexed: true, + internalType: "bytes24", + }, + { + name: "allowed", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressNotAllowed", + inputs: [], + }, + { + type: "error", + name: "ERC20NotAllowed", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "ExceededTokenLimit", + inputs: [], + }, + { + type: "error", + name: "InvalidCalldataLength", + inputs: [], + }, + { + type: "error", + name: "NoSelectorSpecified", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "SelectorNotAllowed", + inputs: [], + }, + { + type: "error", + name: "SpendingRequestNotAllowed", + inputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModule.ts new file mode 100644 index 0000000000..de0f1d2aa1 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModule.ts @@ -0,0 +1,403 @@ +export const nativeTokenLimitModuleAbi = [ + { + type: "function", + name: "limits", + inputs: [ + { + name: "entityId", + type: "uint256", + internalType: "uint256", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "limit", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "postExecutionHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preExecutionHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "specialPaymasters", + inputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "updateLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "newLimit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateSpecialPaymaster", + inputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "NativeTokenSpendLimitUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SpecialPaymasterUpdated", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "paymaster", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "allowed", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ExceededNativeTokenLimit", + inputs: [], + }, + { + type: "error", + name: "InvalidPaymaster", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModule.ts new file mode 100644 index 0000000000..275480aab0 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModule.ts @@ -0,0 +1,241 @@ +export const paymasterGuardModuleAbi = [ + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "paymasters", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "error", + name: "BadPaymasterSpecified", + inputs: [], + }, + { + type: "error", + name: "InvalidPaymaster", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModule.ts similarity index 99% rename from account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts rename to account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModule.ts index 726f226320..d18325cd52 100644 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModule.ts @@ -1,4 +1,4 @@ -export const singleSignerValidationAbi = [ +export const singleSignerValidationModuleAbi = [ { type: "function", name: "moduleId", diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/module.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/module.ts index fa77a1937e..599f29ba9b 100644 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/module.ts +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/module.ts @@ -1,6 +1,6 @@ import { encodeAbiParameters, type Address, type Hex } from "viem"; -import { singleSignerValidationAbi } from "./abis/singleSignerValidation.js"; +import { singleSignerValidationModuleAbi } from "./abis/singleSignerValidationModule.js"; const addresses = { default: "0xEa3a0b544d517f6Ed3Dc2186C74D869c702C376e", @@ -15,7 +15,7 @@ const meta = { // Todo: some unified type for ERC-6900 v0.8 modules. I couldn't figure out how to parameterize the class itself over the abi type parameters for onInstall and onUninstall. export const SingleSignerValidationModule = { meta, - abi: singleSignerValidationAbi, + abi: singleSignerValidationModuleAbi, encodeOnInstallData: (args: { entityId: number; signer: Address }): Hex => { const { entityId, signer } = args; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/time-range-module/abis/timeRangeModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/time-range-module/abis/timeRangeModule.ts new file mode 100644 index 0000000000..e4fe309ca3 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/time-range-module/abis/timeRangeModule.ts @@ -0,0 +1,295 @@ +export const timeRangeModuleAbi = [ + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "setTimeRange", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "validUntil", + type: "uint48", + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + internalType: "uint48", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "timeRanges", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "validUntil", + type: "uint48", + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + internalType: "uint48", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "TimeRangeSet", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "validUntil", + type: "uint48", + indexed: false, + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + indexed: false, + internalType: "uint48", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "TimeRangeNotValid", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/webauthn-validation/abis/webauthnValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/webauthn-validation/abis/webauthnValidation.ts new file mode 100644 index 0000000000..ac35abfc5d --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/webauthn-validation/abis/webauthnValidation.ts @@ -0,0 +1,373 @@ +export const webauthnValidationModuleAbi = [ + { + type: "constructor", + inputs: [ + { + name: "_entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "_accountImpl", + type: "address", + internalType: "contract ModularAccount", + }, + { + name: "_webauthnValidationModule", + type: "address", + internalType: "address", + }, + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "ENTRY_POINT", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "WEBAUTHN_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "addStake", + inputs: [ + { + name: "unstakeDelay", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "createAccount", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getAddress", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getSalt", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renounceOwnership", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "unlockStake", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdraw", + inputs: [ + { + name: "to", + type: "address", + internalType: "address payable", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdrawStake", + inputs: [ + { + name: "withdrawAddress", + type: "address", + internalType: "address payable", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "ownerX", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "AddressInsufficientBalance", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "FailedInnerCall", + inputs: [], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "SafeERC20FailedOperation", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "TransferFailed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/utils.ts b/account-kit/smart-contracts/src/ma-v2/utils.ts index e1dcba662c..f480b5561f 100644 --- a/account-kit/smart-contracts/src/ma-v2/utils.ts +++ b/account-kit/smart-contracts/src/ma-v2/utils.ts @@ -12,3 +12,31 @@ export const packSignature = ({ }: PackSignatureParams): Hex => { return concat(["0xFF", "0x00", validationSignature]); }; + +export const addresses = { + allowlistModule: + "0xE46ca4a98c485caEE2Abb6ef5116292B8c78a868" as `0x${string}`, + nativeTokenLimitModule: + "0xEa6a05306315196f2A7CA2ec7eEA45290bae00A0" as `0x${string}`, + paymasterGuardModule: + "0x976D01aF75D128cae526B5328AC268ac83D607f4" as `0x${string}`, + singleSignerValidationModule: + "0xF56716aE104545BdAf012e14e4640beb52727479" as `0x${string}`, + timeRangeModule: + "0x6FD0a9765a86788126a55aD5a483029a484F996C" as `0x${string}`, + webauthnValidationModule: + "0xCf3423F8EB9EE215560802D03a48cDD44f85bD28" as `0x${string}`, + executionInstallDelegate: + "0x8Bf909fEb66EBcC4725f04E70F319791Ec9d9628" as `0x${string}`, + modularAccountImpl: + "0x99090abd2700E24Cc70E3c486A89F7af876fFA33" as `0x${string}`, + semiModularAccountBytecodeImpl: + "0xDCBb5d4639428B18703801f7Cd7230add729E4b0" as `0x${string}`, + semiModularAccountStorageOnlyImpl: + "0x563ea43Ba0CD9150466B054Ce47FB0Fb45B234E2" as `0x${string}`, + accountFactory: "0xA5FC7aDc6d2c838443dF5bb826152c58b918f2c8" as `0x${string}`, + accountFactoryOwner: + "0x3BD786ac7Dec96eF9d06ebbCFa4e0E0947A2c303" as `0x${string}`, +}; + +export const tempChainId = 11155420; From ec136e9027f71ef9a1981984e7a21a93a2528521 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:57:52 +0000 Subject: [PATCH 02/12] feat: add mav2 account (#1208) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uses a placeholder signer for now --- ## PR-Codex overview This PR introduces a new smart contract account type called `SMAV2Account`, along with its creation function `createSMAV2Account`. It includes types, parameters, and logic for initializing accounts using a bundler client, handling initial owners, and generating account addresses. ### Detailed summary - Added type `SMAV2Account` for smart contract accounts. - Introduced type `CreateSMAV2AccountParams` for account creation parameters. - Implemented `createSMAV2Account` function to create a new account. - Added logic to handle account initialization and owner address retrieval. - Utilized `createBundlerClient` for client creation. - Integrated `standardExecutor` and `multiOwnerMessageSigner` for account functionality. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/ma-v2/account/account.ts | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 account-kit/smart-contracts/src/ma-v2/account/account.ts diff --git a/account-kit/smart-contracts/src/ma-v2/account/account.ts b/account-kit/smart-contracts/src/ma-v2/account/account.ts new file mode 100644 index 0000000000..bfb7db39c9 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/account/account.ts @@ -0,0 +1,127 @@ +import type { + EntryPointDef, + SmartAccountSigner, + SmartContractAccountWithSigner, + ToSmartContractAccountParams, +} from "@aa-sdk/core"; +import { + createBundlerClient, + getAccountAddress, + getEntryPoint, + toSmartContractAccount, +} from "@aa-sdk/core"; +import { + concatHex, + encodeFunctionData, + type Address, + type Chain, + type Hex, + type Transport, +} from "viem"; +import { accountFactoryAbi } from "../abis/accountFactoryAbi.js"; +import { addresses } from "../utils.js"; +import { standardExecutor } from "../../msca/account/standardExecutor.js"; +import { multiOwnerMessageSigner } from "../../msca/plugins/multi-owner/signer.js"; // TODO: swap for MA v2 signer + +export const DEFAULT_OWNER_ENTITY_ID = 0; + +export type SMAV2Account< + TSigner extends SmartAccountSigner = SmartAccountSigner +> = SmartContractAccountWithSigner<"SMAV2Account", TSigner, "0.7.0">; + +export type CreateSMAV2AccountParams< + TTransport extends Transport = Transport, + TSigner extends SmartAccountSigner = SmartAccountSigner, + TEntryPointVersion extends "0.7.0" = "0.7.0" +> = Pick< + ToSmartContractAccountParams< + "SMAV2Account", + TTransport, + Chain, + TEntryPointVersion + >, + "transport" | "chain" +> & { + signer: TSigner; + salt?: bigint; + factoryAddress?: Address; + initCode?: Hex; + initialOwner?: Address; + accountAddress?: Address; + entryPoint?: EntryPointDef; +}; + +export async function createSMAV2Account< + TTransport extends Transport = Transport, + TSigner extends SmartAccountSigner = SmartAccountSigner +>( + config: CreateSMAV2AccountParams +): Promise>; + +export async function createSMAV2Account( + config: CreateSMAV2AccountParams +): Promise { + const { + transport, + chain, + signer, + salt = 0n, + factoryAddress = addresses.accountFactory, + initCode, + initialOwner, + accountAddress, + entryPoint = getEntryPoint(chain, { version: "0.7.0" }), + } = config; + + const client = createBundlerClient({ + transport, + chain, + }); + + const getAccountInitCode = async () => { + if (initCode) { + return initCode; + } + + // If an initial owner is not provided, use the signer's address + const ownerAddress = initialOwner || (await signer.getAddress()); + + return concatHex([ + factoryAddress, + encodeFunctionData({ + abi: accountFactoryAbi, + functionName: "createAccount", + args: [ownerAddress, salt, DEFAULT_OWNER_ENTITY_ID], + }), + ]); + }; + + const _accountAddress = await getAccountAddress({ + client, + entryPoint, + accountAddress, + getAccountInitCode, + }); + + const baseAccount = await toSmartContractAccount({ + transport, + chain, + entryPoint, + accountAddress: _accountAddress, + source: `SMAV2Account`, + getAccountInitCode, + ...standardExecutor, + ...multiOwnerMessageSigner( + // TODO: temp + client, + addresses.accountFactory, + () => signer, + addresses.accountFactory + ), + }); + + return { + ...baseAccount, + getSigner: () => signer, + }; +} From 1d4bc715ee954e9b030bf883709bbdec5979ffed Mon Sep 17 00:00:00 2001 From: linnall <38363056+linnall@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:45:46 +0000 Subject: [PATCH 03/12] feat: add mav2 signer (#1203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [ ] Did you add new tests and confirm existing tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)) - [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`) - [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)? --- This PR introduces a new module for single signer validation in the `account-kit` smart contracts. It adds functionality for packing signatures and validating user operations, along with defining the ABI for the single signer validation module and related contracts. - Added `PackSignatureParams` type and `packSignature` utility in `utils.ts`. - Created `SingleSignerValidationModule` with metadata and encoding functions in `single-signer-validation/module.ts`. - Implemented `singleSignerMessageSigner` function in `single-signer-validation/signer.ts` for signing operations. - Defined the ABI for `singleSignerValidation` in `abis/singleSignerValidation.ts`. - Added ABI for `MAV2Factory` and `smaV2` in their respective files. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/ma-v2/abis/maV2Factory.ts | 638 ++++++++ .../smart-contracts/src/ma-v2/abis/smaV2.ts | 1288 +++++++++++++++++ .../abis/singleSignerValidation.ts | 330 +++++ 3 files changed, 2256 insertions(+) create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts new file mode 100644 index 0000000000..e9fa4e35ff --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts @@ -0,0 +1,638 @@ +export const MAV2FactoryAbi = [ + { + type: "constructor", + inputs: [ + { + name: "_entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "_accountImpl", + type: "address", + internalType: "contract ModularAccount", + }, + { + name: "_semiModularImpl", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + { + name: "_singleSignerValidationModule", + type: "address", + internalType: "address", + }, + { + name: "_webAuthnValidationModule", + type: "address", + internalType: "address", + }, + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "ENTRY_POINT", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "SEMI_MODULAR_ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "SINGLE_SIGNER_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "WEBAUTHN_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "acceptOwnership", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "addStake", + inputs: [ + { + name: "unstakeDelay", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "createAccount", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createSemiModularAccount", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createWebAuthnAccount", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getAddress", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getAddressSemiModular", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getAddressWebAuthn", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getSalt", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getSaltWebAuthn", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "pendingOwner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renounceOwnership", + inputs: [], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "unlockStake", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdraw", + inputs: [ + { + name: "to", + type: "address", + internalType: "address payable", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdrawStake", + inputs: [ + { + name: "withdrawAddress", + type: "address", + internalType: "address payable", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferStarted", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SemiModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "WebAuthnModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "ownerX", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "AddressInsufficientBalance", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "FailedInnerCall", + inputs: [], + }, + { + type: "error", + name: "InvalidAction", + inputs: [], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "SafeERC20FailedOperation", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "TransferFailed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts new file mode 100644 index 0000000000..d48a15a770 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts @@ -0,0 +1,1288 @@ +export const smaV2Abi = [ + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getFallbackSignerData", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateFallbackSignerData", + inputs: [ + { + name: "fallbackSigner", + type: "address", + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FallbackSignerUpdated", + inputs: [ + { + name: "newFallbackSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "FallbackSignerDisabled", + inputs: [], + }, + { + type: "error", + name: "FallbackSignerMismatch", + inputs: [], + }, + { + type: "error", + name: "FallbackValidationInstallationNotAllowed", + inputs: [], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts new file mode 100644 index 0000000000..726f226320 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts @@ -0,0 +1,330 @@ +export const singleSignerValidationAbi = [ + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "replaySafeHash", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "signers", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "transferSigner", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "newSigner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "validateRuntime", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "validateSignature", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "SignerTransferred", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "newSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "previousSigner", + type: "address", + indexed: false, + internalType: "address", + }, + ], + anonymous: true, + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "NotAuthorized", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; From 9aa4d31a8a65c6bcfcb74e88016be42ae276289c Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:45:47 +0000 Subject: [PATCH 04/12] feat: add all mav2 contract addrs, abis (#1207) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [x] Did you add new tests and confirm existing tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)) - [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`) - [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)? --- This PR focuses on renaming and restructuring various ABI exports and imports in the `account-kit/smart-contracts` project, enhancing clarity and organization in the codebase. - Renamed `MAV2FactoryAbi` to `accountFactoryAbi` in `accountFactoryAbi.ts`. - Renamed `smaV2Abi` to `semiModularAccountBytecodeAbi` in `semiModularAccountBytecodeAbi.ts`. - Renamed `singleSignerValidationAbi` to `singleSignerValidationModuleAbi` in `singleSignerValidationModule.ts`. - Updated import statement in `module.ts` for `singleSignerValidationModuleAbi`. - Added new `addresses` export with various module addresses in `utils.ts`. - Introduced `paymasterGuardModuleAbi` in `paymasterGuardModule.ts`. - Added `timeRangeModuleAbi` in `timeRangeModule.ts`. - Added `webauthnValidationModuleAbi` in `webauthnValidation.ts`. - Added `nativeTokenLimitModuleAbi` in `nativeTokenLimitModule.ts`. - Added `allowlistModuleAbi` in `allowlistModule.ts`. - Introduced `modularAccountAbi` in `modularAccountAbi.ts`. - Introduced `semiModularAccountStorageAbi` in `semiModularAccountStorageAbi.ts`. > The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/semiModularAccountStorageAbi.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/ma-v2/abis/maV2Factory.ts | 638 -------- .../smart-contracts/src/ma-v2/abis/smaV2.ts | 1288 ----------------- .../abis/singleSignerValidation.ts | 330 ----- 3 files changed, 2256 deletions(-) delete mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts deleted file mode 100644 index e9fa4e35ff..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts +++ /dev/null @@ -1,638 +0,0 @@ -export const MAV2FactoryAbi = [ - { - type: "constructor", - inputs: [ - { - name: "_entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "_accountImpl", - type: "address", - internalType: "contract ModularAccount", - }, - { - name: "_semiModularImpl", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - { - name: "_singleSignerValidationModule", - type: "address", - internalType: "address", - }, - { - name: "_webAuthnValidationModule", - type: "address", - internalType: "address", - }, - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "ACCOUNT_IMPL", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "ENTRY_POINT", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "SEMI_MODULAR_ACCOUNT_IMPL", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "SINGLE_SIGNER_VALIDATION_MODULE", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "WEBAUTHN_VALIDATION_MODULE", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "acceptOwnership", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "addStake", - inputs: [ - { - name: "unstakeDelay", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "createAccount", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createSemiModularAccount", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createWebAuthnAccount", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "getAddress", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getAddressSemiModular", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getAddressWebAuthn", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getSalt", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "getSaltWebAuthn", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "owner", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "pendingOwner", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "renounceOwnership", - inputs: [], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "transferOwnership", - inputs: [ - { - name: "newOwner", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "unlockStake", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdraw", - inputs: [ - { - name: "to", - type: "address", - internalType: "address payable", - }, - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdrawStake", - inputs: [ - { - name: "withdrawAddress", - type: "address", - internalType: "address payable", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "OwnershipTransferStarted", - inputs: [ - { - name: "previousOwner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newOwner", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "OwnershipTransferred", - inputs: [ - { - name: "previousOwner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newOwner", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "SemiModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "WebAuthnModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "ownerX", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "AddressEmptyCode", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "AddressInsufficientBalance", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "FailedInnerCall", - inputs: [], - }, - { - type: "error", - name: "InvalidAction", - inputs: [], - }, - { - type: "error", - name: "OwnableInvalidOwner", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "OwnableUnauthorizedAccount", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "SafeERC20FailedOperation", - inputs: [ - { - name: "token", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "TransferFailed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts deleted file mode 100644 index d48a15a770..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts +++ /dev/null @@ -1,1288 +0,0 @@ -export const smaV2Abi = [ - { - type: "constructor", - inputs: [ - { - name: "entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "executionInstallDelegate", - type: "address", - internalType: "contract ExecutionInstallDelegate", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "fallback", - stateMutability: "payable", - }, - { - type: "receive", - stateMutability: "payable", - }, - { - type: "function", - name: "accountId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "entryPoint", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "execute", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "result", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeBatch", - inputs: [ - { - name: "calls", - type: "tuple[]", - internalType: "struct Call[]", - components: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - }, - ], - outputs: [ - { - name: "results", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "executeWithRuntimeValidation", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - { - name: "authorization", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "getExecutionData", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ExecutionDataView", - components: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getFallbackSignerData", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getValidationData", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ValidationDataView", - components: [ - { - name: "validationFlags", - type: "uint8", - internalType: "ValidationFlags", - }, - { - name: "validationHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "installExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleInstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "installValidation", - inputs: [ - { - name: "validationConfig", - type: "bytes25", - internalType: "ValidationConfig", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - { - name: "installData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hooks", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "isValidSignature", - inputs: [ - { - name: "hash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "onERC1155BatchReceived", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC1155Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC721Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "performCreate", - inputs: [ - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "isCreate2", - type: "bool", - internalType: "bool", - }, - { - name: "salt", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "createdAddr", - type: "address", - internalType: "address", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "proxiableUUID", - inputs: [], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "uninstallExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleUninstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "uninstallValidation", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "uninstallData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hookUninstallData", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "updateFallbackSignerData", - inputs: [ - { - name: "fallbackSigner", - type: "address", - internalType: "address", - }, - { - name: "isDisabled", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "upgradeToAndCall", - inputs: [ - { - name: "newImplementation", - type: "address", - internalType: "address", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "validateUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "userOpHash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "missingAccountFunds", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "validationData", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ExecutionInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ExecutionUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "FallbackSignerUpdated", - inputs: [ - { - name: "newFallbackSigner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "isDisabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Initialized", - inputs: [ - { - name: "version", - type: "uint64", - indexed: false, - internalType: "uint64", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Upgraded", - inputs: [ - { - name: "implementation", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ArrayLengthMismatch", - inputs: [], - }, - { - type: "error", - name: "CreateFailed", - inputs: [], - }, - { - type: "error", - name: "DeferredActionSignatureInvalid", - inputs: [], - }, - { - type: "error", - name: "DeferredValidationHasValidationHooks", - inputs: [], - }, - { - type: "error", - name: "ExecutionHookAlreadySet", - inputs: [ - { - name: "hookConfig", - type: "bytes25", - internalType: "HookConfig", - }, - ], - }, - { - type: "error", - name: "FallbackSignerDisabled", - inputs: [], - }, - { - type: "error", - name: "FallbackSignerMismatch", - inputs: [], - }, - { - type: "error", - name: "FallbackValidationInstallationNotAllowed", - inputs: [], - }, - { - type: "error", - name: "InterfaceNotSupported", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "InvalidInitialization", - inputs: [], - }, - { - type: "error", - name: "InvalidSignatureType", - inputs: [], - }, - { - type: "error", - name: "ModuleInstallCallbackFailed", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "revertReason", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - type: "error", - name: "NonCanonicalEncoding", - inputs: [], - }, - { - type: "error", - name: "NotEntryPoint", - inputs: [], - }, - { - type: "error", - name: "PreValidationHookDuplicate", - inputs: [], - }, - { - type: "error", - name: "RequireUserOperationContext", - inputs: [], - }, - { - type: "error", - name: "SegmentOutOfOrder", - inputs: [], - }, - { - type: "error", - name: "SelfCallRecursionDepthExceeded", - inputs: [], - }, - { - type: "error", - name: "SignatureValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "UnauthorizedCallContext", - inputs: [], - }, - { - type: "error", - name: "UnexpectedAggregator", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "aggregator", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "UnrecognizedFunction", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "UpgradeFailed", - inputs: [], - }, - { - type: "error", - name: "UserOpValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAlreadySet", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAssocHookLimitExceeded", - inputs: [], - }, - { - type: "error", - name: "ValidationEntityIdInUse", - inputs: [], - }, - { - type: "error", - name: "ValidationFunctionMissing", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "ValidationSignatureSegmentMissing", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts deleted file mode 100644 index 726f226320..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts +++ /dev/null @@ -1,330 +0,0 @@ -export const singleSignerValidationAbi = [ - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "replaySafeHash", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "hash", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "signers", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "transferSigner", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "newSigner", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "validateRuntime", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "validateSignature", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "digest", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "validateUserOp", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "userOpHash", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "event", - name: "SignerTransferred", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "newSigner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "previousSigner", - type: "address", - indexed: false, - internalType: "address", - }, - ], - anonymous: true, - }, - { - type: "error", - name: "InvalidSignatureType", - inputs: [], - }, - { - type: "error", - name: "NotAuthorized", - inputs: [], - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; From 9a81509f6313421f0217e3dc7cb0d7fcfe28f8b2 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:57:18 -0500 Subject: [PATCH 05/12] feat: add scaffold for ma v2 --- .../src/ma-v2/abis/maV2Factory.ts | 638 ++++++++ .../smart-contracts/src/ma-v2/abis/smaV2.ts | 1288 +++++++++++++++++ .../abis/singleSignerValidation.ts | 330 +++++ 3 files changed, 2256 insertions(+) create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts new file mode 100644 index 0000000000..4a438ff75e --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts @@ -0,0 +1,638 @@ +export const MAV2FactoryAbi = [ + { + "type": "constructor", + "inputs": [ + { + "name": "_entryPoint", + "type": "address", + "internalType": "contract IEntryPoint" + }, + { + "name": "_accountImpl", + "type": "address", + "internalType": "contract ModularAccount" + }, + { + "name": "_semiModularImpl", + "type": "address", + "internalType": "contract SemiModularAccountBytecode" + }, + { + "name": "_singleSignerValidationModule", + "type": "address", + "internalType": "address" + }, + { + "name": "_webAuthnValidationModule", + "type": "address", + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "ACCOUNT_IMPL", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract ModularAccount" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "ENTRY_POINT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IEntryPoint" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "SEMI_MODULAR_ACCOUNT_IMPL", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract SemiModularAccountBytecode" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "SINGLE_SIGNER_VALIDATION_MODULE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "WEBAUTHN_VALIDATION_MODULE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "acceptOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addStake", + "inputs": [ + { + "name": "unstakeDelay", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "createAccount", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract ModularAccount" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "createSemiModularAccount", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract SemiModularAccountBytecode" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "createWebAuthnAccount", + "inputs": [ + { + "name": "ownerX", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "ownerY", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract ModularAccount" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getAddress", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAddressSemiModular", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAddressWebAuthn", + "inputs": [ + { + "name": "ownerX", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "ownerY", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSalt", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "getSaltWebAuthn", + "inputs": [ + { + "name": "ownerX", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "ownerY", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "salt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pendingOwner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unlockStake", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [ + { + "name": "to", + "type": "address", + "internalType": "address payable" + }, + { + "name": "token", + "type": "address", + "internalType": "address" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdrawStake", + "inputs": [ + { + "name": "withdrawAddress", + "type": "address", + "internalType": "address payable" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ModularAccountDeployed", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferStarted", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "SemiModularAccountDeployed", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "salt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "WebAuthnModularAccountDeployed", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "ownerX", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "ownerY", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "salt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AddressInsufficientBalance", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAction", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SafeERC20FailedOperation", + "inputs": [ + { + "name": "token", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "TransferFailed", + "inputs": [] + } +]; \ No newline at end of file diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts new file mode 100644 index 0000000000..d279ab29c2 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts @@ -0,0 +1,1288 @@ +export const smaV2Abi = [ + { + "type": "constructor", + "inputs": [ + { + "name": "entryPoint", + "type": "address", + "internalType": "contract IEntryPoint" + }, + { + "name": "executionInstallDelegate", + "type": "address", + "internalType": "contract ExecutionInstallDelegate" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "fallback", + "stateMutability": "payable" + }, + { + "type": "receive", + "stateMutability": "payable" + }, + { + "type": "function", + "name": "accountId", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "entryPoint", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "contract IEntryPoint" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "execute", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "result", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "executeBatch", + "inputs": [ + { + "name": "calls", + "type": "tuple[]", + "internalType": "struct Call[]", + "components": [ + { + "name": "target", + "type": "address", + "internalType": "address" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ] + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "executeUserOp", + "inputs": [ + { + "name": "userOp", + "type": "tuple", + "internalType": "struct PackedUserOperation", + "components": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "nonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "initCode", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "callData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "accountGasLimits", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "preVerificationGas", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasFees", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "paymasterAndData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "executeWithRuntimeValidation", + "inputs": [ + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "authorization", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "getExecutionData", + "inputs": [ + { + "name": "selector", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "data", + "type": "tuple", + "internalType": "struct ExecutionDataView", + "components": [ + { + "name": "module", + "type": "address", + "internalType": "address" + }, + { + "name": "skipRuntimeValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "allowGlobalValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "executionHooks", + "type": "bytes25[]", + "internalType": "HookConfig[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getFallbackSignerData", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getValidationData", + "inputs": [ + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + } + ], + "outputs": [ + { + "name": "data", + "type": "tuple", + "internalType": "struct ValidationDataView", + "components": [ + { + "name": "validationFlags", + "type": "uint8", + "internalType": "ValidationFlags" + }, + { + "name": "validationHooks", + "type": "bytes25[]", + "internalType": "HookConfig[]" + }, + { + "name": "executionHooks", + "type": "bytes25[]", + "internalType": "HookConfig[]" + }, + { + "name": "selectors", + "type": "bytes4[]", + "internalType": "bytes4[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "installExecution", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + }, + { + "name": "manifest", + "type": "tuple", + "internalType": "struct ExecutionManifest", + "components": [ + { + "name": "executionFunctions", + "type": "tuple[]", + "internalType": "struct ManifestExecutionFunction[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "skipRuntimeValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "allowGlobalValidation", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "executionHooks", + "type": "tuple[]", + "internalType": "struct ManifestExecutionHook[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "isPreHook", + "type": "bool", + "internalType": "bool" + }, + { + "name": "isPostHook", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "interfaceIds", + "type": "bytes4[]", + "internalType": "bytes4[]" + } + ] + }, + { + "name": "moduleInstallData", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "installValidation", + "inputs": [ + { + "name": "validationConfig", + "type": "bytes25", + "internalType": "ValidationConfig" + }, + { + "name": "selectors", + "type": "bytes4[]", + "internalType": "bytes4[]" + }, + { + "name": "installData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "hooks", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isValidSignature", + "inputs": [ + { + "name": "hash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "onERC1155BatchReceived", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "onERC1155Received", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "onERC721Received", + "inputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "performCreate", + "inputs": [ + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "initCode", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "isCreate2", + "type": "bool", + "internalType": "bool" + }, + { + "name": "salt", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "createdAddr", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "uninstallExecution", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + }, + { + "name": "manifest", + "type": "tuple", + "internalType": "struct ExecutionManifest", + "components": [ + { + "name": "executionFunctions", + "type": "tuple[]", + "internalType": "struct ManifestExecutionFunction[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "skipRuntimeValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "allowGlobalValidation", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "executionHooks", + "type": "tuple[]", + "internalType": "struct ManifestExecutionHook[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "isPreHook", + "type": "bool", + "internalType": "bool" + }, + { + "name": "isPostHook", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "interfaceIds", + "type": "bytes4[]", + "internalType": "bytes4[]" + } + ] + }, + { + "name": "moduleUninstallData", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "uninstallValidation", + "inputs": [ + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + }, + { + "name": "uninstallData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "hookUninstallData", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateFallbackSignerData", + "inputs": [ + { + "name": "fallbackSigner", + "type": "address", + "internalType": "address" + }, + { + "name": "isDisabled", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "validateUserOp", + "inputs": [ + { + "name": "userOp", + "type": "tuple", + "internalType": "struct PackedUserOperation", + "components": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "nonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "initCode", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "callData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "accountGasLimits", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "preVerificationGas", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasFees", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "paymasterAndData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "name": "userOpHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "missingAccountFunds", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "validationData", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "ExecutionInstalled", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "manifest", + "type": "tuple", + "indexed": false, + "internalType": "struct ExecutionManifest", + "components": [ + { + "name": "executionFunctions", + "type": "tuple[]", + "internalType": "struct ManifestExecutionFunction[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "skipRuntimeValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "allowGlobalValidation", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "executionHooks", + "type": "tuple[]", + "internalType": "struct ManifestExecutionHook[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "isPreHook", + "type": "bool", + "internalType": "bool" + }, + { + "name": "isPostHook", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "interfaceIds", + "type": "bytes4[]", + "internalType": "bytes4[]" + } + ] + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ExecutionUninstalled", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "onUninstallSucceeded", + "type": "bool", + "indexed": false, + "internalType": "bool" + }, + { + "name": "manifest", + "type": "tuple", + "indexed": false, + "internalType": "struct ExecutionManifest", + "components": [ + { + "name": "executionFunctions", + "type": "tuple[]", + "internalType": "struct ManifestExecutionFunction[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "skipRuntimeValidation", + "type": "bool", + "internalType": "bool" + }, + { + "name": "allowGlobalValidation", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "executionHooks", + "type": "tuple[]", + "internalType": "struct ManifestExecutionHook[]", + "components": [ + { + "name": "executionSelector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "isPreHook", + "type": "bool", + "internalType": "bool" + }, + { + "name": "isPostHook", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "name": "interfaceIds", + "type": "bytes4[]", + "internalType": "bytes4[]" + } + ] + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "FallbackSignerUpdated", + "inputs": [ + { + "name": "newFallbackSigner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "isDisabled", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ValidationInstalled", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "entityId", + "type": "uint32", + "indexed": true, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ValidationUninstalled", + "inputs": [ + { + "name": "module", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "entityId", + "type": "uint32", + "indexed": true, + "internalType": "uint32" + }, + { + "name": "onUninstallSucceeded", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "ArrayLengthMismatch", + "inputs": [] + }, + { + "type": "error", + "name": "CreateFailed", + "inputs": [] + }, + { + "type": "error", + "name": "DeferredActionSignatureInvalid", + "inputs": [] + }, + { + "type": "error", + "name": "DeferredValidationHasValidationHooks", + "inputs": [] + }, + { + "type": "error", + "name": "ExecutionHookAlreadySet", + "inputs": [ + { + "name": "hookConfig", + "type": "bytes25", + "internalType": "HookConfig" + } + ] + }, + { + "type": "error", + "name": "FallbackSignerDisabled", + "inputs": [] + }, + { + "type": "error", + "name": "FallbackSignerMismatch", + "inputs": [] + }, + { + "type": "error", + "name": "FallbackValidationInstallationNotAllowed", + "inputs": [] + }, + { + "type": "error", + "name": "InterfaceNotSupported", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidSignatureType", + "inputs": [] + }, + { + "type": "error", + "name": "ModuleInstallCallbackFailed", + "inputs": [ + { + "name": "module", + "type": "address", + "internalType": "address" + }, + { + "name": "revertReason", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "NonCanonicalEncoding", + "inputs": [] + }, + { + "type": "error", + "name": "NotEntryPoint", + "inputs": [] + }, + { + "type": "error", + "name": "PreValidationHookDuplicate", + "inputs": [] + }, + { + "type": "error", + "name": "RequireUserOperationContext", + "inputs": [] + }, + { + "type": "error", + "name": "SegmentOutOfOrder", + "inputs": [] + }, + { + "type": "error", + "name": "SelfCallRecursionDepthExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "SignatureValidationInvalid", + "inputs": [ + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + } + ] + }, + { + "type": "error", + "name": "UnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UnexpectedAggregator", + "inputs": [ + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + }, + { + "name": "aggregator", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "UnrecognizedFunction", + "inputs": [ + { + "name": "selector", + "type": "bytes4", + "internalType": "bytes4" + } + ] + }, + { + "type": "error", + "name": "UpgradeFailed", + "inputs": [] + }, + { + "type": "error", + "name": "UserOpValidationInvalid", + "inputs": [ + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + } + ] + }, + { + "type": "error", + "name": "ValidationAlreadySet", + "inputs": [ + { + "name": "selector", + "type": "bytes4", + "internalType": "bytes4" + }, + { + "name": "validationFunction", + "type": "bytes24", + "internalType": "ModuleEntity" + } + ] + }, + { + "type": "error", + "name": "ValidationAssocHookLimitExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "ValidationEntityIdInUse", + "inputs": [] + }, + { + "type": "error", + "name": "ValidationFunctionMissing", + "inputs": [ + { + "name": "selector", + "type": "bytes4", + "internalType": "bytes4" + } + ] + }, + { + "type": "error", + "name": "ValidationSignatureSegmentMissing", + "inputs": [] + } +]; \ No newline at end of file diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts new file mode 100644 index 0000000000..92e85389af --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts @@ -0,0 +1,330 @@ +export const singleSignerValidationAbi = [ + { + "type": "function", + "name": "moduleId", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "onInstall", + "inputs": [ + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "onUninstall", + "inputs": [ + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "replaySafeHash", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "hash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "signers", + "inputs": [ + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "transferSigner", + "inputs": [ + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "newSigner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "validateRuntime", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "view" + }, + { + "type": "function", + "name": "validateSignature", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "digest", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "validateUserOp", + "inputs": [ + { + "name": "entityId", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "userOp", + "type": "tuple", + "internalType": "struct PackedUserOperation", + "components": [ + { + "name": "sender", + "type": "address", + "internalType": "address" + }, + { + "name": "nonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "initCode", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "callData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "accountGasLimits", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "preVerificationGas", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "gasFees", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "paymasterAndData", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "name": "userOpHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "event", + "name": "SignerTransferred", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "entityId", + "type": "uint32", + "indexed": true, + "internalType": "uint32" + }, + { + "name": "newSigner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "previousSigner", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": true + }, + { + "type": "error", + "name": "InvalidSignatureType", + "inputs": [] + }, + { + "type": "error", + "name": "NotAuthorized", + "inputs": [] + }, + { + "type": "error", + "name": "NotImplemented", + "inputs": [] + }, + { + "type": "error", + "name": "UnexpectedDataPassed", + "inputs": [] + } +]; \ No newline at end of file From 670d45269e57e1ba88794579e8ef765e9a19a8e0 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:05:59 -0500 Subject: [PATCH 06/12] chore: lint --- .../src/ma-v2/abis/maV2Factory.ts | 1274 ++++---- .../smart-contracts/src/ma-v2/abis/smaV2.ts | 2556 ++++++++--------- .../abis/singleSignerValidation.ts | 656 ++--- 3 files changed, 2243 insertions(+), 2243 deletions(-) diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts index 4a438ff75e..e9fa4e35ff 100644 --- a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts +++ b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts @@ -1,638 +1,638 @@ export const MAV2FactoryAbi = [ - { - "type": "constructor", - "inputs": [ - { - "name": "_entryPoint", - "type": "address", - "internalType": "contract IEntryPoint" - }, - { - "name": "_accountImpl", - "type": "address", - "internalType": "contract ModularAccount" - }, - { - "name": "_semiModularImpl", - "type": "address", - "internalType": "contract SemiModularAccountBytecode" - }, - { - "name": "_singleSignerValidationModule", - "type": "address", - "internalType": "address" - }, - { - "name": "_webAuthnValidationModule", - "type": "address", - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "ACCOUNT_IMPL", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract ModularAccount" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "ENTRY_POINT", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract IEntryPoint" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "SEMI_MODULAR_ACCOUNT_IMPL", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract SemiModularAccountBytecode" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "SINGLE_SIGNER_VALIDATION_MODULE", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "WEBAUTHN_VALIDATION_MODULE", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "acceptOwnership", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "addStake", - "inputs": [ - { - "name": "unstakeDelay", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "createAccount", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract ModularAccount" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "createSemiModularAccount", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract SemiModularAccountBytecode" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "createWebAuthnAccount", - "inputs": [ - { - "name": "ownerX", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "ownerY", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract ModularAccount" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "getAddress", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getAddressSemiModular", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getAddressWebAuthn", - "inputs": [ - { - "name": "ownerX", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "ownerY", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getSalt", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "getSaltWebAuthn", - "inputs": [ - { - "name": "ownerX", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "ownerY", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "salt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "owner", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "pendingOwner", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "renounceOwnership", - "inputs": [], - "outputs": [], - "stateMutability": "view" - }, - { - "type": "function", - "name": "transferOwnership", - "inputs": [ - { - "name": "newOwner", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "unlockStake", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "withdraw", - "inputs": [ - { - "name": "to", - "type": "address", - "internalType": "address payable" - }, - { - "name": "token", - "type": "address", - "internalType": "address" - }, - { - "name": "amount", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "withdrawStake", - "inputs": [ - { - "name": "withdrawAddress", - "type": "address", - "internalType": "address payable" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "ModularAccountDeployed", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "OwnershipTransferStarted", - "inputs": [ - { - "name": "previousOwner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "newOwner", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "OwnershipTransferred", - "inputs": [ - { - "name": "previousOwner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "newOwner", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "SemiModularAccountDeployed", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "salt", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "WebAuthnModularAccountDeployed", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "ownerX", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "ownerY", - "type": "uint256", - "indexed": true, - "internalType": "uint256" - }, - { - "name": "salt", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "AddressEmptyCode", - "inputs": [ - { - "name": "target", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AddressInsufficientBalance", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "FailedInnerCall", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidAction", - "inputs": [] - }, - { - "type": "error", - "name": "OwnableInvalidOwner", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "OwnableUnauthorizedAccount", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SafeERC20FailedOperation", - "inputs": [ - { - "name": "token", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "TransferFailed", - "inputs": [] - } -]; \ No newline at end of file + { + type: "constructor", + inputs: [ + { + name: "_entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "_accountImpl", + type: "address", + internalType: "contract ModularAccount", + }, + { + name: "_semiModularImpl", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + { + name: "_singleSignerValidationModule", + type: "address", + internalType: "address", + }, + { + name: "_webAuthnValidationModule", + type: "address", + internalType: "address", + }, + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "ENTRY_POINT", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "SEMI_MODULAR_ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "SINGLE_SIGNER_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "WEBAUTHN_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "acceptOwnership", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "addStake", + inputs: [ + { + name: "unstakeDelay", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "createAccount", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createSemiModularAccount", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SemiModularAccountBytecode", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createWebAuthnAccount", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getAddress", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getAddressSemiModular", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getAddressWebAuthn", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getSalt", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getSaltWebAuthn", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "pendingOwner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renounceOwnership", + inputs: [], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "unlockStake", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdraw", + inputs: [ + { + name: "to", + type: "address", + internalType: "address payable", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdrawStake", + inputs: [ + { + name: "withdrawAddress", + type: "address", + internalType: "address payable", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferStarted", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SemiModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "WebAuthnModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "ownerX", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "AddressInsufficientBalance", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "FailedInnerCall", + inputs: [], + }, + { + type: "error", + name: "InvalidAction", + inputs: [], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "SafeERC20FailedOperation", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "TransferFailed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts index d279ab29c2..d48a15a770 100644 --- a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts +++ b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts @@ -1,1288 +1,1288 @@ export const smaV2Abi = [ - { - "type": "constructor", - "inputs": [ - { - "name": "entryPoint", - "type": "address", - "internalType": "contract IEntryPoint" - }, - { - "name": "executionInstallDelegate", - "type": "address", - "internalType": "contract ExecutionInstallDelegate" - } + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, ], - "stateMutability": "nonpayable" - }, - { - "type": "fallback", - "stateMutability": "payable" - }, - { - "type": "receive", - "stateMutability": "payable" - }, - { - "type": "function", - "name": "accountId", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "string", - "internalType": "string" - } + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "entryPoint", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "contract IEntryPoint" - } + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "execute", - "inputs": [ - { - "name": "target", - "type": "address", - "internalType": "address" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getFallbackSignerData", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, ], - "outputs": [ - { - "name": "result", - "type": "bytes", - "internalType": "bytes" - } + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, ], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "executeBatch", - "inputs": [ - { - "name": "calls", - "type": "tuple[]", - "internalType": "struct Call[]", - "components": [ - { - "name": "target", - "type": "address", - "internalType": "address" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ] - } + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, ], - "outputs": [ - { - "name": "results", - "type": "bytes[]", - "internalType": "bytes[]" - } + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateFallbackSignerData", + inputs: [ + { + name: "fallbackSigner", + type: "address", + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, ], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "executeUserOp", - "inputs": [ - { - "name": "userOp", - "type": "tuple", - "internalType": "struct PackedUserOperation", - "components": [ - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "accountGasLimits", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "preVerificationGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gasFees", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "paymasterAndData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "executeWithRuntimeValidation", - "inputs": [ - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "authorization", - "type": "bytes", - "internalType": "bytes" - } + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, ], - "outputs": [ - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "getExecutionData", - "inputs": [ - { - "name": "selector", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "outputs": [ - { - "name": "data", - "type": "tuple", - "internalType": "struct ExecutionDataView", - "components": [ - { - "name": "module", - "type": "address", - "internalType": "address" - }, - { - "name": "skipRuntimeValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "allowGlobalValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "executionHooks", - "type": "bytes25[]", - "internalType": "HookConfig[]" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getFallbackSignerData", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getValidationData", - "inputs": [ - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - } - ], - "outputs": [ - { - "name": "data", - "type": "tuple", - "internalType": "struct ValidationDataView", - "components": [ - { - "name": "validationFlags", - "type": "uint8", - "internalType": "ValidationFlags" - }, - { - "name": "validationHooks", - "type": "bytes25[]", - "internalType": "HookConfig[]" - }, - { - "name": "executionHooks", - "type": "bytes25[]", - "internalType": "HookConfig[]" - }, - { - "name": "selectors", - "type": "bytes4[]", - "internalType": "bytes4[]" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "installExecution", - "inputs": [ - { - "name": "module", - "type": "address", - "internalType": "address" - }, - { - "name": "manifest", - "type": "tuple", - "internalType": "struct ExecutionManifest", - "components": [ - { - "name": "executionFunctions", - "type": "tuple[]", - "internalType": "struct ManifestExecutionFunction[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "skipRuntimeValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "allowGlobalValidation", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "executionHooks", - "type": "tuple[]", - "internalType": "struct ManifestExecutionHook[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "isPreHook", - "type": "bool", - "internalType": "bool" - }, - { - "name": "isPostHook", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "interfaceIds", - "type": "bytes4[]", - "internalType": "bytes4[]" - } - ] - }, - { - "name": "moduleInstallData", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "installValidation", - "inputs": [ - { - "name": "validationConfig", - "type": "bytes25", - "internalType": "ValidationConfig" - }, - { - "name": "selectors", - "type": "bytes4[]", - "internalType": "bytes4[]" - }, - { - "name": "installData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "hooks", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "isValidSignature", - "inputs": [ - { - "name": "hash", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "onERC1155BatchReceived", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "uint256[]", - "internalType": "uint256[]" - }, - { - "name": "", - "type": "uint256[]", - "internalType": "uint256[]" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "onERC1155Received", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "onERC721Received", - "inputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "performCreate", - "inputs": [ - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "isCreate2", - "type": "bool", - "internalType": "bool" - }, - { - "name": "salt", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "createdAddr", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "proxiableUUID", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "supportsInterface", - "inputs": [ - { - "name": "interfaceId", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "uninstallExecution", - "inputs": [ - { - "name": "module", - "type": "address", - "internalType": "address" - }, - { - "name": "manifest", - "type": "tuple", - "internalType": "struct ExecutionManifest", - "components": [ - { - "name": "executionFunctions", - "type": "tuple[]", - "internalType": "struct ManifestExecutionFunction[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "skipRuntimeValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "allowGlobalValidation", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "executionHooks", - "type": "tuple[]", - "internalType": "struct ManifestExecutionHook[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "isPreHook", - "type": "bool", - "internalType": "bool" - }, - { - "name": "isPostHook", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "interfaceIds", - "type": "bytes4[]", - "internalType": "bytes4[]" - } - ] - }, - { - "name": "moduleUninstallData", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "uninstallValidation", - "inputs": [ - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - }, - { - "name": "uninstallData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "hookUninstallData", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "updateFallbackSignerData", - "inputs": [ - { - "name": "fallbackSigner", - "type": "address", - "internalType": "address" - }, - { - "name": "isDisabled", - "type": "bool", - "internalType": "bool" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "upgradeToAndCall", - "inputs": [ - { - "name": "newImplementation", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "payable" - }, - { - "type": "function", - "name": "validateUserOp", - "inputs": [ - { - "name": "userOp", - "type": "tuple", - "internalType": "struct PackedUserOperation", - "components": [ - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "accountGasLimits", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "preVerificationGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gasFees", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "paymasterAndData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "name": "userOpHash", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "missingAccountFunds", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "validationData", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "ExecutionInstalled", - "inputs": [ - { - "name": "module", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "manifest", - "type": "tuple", - "indexed": false, - "internalType": "struct ExecutionManifest", - "components": [ - { - "name": "executionFunctions", - "type": "tuple[]", - "internalType": "struct ManifestExecutionFunction[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "skipRuntimeValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "allowGlobalValidation", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "executionHooks", - "type": "tuple[]", - "internalType": "struct ManifestExecutionHook[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "isPreHook", - "type": "bool", - "internalType": "bool" - }, - { - "name": "isPostHook", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "interfaceIds", - "type": "bytes4[]", - "internalType": "bytes4[]" - } - ] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ExecutionUninstalled", - "inputs": [ - { - "name": "module", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "onUninstallSucceeded", - "type": "bool", - "indexed": false, - "internalType": "bool" - }, - { - "name": "manifest", - "type": "tuple", - "indexed": false, - "internalType": "struct ExecutionManifest", - "components": [ - { - "name": "executionFunctions", - "type": "tuple[]", - "internalType": "struct ManifestExecutionFunction[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "skipRuntimeValidation", - "type": "bool", - "internalType": "bool" - }, - { - "name": "allowGlobalValidation", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "executionHooks", - "type": "tuple[]", - "internalType": "struct ManifestExecutionHook[]", - "components": [ - { - "name": "executionSelector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "isPreHook", - "type": "bool", - "internalType": "bool" - }, - { - "name": "isPostHook", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "name": "interfaceIds", - "type": "bytes4[]", - "internalType": "bytes4[]" - } - ] - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "FallbackSignerUpdated", - "inputs": [ - { - "name": "newFallbackSigner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "isDisabled", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Initialized", - "inputs": [ - { - "name": "version", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Upgraded", - "inputs": [ - { - "name": "implementation", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ValidationInstalled", - "inputs": [ - { - "name": "module", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "entityId", - "type": "uint32", - "indexed": true, - "internalType": "uint32" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ValidationUninstalled", - "inputs": [ - { - "name": "module", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "entityId", - "type": "uint32", - "indexed": true, - "internalType": "uint32" - }, - { - "name": "onUninstallSucceeded", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "ArrayLengthMismatch", - "inputs": [] - }, - { - "type": "error", - "name": "CreateFailed", - "inputs": [] - }, - { - "type": "error", - "name": "DeferredActionSignatureInvalid", - "inputs": [] - }, - { - "type": "error", - "name": "DeferredValidationHasValidationHooks", - "inputs": [] - }, - { - "type": "error", - "name": "ExecutionHookAlreadySet", - "inputs": [ - { - "name": "hookConfig", - "type": "bytes25", - "internalType": "HookConfig" - } - ] - }, - { - "type": "error", - "name": "FallbackSignerDisabled", - "inputs": [] - }, - { - "type": "error", - "name": "FallbackSignerMismatch", - "inputs": [] - }, - { - "type": "error", - "name": "FallbackValidationInstallationNotAllowed", - "inputs": [] - }, - { - "type": "error", - "name": "InterfaceNotSupported", - "inputs": [ - { - "name": "module", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "InvalidInitialization", - "inputs": [] - }, - { - "type": "error", - "name": "InvalidSignatureType", - "inputs": [] - }, - { - "type": "error", - "name": "ModuleInstallCallbackFailed", - "inputs": [ - { - "name": "module", - "type": "address", - "internalType": "address" - }, - { - "name": "revertReason", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "type": "error", - "name": "NonCanonicalEncoding", - "inputs": [] - }, - { - "type": "error", - "name": "NotEntryPoint", - "inputs": [] - }, - { - "type": "error", - "name": "PreValidationHookDuplicate", - "inputs": [] - }, - { - "type": "error", - "name": "RequireUserOperationContext", - "inputs": [] - }, - { - "type": "error", - "name": "SegmentOutOfOrder", - "inputs": [] - }, - { - "type": "error", - "name": "SelfCallRecursionDepthExceeded", - "inputs": [] - }, - { - "type": "error", - "name": "SignatureValidationInvalid", - "inputs": [ - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - } - ] - }, - { - "type": "error", - "name": "UnauthorizedCallContext", - "inputs": [] - }, - { - "type": "error", - "name": "UnexpectedAggregator", - "inputs": [ - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - }, - { - "name": "aggregator", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "UnrecognizedFunction", - "inputs": [ - { - "name": "selector", - "type": "bytes4", - "internalType": "bytes4" - } - ] - }, - { - "type": "error", - "name": "UpgradeFailed", - "inputs": [] - }, - { - "type": "error", - "name": "UserOpValidationInvalid", - "inputs": [ - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - } - ] - }, - { - "type": "error", - "name": "ValidationAlreadySet", - "inputs": [ - { - "name": "selector", - "type": "bytes4", - "internalType": "bytes4" - }, - { - "name": "validationFunction", - "type": "bytes24", - "internalType": "ModuleEntity" - } - ] - }, - { - "type": "error", - "name": "ValidationAssocHookLimitExceeded", - "inputs": [] - }, - { - "type": "error", - "name": "ValidationEntityIdInUse", - "inputs": [] - }, - { - "type": "error", - "name": "ValidationFunctionMissing", - "inputs": [ - { - "name": "selector", - "type": "bytes4", - "internalType": "bytes4" - } - ] - }, - { - "type": "error", - "name": "ValidationSignatureSegmentMissing", - "inputs": [] - } -]; \ No newline at end of file + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FallbackSignerUpdated", + inputs: [ + { + name: "newFallbackSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "FallbackSignerDisabled", + inputs: [], + }, + { + type: "error", + name: "FallbackSignerMismatch", + inputs: [], + }, + { + type: "error", + name: "FallbackValidationInstallationNotAllowed", + inputs: [], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts index 92e85389af..726f226320 100644 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts @@ -1,330 +1,330 @@ export const singleSignerValidationAbi = [ - { - "type": "function", - "name": "moduleId", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "string", - "internalType": "string" - } + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "replaySafeHash", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "signers", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "transferSigner", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "newSigner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "validateRuntime", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "validateSignature", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "digest", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, ], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "onInstall", - "inputs": [ - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "onUninstall", - "inputs": [ - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "replaySafeHash", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - }, - { - "name": "hash", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "signers", - "inputs": [ - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "account", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "supportsInterface", - "inputs": [ - { - "name": "interfaceId", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "transferSigner", - "inputs": [ - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "newSigner", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "validateRuntime", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "view" - }, - { - "type": "function", - "name": "validateSignature", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - }, - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "digest", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes4", - "internalType": "bytes4" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "validateUserOp", - "inputs": [ - { - "name": "entityId", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "userOp", - "type": "tuple", - "internalType": "struct PackedUserOperation", - "components": [ - { - "name": "sender", - "type": "address", - "internalType": "address" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "initCode", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "callData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "accountGasLimits", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "preVerificationGas", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "gasFees", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "paymasterAndData", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "signature", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "name": "userOpHash", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "event", - "name": "SignerTransferred", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "entityId", - "type": "uint32", - "indexed": true, - "internalType": "uint32" - }, - { - "name": "newSigner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "previousSigner", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": true - }, - { - "type": "error", - "name": "InvalidSignatureType", - "inputs": [] - }, - { - "type": "error", - "name": "NotAuthorized", - "inputs": [] - }, - { - "type": "error", - "name": "NotImplemented", - "inputs": [] - }, - { - "type": "error", - "name": "UnexpectedDataPassed", - "inputs": [] - } -]; \ No newline at end of file + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "SignerTransferred", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "newSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "previousSigner", + type: "address", + indexed: false, + internalType: "address", + }, + ], + anonymous: true, + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "NotAuthorized", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; From 7e4f1912912159c0f9745fa6c3872e279c2993fb Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:57:18 -0500 Subject: [PATCH 07/12] feat: add scaffold for ma v2 --- .../src/ma-v2/abis/maV2Factory.ts | 638 -------- .../smart-contracts/src/ma-v2/abis/smaV2.ts | 1288 ----------------- .../abis/singleSignerValidation.ts | 330 ----- 3 files changed, 2256 deletions(-) delete mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts deleted file mode 100644 index e9fa4e35ff..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/abis/maV2Factory.ts +++ /dev/null @@ -1,638 +0,0 @@ -export const MAV2FactoryAbi = [ - { - type: "constructor", - inputs: [ - { - name: "_entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "_accountImpl", - type: "address", - internalType: "contract ModularAccount", - }, - { - name: "_semiModularImpl", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - { - name: "_singleSignerValidationModule", - type: "address", - internalType: "address", - }, - { - name: "_webAuthnValidationModule", - type: "address", - internalType: "address", - }, - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "ACCOUNT_IMPL", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "ENTRY_POINT", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "SEMI_MODULAR_ACCOUNT_IMPL", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "SINGLE_SIGNER_VALIDATION_MODULE", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "WEBAUTHN_VALIDATION_MODULE", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "acceptOwnership", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "addStake", - inputs: [ - { - name: "unstakeDelay", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "createAccount", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createSemiModularAccount", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract SemiModularAccountBytecode", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createWebAuthnAccount", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "getAddress", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getAddressSemiModular", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getAddressWebAuthn", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getSalt", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "getSaltWebAuthn", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "owner", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "pendingOwner", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "renounceOwnership", - inputs: [], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "transferOwnership", - inputs: [ - { - name: "newOwner", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "unlockStake", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdraw", - inputs: [ - { - name: "to", - type: "address", - internalType: "address payable", - }, - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdrawStake", - inputs: [ - { - name: "withdrawAddress", - type: "address", - internalType: "address payable", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "OwnershipTransferStarted", - inputs: [ - { - name: "previousOwner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newOwner", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "OwnershipTransferred", - inputs: [ - { - name: "previousOwner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newOwner", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "SemiModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "WebAuthnModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "ownerX", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "AddressEmptyCode", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "AddressInsufficientBalance", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "FailedInnerCall", - inputs: [], - }, - { - type: "error", - name: "InvalidAction", - inputs: [], - }, - { - type: "error", - name: "OwnableInvalidOwner", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "OwnableUnauthorizedAccount", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "SafeERC20FailedOperation", - inputs: [ - { - name: "token", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "TransferFailed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts deleted file mode 100644 index d48a15a770..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/abis/smaV2.ts +++ /dev/null @@ -1,1288 +0,0 @@ -export const smaV2Abi = [ - { - type: "constructor", - inputs: [ - { - name: "entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "executionInstallDelegate", - type: "address", - internalType: "contract ExecutionInstallDelegate", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "fallback", - stateMutability: "payable", - }, - { - type: "receive", - stateMutability: "payable", - }, - { - type: "function", - name: "accountId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "entryPoint", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "execute", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "result", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeBatch", - inputs: [ - { - name: "calls", - type: "tuple[]", - internalType: "struct Call[]", - components: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - }, - ], - outputs: [ - { - name: "results", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "executeWithRuntimeValidation", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - { - name: "authorization", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "getExecutionData", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ExecutionDataView", - components: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getFallbackSignerData", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getValidationData", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ValidationDataView", - components: [ - { - name: "validationFlags", - type: "uint8", - internalType: "ValidationFlags", - }, - { - name: "validationHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "installExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleInstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "installValidation", - inputs: [ - { - name: "validationConfig", - type: "bytes25", - internalType: "ValidationConfig", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - { - name: "installData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hooks", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "isValidSignature", - inputs: [ - { - name: "hash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "onERC1155BatchReceived", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC1155Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC721Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "performCreate", - inputs: [ - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "isCreate2", - type: "bool", - internalType: "bool", - }, - { - name: "salt", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "createdAddr", - type: "address", - internalType: "address", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "proxiableUUID", - inputs: [], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "uninstallExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleUninstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "uninstallValidation", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "uninstallData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hookUninstallData", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "updateFallbackSignerData", - inputs: [ - { - name: "fallbackSigner", - type: "address", - internalType: "address", - }, - { - name: "isDisabled", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "upgradeToAndCall", - inputs: [ - { - name: "newImplementation", - type: "address", - internalType: "address", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "validateUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "userOpHash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "missingAccountFunds", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "validationData", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ExecutionInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ExecutionUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "FallbackSignerUpdated", - inputs: [ - { - name: "newFallbackSigner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "isDisabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Initialized", - inputs: [ - { - name: "version", - type: "uint64", - indexed: false, - internalType: "uint64", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Upgraded", - inputs: [ - { - name: "implementation", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ArrayLengthMismatch", - inputs: [], - }, - { - type: "error", - name: "CreateFailed", - inputs: [], - }, - { - type: "error", - name: "DeferredActionSignatureInvalid", - inputs: [], - }, - { - type: "error", - name: "DeferredValidationHasValidationHooks", - inputs: [], - }, - { - type: "error", - name: "ExecutionHookAlreadySet", - inputs: [ - { - name: "hookConfig", - type: "bytes25", - internalType: "HookConfig", - }, - ], - }, - { - type: "error", - name: "FallbackSignerDisabled", - inputs: [], - }, - { - type: "error", - name: "FallbackSignerMismatch", - inputs: [], - }, - { - type: "error", - name: "FallbackValidationInstallationNotAllowed", - inputs: [], - }, - { - type: "error", - name: "InterfaceNotSupported", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "InvalidInitialization", - inputs: [], - }, - { - type: "error", - name: "InvalidSignatureType", - inputs: [], - }, - { - type: "error", - name: "ModuleInstallCallbackFailed", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "revertReason", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - type: "error", - name: "NonCanonicalEncoding", - inputs: [], - }, - { - type: "error", - name: "NotEntryPoint", - inputs: [], - }, - { - type: "error", - name: "PreValidationHookDuplicate", - inputs: [], - }, - { - type: "error", - name: "RequireUserOperationContext", - inputs: [], - }, - { - type: "error", - name: "SegmentOutOfOrder", - inputs: [], - }, - { - type: "error", - name: "SelfCallRecursionDepthExceeded", - inputs: [], - }, - { - type: "error", - name: "SignatureValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "UnauthorizedCallContext", - inputs: [], - }, - { - type: "error", - name: "UnexpectedAggregator", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "aggregator", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "UnrecognizedFunction", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "UpgradeFailed", - inputs: [], - }, - { - type: "error", - name: "UserOpValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAlreadySet", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAssocHookLimitExceeded", - inputs: [], - }, - { - type: "error", - name: "ValidationEntityIdInUse", - inputs: [], - }, - { - type: "error", - name: "ValidationFunctionMissing", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "ValidationSignatureSegmentMissing", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts deleted file mode 100644 index 726f226320..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidation.ts +++ /dev/null @@ -1,330 +0,0 @@ -export const singleSignerValidationAbi = [ - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "replaySafeHash", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "hash", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "signers", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "transferSigner", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "newSigner", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "validateRuntime", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "validateSignature", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "digest", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "validateUserOp", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "userOpHash", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "event", - name: "SignerTransferred", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "newSigner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "previousSigner", - type: "address", - indexed: false, - internalType: "address", - }, - ], - anonymous: true, - }, - { - type: "error", - name: "InvalidSignatureType", - inputs: [], - }, - { - type: "error", - name: "NotAuthorized", - inputs: [], - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; From d3c29a264e87a1dc95694326b0e18e745667c665 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Fri, 13 Dec 2024 21:50:57 +0000 Subject: [PATCH 08/12] feat: add all mav2 contract addrs, abis (#1207) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Checklist - [x] Did you add new tests and confirm existing tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `site` folder, and guidelines for updating/adding docs can be found in the [contribution guide](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)) - [ ] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [ ] Did you run lint (`yarn lint:check`) and fix any issues? (`yarn lint:write`) - [ ] Did you follow the [contribution guidelines](https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md)? --- ## PR-Codex overview This PR introduces several new smart contract ABIs and address constants for a modular account system, enhancing functionality for various modules, including validation and execution. ### Detailed summary - Added `addresses` constant with various module addresses in `addresses.ts`. - Introduced ABIs for `paymasterGuardModule`, `timeRangeModule`, `webauthnValidation`, `nativeTokenLimitModule`, `allowlistModule`, and `maV2`. - Each ABI includes functions, events, and errors relevant to their respective modules. > The following files were skipped due to too many changes: `account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../smart-contracts/src/ma-v2/abis/maV2.ts | 1241 ++++++++++++++++ .../src/ma-v2/abis/smaStorage.ts | 1301 +++++++++++++++++ .../smart-contracts/src/ma-v2/addresses.ts | 29 + .../abis/allowlistModule.ts | 715 +++++++++ .../abis/nativeTokenLimitModule.ts | 403 +++++ .../abis/paymasterGuardModule.ts | 241 +++ .../abis/timeRangeModule.ts | 295 ++++ .../abis/webauthnValidation.ts | 373 +++++ 8 files changed, 4598 insertions(+) create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/addresses.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts create mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts new file mode 100644 index 0000000000..d3e7b7ec66 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts @@ -0,0 +1,1241 @@ +export const maV2Abi = [ + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initializeWithValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts b/account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts new file mode 100644 index 0000000000..a73c9d6ebf --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/abis/smaStorage.ts @@ -0,0 +1,1301 @@ +export const smaStorageAbi = [ + { + type: "constructor", + inputs: [ + { + name: "entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "executionInstallDelegate", + type: "address", + internalType: "contract ExecutionInstallDelegate", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "fallback", + stateMutability: "payable", + }, + { + type: "receive", + stateMutability: "payable", + }, + { + type: "function", + name: "accountId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "entryPoint", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "execute", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "result", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeBatch", + inputs: [ + { + name: "calls", + type: "tuple[]", + internalType: "struct Call[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + }, + ], + outputs: [ + { + name: "results", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "executeUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "executeWithRuntimeValidation", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "authorization", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "getExecutionData", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ExecutionDataView", + components: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getFallbackSignerData", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getValidationData", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + outputs: [ + { + name: "data", + type: "tuple", + internalType: "struct ValidationDataView", + components: [ + { + name: "validationFlags", + type: "uint8", + internalType: "ValidationFlags", + }, + { + name: "validationHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "executionHooks", + type: "bytes25[]", + internalType: "HookConfig[]", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { + name: "initialSigner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleInstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "installValidation", + inputs: [ + { + name: "validationConfig", + type: "bytes25", + internalType: "ValidationConfig", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + { + name: "installData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hooks", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isValidSignature", + inputs: [ + { + name: "hash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "onERC1155BatchReceived", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC1155Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onERC721Received", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "performCreate", + inputs: [ + { + name: "value", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "isCreate2", + type: "bool", + internalType: "bool", + }, + { + name: "salt", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "createdAddr", + type: "address", + internalType: "address", + }, + ], + stateMutability: "payable", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "uninstallExecution", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + { + name: "moduleUninstallData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "uninstallValidation", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "uninstallData", + type: "bytes", + internalType: "bytes", + }, + { + name: "hookUninstallData", + type: "bytes[]", + internalType: "bytes[]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateFallbackSignerData", + inputs: [ + { + name: "fallbackSigner", + type: "address", + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "validateUserOp", + inputs: [ + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "userOpHash", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "missingAccountFunds", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "validationData", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ExecutionInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ExecutionUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + { + name: "manifest", + type: "tuple", + indexed: false, + internalType: "struct ExecutionManifest", + components: [ + { + name: "executionFunctions", + type: "tuple[]", + internalType: "struct ManifestExecutionFunction[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "skipRuntimeValidation", + type: "bool", + internalType: "bool", + }, + { + name: "allowGlobalValidation", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "executionHooks", + type: "tuple[]", + internalType: "struct ManifestExecutionHook[]", + components: [ + { + name: "executionSelector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "isPreHook", + type: "bool", + internalType: "bool", + }, + { + name: "isPostHook", + type: "bool", + internalType: "bool", + }, + ], + }, + { + name: "interfaceIds", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FallbackSignerUpdated", + inputs: [ + { + name: "newFallbackSigner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "isDisabled", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationInstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ValidationUninstalled", + inputs: [ + { + name: "module", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "onUninstallSucceeded", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ArrayLengthMismatch", + inputs: [], + }, + { + type: "error", + name: "CreateFailed", + inputs: [], + }, + { + type: "error", + name: "DeferredActionSignatureInvalid", + inputs: [], + }, + { + type: "error", + name: "DeferredValidationHasValidationHooks", + inputs: [], + }, + { + type: "error", + name: "ExecutionHookAlreadySet", + inputs: [ + { + name: "hookConfig", + type: "bytes25", + internalType: "HookConfig", + }, + ], + }, + { + type: "error", + name: "FallbackSignerDisabled", + inputs: [], + }, + { + type: "error", + name: "FallbackSignerMismatch", + inputs: [], + }, + { + type: "error", + name: "FallbackValidationInstallationNotAllowed", + inputs: [], + }, + { + type: "error", + name: "InterfaceNotSupported", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "InvalidSignatureType", + inputs: [], + }, + { + type: "error", + name: "ModuleInstallCallbackFailed", + inputs: [ + { + name: "module", + type: "address", + internalType: "address", + }, + { + name: "revertReason", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + type: "error", + name: "NonCanonicalEncoding", + inputs: [], + }, + { + type: "error", + name: "NotEntryPoint", + inputs: [], + }, + { + type: "error", + name: "PreValidationHookDuplicate", + inputs: [], + }, + { + type: "error", + name: "RequireUserOperationContext", + inputs: [], + }, + { + type: "error", + name: "SegmentOutOfOrder", + inputs: [], + }, + { + type: "error", + name: "SelfCallRecursionDepthExceeded", + inputs: [], + }, + { + type: "error", + name: "SignatureValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "UnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UnexpectedAggregator", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + { + name: "aggregator", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "UnrecognizedFunction", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UpgradeFailed", + inputs: [], + }, + { + type: "error", + name: "UserOpValidationInvalid", + inputs: [ + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAlreadySet", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "validationFunction", + type: "bytes24", + internalType: "ModuleEntity", + }, + ], + }, + { + type: "error", + name: "ValidationAssocHookLimitExceeded", + inputs: [], + }, + { + type: "error", + name: "ValidationEntityIdInUse", + inputs: [], + }, + { + type: "error", + name: "ValidationFunctionMissing", + inputs: [ + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "ValidationSignatureSegmentMissing", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/addresses.ts b/account-kit/smart-contracts/src/ma-v2/addresses.ts new file mode 100644 index 0000000000..8b33143a62 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/addresses.ts @@ -0,0 +1,29 @@ +// TODO: improve format + +export const addresses = { + allowlistModule: + "0xE46ca4a98c485caEE2Abb6ef5116292B8c78a868" as `0x${string}`, + nativeTokenLimitModule: + "0xEa6a05306315196f2A7CA2ec7eEA45290bae00A0" as `0x${string}`, + paymasterGuardModule: + "0x976D01aF75D128cae526B5328AC268ac83D607f4" as `0x${string}`, + singleSignerValidationModule: + "0xF56716aE104545BdAf012e14e4640beb52727479" as `0x${string}`, + timeRangeModule: + "0x6FD0a9765a86788126a55aD5a483029a484F996C" as `0x${string}`, + webauthnValidationModule: + "0xCf3423F8EB9EE215560802D03a48cDD44f85bD28" as `0x${string}`, + executionInstallDelegate: + "0x8Bf909fEb66EBcC4725f04E70F319791Ec9d9628" as `0x${string}`, + modularAccountImpl: + "0x99090abd2700E24Cc70E3c486A89F7af876fFA33" as `0x${string}`, + semiModularAccountBytecodeImpl: + "0xDCBb5d4639428B18703801f7Cd7230add729E4b0" as `0x${string}`, + semiModularAccountStorageOnlyImpl: + "0x563ea43Ba0CD9150466B054Ce47FB0Fb45B234E2" as `0x${string}`, + accountFactory: "0xA5FC7aDc6d2c838443dF5bb826152c58b918f2c8" as `0x${string}`, + accountFactoryOwner: + "0x3BD786ac7Dec96eF9d06ebbCFa4e0E0947A2c303" as `0x${string}`, +}; + +export const tempChainId = 11155420; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts new file mode 100644 index 0000000000..270e36dc13 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts @@ -0,0 +1,715 @@ +export const allowlistModuleAbi = [ + { + type: "function", + name: "addressAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "checkAllowlistCalldata", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "deleteAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "inputs", + type: "tuple[]", + internalType: "struct AllowlistModule.AllowlistInput[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "erc20SpendLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "erc20SpendLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "postExecutionHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preExecutionHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "selectorAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "setAddressAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setSelectorAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "selector", + type: "bytes4", + internalType: "bytes4", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "updateAllowlist", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "inputs", + type: "tuple[]", + internalType: "struct AllowlistModule.AllowlistInput[]", + components: [ + { + name: "target", + type: "address", + internalType: "address", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "erc20SpendLimit", + type: "uint256", + internalType: "uint256", + }, + { + name: "selectors", + type: "bytes4[]", + internalType: "bytes4[]", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + { + name: "newLimit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "AddressAllowlistUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "target", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "entry", + type: "tuple", + indexed: false, + internalType: "struct AllowlistModule.AddressAllowlistEntry", + components: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + { + name: "hasSelectorAllowlist", + type: "bool", + internalType: "bool", + }, + { + name: "hasERC20SpendLimit", + type: "bool", + internalType: "bool", + }, + ], + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ERC20SpendLimitUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SelectorAllowlistUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "targetAndSelector", + type: "bytes24", + indexed: true, + internalType: "bytes24", + }, + { + name: "allowed", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressNotAllowed", + inputs: [], + }, + { + type: "error", + name: "ERC20NotAllowed", + inputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "ExceededTokenLimit", + inputs: [], + }, + { + type: "error", + name: "InvalidCalldataLength", + inputs: [], + }, + { + type: "error", + name: "NoSelectorSpecified", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "SelectorNotAllowed", + inputs: [], + }, + { + type: "error", + name: "SpendingRequestNotAllowed", + inputs: [ + { + name: "", + type: "bytes4", + internalType: "bytes4", + }, + ], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts new file mode 100644 index 0000000000..de0f1d2aa1 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts @@ -0,0 +1,403 @@ +export const nativeTokenLimitModuleAbi = [ + { + type: "function", + name: "limits", + inputs: [ + { + name: "entityId", + type: "uint256", + internalType: "uint256", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "limit", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "postExecutionHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preExecutionHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [ + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "specialPaymasters", + inputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "updateLimits", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "newLimit", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateSpecialPaymaster", + inputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + { + name: "allowed", + type: "bool", + internalType: "bool", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "NativeTokenSpendLimitUpdated", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newLimit", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SpecialPaymasterUpdated", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "paymaster", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "allowed", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "ExceededNativeTokenLimit", + inputs: [], + }, + { + type: "error", + name: "InvalidPaymaster", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts new file mode 100644 index 0000000000..275480aab0 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts @@ -0,0 +1,241 @@ +export const paymasterGuardModuleAbi = [ + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "paymasters", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "paymaster", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "error", + name: "BadPaymasterSpecified", + inputs: [], + }, + { + type: "error", + name: "InvalidPaymaster", + inputs: [], + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts new file mode 100644 index 0000000000..e4fe309ca3 --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts @@ -0,0 +1,295 @@ +export const timeRangeModuleAbi = [ + { + type: "function", + name: "moduleId", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "onInstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "onUninstall", + inputs: [ + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "preRuntimeValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "uint256", + internalType: "uint256", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "view", + }, + { + type: "function", + name: "preSignatureValidationHook", + inputs: [ + { + name: "", + type: "uint32", + internalType: "uint32", + }, + { + name: "", + type: "address", + internalType: "address", + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "pure", + }, + { + type: "function", + name: "preUserOpValidationHook", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "userOp", + type: "tuple", + internalType: "struct PackedUserOperation", + components: [ + { + name: "sender", + type: "address", + internalType: "address", + }, + { + name: "nonce", + type: "uint256", + internalType: "uint256", + }, + { + name: "initCode", + type: "bytes", + internalType: "bytes", + }, + { + name: "callData", + type: "bytes", + internalType: "bytes", + }, + { + name: "accountGasLimits", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "preVerificationGas", + type: "uint256", + internalType: "uint256", + }, + { + name: "gasFees", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "paymasterAndData", + type: "bytes", + internalType: "bytes", + }, + { + name: "signature", + type: "bytes", + internalType: "bytes", + }, + ], + }, + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "setTimeRange", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "validUntil", + type: "uint48", + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + internalType: "uint48", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "timeRanges", + inputs: [ + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "validUntil", + type: "uint48", + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + internalType: "uint48", + }, + ], + stateMutability: "view", + }, + { + type: "event", + name: "TimeRangeSet", + inputs: [ + { + name: "entityId", + type: "uint32", + indexed: true, + internalType: "uint32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "validUntil", + type: "uint48", + indexed: false, + internalType: "uint48", + }, + { + name: "validAfter", + type: "uint48", + indexed: false, + internalType: "uint48", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "NotImplemented", + inputs: [], + }, + { + type: "error", + name: "TimeRangeNotValid", + inputs: [], + }, + { + type: "error", + name: "UnexpectedDataPassed", + inputs: [], + }, +]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts new file mode 100644 index 0000000000..ac35abfc5d --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts @@ -0,0 +1,373 @@ +export const webauthnValidationModuleAbi = [ + { + type: "constructor", + inputs: [ + { + name: "_entryPoint", + type: "address", + internalType: "contract IEntryPoint", + }, + { + name: "_accountImpl", + type: "address", + internalType: "contract ModularAccount", + }, + { + name: "_webauthnValidationModule", + type: "address", + internalType: "address", + }, + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "ACCOUNT_IMPL", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "ENTRY_POINT", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract IEntryPoint", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "WEBAUTHN_VALIDATION_MODULE", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "addStake", + inputs: [ + { + name: "unstakeDelay", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "createAccount", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "contract ModularAccount", + }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getAddress", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getSalt", + inputs: [ + { + name: "ownerX", + type: "uint256", + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + internalType: "uint256", + }, + { + name: "entityId", + type: "uint32", + internalType: "uint32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renounceOwnership", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferOwnership", + inputs: [ + { + name: "newOwner", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "unlockStake", + inputs: [], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdraw", + inputs: [ + { + name: "to", + type: "address", + internalType: "address payable", + }, + { + name: "token", + type: "address", + internalType: "address", + }, + { + name: "amount", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "withdrawStake", + inputs: [ + { + name: "withdrawAddress", + type: "address", + internalType: "address payable", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "ModularAccountDeployed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "ownerX", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "ownerY", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "salt", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { + name: "previousOwner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "newOwner", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "AddressInsufficientBalance", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "FailedInnerCall", + inputs: [], + }, + { + type: "error", + name: "OwnableInvalidOwner", + inputs: [ + { + name: "owner", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "OwnableUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "SafeERC20FailedOperation", + inputs: [ + { + name: "token", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "TransferFailed", + inputs: [], + }, +]; From f0b750b380348593ae2f8dce9cc8357eaa138784 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:42:28 -0500 Subject: [PATCH 09/12] feat: add mav2 account --- .../src/ma-v2/client/client.test.ts | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 account-kit/smart-contracts/src/ma-v2/client/client.test.ts diff --git a/account-kit/smart-contracts/src/ma-v2/client/client.test.ts b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts new file mode 100644 index 0000000000..e26d7e09ff --- /dev/null +++ b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts @@ -0,0 +1,150 @@ +import { + custom, + keccak256, + parseEther, + publicActions, + toHex, + type Address, + } from "viem"; + import { privateKeyToAccount } from "viem/accounts"; + + import { LocalAccountSigner, type SmartAccountSigner } from "@aa-sdk/core"; + + import { + createSMAV2SignerAccountClient, + } from "./client.js"; + + import { local070InstanceOptSep } from "~test/instances.js"; + import { setBalance } from "viem/actions"; + import { accounts } from "~test/constants.js"; + + describe("6900 RI installValidation Tests", async () => { + const instance = local070InstanceOptSep; + const client = instance.getClient().extend(publicActions); + + const signer: SmartAccountSigner = new LocalAccountSigner( + accounts.fundedAccountOwner + ); + + it("should send a UO", async () => { + // Generate and add the secondary signer + + const provider = await givenConnectedProvider({ signer }) + + console.log(signer); + console.log("provider: ", provider.getAddress()); + + await setBalance(instance.getClient(), { + address: provider.getAddress(), + value: parseEther("2"), + }); + + const target = "0x000000000000000000000000000000000000dEaD"; + + const startBalance = await client.getBalance({ + address: target, + }) + + const result2 = provider.sendUserOperation({ + uo: { + target: target, + value: parseEther("1"), + data: '0x', + }}) + + }); + + it("should fail after uninstalling the secondary signer", async () => { + // // Generate and add the secondary signer + + // const secondarySigner = new LocalAccountSigner( + // privateKeyToAccount(keccak256(toHex("secondarySigner2"))) + // ); + + // const provider = (await givenConnectedProvider({ signer })).extend( + // installValidationActions + // ); + + // await setBalance(instance.getClient(), { + // address: provider.getAddress(), + // value: parseEther("2"), + // }); + + // const entityId = 2; + + // const result1 = await provider.installValidation({ + // args: { + // validationConfig: { + // moduleAddress: SingleSignerValidationModule.meta.addresses.default, + // entityId, + // isGlobal: true, + // isSignatureValidation: true, + // }, + // selectors: [], + // installData: SingleSignerValidationModule.encodeOnInstallData({ + // entityId, + // signer: await secondarySigner.getAddress(), + // }), + // hooks: [], + // }, + // }); + + // const txnHash1 = provider.waitForUserOperationTransaction(result1); + + // await expect(txnHash1).resolves.not.toThrowError(); + + // // Now the new validation is installed, uninstall it + + // const result2 = await provider.uninstallValidation({ + // args: { + // moduleAddress: SingleSignerValidationModule.meta.addresses.default, + // entityId, + // uninstallData: SingleSignerValidationModule.encodeOnUninstallData({ + // entityId, + // }), + // hookUninstallDatas: [], + // }, + // }); + + // const txnHash2 = provider.waitForUserOperationTransaction(result2); + + // await expect(txnHash2).resolves.not.toThrowError(); + + // // Now the validation is uninstalled, attempt to use it to execute. + + // const accountAddress = provider.getAddress(); + + // const newValidationAccountClient = await createSingleSignerRIAccountClient({ + // chain: instance.chain, + // signer: secondarySigner, + // accountAddress, + // entityId, + // transport: custom(instance.getClient()), + // }); + + // // Attempt to execute a transfer of 1 ETH from the account to a dead address. + + // const targetAddress = "0x000000000000000000000000000000000000dEaD"; + + // const result3 = newValidationAccountClient.sendUserOperation({ + // uo: { + // target: targetAddress, + // value: parseEther("0.5"), + // data: "0x", + // }, + // }); + + // await expect(result3).rejects.toThrowError(); + }); + + const givenConnectedProvider = async ({ + signer, + }: { + signer: SmartAccountSigner; + }) => + createSMAV2SignerAccountClient({ + chain: instance.chain, + signer, + transport: custom(instance.getClient()), + }); + }); \ No newline at end of file From 840636a2d6929bd910c10bbb7191fbfd0f4f21c9 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:53:24 -0500 Subject: [PATCH 10/12] feat: add entity id nonce logic --- .../smart-contracts/src/ma-v2/abis/maV2.ts | 1241 ----------------- .../src/ma-v2/account/account.ts | 37 + .../abis/allowlistModule.ts | 715 ---------- .../abis/nativeTokenLimitModule.ts | 403 ------ .../abis/paymasterGuardModule.ts | 241 ---- .../abis/timeRangeModule.ts | 295 ---- .../abis/webauthnValidation.ts | 373 ----- 7 files changed, 37 insertions(+), 3268 deletions(-) delete mode 100644 account-kit/smart-contracts/src/ma-v2/abis/maV2.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts delete mode 100644 account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts diff --git a/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts b/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts deleted file mode 100644 index d3e7b7ec66..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/abis/maV2.ts +++ /dev/null @@ -1,1241 +0,0 @@ -export const maV2Abi = [ - { - type: "constructor", - inputs: [ - { - name: "entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "executionInstallDelegate", - type: "address", - internalType: "contract ExecutionInstallDelegate", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "fallback", - stateMutability: "payable", - }, - { - type: "receive", - stateMutability: "payable", - }, - { - type: "function", - name: "accountId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "entryPoint", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "execute", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "result", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeBatch", - inputs: [ - { - name: "calls", - type: "tuple[]", - internalType: "struct Call[]", - components: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - }, - ], - outputs: [ - { - name: "results", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "executeUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "executeWithRuntimeValidation", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - { - name: "authorization", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "getExecutionData", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ExecutionDataView", - components: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getValidationData", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - outputs: [ - { - name: "data", - type: "tuple", - internalType: "struct ValidationDataView", - components: [ - { - name: "validationFlags", - type: "uint8", - internalType: "ValidationFlags", - }, - { - name: "validationHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "executionHooks", - type: "bytes25[]", - internalType: "HookConfig[]", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "initializeWithValidation", - inputs: [ - { - name: "validationConfig", - type: "bytes25", - internalType: "ValidationConfig", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - { - name: "installData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hooks", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "installExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleInstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "installValidation", - inputs: [ - { - name: "validationConfig", - type: "bytes25", - internalType: "ValidationConfig", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - { - name: "installData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hooks", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "isValidSignature", - inputs: [ - { - name: "hash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "onERC1155BatchReceived", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC1155Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onERC721Received", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "performCreate", - inputs: [ - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "isCreate2", - type: "bool", - internalType: "bool", - }, - { - name: "salt", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "createdAddr", - type: "address", - internalType: "address", - }, - ], - stateMutability: "payable", - }, - { - type: "function", - name: "proxiableUUID", - inputs: [], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "uninstallExecution", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - { - name: "moduleUninstallData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "uninstallValidation", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "uninstallData", - type: "bytes", - internalType: "bytes", - }, - { - name: "hookUninstallData", - type: "bytes[]", - internalType: "bytes[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "upgradeToAndCall", - inputs: [ - { - name: "newImplementation", - type: "address", - internalType: "address", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "validateUserOp", - inputs: [ - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "userOpHash", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "missingAccountFunds", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "validationData", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ExecutionInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ExecutionUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - { - name: "manifest", - type: "tuple", - indexed: false, - internalType: "struct ExecutionManifest", - components: [ - { - name: "executionFunctions", - type: "tuple[]", - internalType: "struct ManifestExecutionFunction[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "skipRuntimeValidation", - type: "bool", - internalType: "bool", - }, - { - name: "allowGlobalValidation", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "executionHooks", - type: "tuple[]", - internalType: "struct ManifestExecutionHook[]", - components: [ - { - name: "executionSelector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "isPreHook", - type: "bool", - internalType: "bool", - }, - { - name: "isPostHook", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "interfaceIds", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Initialized", - inputs: [ - { - name: "version", - type: "uint64", - indexed: false, - internalType: "uint64", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Upgraded", - inputs: [ - { - name: "implementation", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationInstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ValidationUninstalled", - inputs: [ - { - name: "module", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "onUninstallSucceeded", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ArrayLengthMismatch", - inputs: [], - }, - { - type: "error", - name: "CreateFailed", - inputs: [], - }, - { - type: "error", - name: "DeferredActionSignatureInvalid", - inputs: [], - }, - { - type: "error", - name: "DeferredValidationHasValidationHooks", - inputs: [], - }, - { - type: "error", - name: "ExecutionHookAlreadySet", - inputs: [ - { - name: "hookConfig", - type: "bytes25", - internalType: "HookConfig", - }, - ], - }, - { - type: "error", - name: "InterfaceNotSupported", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "InvalidInitialization", - inputs: [], - }, - { - type: "error", - name: "ModuleInstallCallbackFailed", - inputs: [ - { - name: "module", - type: "address", - internalType: "address", - }, - { - name: "revertReason", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - type: "error", - name: "NonCanonicalEncoding", - inputs: [], - }, - { - type: "error", - name: "NotEntryPoint", - inputs: [], - }, - { - type: "error", - name: "PreValidationHookDuplicate", - inputs: [], - }, - { - type: "error", - name: "RequireUserOperationContext", - inputs: [], - }, - { - type: "error", - name: "SegmentOutOfOrder", - inputs: [], - }, - { - type: "error", - name: "SelfCallRecursionDepthExceeded", - inputs: [], - }, - { - type: "error", - name: "SignatureValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "UnauthorizedCallContext", - inputs: [], - }, - { - type: "error", - name: "UnexpectedAggregator", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - { - name: "aggregator", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "UnrecognizedFunction", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "UpgradeFailed", - inputs: [], - }, - { - type: "error", - name: "UserOpValidationInvalid", - inputs: [ - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAlreadySet", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "validationFunction", - type: "bytes24", - internalType: "ModuleEntity", - }, - ], - }, - { - type: "error", - name: "ValidationAssocHookLimitExceeded", - inputs: [], - }, - { - type: "error", - name: "ValidationEntityIdInUse", - inputs: [], - }, - { - type: "error", - name: "ValidationFunctionMissing", - inputs: [ - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "ValidationSignatureSegmentMissing", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/account/account.ts b/account-kit/smart-contracts/src/ma-v2/account/account.ts index bfb7db39c9..355a323fce 100644 --- a/account-kit/smart-contracts/src/ma-v2/account/account.ts +++ b/account-kit/smart-contracts/src/ma-v2/account/account.ts @@ -13,6 +13,7 @@ import { import { concatHex, encodeFunctionData, + getContract, type Address, type Chain, type Hex, @@ -49,6 +50,8 @@ export type CreateSMAV2AccountParams< initialOwner?: Address; accountAddress?: Address; entryPoint?: EntryPointDef; + isGlobalValidation?: boolean; + entityId?: bigint; }; export async function createSMAV2Account< @@ -71,8 +74,14 @@ export async function createSMAV2Account( initialOwner, accountAddress, entryPoint = getEntryPoint(chain, { version: "0.7.0" }), + isGlobalValidation = true, + entityId = 0n, } = config; + if (entityId >= 2n ** 32n) { + throw new Error("Entity ID must be less than uint32.max"); + } + const client = createBundlerClient({ transport, chain, @@ -120,8 +129,36 @@ export async function createSMAV2Account( ), }); + // TODO: add deferred action flag + const getAccountNonce = async (nonceKey?: bigint): Promise => { + // uint32 entityId + (bytes1 options) makes a uint40 + const nonceKeySuffix: bigint = + entityId * 256n + (isGlobalValidation ? 1n : 0n); + + if (nonceKey) { + // comparing the end 40 bytes to suffix + if (nonceKey % 2n ** 40n !== nonceKeySuffix) { + throw new Error("Invalid nonceKey"); + } + } else { + nonceKey = nonceKeySuffix; + } + + const entryPointContract = getContract({ + address: entryPoint.address, + abi: entryPoint.abi, + client, + }); + + return entryPointContract.read.getNonce([ + accountAddress, + nonceKey, + ]) as Promise; + }; + return { ...baseAccount, + getAccountNonce, getSigner: () => signer, }; } diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts deleted file mode 100644 index 270e36dc13..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/allowlistModule.ts +++ /dev/null @@ -1,715 +0,0 @@ -export const allowlistModuleAbi = [ - { - type: "function", - name: "addressAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - { - name: "hasSelectorAllowlist", - type: "bool", - internalType: "bool", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "checkAllowlistCalldata", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "deleteAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "inputs", - type: "tuple[]", - internalType: "struct AllowlistModule.AllowlistInput[]", - components: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "hasSelectorAllowlist", - type: "bool", - internalType: "bool", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - { - name: "erc20SpendLimit", - type: "uint256", - internalType: "uint256", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "erc20SpendLimits", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "postExecutionHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preExecutionHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "preRuntimeValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "preSignatureValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preUserOpValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "selectorAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "setAddressAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - { - name: "hasSelectorAllowlist", - type: "bool", - internalType: "bool", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setSelectorAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "selector", - type: "bytes4", - internalType: "bytes4", - }, - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "updateAllowlist", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "inputs", - type: "tuple[]", - internalType: "struct AllowlistModule.AllowlistInput[]", - components: [ - { - name: "target", - type: "address", - internalType: "address", - }, - { - name: "hasSelectorAllowlist", - type: "bool", - internalType: "bool", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - { - name: "erc20SpendLimit", - type: "uint256", - internalType: "uint256", - }, - { - name: "selectors", - type: "bytes4[]", - internalType: "bytes4[]", - }, - ], - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "updateLimits", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - { - name: "newLimit", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "AddressAllowlistUpdated", - inputs: [ - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "target", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "entry", - type: "tuple", - indexed: false, - internalType: "struct AllowlistModule.AddressAllowlistEntry", - components: [ - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - { - name: "hasSelectorAllowlist", - type: "bool", - internalType: "bool", - }, - { - name: "hasERC20SpendLimit", - type: "bool", - internalType: "bool", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ERC20SpendLimitUpdated", - inputs: [ - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "token", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newLimit", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "SelectorAllowlistUpdated", - inputs: [ - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "targetAndSelector", - type: "bytes24", - indexed: true, - internalType: "bytes24", - }, - { - name: "allowed", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "AddressNotAllowed", - inputs: [], - }, - { - type: "error", - name: "ERC20NotAllowed", - inputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ExceededTokenLimit", - inputs: [], - }, - { - type: "error", - name: "InvalidCalldataLength", - inputs: [], - }, - { - type: "error", - name: "NoSelectorSpecified", - inputs: [], - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "SelectorNotAllowed", - inputs: [], - }, - { - type: "error", - name: "SpendingRequestNotAllowed", - inputs: [ - { - name: "", - type: "bytes4", - internalType: "bytes4", - }, - ], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts deleted file mode 100644 index de0f1d2aa1..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/nativeTokenLimitModule.ts +++ /dev/null @@ -1,403 +0,0 @@ -export const nativeTokenLimitModuleAbi = [ - { - type: "function", - name: "limits", - inputs: [ - { - name: "entityId", - type: "uint256", - internalType: "uint256", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "limit", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "postExecutionHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preExecutionHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "preRuntimeValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preSignatureValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preUserOpValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "specialPaymasters", - inputs: [ - { - name: "paymaster", - type: "address", - internalType: "address", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "updateLimits", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "newLimit", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "updateSpecialPaymaster", - inputs: [ - { - name: "paymaster", - type: "address", - internalType: "address", - }, - { - name: "allowed", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "NativeTokenSpendLimitUpdated", - inputs: [ - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newLimit", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "SpecialPaymasterUpdated", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "paymaster", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "allowed", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "ExceededNativeTokenLimit", - inputs: [], - }, - { - type: "error", - name: "InvalidPaymaster", - inputs: [], - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts deleted file mode 100644 index 275480aab0..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/paymasterGuardModule.ts +++ /dev/null @@ -1,241 +0,0 @@ -export const paymasterGuardModuleAbi = [ - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "paymasters", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "paymaster", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "preRuntimeValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "preSignatureValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preUserOpValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "error", - name: "BadPaymasterSpecified", - inputs: [], - }, - { - type: "error", - name: "InvalidPaymaster", - inputs: [], - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts deleted file mode 100644 index e4fe309ca3..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/timeRangeModule.ts +++ /dev/null @@ -1,295 +0,0 @@ -export const timeRangeModuleAbi = [ - { - type: "function", - name: "moduleId", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "onInstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "onUninstall", - inputs: [ - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "preRuntimeValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "uint256", - internalType: "uint256", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "view", - }, - { - type: "function", - name: "preSignatureValidationHook", - inputs: [ - { - name: "", - type: "uint32", - internalType: "uint32", - }, - { - name: "", - type: "address", - internalType: "address", - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [], - stateMutability: "pure", - }, - { - type: "function", - name: "preUserOpValidationHook", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "userOp", - type: "tuple", - internalType: "struct PackedUserOperation", - components: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "initCode", - type: "bytes", - internalType: "bytes", - }, - { - name: "callData", - type: "bytes", - internalType: "bytes", - }, - { - name: "accountGasLimits", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "preVerificationGas", - type: "uint256", - internalType: "uint256", - }, - { - name: "gasFees", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "paymasterAndData", - type: "bytes", - internalType: "bytes", - }, - { - name: "signature", - type: "bytes", - internalType: "bytes", - }, - ], - }, - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "setTimeRange", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "validUntil", - type: "uint48", - internalType: "uint48", - }, - { - name: "validAfter", - type: "uint48", - internalType: "uint48", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "timeRanges", - inputs: [ - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "validUntil", - type: "uint48", - internalType: "uint48", - }, - { - name: "validAfter", - type: "uint48", - internalType: "uint48", - }, - ], - stateMutability: "view", - }, - { - type: "event", - name: "TimeRangeSet", - inputs: [ - { - name: "entityId", - type: "uint32", - indexed: true, - internalType: "uint32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "validUntil", - type: "uint48", - indexed: false, - internalType: "uint48", - }, - { - name: "validAfter", - type: "uint48", - indexed: false, - internalType: "uint48", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "NotImplemented", - inputs: [], - }, - { - type: "error", - name: "TimeRangeNotValid", - inputs: [], - }, - { - type: "error", - name: "UnexpectedDataPassed", - inputs: [], - }, -]; diff --git a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts b/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts deleted file mode 100644 index ac35abfc5d..0000000000 --- a/account-kit/smart-contracts/src/ma-v2/modules/single-signer-validation/abis/webauthnValidation.ts +++ /dev/null @@ -1,373 +0,0 @@ -export const webauthnValidationModuleAbi = [ - { - type: "constructor", - inputs: [ - { - name: "_entryPoint", - type: "address", - internalType: "contract IEntryPoint", - }, - { - name: "_accountImpl", - type: "address", - internalType: "contract ModularAccount", - }, - { - name: "_webauthnValidationModule", - type: "address", - internalType: "address", - }, - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "ACCOUNT_IMPL", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "ENTRY_POINT", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IEntryPoint", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "WEBAUTHN_VALIDATION_MODULE", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "addStake", - inputs: [ - { - name: "unstakeDelay", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [], - stateMutability: "payable", - }, - { - type: "function", - name: "createAccount", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ModularAccount", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "getAddress", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getSalt", - inputs: [ - { - name: "ownerX", - type: "uint256", - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - internalType: "uint256", - }, - { - name: "entityId", - type: "uint32", - internalType: "uint32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "owner", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "renounceOwnership", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "transferOwnership", - inputs: [ - { - name: "newOwner", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "unlockStake", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdraw", - inputs: [ - { - name: "to", - type: "address", - internalType: "address payable", - }, - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "amount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "withdrawStake", - inputs: [ - { - name: "withdrawAddress", - type: "address", - internalType: "address payable", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "ModularAccountDeployed", - inputs: [ - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "ownerX", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "ownerY", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "salt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "OwnershipTransferred", - inputs: [ - { - name: "previousOwner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "newOwner", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "AddressEmptyCode", - inputs: [ - { - name: "target", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "AddressInsufficientBalance", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "FailedInnerCall", - inputs: [], - }, - { - type: "error", - name: "OwnableInvalidOwner", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "OwnableUnauthorizedAccount", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "SafeERC20FailedOperation", - inputs: [ - { - name: "token", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "TransferFailed", - inputs: [], - }, -]; From 212fbbbf2b3482f0f8ab438a1d46b3c5cd34e280 Mon Sep 17 00:00:00 2001 From: linna Date: Thu, 12 Dec 2024 19:45:53 -0500 Subject: [PATCH 11/12] feat: adds MAv2 client --- .../src/ma-v2/client/client.ts | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/account-kit/smart-contracts/src/ma-v2/client/client.ts b/account-kit/smart-contracts/src/ma-v2/client/client.ts index e69de29bb2..f3d693e55f 100644 --- a/account-kit/smart-contracts/src/ma-v2/client/client.ts +++ b/account-kit/smart-contracts/src/ma-v2/client/client.ts @@ -0,0 +1,73 @@ +import { + createSmartAccountClient, + type SmartAccountClient, + type SmartAccountSigner, +} from "@aa-sdk/core"; +import { type Chain, type CustomTransport, type Transport } from "viem"; + +import type { SmartAccountClientConfig } from "@aa-sdk/core"; + +import { + createSMAV2Account, + type CreateSMAV2AccountParams, + type SMAV2Account, +} from "../account/account.js"; + +export type CreateSMAV2AccountClientParams< + TTransport extends Transport = Transport, + TChain extends Chain = Chain, + TSigner extends SmartAccountSigner = SmartAccountSigner +> = CreateSMAV2AccountParams & + Omit< + SmartAccountClientConfig, + "transport" | "account" | "chain" + >; + +export function createSMAV2SignerAccountClient< + TChain extends Chain = Chain, + TSigner extends SmartAccountSigner = SmartAccountSigner +>( + args: CreateSMAV2AccountClientParams +): Promise>>; + +/** + * Creates a MAv2 account client using the provided configuration parameters. + * + * @example + * ```ts + * import { http } from "viem"; + * import { createSMAV2SignerAccountClient } from "@account-kit/smart-contracts"; + * import { LocalAccountSigner } from "@aa-sdk/core"; + * import { sepolia } from "@account-kit/infra"; + * + * const MNEMONIC = "..."; + * const RPC_URL = "..."; + * + * const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); + * + * const chain = sepolia; + * + * const transport = http(RPC_URL); + * + * const SMAV2SignerAccountClient = await createSMAV2SignerAccountClient({di + * chain, + * signer, + * transport, + * }); + * ``` + * + * @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client + * @returns {Promise} A promise that resolves to a `SmartAccountClient` instance + */ +export async function createSMAV2SignerAccountClient({ + ...config +}: CreateSMAV2AccountClientParams): Promise { + const maV2SignerAccount = await createSMAV2Account({ + ...config, + }); + + return createSmartAccountClient({ + ...config, + account: maV2SignerAccount, + }); +} From 5b3c0b05c08151e66128ae399925e469dcf834ed Mon Sep 17 00:00:00 2001 From: linna Date: Fri, 13 Dec 2024 15:24:36 -0500 Subject: [PATCH 12/12] fix: removes signer from create client function name --- .../src/ma-v2/client/client.test.ts | 136 ++++++++---------- .../src/ma-v2/client/client.ts | 8 +- 2 files changed, 62 insertions(+), 82 deletions(-) diff --git a/account-kit/smart-contracts/src/ma-v2/client/client.test.ts b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts index e26d7e09ff..2f03427dcd 100644 --- a/account-kit/smart-contracts/src/ma-v2/client/client.test.ts +++ b/account-kit/smart-contracts/src/ma-v2/client/client.test.ts @@ -1,77 +1,70 @@ import { - custom, - keccak256, - parseEther, - publicActions, - toHex, - type Address, - } from "viem"; - import { privateKeyToAccount } from "viem/accounts"; - - import { LocalAccountSigner, type SmartAccountSigner } from "@aa-sdk/core"; - - import { - createSMAV2SignerAccountClient, - } from "./client.js"; - - import { local070InstanceOptSep } from "~test/instances.js"; - import { setBalance } from "viem/actions"; - import { accounts } from "~test/constants.js"; - - describe("6900 RI installValidation Tests", async () => { - const instance = local070InstanceOptSep; - const client = instance.getClient().extend(publicActions); + custom, + keccak256, + parseEther, + publicActions, + toHex, + type Address, +} from "viem"; +import { privateKeyToAccount } from "viem/accounts"; - const signer: SmartAccountSigner = new LocalAccountSigner( - accounts.fundedAccountOwner - ); - - it("should send a UO", async () => { - // Generate and add the secondary signer - - const provider = await givenConnectedProvider({ signer }) - - console.log(signer); - console.log("provider: ", provider.getAddress()); +import { LocalAccountSigner, type SmartAccountSigner } from "@aa-sdk/core"; - await setBalance(instance.getClient(), { - address: provider.getAddress(), - value: parseEther("2"), - }); - - const target = "0x000000000000000000000000000000000000dEaD"; +import { createSMAV2AccountClient } from "./client.js"; - const startBalance = await client.getBalance({ - address: target, - }) +import { local070InstanceOptSep } from "~test/instances.js"; +import { setBalance } from "viem/actions"; +import { accounts } from "~test/constants.js"; - const result2 = provider.sendUserOperation({ - uo: { +describe("6900 RI installValidation Tests", async () => { + const instance = local070InstanceOptSep; + const client = instance.getClient().extend(publicActions); + + const signer: SmartAccountSigner = new LocalAccountSigner( + accounts.fundedAccountOwner + ); + + it("should send a UO", async () => { + // Generate and add the secondary signer + + const provider = await givenConnectedProvider({ signer }); + + console.log(signer); + console.log("provider: ", provider.getAddress()); + + await setBalance(instance.getClient(), { + address: provider.getAddress(), + value: parseEther("2"), + }); + + const target = "0x000000000000000000000000000000000000dEaD"; + + const startBalance = await client.getBalance({ + address: target, + }); + + const result2 = provider.sendUserOperation({ + uo: { target: target, value: parseEther("1"), - data: '0x', - }}) - + data: "0x", + }, }); - - it("should fail after uninstalling the secondary signer", async () => { + }); + + it("should fail after uninstalling the secondary signer", async () => { // // Generate and add the secondary signer - // const secondarySigner = new LocalAccountSigner( // privateKeyToAccount(keccak256(toHex("secondarySigner2"))) // ); - // const provider = (await givenConnectedProvider({ signer })).extend( // installValidationActions // ); - // await setBalance(instance.getClient(), { // address: provider.getAddress(), // value: parseEther("2"), // }); - // const entityId = 2; - // const result1 = await provider.installValidation({ // args: { // validationConfig: { @@ -88,13 +81,9 @@ import { // hooks: [], // }, // }); - // const txnHash1 = provider.waitForUserOperationTransaction(result1); - // await expect(txnHash1).resolves.not.toThrowError(); - // // Now the new validation is installed, uninstall it - // const result2 = await provider.uninstallValidation({ // args: { // moduleAddress: SingleSignerValidationModule.meta.addresses.default, @@ -105,15 +94,10 @@ import { // hookUninstallDatas: [], // }, // }); - // const txnHash2 = provider.waitForUserOperationTransaction(result2); - // await expect(txnHash2).resolves.not.toThrowError(); - // // Now the validation is uninstalled, attempt to use it to execute. - // const accountAddress = provider.getAddress(); - // const newValidationAccountClient = await createSingleSignerRIAccountClient({ // chain: instance.chain, // signer: secondarySigner, @@ -121,11 +105,8 @@ import { // entityId, // transport: custom(instance.getClient()), // }); - // // Attempt to execute a transfer of 1 ETH from the account to a dead address. - // const targetAddress = "0x000000000000000000000000000000000000dEaD"; - // const result3 = newValidationAccountClient.sendUserOperation({ // uo: { // target: targetAddress, @@ -133,18 +114,17 @@ import { // data: "0x", // }, // }); - // await expect(result3).rejects.toThrowError(); - }); - - const givenConnectedProvider = async ({ + }); + + const givenConnectedProvider = async ({ + signer, + }: { + signer: SmartAccountSigner; + }) => + createSMAV2AccountClient({ + chain: instance.chain, signer, - }: { - signer: SmartAccountSigner; - }) => - createSMAV2SignerAccountClient({ - chain: instance.chain, - signer, - transport: custom(instance.getClient()), + transport: custom(instance.getClient()), }); - }); \ No newline at end of file +}); diff --git a/account-kit/smart-contracts/src/ma-v2/client/client.ts b/account-kit/smart-contracts/src/ma-v2/client/client.ts index f3d693e55f..28267d920d 100644 --- a/account-kit/smart-contracts/src/ma-v2/client/client.ts +++ b/account-kit/smart-contracts/src/ma-v2/client/client.ts @@ -23,7 +23,7 @@ export type CreateSMAV2AccountClientParams< "transport" | "account" | "chain" >; -export function createSMAV2SignerAccountClient< +export function createSMAV2AccountClient< TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner >( @@ -59,15 +59,15 @@ export function createSMAV2SignerAccountClient< * @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client * @returns {Promise} A promise that resolves to a `SmartAccountClient` instance */ -export async function createSMAV2SignerAccountClient({ +export async function createSMAV2AccountClient({ ...config }: CreateSMAV2AccountClientParams): Promise { - const maV2SignerAccount = await createSMAV2Account({ + const maV2Account = await createSMAV2Account({ ...config, }); return createSmartAccountClient({ ...config, - account: maV2SignerAccount, + account: maV2Account, }); }