From 887569dfd675b006a7be581b6e68cb779d27af1b Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Fri, 3 Nov 2023 06:21:07 +0530 Subject: [PATCH 1/2] Biconomy Smart Account V2 --- abi/EcdsaOwnershipRegistryModule.json | 290 ++++ abi/IEcdsaOwnershipRegistryModule.json | 159 ++ abi/SmartAccount.json | 1175 ++++++++++++++ abi/SmartAccountFactory.json | 286 ++++ src/constants/biconomy.ts | 6 + src/constants/index.ts | 1 + src/preset/builder/biconomy.ts | 145 ++ src/preset/builder/index.ts | 1 + src/typechain/EcdsaOwnershipRegistryModule.ts | 416 +++++ .../IEcdsaOwnershipRegistryModule.ts | 268 ++++ src/typechain/SmartAccount.ts | 1383 +++++++++++++++++ src/typechain/SmartAccountFactory.ts | 530 +++++++ .../EcdsaOwnershipRegistryModule__factory.ts | 316 ++++ .../IEcdsaOwnershipRegistryModule__factory.ts | 185 +++ .../factories/SmartAccountFactory__factory.ts | 308 ++++ .../factories/SmartAccount__factory.ts | 1194 ++++++++++++++ src/typechain/factories/index.ts | 4 + src/typechain/index.ts | 8 + 18 files changed, 6675 insertions(+) create mode 100644 abi/EcdsaOwnershipRegistryModule.json create mode 100644 abi/IEcdsaOwnershipRegistryModule.json create mode 100644 abi/SmartAccount.json create mode 100644 abi/SmartAccountFactory.json create mode 100644 src/constants/biconomy.ts create mode 100644 src/preset/builder/biconomy.ts create mode 100644 src/typechain/EcdsaOwnershipRegistryModule.ts create mode 100644 src/typechain/IEcdsaOwnershipRegistryModule.ts create mode 100644 src/typechain/SmartAccount.ts create mode 100644 src/typechain/SmartAccountFactory.ts create mode 100644 src/typechain/factories/EcdsaOwnershipRegistryModule__factory.ts create mode 100644 src/typechain/factories/IEcdsaOwnershipRegistryModule__factory.ts create mode 100644 src/typechain/factories/SmartAccountFactory__factory.ts create mode 100644 src/typechain/factories/SmartAccount__factory.ts diff --git a/abi/EcdsaOwnershipRegistryModule.json b/abi/EcdsaOwnershipRegistryModule.json new file mode 100644 index 0000000..9116fd1 --- /dev/null +++ b/abi/EcdsaOwnershipRegistryModule.json @@ -0,0 +1,290 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "AlreadyInitedForSmartAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "NoOwnerRegisteredForSmartAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "NotEOA", + "type": "error" + }, + { + "inputs": [], + "name": "WrongSignatureLength", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowedAsOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartAccount", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "eoaOwner", + "type": "address" + } + ], + "name": "initForSmartAccount", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "dataHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "moduleSignature", + "type": "bytes" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "dataHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "moduleSignature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "isValidSignatureForAddress", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + } + ], + "name": "validateUserOp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/abi/IEcdsaOwnershipRegistryModule.json b/abi/IEcdsaOwnershipRegistryModule.json new file mode 100644 index 0000000..4fd3a06 --- /dev/null +++ b/abi/IEcdsaOwnershipRegistryModule.json @@ -0,0 +1,159 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "AlreadyInitedForSmartAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "NoOwnerRegisteredForSmartAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "NotEOA", + "type": "error" + }, + { + "inputs": [], + "name": "WrongSignatureLength", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowedAsOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "smartAccount", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "oldOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "eoaOwner", + "type": "address" + } + ], + "name": "initForSmartAccount", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "dataHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "moduleSignature", + "type": "bytes" + }, + { + "internalType": "address", + "name": "smartAccount", + "type": "address" + } + ], + "name": "isValidSignatureForAddress", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/abi/SmartAccount.json b/abi/SmartAccount.json new file mode 100644 index 0000000..2f5133b --- /dev/null +++ b/abi/SmartAccount.json @@ -0,0 +1,1175 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "anEntryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "BaseImplementationCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotAnEntryPoint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotEntryPoint", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotEntryPointOrOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotEntryPointOrSelf", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "CallerIsNotSelf", + "type": "error" + }, + { + "inputs": [], + "name": "DelegateCallsOnly", + "type": "error" + }, + { + "inputs": [], + "name": "EntryPointCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "HandlerCannotBeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementationAddress", + "type": "address" + } + ], + "name": "InvalidImplementation", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "MixedAuthFail", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "ModuleAlreadyEnabled", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "expectedModule", + "type": "address" + }, + { + "internalType": "address", + "name": "returnedModule", + "type": "address" + }, + { + "internalType": "address", + "name": "prevModule", + "type": "address" + } + ], + "name": "ModuleAndPrevModuleMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "ModuleCannotBeZeroOrSentinel", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "ModuleNotEnabled", + "type": "error" + }, + { + "inputs": [], + "name": "ModulesAlreadyInitialized", + "type": "error" + }, + { + "inputs": [], + "name": "ModulesSetupExecutionFailed", + "type": "error" + }, + { + "inputs": [], + "name": "OwnerCanNotBeSelf", + "type": "error" + }, + { + "inputs": [], + "name": "OwnerCannotBeZero", + "type": "error" + }, + { + "inputs": [], + "name": "OwnerProvidedIsSame", + "type": "error" + }, + { + "inputs": [], + "name": "TransferToZeroAddressAttempt", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "destLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "valueLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "funcLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "operationLength", + "type": "uint256" + } + ], + "name": "WrongBatchProvided", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "contractSignature", + "type": "bytes" + } + ], + "name": "WrongContractSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "uintS", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "contractSignatureLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "signatureLength", + "type": "uint256" + } + ], + "name": "WrongContractSignatureFormat", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "moduleAddressProvided", + "type": "address" + } + ], + "name": "WrongValidationModule", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousHandler", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "handler", + "type": "address" + } + ], + "name": "ChangedFallbackHandler", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "DisabledModule", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "EnabledModule", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "txGas", + "type": "uint256" + } + ], + "name": "ExecutionFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "ExecutionFromModuleFailure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "ExecutionFromModuleSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "txGas", + "type": "uint256" + } + ], + "name": "ExecutionSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "ImplementationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "module", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + } + ], + "name": "ModuleTransaction", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SmartAccountReceivedNativeToken", + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "addDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "prevModule", + "type": "address" + }, + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "disableModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "enableModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "entryPoint", + "outputs": [ + { + "internalType": "contract IEntryPoint", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "to", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "value", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "enum Enum.Operation[]", + "name": "operations", + "type": "uint8[]" + } + ], + "name": "execBatchTransactionFromModule", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "txGas", + "type": "uint256" + } + ], + "name": "execTransactionFromModule", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + } + ], + "name": "execTransactionFromModule", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + }, + { + "internalType": "enum Enum.Operation", + "name": "operation", + "type": "uint8" + } + ], + "name": "execTransactionFromModuleReturnData", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "func", + "type": "bytes" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "dest", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "value", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "func", + "type": "bytes[]" + } + ], + "name": "executeBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "dest", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "value", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "func", + "type": "bytes[]" + } + ], + "name": "executeBatch_y6U", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "func", + "type": "bytes" + } + ], + "name": "execute_ncC", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getFallbackHandler", + "outputs": [ + { + "internalType": "address", + "name": "_handler", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImplementation", + "outputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "start", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pageSize", + "type": "uint256" + } + ], + "name": "getModulesPaginated", + "outputs": [ + { + "internalType": "address[]", + "name": "array", + "type": "address[]" + }, + { + "internalType": "address", + "name": "next", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "handler", + "type": "address" + }, + { + "internalType": "address", + "name": "moduleSetupContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "moduleSetupData", + "type": "bytes" + } + ], + "name": "init", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "module", + "type": "address" + } + ], + "name": "isModuleEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "dataHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint192", + "name": "_key", + "type": "uint192" + } + ], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "noncesDeprecated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ownerDeprecated", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "handler", + "type": "address" + } + ], + "name": "setFallbackHandler", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "setupContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "setupData", + "type": "bytes" + } + ], + "name": "setupAndEnableModule", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + } + ], + "name": "updateImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validateUserOp", + "outputs": [ + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawDepositTo", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} diff --git a/abi/SmartAccountFactory.json b/abi/SmartAccountFactory.json new file mode 100644 index 0000000..b6f2d02 --- /dev/null +++ b/abi/SmartAccountFactory.json @@ -0,0 +1,286 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_basicImplementation", + "type": "address" + }, + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "initialAuthModule", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "AccountCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "initialAuthModule", + "type": "address" + } + ], + "name": "AccountCreationWithoutIndex", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "accountCreationCode", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "epAddress", + "type": "address" + }, + { + "internalType": "uint32", + "name": "unstakeDelaySec", + "type": "uint32" + } + ], + "name": "addStake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "basicImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "moduleSetupContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "moduleSetupData", + "type": "bytes" + } + ], + "name": "deployAccount", + "outputs": [ + { + "internalType": "address", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "moduleSetupContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "moduleSetupData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "deployCounterFactualAccount", + "outputs": [ + { + "internalType": "address", + "name": "proxy", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "moduleSetupContract", + "type": "address" + }, + { + "internalType": "bytes", + "name": "moduleSetupData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getAddressForCounterFactualAccount", + "outputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimalHandler", + "outputs": [ + { + "internalType": "contract DefaultCallbackHandler", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "epAddress", + "type": "address" + } + ], + "name": "unlockStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "epAddress", + "type": "address" + }, + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + } + ], + "name": "withdrawStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/src/constants/biconomy.ts b/src/constants/biconomy.ts new file mode 100644 index 0000000..2d25866 --- /dev/null +++ b/src/constants/biconomy.ts @@ -0,0 +1,6 @@ +export const Biconomy = { + SmartAccount: "0x0000002512019Dafb59528B82CB92D3c5D2423aC", + SmartAccountFactory: "0x000000a56Aaca3e9a4C479ea6b6CD0DbcB6634F5", + ECDSAOwnershipRegistryModule: "0x0000001c5b32F37F5beA87BDD5374eB2aC54eA8e", + }; + \ No newline at end of file diff --git a/src/constants/index.ts b/src/constants/index.ts index 66d0b8d..0c1c997 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,3 +1,4 @@ export * from "./erc4337"; export * from "./kernel"; export * from "./safe"; +export * from "./biconomy"; diff --git a/src/preset/builder/biconomy.ts b/src/preset/builder/biconomy.ts new file mode 100644 index 0000000..3dd1c43 --- /dev/null +++ b/src/preset/builder/biconomy.ts @@ -0,0 +1,145 @@ +import { BigNumberish, BytesLike, ethers } from "ethers"; +import { UserOperationBuilder } from "../../builder"; +import { BundlerJsonRpcProvider } from "../../provider"; +import { ERC4337, Biconomy as BiconomyConst } from "../../constants"; + +import { + EntryPoint, + SmartAccountFactory, + SmartAccountFactory__factory, + EntryPoint__factory, + SmartAccount, + SmartAccount__factory, + EcdsaOwnershipRegistryModule__factory, + EcdsaOwnershipRegistryModule, + } from "../../typechain"; + import { + ICall, + IPresetBuilderOpts, UserOperationMiddlewareFn, + } from "../../types"; +import { EOASignature, estimateUserOperationGas, getGasPrice } from "../middleware"; + + export class BiconomySmartAccount extends UserOperationBuilder { + + private signer: ethers.Signer; + private provider: ethers.providers.JsonRpcProvider; + private entryPoint: EntryPoint; + private factory: SmartAccountFactory; + private defaultValidationModule: EcdsaOwnershipRegistryModule; + private initCode: string; + proxy: SmartAccount; + + private constructor( + signer: ethers.Signer, + rpcUrl: string, + opts?: IPresetBuilderOpts + ) { + super(); + this.signer = signer; + this.provider = new BundlerJsonRpcProvider(rpcUrl).setBundlerRpc( + opts?.overrideBundlerRpc); + this.entryPoint = EntryPoint__factory.connect( + opts?.entryPoint || ERC4337.EntryPoint, + this.provider + ); + this.factory = SmartAccountFactory__factory.connect( + opts?.factory || BiconomyConst.SmartAccountFactory, + this.provider + ); + this.defaultValidationModule = EcdsaOwnershipRegistryModule__factory.connect( + BiconomyConst.ECDSAOwnershipRegistryModule, + this.provider + ) + this.initCode = "0x"; + this.proxy = SmartAccount__factory.connect( + ethers.constants.AddressZero, + this.provider + ); + } + + private resolveAccount: UserOperationMiddlewareFn = async (ctx) => { + ctx.op.nonce = await this.entryPoint.getNonce(ctx.op.sender, 0); + ctx.op.initCode = ctx.op.nonce.eq(0) ? this.initCode : "0x"; + }; + + public static async init( + signer: ethers.Signer, + rpcUrl: string, + opts?: IPresetBuilderOpts + ): Promise { + const instance = new BiconomySmartAccount(signer, rpcUrl, opts); + + const moduleSetupData = instance.defaultValidationModule.interface.encodeFunctionData("initForSmartAccount", [ + await instance.signer.getAddress() + ]); + + try { + instance.initCode = ethers.utils.hexConcat([ + instance.factory.address, + instance.factory.interface.encodeFunctionData("deployCounterFactualAccount", [ + BiconomyConst.ECDSAOwnershipRegistryModule, + moduleSetupData, + ethers.BigNumber.from(opts?.salt ?? 0), + ]), + ]); + await instance.entryPoint.callStatic.getSenderAddress(instance.initCode); + + throw new Error("getSenderAddress: unexpected result"); + } catch (error: any) { + const addr = error?.errorArgs?.sender; + if (!addr) throw error; + + // in case of not throwing error + // const addr = await instance.factory.getAddressForCounterFactualAccount(BiconomyConst.ECDSAOwnershipRegistryModule, moduleSetupData, ethers.BigNumber.from(opts?.salt ?? 0)) + instance.proxy = SmartAccount__factory.connect(addr, instance.provider); + } + + const moduleAddress = ethers.utils.getAddress(BiconomyConst.ECDSAOwnershipRegistryModule); + const dynamicPart = moduleAddress.substring(2).padEnd(40, "0"); + const dummySig = `0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${dynamicPart}000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000`; + + const base = instance + .useDefaults({ + sender: instance.proxy.address, + signature: dummySig, + }) + .useMiddleware(instance.resolveAccount) + .useMiddleware(getGasPrice(instance.provider)); + + const withPM = opts?.paymasterMiddleware + ? base.useMiddleware(opts.paymasterMiddleware) + : base.useMiddleware(estimateUserOperationGas(instance.provider)); + + return withPM + .useMiddleware(EOASignature(instance.signer)) + } + + execute(call: ICall) { + return this.setCallData( + this.proxy.interface.encodeFunctionData("execute_ncC", [ + call.to, + call.value, + call.data + ]) + ); + } + + executeBatch(calls: Array) { + // Define the arrays for 'to', 'value', and 'data' + const toArray: string[] = []; + const valueArray: BigNumberish[] = []; + const dataArray: BytesLike[] = []; + + // Iterate over the 'calls' array and populate the three arrays + calls.forEach(call => { + toArray.push(call.to); + valueArray.push(call.value); + dataArray.push(call.data); + }); + + return this.setCallData( + this.proxy.interface.encodeFunctionData("executeBatch_y6U", [toArray, valueArray, dataArray]) + ); + } + } + diff --git a/src/preset/builder/index.ts b/src/preset/builder/index.ts index 06d7608..4a92eb1 100644 --- a/src/preset/builder/index.ts +++ b/src/preset/builder/index.ts @@ -1,2 +1,3 @@ export * from "./kernel"; export * from "./simpleAccount"; +export * from "./biconomy"; diff --git a/src/typechain/EcdsaOwnershipRegistryModule.ts b/src/typechain/EcdsaOwnershipRegistryModule.ts new file mode 100644 index 0000000..1982397 --- /dev/null +++ b/src/typechain/EcdsaOwnershipRegistryModule.ts @@ -0,0 +1,416 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from "./common"; + +export type UserOperationStruct = { + sender: string; + nonce: BigNumberish; + initCode: BytesLike; + callData: BytesLike; + callGasLimit: BigNumberish; + verificationGasLimit: BigNumberish; + preVerificationGas: BigNumberish; + maxFeePerGas: BigNumberish; + maxPriorityFeePerGas: BigNumberish; + paymasterAndData: BytesLike; + signature: BytesLike; +}; + +export type UserOperationStructOutput = [ + string, + BigNumber, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + string, + string +] & { + sender: string; + nonce: BigNumber; + initCode: string; + callData: string; + callGasLimit: BigNumber; + verificationGasLimit: BigNumber; + preVerificationGas: BigNumber; + maxFeePerGas: BigNumber; + maxPriorityFeePerGas: BigNumber; + paymasterAndData: string; + signature: string; +}; + +export interface EcdsaOwnershipRegistryModuleInterface extends utils.Interface { + functions: { + "NAME()": FunctionFragment; + "VERSION()": FunctionFragment; + "getOwner(address)": FunctionFragment; + "initForSmartAccount(address)": FunctionFragment; + "isValidSignature(bytes32,bytes)": FunctionFragment; + "isValidSignatureForAddress(bytes32,bytes,address)": FunctionFragment; + "renounceOwnership()": FunctionFragment; + "transferOwnership(address)": FunctionFragment; + "validateUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes32)": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "NAME" + | "VERSION" + | "getOwner" + | "initForSmartAccount" + | "isValidSignature" + | "isValidSignatureForAddress" + | "renounceOwnership" + | "transferOwnership" + | "validateUserOp" + ): FunctionFragment; + + encodeFunctionData(functionFragment: "NAME", values?: undefined): string; + encodeFunctionData(functionFragment: "VERSION", values?: undefined): string; + encodeFunctionData(functionFragment: "getOwner", values: [string]): string; + encodeFunctionData( + functionFragment: "initForSmartAccount", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "isValidSignature", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isValidSignatureForAddress", + values: [BytesLike, BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "renounceOwnership", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "validateUserOp", + values: [UserOperationStruct, BytesLike] + ): string; + + decodeFunctionResult(functionFragment: "NAME", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "VERSION", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getOwner", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "initForSmartAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isValidSignature", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isValidSignatureForAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "renounceOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "validateUserOp", + data: BytesLike + ): Result; + + events: { + "OwnershipTransferred(address,address,address)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; +} + +export interface OwnershipTransferredEventObject { + smartAccount: string; + oldOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent< + [string, string, string], + OwnershipTransferredEventObject +>; + +export type OwnershipTransferredEventFilter = + TypedEventFilter; + +export interface EcdsaOwnershipRegistryModule extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: EcdsaOwnershipRegistryModuleInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + NAME(overrides?: CallOverrides): Promise<[string]>; + + VERSION(overrides?: CallOverrides): Promise<[string]>; + + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise<[string]>; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignature( + dataHash: BytesLike, + moduleSignature: BytesLike, + overrides?: CallOverrides + ): Promise<[string]>; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise<[string]>; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + }; + + NAME(overrides?: CallOverrides): Promise; + + VERSION(overrides?: CallOverrides): Promise; + + getOwner(smartAccount: string, overrides?: CallOverrides): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignature( + dataHash: BytesLike, + moduleSignature: BytesLike, + overrides?: CallOverrides + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + overrides?: CallOverrides + ): Promise; + + callStatic: { + NAME(overrides?: CallOverrides): Promise; + + VERSION(overrides?: CallOverrides): Promise; + + getOwner(smartAccount: string, overrides?: CallOverrides): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: CallOverrides + ): Promise; + + isValidSignature( + dataHash: BytesLike, + moduleSignature: BytesLike, + overrides?: CallOverrides + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership(overrides?: CallOverrides): Promise; + + transferOwnership(owner: string, overrides?: CallOverrides): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + "OwnershipTransferred(address,address,address)"( + smartAccount?: string | null, + oldOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + OwnershipTransferred( + smartAccount?: string | null, + oldOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + }; + + estimateGas: { + NAME(overrides?: CallOverrides): Promise; + + VERSION(overrides?: CallOverrides): Promise; + + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignature( + dataHash: BytesLike, + moduleSignature: BytesLike, + overrides?: CallOverrides + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + overrides?: CallOverrides + ): Promise; + }; + + populateTransaction: { + NAME(overrides?: CallOverrides): Promise; + + VERSION(overrides?: CallOverrides): Promise; + + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignature( + dataHash: BytesLike, + moduleSignature: BytesLike, + overrides?: CallOverrides + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + overrides?: CallOverrides + ): Promise; + }; +} diff --git a/src/typechain/IEcdsaOwnershipRegistryModule.ts b/src/typechain/IEcdsaOwnershipRegistryModule.ts new file mode 100644 index 0000000..f649c5e --- /dev/null +++ b/src/typechain/IEcdsaOwnershipRegistryModule.ts @@ -0,0 +1,268 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from "./common"; + +export interface IEcdsaOwnershipRegistryModuleInterface + extends utils.Interface { + functions: { + "getOwner(address)": FunctionFragment; + "initForSmartAccount(address)": FunctionFragment; + "isValidSignatureForAddress(bytes32,bytes,address)": FunctionFragment; + "renounceOwnership()": FunctionFragment; + "transferOwnership(address)": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "getOwner" + | "initForSmartAccount" + | "isValidSignatureForAddress" + | "renounceOwnership" + | "transferOwnership" + ): FunctionFragment; + + encodeFunctionData(functionFragment: "getOwner", values: [string]): string; + encodeFunctionData( + functionFragment: "initForSmartAccount", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "isValidSignatureForAddress", + values: [BytesLike, BytesLike, string] + ): string; + encodeFunctionData( + functionFragment: "renounceOwnership", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [string] + ): string; + + decodeFunctionResult(functionFragment: "getOwner", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "initForSmartAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isValidSignatureForAddress", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "renounceOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + + events: { + "OwnershipTransferred(address,address,address)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; +} + +export interface OwnershipTransferredEventObject { + smartAccount: string; + oldOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent< + [string, string, string], + OwnershipTransferredEventObject +>; + +export type OwnershipTransferredEventFilter = + TypedEventFilter; + +export interface IEcdsaOwnershipRegistryModule extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: IEcdsaOwnershipRegistryModuleInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise<[string]>; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise<[string]>; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; + + getOwner(smartAccount: string, overrides?: CallOverrides): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + callStatic: { + getOwner(smartAccount: string, overrides?: CallOverrides): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: CallOverrides + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership(overrides?: CallOverrides): Promise; + + transferOwnership(owner: string, overrides?: CallOverrides): Promise; + }; + + filters: { + "OwnershipTransferred(address,address,address)"( + smartAccount?: string | null, + oldOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + OwnershipTransferred( + smartAccount?: string | null, + oldOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + }; + + estimateGas: { + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; + + populateTransaction: { + getOwner( + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + initForSmartAccount( + eoaOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + isValidSignatureForAddress( + dataHash: BytesLike, + moduleSignature: BytesLike, + smartAccount: string, + overrides?: CallOverrides + ): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + owner: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; +} diff --git a/src/typechain/SmartAccount.ts b/src/typechain/SmartAccount.ts new file mode 100644 index 0000000..70a1c83 --- /dev/null +++ b/src/typechain/SmartAccount.ts @@ -0,0 +1,1383 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PayableOverrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from "./common"; + +export type UserOperationStruct = { + sender: string; + nonce: BigNumberish; + initCode: BytesLike; + callData: BytesLike; + callGasLimit: BigNumberish; + verificationGasLimit: BigNumberish; + preVerificationGas: BigNumberish; + maxFeePerGas: BigNumberish; + maxPriorityFeePerGas: BigNumberish; + paymasterAndData: BytesLike; + signature: BytesLike; +}; + +export type UserOperationStructOutput = [ + string, + BigNumber, + string, + string, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + BigNumber, + string, + string +] & { + sender: string; + nonce: BigNumber; + initCode: string; + callData: string; + callGasLimit: BigNumber; + verificationGasLimit: BigNumber; + preVerificationGas: BigNumber; + maxFeePerGas: BigNumber; + maxPriorityFeePerGas: BigNumber; + paymasterAndData: string; + signature: string; +}; + +export interface SmartAccountInterface extends utils.Interface { + functions: { + "VERSION()": FunctionFragment; + "addDeposit()": FunctionFragment; + "disableModule(address,address)": FunctionFragment; + "enableModule(address)": FunctionFragment; + "entryPoint()": FunctionFragment; + "execBatchTransactionFromModule(address[],uint256[],bytes[],uint8[])": FunctionFragment; + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)": FunctionFragment; + "execTransactionFromModule(address,uint256,bytes,uint8)": FunctionFragment; + "execTransactionFromModuleReturnData(address,uint256,bytes,uint8)": FunctionFragment; + "execute(address,uint256,bytes)": FunctionFragment; + "executeBatch(address[],uint256[],bytes[])": FunctionFragment; + "executeBatch_y6U(address[],uint256[],bytes[])": FunctionFragment; + "execute_ncC(address,uint256,bytes)": FunctionFragment; + "getDeposit()": FunctionFragment; + "getFallbackHandler()": FunctionFragment; + "getImplementation()": FunctionFragment; + "getModulesPaginated(address,uint256)": FunctionFragment; + "init(address,address,bytes)": FunctionFragment; + "isModuleEnabled(address)": FunctionFragment; + "isValidSignature(bytes32,bytes)": FunctionFragment; + "nonce(uint192)": FunctionFragment; + "noncesDeprecated(uint256)": FunctionFragment; + "ownerDeprecated()": FunctionFragment; + "setFallbackHandler(address)": FunctionFragment; + "setupAndEnableModule(address,bytes)": FunctionFragment; + "supportsInterface(bytes4)": FunctionFragment; + "updateImplementation(address)": FunctionFragment; + "validateUserOp((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes32,uint256)": FunctionFragment; + "withdrawDepositTo(address,uint256)": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "VERSION" + | "addDeposit" + | "disableModule" + | "enableModule" + | "entryPoint" + | "execBatchTransactionFromModule" + | "execTransactionFromModule(address,uint256,bytes,uint8,uint256)" + | "execTransactionFromModule(address,uint256,bytes,uint8)" + | "execTransactionFromModuleReturnData" + | "execute" + | "executeBatch" + | "executeBatch_y6U" + | "execute_ncC" + | "getDeposit" + | "getFallbackHandler" + | "getImplementation" + | "getModulesPaginated" + | "init" + | "isModuleEnabled" + | "isValidSignature" + | "nonce" + | "noncesDeprecated" + | "ownerDeprecated" + | "setFallbackHandler" + | "setupAndEnableModule" + | "supportsInterface" + | "updateImplementation" + | "validateUserOp" + | "withdrawDepositTo" + ): FunctionFragment; + + encodeFunctionData(functionFragment: "VERSION", values?: undefined): string; + encodeFunctionData( + functionFragment: "addDeposit", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "disableModule", + values: [string, string] + ): string; + encodeFunctionData( + functionFragment: "enableModule", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "entryPoint", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "execBatchTransactionFromModule", + values: [string[], BigNumberish[], BytesLike[], BigNumberish[]] + ): string; + encodeFunctionData( + functionFragment: "execTransactionFromModule(address,uint256,bytes,uint8,uint256)", + values: [string, BigNumberish, BytesLike, BigNumberish, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "execTransactionFromModule(address,uint256,bytes,uint8)", + values: [string, BigNumberish, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "execTransactionFromModuleReturnData", + values: [string, BigNumberish, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "execute", + values: [string, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "executeBatch", + values: [string[], BigNumberish[], BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "executeBatch_y6U", + values: [string[], BigNumberish[], BytesLike[]] + ): string; + encodeFunctionData( + functionFragment: "execute_ncC", + values: [string, BigNumberish, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "getDeposit", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getFallbackHandler", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getImplementation", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "getModulesPaginated", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "init", + values: [string, string, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "isModuleEnabled", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "isValidSignature", + values: [BytesLike, BytesLike] + ): string; + encodeFunctionData(functionFragment: "nonce", values: [BigNumberish]): string; + encodeFunctionData( + functionFragment: "noncesDeprecated", + values: [BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "ownerDeprecated", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "setFallbackHandler", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "setupAndEnableModule", + values: [string, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "supportsInterface", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "updateImplementation", + values: [string] + ): string; + encodeFunctionData( + functionFragment: "validateUserOp", + values: [UserOperationStruct, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "withdrawDepositTo", + values: [string, BigNumberish] + ): string; + + decodeFunctionResult(functionFragment: "VERSION", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "addDeposit", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "disableModule", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "enableModule", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "entryPoint", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "execBatchTransactionFromModule", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "execTransactionFromModule(address,uint256,bytes,uint8,uint256)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "execTransactionFromModule(address,uint256,bytes,uint8)", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "execTransactionFromModuleReturnData", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "execute", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "executeBatch", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "executeBatch_y6U", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "execute_ncC", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "getDeposit", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "getFallbackHandler", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getImplementation", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getModulesPaginated", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "init", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "isModuleEnabled", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "isValidSignature", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "nonce", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "noncesDeprecated", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "ownerDeprecated", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setFallbackHandler", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "setupAndEnableModule", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "supportsInterface", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "updateImplementation", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "validateUserOp", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "withdrawDepositTo", + data: BytesLike + ): Result; + + events: { + "ChangedFallbackHandler(address,address)": EventFragment; + "DisabledModule(address)": EventFragment; + "EnabledModule(address)": EventFragment; + "ExecutionFailure(address,uint256,bytes,uint8,uint256)": EventFragment; + "ExecutionFromModuleFailure(address)": EventFragment; + "ExecutionFromModuleSuccess(address)": EventFragment; + "ExecutionSuccess(address,uint256,bytes,uint8,uint256)": EventFragment; + "ImplementationUpdated(address,address)": EventFragment; + "ModuleTransaction(address,address,uint256,bytes,uint8)": EventFragment; + "SmartAccountReceivedNativeToken(address,uint256)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "ChangedFallbackHandler"): EventFragment; + getEvent(nameOrSignatureOrTopic: "DisabledModule"): EventFragment; + getEvent(nameOrSignatureOrTopic: "EnabledModule"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ExecutionFailure"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ExecutionFromModuleFailure"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ExecutionFromModuleSuccess"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ExecutionSuccess"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ImplementationUpdated"): EventFragment; + getEvent(nameOrSignatureOrTopic: "ModuleTransaction"): EventFragment; + getEvent( + nameOrSignatureOrTopic: "SmartAccountReceivedNativeToken" + ): EventFragment; +} + +export interface ChangedFallbackHandlerEventObject { + previousHandler: string; + handler: string; +} +export type ChangedFallbackHandlerEvent = TypedEvent< + [string, string], + ChangedFallbackHandlerEventObject +>; + +export type ChangedFallbackHandlerEventFilter = + TypedEventFilter; + +export interface DisabledModuleEventObject { + module: string; +} +export type DisabledModuleEvent = TypedEvent< + [string], + DisabledModuleEventObject +>; + +export type DisabledModuleEventFilter = TypedEventFilter; + +export interface EnabledModuleEventObject { + module: string; +} +export type EnabledModuleEvent = TypedEvent<[string], EnabledModuleEventObject>; + +export type EnabledModuleEventFilter = TypedEventFilter; + +export interface ExecutionFailureEventObject { + to: string; + value: BigNumber; + data: string; + operation: number; + txGas: BigNumber; +} +export type ExecutionFailureEvent = TypedEvent< + [string, BigNumber, string, number, BigNumber], + ExecutionFailureEventObject +>; + +export type ExecutionFailureEventFilter = + TypedEventFilter; + +export interface ExecutionFromModuleFailureEventObject { + module: string; +} +export type ExecutionFromModuleFailureEvent = TypedEvent< + [string], + ExecutionFromModuleFailureEventObject +>; + +export type ExecutionFromModuleFailureEventFilter = + TypedEventFilter; + +export interface ExecutionFromModuleSuccessEventObject { + module: string; +} +export type ExecutionFromModuleSuccessEvent = TypedEvent< + [string], + ExecutionFromModuleSuccessEventObject +>; + +export type ExecutionFromModuleSuccessEventFilter = + TypedEventFilter; + +export interface ExecutionSuccessEventObject { + to: string; + value: BigNumber; + data: string; + operation: number; + txGas: BigNumber; +} +export type ExecutionSuccessEvent = TypedEvent< + [string, BigNumber, string, number, BigNumber], + ExecutionSuccessEventObject +>; + +export type ExecutionSuccessEventFilter = + TypedEventFilter; + +export interface ImplementationUpdatedEventObject { + oldImplementation: string; + newImplementation: string; +} +export type ImplementationUpdatedEvent = TypedEvent< + [string, string], + ImplementationUpdatedEventObject +>; + +export type ImplementationUpdatedEventFilter = + TypedEventFilter; + +export interface ModuleTransactionEventObject { + module: string; + to: string; + value: BigNumber; + data: string; + operation: number; +} +export type ModuleTransactionEvent = TypedEvent< + [string, string, BigNumber, string, number], + ModuleTransactionEventObject +>; + +export type ModuleTransactionEventFilter = + TypedEventFilter; + +export interface SmartAccountReceivedNativeTokenEventObject { + sender: string; + value: BigNumber; +} +export type SmartAccountReceivedNativeTokenEvent = TypedEvent< + [string, BigNumber], + SmartAccountReceivedNativeTokenEventObject +>; + +export type SmartAccountReceivedNativeTokenEventFilter = + TypedEventFilter; + +export interface SmartAccount extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: SmartAccountInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + VERSION(overrides?: CallOverrides): Promise<[string]>; + + addDeposit( + overrides?: PayableOverrides & { from?: string } + ): Promise; + + disableModule( + prevModule: string, + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + enableModule( + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + entryPoint(overrides?: CallOverrides): Promise<[string]>; + + execBatchTransactionFromModule( + to: string[], + value: BigNumberish[], + data: BytesLike[], + operations: BigNumberish[], + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + txGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execTransactionFromModuleReturnData( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execute( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch_y6U( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + execute_ncC( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getDeposit(overrides?: CallOverrides): Promise<[BigNumber]>; + + getFallbackHandler( + overrides?: CallOverrides + ): Promise<[string] & { _handler: string }>; + + getImplementation( + overrides?: CallOverrides + ): Promise<[string] & { _implementation: string }>; + + getModulesPaginated( + start: string, + pageSize: BigNumberish, + overrides?: CallOverrides + ): Promise<[string[], string] & { array: string[]; next: string }>; + + init( + handler: string, + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + isModuleEnabled( + module: string, + overrides?: CallOverrides + ): Promise<[boolean]>; + + isValidSignature( + dataHash: BytesLike, + signature: BytesLike, + overrides?: CallOverrides + ): Promise<[string]>; + + nonce(_key: BigNumberish, overrides?: CallOverrides): Promise<[BigNumber]>; + + noncesDeprecated( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + + ownerDeprecated(overrides?: CallOverrides): Promise<[string]>; + + setFallbackHandler( + handler: string, + overrides?: Overrides & { from?: string } + ): Promise; + + setupAndEnableModule( + setupContract: string, + setupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + supportsInterface( + _interfaceId: BytesLike, + overrides?: CallOverrides + ): Promise<[boolean]>; + + updateImplementation( + _implementation: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + missingAccountFunds: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawDepositTo( + withdrawAddress: string, + amount: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + }; + + VERSION(overrides?: CallOverrides): Promise; + + addDeposit( + overrides?: PayableOverrides & { from?: string } + ): Promise; + + disableModule( + prevModule: string, + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + enableModule( + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + entryPoint(overrides?: CallOverrides): Promise; + + execBatchTransactionFromModule( + to: string[], + value: BigNumberish[], + data: BytesLike[], + operations: BigNumberish[], + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + txGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execTransactionFromModuleReturnData( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execute( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch_y6U( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + execute_ncC( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getDeposit(overrides?: CallOverrides): Promise; + + getFallbackHandler(overrides?: CallOverrides): Promise; + + getImplementation(overrides?: CallOverrides): Promise; + + getModulesPaginated( + start: string, + pageSize: BigNumberish, + overrides?: CallOverrides + ): Promise<[string[], string] & { array: string[]; next: string }>; + + init( + handler: string, + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + isModuleEnabled(module: string, overrides?: CallOverrides): Promise; + + isValidSignature( + dataHash: BytesLike, + signature: BytesLike, + overrides?: CallOverrides + ): Promise; + + nonce(_key: BigNumberish, overrides?: CallOverrides): Promise; + + noncesDeprecated( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + ownerDeprecated(overrides?: CallOverrides): Promise; + + setFallbackHandler( + handler: string, + overrides?: Overrides & { from?: string } + ): Promise; + + setupAndEnableModule( + setupContract: string, + setupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + supportsInterface( + _interfaceId: BytesLike, + overrides?: CallOverrides + ): Promise; + + updateImplementation( + _implementation: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + missingAccountFunds: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawDepositTo( + withdrawAddress: string, + amount: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + callStatic: { + VERSION(overrides?: CallOverrides): Promise; + + addDeposit(overrides?: CallOverrides): Promise; + + disableModule( + prevModule: string, + module: string, + overrides?: CallOverrides + ): Promise; + + enableModule(module: string, overrides?: CallOverrides): Promise; + + entryPoint(overrides?: CallOverrides): Promise; + + execBatchTransactionFromModule( + to: string[], + value: BigNumberish[], + data: BytesLike[], + operations: BigNumberish[], + overrides?: CallOverrides + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + txGas: BigNumberish, + overrides?: CallOverrides + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: CallOverrides + ): Promise; + + execTransactionFromModuleReturnData( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: CallOverrides + ): Promise<[boolean, string] & { success: boolean; returnData: string }>; + + execute( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: CallOverrides + ): Promise; + + executeBatch( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: CallOverrides + ): Promise; + + executeBatch_y6U( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: CallOverrides + ): Promise; + + execute_ncC( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: CallOverrides + ): Promise; + + getDeposit(overrides?: CallOverrides): Promise; + + getFallbackHandler(overrides?: CallOverrides): Promise; + + getImplementation(overrides?: CallOverrides): Promise; + + getModulesPaginated( + start: string, + pageSize: BigNumberish, + overrides?: CallOverrides + ): Promise<[string[], string] & { array: string[]; next: string }>; + + init( + handler: string, + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: CallOverrides + ): Promise; + + isModuleEnabled( + module: string, + overrides?: CallOverrides + ): Promise; + + isValidSignature( + dataHash: BytesLike, + signature: BytesLike, + overrides?: CallOverrides + ): Promise; + + nonce(_key: BigNumberish, overrides?: CallOverrides): Promise; + + noncesDeprecated( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + ownerDeprecated(overrides?: CallOverrides): Promise; + + setFallbackHandler( + handler: string, + overrides?: CallOverrides + ): Promise; + + setupAndEnableModule( + setupContract: string, + setupData: BytesLike, + overrides?: CallOverrides + ): Promise; + + supportsInterface( + _interfaceId: BytesLike, + overrides?: CallOverrides + ): Promise; + + updateImplementation( + _implementation: string, + overrides?: CallOverrides + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + missingAccountFunds: BigNumberish, + overrides?: CallOverrides + ): Promise; + + withdrawDepositTo( + withdrawAddress: string, + amount: BigNumberish, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + "ChangedFallbackHandler(address,address)"( + previousHandler?: string | null, + handler?: string | null + ): ChangedFallbackHandlerEventFilter; + ChangedFallbackHandler( + previousHandler?: string | null, + handler?: string | null + ): ChangedFallbackHandlerEventFilter; + + "DisabledModule(address)"(module?: null): DisabledModuleEventFilter; + DisabledModule(module?: null): DisabledModuleEventFilter; + + "EnabledModule(address)"(module?: null): EnabledModuleEventFilter; + EnabledModule(module?: null): EnabledModuleEventFilter; + + "ExecutionFailure(address,uint256,bytes,uint8,uint256)"( + to?: string | null, + value?: BigNumberish | null, + data?: BytesLike | null, + operation?: null, + txGas?: null + ): ExecutionFailureEventFilter; + ExecutionFailure( + to?: string | null, + value?: BigNumberish | null, + data?: BytesLike | null, + operation?: null, + txGas?: null + ): ExecutionFailureEventFilter; + + "ExecutionFromModuleFailure(address)"( + module?: string | null + ): ExecutionFromModuleFailureEventFilter; + ExecutionFromModuleFailure( + module?: string | null + ): ExecutionFromModuleFailureEventFilter; + + "ExecutionFromModuleSuccess(address)"( + module?: string | null + ): ExecutionFromModuleSuccessEventFilter; + ExecutionFromModuleSuccess( + module?: string | null + ): ExecutionFromModuleSuccessEventFilter; + + "ExecutionSuccess(address,uint256,bytes,uint8,uint256)"( + to?: string | null, + value?: BigNumberish | null, + data?: BytesLike | null, + operation?: null, + txGas?: null + ): ExecutionSuccessEventFilter; + ExecutionSuccess( + to?: string | null, + value?: BigNumberish | null, + data?: BytesLike | null, + operation?: null, + txGas?: null + ): ExecutionSuccessEventFilter; + + "ImplementationUpdated(address,address)"( + oldImplementation?: string | null, + newImplementation?: string | null + ): ImplementationUpdatedEventFilter; + ImplementationUpdated( + oldImplementation?: string | null, + newImplementation?: string | null + ): ImplementationUpdatedEventFilter; + + "ModuleTransaction(address,address,uint256,bytes,uint8)"( + module?: null, + to?: null, + value?: null, + data?: null, + operation?: null + ): ModuleTransactionEventFilter; + ModuleTransaction( + module?: null, + to?: null, + value?: null, + data?: null, + operation?: null + ): ModuleTransactionEventFilter; + + "SmartAccountReceivedNativeToken(address,uint256)"( + sender?: string | null, + value?: BigNumberish | null + ): SmartAccountReceivedNativeTokenEventFilter; + SmartAccountReceivedNativeToken( + sender?: string | null, + value?: BigNumberish | null + ): SmartAccountReceivedNativeTokenEventFilter; + }; + + estimateGas: { + VERSION(overrides?: CallOverrides): Promise; + + addDeposit( + overrides?: PayableOverrides & { from?: string } + ): Promise; + + disableModule( + prevModule: string, + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + enableModule( + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + entryPoint(overrides?: CallOverrides): Promise; + + execBatchTransactionFromModule( + to: string[], + value: BigNumberish[], + data: BytesLike[], + operations: BigNumberish[], + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + txGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execTransactionFromModuleReturnData( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execute( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch_y6U( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + execute_ncC( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getDeposit(overrides?: CallOverrides): Promise; + + getFallbackHandler(overrides?: CallOverrides): Promise; + + getImplementation(overrides?: CallOverrides): Promise; + + getModulesPaginated( + start: string, + pageSize: BigNumberish, + overrides?: CallOverrides + ): Promise; + + init( + handler: string, + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + isModuleEnabled( + module: string, + overrides?: CallOverrides + ): Promise; + + isValidSignature( + dataHash: BytesLike, + signature: BytesLike, + overrides?: CallOverrides + ): Promise; + + nonce(_key: BigNumberish, overrides?: CallOverrides): Promise; + + noncesDeprecated( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + ownerDeprecated(overrides?: CallOverrides): Promise; + + setFallbackHandler( + handler: string, + overrides?: Overrides & { from?: string } + ): Promise; + + setupAndEnableModule( + setupContract: string, + setupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + supportsInterface( + _interfaceId: BytesLike, + overrides?: CallOverrides + ): Promise; + + updateImplementation( + _implementation: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + missingAccountFunds: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawDepositTo( + withdrawAddress: string, + amount: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + }; + + populateTransaction: { + VERSION(overrides?: CallOverrides): Promise; + + addDeposit( + overrides?: PayableOverrides & { from?: string } + ): Promise; + + disableModule( + prevModule: string, + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + enableModule( + module: string, + overrides?: Overrides & { from?: string } + ): Promise; + + entryPoint(overrides?: CallOverrides): Promise; + + execBatchTransactionFromModule( + to: string[], + value: BigNumberish[], + data: BytesLike[], + operations: BigNumberish[], + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8,uint256)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + txGas: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + "execTransactionFromModule(address,uint256,bytes,uint8)"( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execTransactionFromModuleReturnData( + to: string, + value: BigNumberish, + data: BytesLike, + operation: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + execute( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + executeBatch_y6U( + dest: string[], + value: BigNumberish[], + func: BytesLike[], + overrides?: Overrides & { from?: string } + ): Promise; + + execute_ncC( + dest: string, + value: BigNumberish, + func: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + getDeposit(overrides?: CallOverrides): Promise; + + getFallbackHandler( + overrides?: CallOverrides + ): Promise; + + getImplementation(overrides?: CallOverrides): Promise; + + getModulesPaginated( + start: string, + pageSize: BigNumberish, + overrides?: CallOverrides + ): Promise; + + init( + handler: string, + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + isModuleEnabled( + module: string, + overrides?: CallOverrides + ): Promise; + + isValidSignature( + dataHash: BytesLike, + signature: BytesLike, + overrides?: CallOverrides + ): Promise; + + nonce( + _key: BigNumberish, + overrides?: CallOverrides + ): Promise; + + noncesDeprecated( + arg0: BigNumberish, + overrides?: CallOverrides + ): Promise; + + ownerDeprecated(overrides?: CallOverrides): Promise; + + setFallbackHandler( + handler: string, + overrides?: Overrides & { from?: string } + ): Promise; + + setupAndEnableModule( + setupContract: string, + setupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + supportsInterface( + _interfaceId: BytesLike, + overrides?: CallOverrides + ): Promise; + + updateImplementation( + _implementation: string, + overrides?: Overrides & { from?: string } + ): Promise; + + validateUserOp( + userOp: UserOperationStruct, + userOpHash: BytesLike, + missingAccountFunds: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawDepositTo( + withdrawAddress: string, + amount: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + }; +} diff --git a/src/typechain/SmartAccountFactory.ts b/src/typechain/SmartAccountFactory.ts new file mode 100644 index 0000000..d345ff0 --- /dev/null +++ b/src/typechain/SmartAccountFactory.ts @@ -0,0 +1,530 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PayableOverrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from "./common"; + +export interface SmartAccountFactoryInterface extends utils.Interface { + functions: { + "accountCreationCode()": FunctionFragment; + "addStake(address,uint32)": FunctionFragment; + "basicImplementation()": FunctionFragment; + "deployAccount(address,bytes)": FunctionFragment; + "deployCounterFactualAccount(address,bytes,uint256)": FunctionFragment; + "getAddressForCounterFactualAccount(address,bytes,uint256)": FunctionFragment; + "minimalHandler()": FunctionFragment; + "owner()": FunctionFragment; + "renounceOwnership()": FunctionFragment; + "transferOwnership(address)": FunctionFragment; + "unlockStake(address)": FunctionFragment; + "withdrawStake(address,address)": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "accountCreationCode" + | "addStake" + | "basicImplementation" + | "deployAccount" + | "deployCounterFactualAccount" + | "getAddressForCounterFactualAccount" + | "minimalHandler" + | "owner" + | "renounceOwnership" + | "transferOwnership" + | "unlockStake" + | "withdrawStake" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "accountCreationCode", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "addStake", + values: [string, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "basicImplementation", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "deployAccount", + values: [string, BytesLike] + ): string; + encodeFunctionData( + functionFragment: "deployCounterFactualAccount", + values: [string, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "getAddressForCounterFactualAccount", + values: [string, BytesLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "minimalHandler", + values?: undefined + ): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData( + functionFragment: "renounceOwnership", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transferOwnership", + values: [string] + ): string; + encodeFunctionData(functionFragment: "unlockStake", values: [string]): string; + encodeFunctionData( + functionFragment: "withdrawStake", + values: [string, string] + ): string; + + decodeFunctionResult( + functionFragment: "accountCreationCode", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "addStake", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "basicImplementation", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "deployAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "deployCounterFactualAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "getAddressForCounterFactualAccount", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "minimalHandler", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "renounceOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "transferOwnership", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "unlockStake", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "withdrawStake", + data: BytesLike + ): Result; + + events: { + "AccountCreation(address,address,uint256)": EventFragment; + "AccountCreationWithoutIndex(address,address)": EventFragment; + "OwnershipTransferred(address,address)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "AccountCreation"): EventFragment; + getEvent( + nameOrSignatureOrTopic: "AccountCreationWithoutIndex" + ): EventFragment; + getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment; +} + +export interface AccountCreationEventObject { + account: string; + initialAuthModule: string; + index: BigNumber; +} +export type AccountCreationEvent = TypedEvent< + [string, string, BigNumber], + AccountCreationEventObject +>; + +export type AccountCreationEventFilter = TypedEventFilter; + +export interface AccountCreationWithoutIndexEventObject { + account: string; + initialAuthModule: string; +} +export type AccountCreationWithoutIndexEvent = TypedEvent< + [string, string], + AccountCreationWithoutIndexEventObject +>; + +export type AccountCreationWithoutIndexEventFilter = + TypedEventFilter; + +export interface OwnershipTransferredEventObject { + previousOwner: string; + newOwner: string; +} +export type OwnershipTransferredEvent = TypedEvent< + [string, string], + OwnershipTransferredEventObject +>; + +export type OwnershipTransferredEventFilter = + TypedEventFilter; + +export interface SmartAccountFactory extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: SmartAccountFactoryInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + accountCreationCode(overrides?: CallOverrides): Promise<[string]>; + + addStake( + epAddress: string, + unstakeDelaySec: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + basicImplementation(overrides?: CallOverrides): Promise<[string]>; + + deployAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + deployCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + getAddressForCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise<[string] & { _account: string }>; + + minimalHandler(overrides?: CallOverrides): Promise<[string]>; + + owner(overrides?: CallOverrides): Promise<[string]>; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + unlockStake( + epAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawStake( + epAddress: string, + withdrawAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; + + accountCreationCode(overrides?: CallOverrides): Promise; + + addStake( + epAddress: string, + unstakeDelaySec: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + basicImplementation(overrides?: CallOverrides): Promise; + + deployAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + deployCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + getAddressForCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + minimalHandler(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + unlockStake( + epAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawStake( + epAddress: string, + withdrawAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + + callStatic: { + accountCreationCode(overrides?: CallOverrides): Promise; + + addStake( + epAddress: string, + unstakeDelaySec: BigNumberish, + overrides?: CallOverrides + ): Promise; + + basicImplementation(overrides?: CallOverrides): Promise; + + deployAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: CallOverrides + ): Promise; + + deployCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + getAddressForCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + minimalHandler(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership(overrides?: CallOverrides): Promise; + + transferOwnership( + newOwner: string, + overrides?: CallOverrides + ): Promise; + + unlockStake(epAddress: string, overrides?: CallOverrides): Promise; + + withdrawStake( + epAddress: string, + withdrawAddress: string, + overrides?: CallOverrides + ): Promise; + }; + + filters: { + "AccountCreation(address,address,uint256)"( + account?: string | null, + initialAuthModule?: string | null, + index?: BigNumberish | null + ): AccountCreationEventFilter; + AccountCreation( + account?: string | null, + initialAuthModule?: string | null, + index?: BigNumberish | null + ): AccountCreationEventFilter; + + "AccountCreationWithoutIndex(address,address)"( + account?: string | null, + initialAuthModule?: string | null + ): AccountCreationWithoutIndexEventFilter; + AccountCreationWithoutIndex( + account?: string | null, + initialAuthModule?: string | null + ): AccountCreationWithoutIndexEventFilter; + + "OwnershipTransferred(address,address)"( + previousOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + OwnershipTransferred( + previousOwner?: string | null, + newOwner?: string | null + ): OwnershipTransferredEventFilter; + }; + + estimateGas: { + accountCreationCode(overrides?: CallOverrides): Promise; + + addStake( + epAddress: string, + unstakeDelaySec: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + basicImplementation(overrides?: CallOverrides): Promise; + + deployAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + deployCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + getAddressForCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + minimalHandler(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + unlockStake( + epAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawStake( + epAddress: string, + withdrawAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; + + populateTransaction: { + accountCreationCode( + overrides?: CallOverrides + ): Promise; + + addStake( + epAddress: string, + unstakeDelaySec: BigNumberish, + overrides?: PayableOverrides & { from?: string } + ): Promise; + + basicImplementation( + overrides?: CallOverrides + ): Promise; + + deployAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + deployCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: Overrides & { from?: string } + ): Promise; + + getAddressForCounterFactualAccount( + moduleSetupContract: string, + moduleSetupData: BytesLike, + index: BigNumberish, + overrides?: CallOverrides + ): Promise; + + minimalHandler(overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + renounceOwnership( + overrides?: Overrides & { from?: string } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string } + ): Promise; + + unlockStake( + epAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + + withdrawStake( + epAddress: string, + withdrawAddress: string, + overrides?: Overrides & { from?: string } + ): Promise; + }; +} diff --git a/src/typechain/factories/EcdsaOwnershipRegistryModule__factory.ts b/src/typechain/factories/EcdsaOwnershipRegistryModule__factory.ts new file mode 100644 index 0000000..1cacaee --- /dev/null +++ b/src/typechain/factories/EcdsaOwnershipRegistryModule__factory.ts @@ -0,0 +1,316 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + EcdsaOwnershipRegistryModule, + EcdsaOwnershipRegistryModuleInterface, +} from "../EcdsaOwnershipRegistryModule"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "AlreadyInitedForSmartAccount", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "NoOwnerRegisteredForSmartAccount", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "NotEOA", + type: "error", + }, + { + inputs: [], + name: "WrongSignatureLength", + type: "error", + }, + { + inputs: [], + name: "ZeroAddressNotAllowedAsOwner", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "smartAccount", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "NAME", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "VERSION", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "getOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "eoaOwner", + type: "address", + }, + ], + name: "initForSmartAccount", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "dataHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "moduleSignature", + type: "bytes", + }, + ], + name: "isValidSignature", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "dataHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "moduleSignature", + type: "bytes", + }, + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "isValidSignatureForAddress", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bytes", + name: "initCode", + type: "bytes", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + { + internalType: "uint256", + name: "callGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "verificationGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "preVerificationGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxFeePerGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxPriorityFeePerGas", + type: "uint256", + }, + { + internalType: "bytes", + name: "paymasterAndData", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + internalType: "struct UserOperation", + name: "userOp", + type: "tuple", + }, + { + internalType: "bytes32", + name: "userOpHash", + type: "bytes32", + }, + ], + name: "validateUserOp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +export class EcdsaOwnershipRegistryModule__factory { + static readonly abi = _abi; + static createInterface(): EcdsaOwnershipRegistryModuleInterface { + return new utils.Interface(_abi) as EcdsaOwnershipRegistryModuleInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): EcdsaOwnershipRegistryModule { + return new Contract( + address, + _abi, + signerOrProvider + ) as EcdsaOwnershipRegistryModule; + } +} diff --git a/src/typechain/factories/IEcdsaOwnershipRegistryModule__factory.ts b/src/typechain/factories/IEcdsaOwnershipRegistryModule__factory.ts new file mode 100644 index 0000000..3c34090 --- /dev/null +++ b/src/typechain/factories/IEcdsaOwnershipRegistryModule__factory.ts @@ -0,0 +1,185 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + IEcdsaOwnershipRegistryModule, + IEcdsaOwnershipRegistryModuleInterface, +} from "../IEcdsaOwnershipRegistryModule"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "AlreadyInitedForSmartAccount", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "NoOwnerRegisteredForSmartAccount", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "account", + type: "address", + }, + ], + name: "NotEOA", + type: "error", + }, + { + inputs: [], + name: "WrongSignatureLength", + type: "error", + }, + { + inputs: [], + name: "ZeroAddressNotAllowedAsOwner", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "smartAccount", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [ + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "getOwner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "eoaOwner", + type: "address", + }, + ], + name: "initForSmartAccount", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "dataHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "moduleSignature", + type: "bytes", + }, + { + internalType: "address", + name: "smartAccount", + type: "address", + }, + ], + name: "isValidSignatureForAddress", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class IEcdsaOwnershipRegistryModule__factory { + static readonly abi = _abi; + static createInterface(): IEcdsaOwnershipRegistryModuleInterface { + return new utils.Interface(_abi) as IEcdsaOwnershipRegistryModuleInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): IEcdsaOwnershipRegistryModule { + return new Contract( + address, + _abi, + signerOrProvider + ) as IEcdsaOwnershipRegistryModule; + } +} diff --git a/src/typechain/factories/SmartAccountFactory__factory.ts b/src/typechain/factories/SmartAccountFactory__factory.ts new file mode 100644 index 0000000..db7b323 --- /dev/null +++ b/src/typechain/factories/SmartAccountFactory__factory.ts @@ -0,0 +1,308 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + SmartAccountFactory, + SmartAccountFactoryInterface, +} from "../SmartAccountFactory"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_basicImplementation", + type: "address", + }, + { + internalType: "address", + name: "_newOwner", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "initialAuthModule", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "AccountCreation", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "account", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "initialAuthModule", + type: "address", + }, + ], + name: "AccountCreationWithoutIndex", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousOwner", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "accountCreationCode", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "epAddress", + type: "address", + }, + { + internalType: "uint32", + name: "unstakeDelaySec", + type: "uint32", + }, + ], + name: "addStake", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "basicImplementation", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "moduleSetupContract", + type: "address", + }, + { + internalType: "bytes", + name: "moduleSetupData", + type: "bytes", + }, + ], + name: "deployAccount", + outputs: [ + { + internalType: "address", + name: "proxy", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "moduleSetupContract", + type: "address", + }, + { + internalType: "bytes", + name: "moduleSetupData", + type: "bytes", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "deployCounterFactualAccount", + outputs: [ + { + internalType: "address", + name: "proxy", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "moduleSetupContract", + type: "address", + }, + { + internalType: "bytes", + name: "moduleSetupData", + type: "bytes", + }, + { + internalType: "uint256", + name: "index", + type: "uint256", + }, + ], + name: "getAddressForCounterFactualAccount", + outputs: [ + { + internalType: "address", + name: "_account", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "minimalHandler", + outputs: [ + { + internalType: "contract DefaultCallbackHandler", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "renounceOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "epAddress", + type: "address", + }, + ], + name: "unlockStake", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "epAddress", + type: "address", + }, + { + internalType: "address payable", + name: "withdrawAddress", + type: "address", + }, + ], + name: "withdrawStake", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class SmartAccountFactory__factory { + static readonly abi = _abi; + static createInterface(): SmartAccountFactoryInterface { + return new utils.Interface(_abi) as SmartAccountFactoryInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): SmartAccountFactory { + return new Contract(address, _abi, signerOrProvider) as SmartAccountFactory; + } +} diff --git a/src/typechain/factories/SmartAccount__factory.ts b/src/typechain/factories/SmartAccount__factory.ts new file mode 100644 index 0000000..74ae353 --- /dev/null +++ b/src/typechain/factories/SmartAccount__factory.ts @@ -0,0 +1,1194 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { SmartAccount, SmartAccountInterface } from "../SmartAccount"; + +const _abi = [ + { + inputs: [ + { + internalType: "contract IEntryPoint", + name: "anEntryPoint", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "AlreadyInitialized", + type: "error", + }, + { + inputs: [], + name: "BaseImplementationCannotBeZero", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotAnEntryPoint", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotEntryPoint", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotEntryPointOrOwner", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotEntryPointOrSelf", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotOwner", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "CallerIsNotSelf", + type: "error", + }, + { + inputs: [], + name: "DelegateCallsOnly", + type: "error", + }, + { + inputs: [], + name: "EntryPointCannotBeZero", + type: "error", + }, + { + inputs: [], + name: "HandlerCannotBeZero", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "implementationAddress", + type: "address", + }, + ], + name: "InvalidImplementation", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "caller", + type: "address", + }, + ], + name: "MixedAuthFail", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "ModuleAlreadyEnabled", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "expectedModule", + type: "address", + }, + { + internalType: "address", + name: "returnedModule", + type: "address", + }, + { + internalType: "address", + name: "prevModule", + type: "address", + }, + ], + name: "ModuleAndPrevModuleMismatch", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "ModuleCannotBeZeroOrSentinel", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "ModuleNotEnabled", + type: "error", + }, + { + inputs: [], + name: "ModulesAlreadyInitialized", + type: "error", + }, + { + inputs: [], + name: "ModulesSetupExecutionFailed", + type: "error", + }, + { + inputs: [], + name: "OwnerCanNotBeSelf", + type: "error", + }, + { + inputs: [], + name: "OwnerCannotBeZero", + type: "error", + }, + { + inputs: [], + name: "OwnerProvidedIsSame", + type: "error", + }, + { + inputs: [], + name: "TransferToZeroAddressAttempt", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "destLength", + type: "uint256", + }, + { + internalType: "uint256", + name: "valueLength", + type: "uint256", + }, + { + internalType: "uint256", + name: "funcLength", + type: "uint256", + }, + { + internalType: "uint256", + name: "operationLength", + type: "uint256", + }, + ], + name: "WrongBatchProvided", + type: "error", + }, + { + inputs: [ + { + internalType: "bytes", + name: "contractSignature", + type: "bytes", + }, + ], + name: "WrongContractSignature", + type: "error", + }, + { + inputs: [ + { + internalType: "uint256", + name: "uintS", + type: "uint256", + }, + { + internalType: "uint256", + name: "contractSignatureLength", + type: "uint256", + }, + { + internalType: "uint256", + name: "signatureLength", + type: "uint256", + }, + ], + name: "WrongContractSignatureFormat", + type: "error", + }, + { + inputs: [ + { + internalType: "address", + name: "moduleAddressProvided", + type: "address", + }, + ], + name: "WrongValidationModule", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "previousHandler", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "handler", + type: "address", + }, + ], + name: "ChangedFallbackHandler", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "DisabledModule", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "EnabledModule", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + indexed: false, + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + { + indexed: false, + internalType: "uint256", + name: "txGas", + type: "uint256", + }, + ], + name: "ExecutionFailure", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "ExecutionFromModuleFailure", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "ExecutionFromModuleSuccess", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + indexed: true, + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + indexed: false, + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + { + indexed: false, + internalType: "uint256", + name: "txGas", + type: "uint256", + }, + ], + name: "ExecutionSuccess", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "oldImplementation", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "newImplementation", + type: "address", + }, + ], + name: "ImplementationUpdated", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "module", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + indexed: false, + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + ], + name: "ModuleTransaction", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "sender", + type: "address", + }, + { + indexed: true, + internalType: "uint256", + name: "value", + type: "uint256", + }, + ], + name: "SmartAccountReceivedNativeToken", + type: "event", + }, + { + stateMutability: "nonpayable", + type: "fallback", + }, + { + inputs: [], + name: "VERSION", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "addDeposit", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "prevModule", + type: "address", + }, + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "disableModule", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "enableModule", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "entryPoint", + outputs: [ + { + internalType: "contract IEntryPoint", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "to", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "value", + type: "uint256[]", + }, + { + internalType: "bytes[]", + name: "data", + type: "bytes[]", + }, + { + internalType: "enum Enum.Operation[]", + name: "operations", + type: "uint8[]", + }, + ], + name: "execBatchTransactionFromModule", + outputs: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + { + internalType: "uint256", + name: "txGas", + type: "uint256", + }, + ], + name: "execTransactionFromModule", + outputs: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + ], + name: "execTransactionFromModule", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "enum Enum.Operation", + name: "operation", + type: "uint8", + }, + ], + name: "execTransactionFromModuleReturnData", + outputs: [ + { + internalType: "bool", + name: "success", + type: "bool", + }, + { + internalType: "bytes", + name: "returnData", + type: "bytes", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "dest", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "func", + type: "bytes", + }, + ], + name: "execute", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "dest", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "value", + type: "uint256[]", + }, + { + internalType: "bytes[]", + name: "func", + type: "bytes[]", + }, + ], + name: "executeBatch", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address[]", + name: "dest", + type: "address[]", + }, + { + internalType: "uint256[]", + name: "value", + type: "uint256[]", + }, + { + internalType: "bytes[]", + name: "func", + type: "bytes[]", + }, + ], + name: "executeBatch_y6U", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "dest", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "func", + type: "bytes", + }, + ], + name: "execute_ncC", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "getDeposit", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getFallbackHandler", + outputs: [ + { + internalType: "address", + name: "_handler", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getImplementation", + outputs: [ + { + internalType: "address", + name: "_implementation", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "start", + type: "address", + }, + { + internalType: "uint256", + name: "pageSize", + type: "uint256", + }, + ], + name: "getModulesPaginated", + outputs: [ + { + internalType: "address[]", + name: "array", + type: "address[]", + }, + { + internalType: "address", + name: "next", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "handler", + type: "address", + }, + { + internalType: "address", + name: "moduleSetupContract", + type: "address", + }, + { + internalType: "bytes", + name: "moduleSetupData", + type: "bytes", + }, + ], + name: "init", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "module", + type: "address", + }, + ], + name: "isModuleEnabled", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "dataHash", + type: "bytes32", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "isValidSignature", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint192", + name: "_key", + type: "uint192", + }, + ], + name: "nonce", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + name: "noncesDeprecated", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "ownerDeprecated", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "handler", + type: "address", + }, + ], + name: "setFallbackHandler", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "setupContract", + type: "address", + }, + { + internalType: "bytes", + name: "setupData", + type: "bytes", + }, + ], + name: "setupAndEnableModule", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes4", + name: "_interfaceId", + type: "bytes4", + }, + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "_implementation", + type: "address", + }, + ], + name: "updateImplementation", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "bytes", + name: "initCode", + type: "bytes", + }, + { + internalType: "bytes", + name: "callData", + type: "bytes", + }, + { + internalType: "uint256", + name: "callGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "verificationGasLimit", + type: "uint256", + }, + { + internalType: "uint256", + name: "preVerificationGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxFeePerGas", + type: "uint256", + }, + { + internalType: "uint256", + name: "maxPriorityFeePerGas", + type: "uint256", + }, + { + internalType: "bytes", + name: "paymasterAndData", + type: "bytes", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + internalType: "struct UserOperation", + name: "userOp", + type: "tuple", + }, + { + internalType: "bytes32", + name: "userOpHash", + type: "bytes32", + }, + { + internalType: "uint256", + name: "missingAccountFunds", + type: "uint256", + }, + ], + name: "validateUserOp", + outputs: [ + { + internalType: "uint256", + name: "validationData", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address payable", + name: "withdrawAddress", + type: "address", + }, + { + internalType: "uint256", + name: "amount", + type: "uint256", + }, + ], + name: "withdrawDepositTo", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + stateMutability: "payable", + type: "receive", + }, +] as const; + +export class SmartAccount__factory { + static readonly abi = _abi; + static createInterface(): SmartAccountInterface { + return new utils.Interface(_abi) as SmartAccountInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): SmartAccount { + return new Contract(address, _abi, signerOrProvider) as SmartAccount; + } +} diff --git a/src/typechain/factories/index.ts b/src/typechain/factories/index.ts index ce1657c..6719eef 100644 --- a/src/typechain/factories/index.ts +++ b/src/typechain/factories/index.ts @@ -3,9 +3,13 @@ /* eslint-disable */ export { ECDSAKernelFactory__factory } from "./ECDSAKernelFactory__factory"; export { ECDSAValidator__factory } from "./ECDSAValidator__factory"; +export { EcdsaOwnershipRegistryModule__factory } from "./EcdsaOwnershipRegistryModule__factory"; export { EntryPoint__factory } from "./EntryPoint__factory"; +export { IEcdsaOwnershipRegistryModule__factory } from "./IEcdsaOwnershipRegistryModule__factory"; export { Kernel__factory } from "./Kernel__factory"; export { KernelFactory__factory } from "./KernelFactory__factory"; export { Multisend__factory } from "./Multisend__factory"; export { SimpleAccount__factory } from "./SimpleAccount__factory"; export { SimpleAccountFactory__factory } from "./SimpleAccountFactory__factory"; +export { SmartAccount__factory } from "./SmartAccount__factory"; +export { SmartAccountFactory__factory } from "./SmartAccountFactory__factory"; diff --git a/src/typechain/index.ts b/src/typechain/index.ts index 43b2eb1..7ae1163 100644 --- a/src/typechain/index.ts +++ b/src/typechain/index.ts @@ -3,18 +3,26 @@ /* eslint-disable */ export type { ECDSAKernelFactory } from "./ECDSAKernelFactory"; export type { ECDSAValidator } from "./ECDSAValidator"; +export type { EcdsaOwnershipRegistryModule } from "./EcdsaOwnershipRegistryModule"; export type { EntryPoint } from "./EntryPoint"; +export type { IEcdsaOwnershipRegistryModule } from "./IEcdsaOwnershipRegistryModule"; export type { Kernel } from "./Kernel"; export type { KernelFactory } from "./KernelFactory"; export type { Multisend } from "./Multisend"; export type { SimpleAccount } from "./SimpleAccount"; export type { SimpleAccountFactory } from "./SimpleAccountFactory"; +export type { SmartAccount } from "./SmartAccount"; +export type { SmartAccountFactory } from "./SmartAccountFactory"; export * as factories from "./factories"; export { ECDSAKernelFactory__factory } from "./factories/ECDSAKernelFactory__factory"; +export { EcdsaOwnershipRegistryModule__factory } from "./factories/EcdsaOwnershipRegistryModule__factory"; export { ECDSAValidator__factory } from "./factories/ECDSAValidator__factory"; export { EntryPoint__factory } from "./factories/EntryPoint__factory"; +export { IEcdsaOwnershipRegistryModule__factory } from "./factories/IEcdsaOwnershipRegistryModule__factory"; export { Kernel__factory } from "./factories/Kernel__factory"; export { KernelFactory__factory } from "./factories/KernelFactory__factory"; export { Multisend__factory } from "./factories/Multisend__factory"; export { SimpleAccount__factory } from "./factories/SimpleAccount__factory"; export { SimpleAccountFactory__factory } from "./factories/SimpleAccountFactory__factory"; +export { SmartAccount__factory } from "./factories/SmartAccount__factory"; +export { SmartAccountFactory__factory } from "./factories/SmartAccountFactory__factory"; From 8c73e9e75506be24c364ee7148c86b5e13bdb01e Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:00:47 +0530 Subject: [PATCH 2/2] module signature middleware + dev notes --- src/preset/builder/biconomy.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/preset/builder/biconomy.ts b/src/preset/builder/biconomy.ts index 3dd1c43..b96d1f2 100644 --- a/src/preset/builder/biconomy.ts +++ b/src/preset/builder/biconomy.ts @@ -62,6 +62,13 @@ import { EOASignature, estimateUserOperationGas, getGasPrice } from "../middlewa ctx.op.initCode = ctx.op.nonce.eq(0) ? this.initCode : "0x"; }; + private moduleSignature: UserOperationMiddlewareFn = async (ctx) => { + ctx.op.signature = ethers.utils.defaultAbiCoder.encode( + ["bytes", "address"], + [ctx.op.signature, BiconomyConst.ECDSAOwnershipRegistryModule] + ); + }; + public static async init( signer: ethers.Signer, rpcUrl: string, @@ -86,11 +93,12 @@ import { EOASignature, estimateUserOperationGas, getGasPrice } from "../middlewa throw new Error("getSenderAddress: unexpected result"); } catch (error: any) { - const addr = error?.errorArgs?.sender; - if (!addr) throw error; + // Review + // const addr = error?.errorArgs?.sender; + // if (!addr) throw error; - // in case of not throwing error - // const addr = await instance.factory.getAddressForCounterFactualAccount(BiconomyConst.ECDSAOwnershipRegistryModule, moduleSetupData, ethers.BigNumber.from(opts?.salt ?? 0)) + // in case of not throwing error (check for AA13 initcode failed or OOG) + const addr = await instance.factory.getAddressForCounterFactualAccount(BiconomyConst.ECDSAOwnershipRegistryModule, moduleSetupData, ethers.BigNumber.from(opts?.salt ?? 0)) instance.proxy = SmartAccount__factory.connect(addr, instance.provider); } @@ -112,6 +120,7 @@ import { EOASignature, estimateUserOperationGas, getGasPrice } from "../middlewa return withPM .useMiddleware(EOASignature(instance.signer)) + .useMiddleware(instance.moduleSignature); } execute(call: ICall) {