├── .github └── workflows │ ├── mockgen.yml │ └── test.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── _examples ├── indexer │ └── main.go └── metadata │ └── main.go ├── abi.go ├── api ├── api.gen.go └── api.go ├── auth.go ├── auth_test.go ├── compressor ├── cbuffer.go ├── compressor.go ├── constants.go ├── contract.go ├── costmodel.go ├── decoder.go ├── encoder.go ├── loadstate.go └── utils.go ├── config.go ├── config_test.go ├── contracts ├── .gitignore ├── artifacts │ ├── erc1155 │ │ ├── interfaces │ │ │ ├── IERC1155.sol │ │ │ │ └── IERC1155.json │ │ │ ├── IERC1155Meta.sol │ │ │ │ └── IERC1155Meta.json │ │ │ ├── IERC1155Metadata.sol │ │ │ │ └── IERC1155Metadata.json │ │ │ ├── IERC1155MintBurn.sol │ │ │ │ └── IERC1155MintBurn.json │ │ │ ├── IERC1155TokenReceiver.sol │ │ │ │ └── IERC1155TokenReceiver.json │ │ │ ├── IERC1271Wallet.sol │ │ │ │ └── IERC1271Wallet.json │ │ │ ├── IERC165.sol │ │ │ │ └── IERC165.json │ │ │ └── IERC20.sol │ │ │ │ └── IERC20.json │ │ ├── mocks │ │ │ ├── ERC1155MetaMintBurnMock.sol │ │ │ │ └── ERC1155MetaMintBurnMock.json │ │ │ ├── ERC1155MetaMintBurnPackedBalanceMock.sol │ │ │ │ └── ERC1155MetaMintBurnPackedBalanceMock.json │ │ │ ├── ERC1155MetadataMock.sol │ │ │ │ └── ERC1155MetadataMock.json │ │ │ ├── ERC1155MintBurnMock.sol │ │ │ │ └── ERC1155MintBurnMock.json │ │ │ ├── ERC1155MintBurnPackedBalanceMock.sol │ │ │ │ └── ERC1155MintBurnPackedBalanceMock.json │ │ │ ├── ERC1155OperatorMock.sol │ │ │ │ └── ERC1155OperatorMock.json │ │ │ ├── ERC1155ReceiverMock.sol │ │ │ │ └── ERC1155ReceiverMock.json │ │ │ ├── ERC1271WalletValidationMock.sol │ │ │ │ ├── ERC1271WalletValidationMock.json │ │ │ │ └── LibEIP712.json │ │ │ ├── ERC20Mock.sol │ │ │ │ ├── ERC20.json │ │ │ │ └── ERC20Mock.json │ │ │ └── OwnableMock.sol │ │ │ │ └── OwnableMock.json │ │ ├── tokens │ │ │ ├── ERC1155 │ │ │ │ ├── ERC1155.sol │ │ │ │ │ └── ERC1155.json │ │ │ │ ├── ERC1155Meta.sol │ │ │ │ │ └── ERC1155Meta.json │ │ │ │ ├── ERC1155Metadata.sol │ │ │ │ │ └── ERC1155Metadata.json │ │ │ │ └── ERC1155MintBurn.sol │ │ │ │ │ └── ERC1155MintBurn.json │ │ │ └── ERC1155PackedBalance │ │ │ │ ├── ERC1155MetaPackedBalance.sol │ │ │ │ └── ERC1155MetaPackedBalance.json │ │ │ │ ├── ERC1155MintBurnPackedBalance.sol │ │ │ │ └── ERC1155MintBurnPackedBalance.json │ │ │ │ └── ERC1155PackedBalance.sol │ │ │ │ └── ERC1155PackedBalance.json │ │ └── utils │ │ │ ├── Address.sol │ │ │ └── Address.json │ │ │ ├── ERC165.sol │ │ │ └── ERC165.json │ │ │ ├── LibBytes.sol │ │ │ └── LibBytes.json │ │ │ ├── LibEIP712.sol │ │ │ └── LibEIP712.json │ │ │ ├── Ownable.sol │ │ │ └── Ownable.json │ │ │ ├── SafeMath.sol │ │ │ └── SafeMath.json │ │ │ └── SignatureValidator.sol │ │ │ └── SignatureValidator.json │ ├── erc1271 │ │ └── ierc1271.json │ ├── erc20-meta-token │ │ ├── interfaces │ │ │ └── IERC20Wrapper.sol │ │ │ │ └── IERC20Wrapper.json │ │ ├── mocks │ │ │ └── ERC20Mock.sol │ │ │ │ ├── ERC20.json │ │ │ │ └── ERC20Mock.json │ │ └── wrapper │ │ │ ├── ERC20Wrapper.sol │ │ │ └── ERC20Wrapper.json │ │ │ └── MetaERC20Wrapper.sol │ │ │ └── MetaERC20Wrapper.json │ ├── erc20 │ │ ├── IERC20.json │ │ ├── IERC20Errors.json │ │ ├── IERC20Metadata.json │ │ └── IERC20Permit.json │ ├── erc6909 │ │ ├── IERC6909.json │ │ ├── IERC6909ContentURI.json │ │ ├── IERC6909Metadata.json │ │ └── IERC6909TokenSupply.json │ ├── erc721 │ │ ├── IERC721.json │ │ ├── IERC721Enumerable.json │ │ ├── IERC721Errors.json │ │ ├── IERC721Metadata.json │ │ └── IERC721Receiver.json │ ├── niftyswap │ │ ├── exchange │ │ │ ├── NiftyswapExchange.sol │ │ │ │ └── NiftyswapExchange.json │ │ │ ├── NiftyswapExchange20.sol │ │ │ │ └── NiftyswapExchange20.json │ │ │ ├── NiftyswapFactory.sol │ │ │ │ └── NiftyswapFactory.json │ │ │ └── NiftyswapFactory20.sol │ │ │ │ └── NiftyswapFactory20.json │ │ ├── interfaces │ │ │ ├── IERC2981.sol │ │ │ │ └── IERC2981.json │ │ │ ├── INiftyswapExchange.sol │ │ │ │ └── INiftyswapExchange.json │ │ │ ├── INiftyswapExchange20.sol │ │ │ │ └── INiftyswapExchange20.json │ │ │ ├── INiftyswapFactory.sol │ │ │ │ └── INiftyswapFactory.json │ │ │ ├── INiftyswapFactory20.sol │ │ │ │ └── INiftyswapFactory20.json │ │ │ ├── IOwnable.sol │ │ │ │ └── IOwnable.json │ │ │ └── IWrapAndNiftyswap.sol │ │ │ │ └── IWrapAndNiftyswap.json │ │ ├── mocks │ │ │ ├── ERC1155Mock.sol │ │ │ │ └── ERC1155Mock.json │ │ │ ├── ERC1155PackedBalanceMock.sol │ │ │ │ └── ERC1155PackedBalanceMock.json │ │ │ ├── ERC1155RoyaltyMock.sol │ │ │ │ └── ERC1155RoyaltyMock.json │ │ │ ├── ERC20TokenMock.sol │ │ │ │ └── ERC20TokenMock.json │ │ │ └── ERC20WrapperMock.sol │ │ │ │ └── ERC20WrapperMock.json │ │ └── utils │ │ │ ├── DelegatedOwnable.sol │ │ │ └── DelegatedOwnable.json │ │ │ ├── Ownable.sol │ │ │ └── Ownable.json │ │ │ ├── ReentrancyGuard.sol │ │ │ └── ReentrancyGuard.json │ │ │ ├── SafeMath.sol │ │ │ └── SafeMath.json │ │ │ └── WrapAndNiftyswap.sol │ │ │ └── WrapAndNiftyswap.json │ ├── seq_marketplace │ │ └── ISequenceMarket.sol │ │ │ └── ISequenceMarket.json │ ├── seq_sale │ │ ├── IERC1155Sale.sol │ │ │ └── IERC1155Sale.json │ │ └── IERC721Sale.sol │ │ │ └── IERC721Sale.json │ ├── wallet-contracts-v2 │ │ ├── Factory.sol │ │ │ └── Factory.json │ │ ├── Wallet.sol │ │ │ └── Wallet.json │ │ ├── interfaces │ │ │ ├── IERC1271Wallet.sol │ │ │ │ └── IERC1271Wallet.json │ │ │ └── receivers │ │ │ │ ├── IERC1155Receiver.sol │ │ │ │ └── IERC1155Receiver.json │ │ │ │ ├── IERC223Receiver.sol │ │ │ │ └── IERC223Receiver.json │ │ │ │ └── IERC721Receiver.sol │ │ │ │ └── IERC721Receiver.json │ │ ├── mocks │ │ │ ├── CallReceiverMock.sol │ │ │ │ └── CallReceiverMock.json │ │ │ ├── DelegateCallMock.sol │ │ │ │ └── DelegateCallMock.json │ │ │ ├── ERC165CheckerMock.sol │ │ │ │ └── ERC165CheckerMock.json │ │ │ ├── GasBurnerMock.sol │ │ │ │ └── GasBurnerMock.json │ │ │ ├── HookCallerMock.sol │ │ │ │ └── HookCallerMock.json │ │ │ ├── HookMock.sol │ │ │ │ └── HookMock.json │ │ │ ├── LibBytesImpl.sol │ │ │ │ └── LibBytesImpl.json │ │ │ ├── LibBytesPointerImpl.sol │ │ │ │ └── LibBytesPointerImpl.json │ │ │ ├── LibStringImp.sol │ │ │ │ └── LibStringImp.json │ │ │ └── ModuleMock.sol │ │ │ │ └── ModuleMock.json │ │ ├── modules │ │ │ ├── GuestModule.sol │ │ │ │ └── GuestModule.json │ │ │ ├── MainModule.sol │ │ │ │ └── MainModule.json │ │ │ ├── MainModuleGasEstimation.sol │ │ │ │ └── MainModuleGasEstimation.json │ │ │ ├── MainModuleUpgradable.sol │ │ │ │ └── MainModuleUpgradable.json │ │ │ ├── commons │ │ │ │ ├── Implementation.sol │ │ │ │ │ └── Implementation.json │ │ │ │ ├── ModuleAuth.sol │ │ │ │ │ └── ModuleAuth.json │ │ │ │ ├── ModuleAuthConvenience.sol │ │ │ │ │ └── ModuleAuthConvenience.json │ │ │ │ ├── ModuleAuthFixed.sol │ │ │ │ │ └── ModuleAuthFixed.json │ │ │ │ ├── ModuleAuthUpgradable.sol │ │ │ │ │ └── ModuleAuthUpgradable.json │ │ │ │ ├── ModuleCalls.sol │ │ │ │ │ └── ModuleCalls.json │ │ │ │ ├── ModuleCreator.sol │ │ │ │ │ └── ModuleCreator.json │ │ │ │ ├── ModuleERC165.sol │ │ │ │ │ └── ModuleERC165.json │ │ │ │ ├── ModuleERC5719.sol │ │ │ │ │ └── ModuleERC5719.json │ │ │ │ ├── ModuleExtraAuth.sol │ │ │ │ │ └── ModuleExtraAuth.json │ │ │ │ ├── ModuleHooks.sol │ │ │ │ │ └── ModuleHooks.json │ │ │ │ ├── ModuleIPFS.sol │ │ │ │ │ └── ModuleIPFS.json │ │ │ │ ├── ModuleNonce.sol │ │ │ │ │ └── ModuleNonce.json │ │ │ │ ├── ModuleOnlyDelegatecall.sol │ │ │ │ │ └── ModuleOnlyDelegatecall.json │ │ │ │ ├── ModuleSelfAuth.sol │ │ │ │ │ └── ModuleSelfAuth.json │ │ │ │ ├── ModuleStorage.sol │ │ │ │ │ └── ModuleStorage.json │ │ │ │ ├── ModuleUpdate.sol │ │ │ │ │ └── ModuleUpdate.json │ │ │ │ ├── interfaces │ │ │ │ │ ├── IModuleAuth.sol │ │ │ │ │ │ └── IModuleAuth.json │ │ │ │ │ ├── IModuleAuthUpgradable.sol │ │ │ │ │ │ └── IModuleAuthUpgradable.json │ │ │ │ │ ├── IModuleCalls.sol │ │ │ │ │ │ └── IModuleCalls.json │ │ │ │ │ ├── IModuleCreator.sol │ │ │ │ │ │ └── IModuleCreator.json │ │ │ │ │ ├── IModuleHooks.sol │ │ │ │ │ │ └── IModuleHooks.json │ │ │ │ │ └── IModuleUpdate.sol │ │ │ │ │ │ └── IModuleUpdate.json │ │ │ │ └── submodules │ │ │ │ │ ├── auth │ │ │ │ │ ├── SequenceBaseSig.sol │ │ │ │ │ │ └── SequenceBaseSig.json │ │ │ │ │ ├── SequenceChainedSig.sol │ │ │ │ │ │ └── SequenceChainedSig.json │ │ │ │ │ ├── SequenceDynamicSig.sol │ │ │ │ │ │ └── SequenceDynamicSig.json │ │ │ │ │ └── SequenceNoChainIdSig.sol │ │ │ │ │ │ └── SequenceNoChainIdSig.json │ │ │ │ │ └── nonce │ │ │ │ │ └── SubModuleNonce.sol │ │ │ │ │ └── SubModuleNonce.json │ │ │ └── utils │ │ │ │ ├── GasEstimator.sol │ │ │ │ └── GasEstimator.json │ │ │ │ ├── MultiCallUtils.sol │ │ │ │ └── MultiCallUtils.json │ │ │ │ ├── RequireUtils.sol │ │ │ │ └── RequireUtils.json │ │ │ │ └── SequenceUtils.sol │ │ │ │ └── SequenceUtils.json │ │ └── utils │ │ │ ├── LibAddress.sol │ │ │ └── LibAddress.json │ │ │ ├── LibBytes.sol │ │ │ └── LibBytes.json │ │ │ ├── LibBytesPointer.sol │ │ │ └── LibBytesPointer.json │ │ │ ├── LibOptim.sol │ │ │ └── LibOptim.json │ │ │ ├── LibString.sol │ │ │ └── LibString.json │ │ │ └── SignatureValidator.sol │ │ │ └── SignatureValidator.json │ └── wallet-contracts │ │ ├── Factory.sol │ │ └── Factory.json │ │ ├── Wallet.sol │ │ └── Wallet.json │ │ ├── interfaces │ │ ├── IERC1271Wallet.sol │ │ │ └── IERC1271Wallet.json │ │ └── receivers │ │ │ ├── IERC1155Receiver.sol │ │ │ └── IERC1155Receiver.json │ │ │ ├── IERC223Receiver.sol │ │ │ └── IERC223Receiver.json │ │ │ └── IERC721Receiver.sol │ │ │ └── IERC721Receiver.json │ │ ├── migrations │ │ └── Migrations.sol │ │ │ └── Migrations.json │ │ ├── mocks │ │ ├── CallReceiverMock.sol │ │ │ └── CallReceiverMock.json │ │ ├── DelegateCallMock.sol │ │ │ └── DelegateCallMock.json │ │ ├── ERC165CheckerMock.sol │ │ │ └── ERC165CheckerMock.json │ │ ├── GasBurnerMock.sol │ │ │ └── GasBurnerMock.json │ │ ├── HookCallerMock.sol │ │ │ └── HookCallerMock.json │ │ ├── HookMock.sol │ │ │ └── HookMock.json │ │ ├── LibBytesImpl.sol │ │ │ └── LibBytesImpl.json │ │ └── ModuleMock.sol │ │ │ └── ModuleMock.json │ │ ├── modules │ │ ├── GuestModule.sol │ │ │ └── GuestModule.json │ │ ├── MainModule.sol │ │ │ └── MainModule.json │ │ ├── MainModuleGasEstimation.sol │ │ │ └── MainModuleGasEstimation.json │ │ ├── MainModuleUpgradable.sol │ │ │ └── MainModuleUpgradable.json │ │ ├── commons │ │ │ ├── Implementation.sol │ │ │ │ └── Implementation.json │ │ │ ├── ModuleAuth.sol │ │ │ │ └── ModuleAuth.json │ │ │ ├── ModuleAuthFixed.sol │ │ │ │ └── ModuleAuthFixed.json │ │ │ ├── ModuleAuthUpgradable.sol │ │ │ │ └── ModuleAuthUpgradable.json │ │ │ ├── ModuleCalls.sol │ │ │ │ └── ModuleCalls.json │ │ │ ├── ModuleCreator.sol │ │ │ │ └── ModuleCreator.json │ │ │ ├── ModuleERC165.sol │ │ │ │ └── ModuleERC165.json │ │ │ ├── ModuleHooks.sol │ │ │ │ └── ModuleHooks.json │ │ │ ├── ModuleIgnoreAuthUpgradable.sol │ │ │ │ └── ModuleIgnoreAuthUpgradable.json │ │ │ ├── ModuleIgnoreNonceCalls.sol │ │ │ │ └── ModuleIgnoreNonceCalls.json │ │ │ ├── ModuleSelfAuth.sol │ │ │ │ └── ModuleSelfAuth.json │ │ │ ├── ModuleStorage.sol │ │ │ │ └── ModuleStorage.json │ │ │ ├── ModuleUpdate.sol │ │ │ │ └── ModuleUpdate.json │ │ │ └── interfaces │ │ │ │ ├── IModuleAuth.sol │ │ │ │ └── IModuleAuth.json │ │ │ │ ├── IModuleAuthUpgradable.sol │ │ │ │ └── IModuleAuthUpgradable.json │ │ │ │ ├── IModuleCalls.sol │ │ │ │ └── IModuleCalls.json │ │ │ │ ├── IModuleCreator.sol │ │ │ │ └── IModuleCreator.json │ │ │ │ ├── IModuleHooks.sol │ │ │ │ └── IModuleHooks.json │ │ │ │ └── IModuleUpdate.sol │ │ │ │ └── IModuleUpdate.json │ │ └── utils │ │ │ ├── GasEstimator.sol │ │ │ └── GasEstimator.json │ │ │ ├── MultiCallUtils.sol │ │ │ └── MultiCallUtils.json │ │ │ ├── RequireUtils.sol │ │ │ └── RequireUtils.json │ │ │ ├── SequenceUtils.sol │ │ │ └── SequenceUtils.json │ │ │ └── libs │ │ │ └── RequireFreshSigner.sol │ │ │ └── RequireFreshSigner.json │ │ └── utils │ │ ├── LibAddress.sol │ │ └── LibAddress.json │ │ ├── LibBytes.sol │ │ └── LibBytes.json │ │ └── SignatureValidator.sol │ │ └── SignatureValidator.json ├── contracts.go ├── gen │ ├── gasestimator │ │ └── gas_estimator.gen.go │ ├── gen.go │ ├── ierc1271 │ │ ├── ierc1271.gen.go │ │ └── ierc1271.go │ ├── niftyswap │ │ ├── iniftyswap_exchange.gen.go │ │ ├── iniftyswap_exchange_20.gen.go │ │ ├── iniftyswap_factory.gen.go │ │ ├── iniftyswap_factory_20.gen.go │ │ ├── iwrap_and_niftyswap.gen.go │ │ ├── niftyswap_exchange.gen.go │ │ ├── niftyswap_exchange_20.gen.go │ │ ├── niftyswap_factory.gen.go │ │ ├── niftyswap_factory_20.gen.go │ │ └── wrap_and_niftyswap.gen.go │ ├── seq_marketplace │ │ └── seq_marketplace.gen.go │ ├── seq_sale │ │ ├── erc1155 │ │ │ └── sale_erc1155.gen.go │ │ └── erc721 │ │ │ └── sale_erc721.gen.go │ ├── tokens │ │ ├── ierc1155.gen.go │ │ ├── ierc20.gen.go │ │ ├── ierc20wrapper.gen.go │ │ ├── ierc6909.gen.go │ │ └── ierc721.gen.go │ ├── v1 │ │ ├── walletfactory │ │ │ └── wallet_factory.gen.go │ │ ├── walletgasestimator │ │ │ └── wallet_gas_estimator.gen.go │ │ ├── walletguest │ │ │ └── wallet_guest_module.gen.go │ │ ├── walletmain │ │ │ └── wallet_main_module.gen.go │ │ ├── walletupgradable │ │ │ └── wallet_main_module_upgradable.gen.go │ │ └── walletutils │ │ │ ├── wallet_require_fresh_signer.gen.go │ │ │ └── wallet_utils.gen.go │ ├── v2 │ │ ├── walletfactory │ │ │ └── wallet_factory.gen.go │ │ ├── walletgasestimator │ │ │ └── wallet_gas_estimator.gen.go │ │ ├── walletguest │ │ │ └── wallet_guest_module.gen.go │ │ ├── walletmain │ │ │ └── wallet_main_module.gen.go │ │ ├── walletupgradable │ │ │ └── wallet_main_module_upgradable.gen.go │ │ └── walletutils │ │ │ └── wallet_utils.gen.go │ └── walletcallmock │ │ └── wallet_call_mock.gen.go ├── package.json └── pnpm-lock.yaml ├── core ├── core.go ├── core_test.go ├── v1 │ ├── v1.go │ └── v1_test.go └── v2 │ ├── v2.go │ └── v2_test.go ├── deployer ├── deployer.go ├── deployer_test.go ├── eip2740_deployer.go └── eip2740_deployer_test.go ├── digests.go ├── eip6492 └── eip6492.go ├── estimator.go ├── estimator_test.go ├── go.mod ├── go.sum ├── go.work ├── go.work.sum ├── guard └── proto │ └── guard.gen.go ├── indexer ├── indexer.gen.go └── indexer.go ├── intents ├── intent.gen.go ├── intent.ridl ├── intent_data_ext.go ├── intent_data_get_transaction_receipt_ext.go ├── intent_data_sign_712_ext.go ├── intent_data_sign_712_ext_test.go ├── intent_data_sign_message_ext.go ├── intent_data_sign_message_ext_test.go ├── intent_data_transaction_contract_abi.go ├── intent_data_transaction_delayed_abi.go ├── intent_data_transaction_delayed_abi_test.go ├── intent_data_transaction_ext.go ├── intent_data_transaction_ext_test.go ├── intent_ext.go ├── intent_response_typed.go ├── intent_typed.go ├── intent_typed_test.go ├── proto.go ├── session.go └── session_test.go ├── lib └── prototyp │ ├── _hash_text.go │ ├── bigint.go │ ├── bigint_maybe.go │ ├── bigint_test.go │ ├── hash.go │ ├── hash_maybe.go │ ├── hash_maybe_test.go │ ├── hash_test.go │ ├── json_string.go │ ├── json_string_test.go │ ├── key.go │ └── prototyp.go ├── marketplace ├── marketplace.gen.go └── marketplace.go ├── message.go ├── message_test.go ├── metadata ├── collections.go ├── metadata.gen.go └── metadata.go ├── mock ├── api.mock.go ├── indexer.mock.go ├── marketplace.mock.go ├── metadata.mock.go ├── mock.go └── relayer.mock.go ├── network.go ├── networks └── networks.go ├── receipt_fetcher.go ├── receipts.go ├── receipts_test.go ├── relayer.go ├── relayer ├── local_relayer.go ├── proto │ └── relayer.gen.go ├── relayer.go └── rpc_relayer.go ├── relayer_test.go ├── sequence.go ├── sequence_test.go ├── sessions └── proto │ └── sessions.gen.go ├── signature.go ├── signature_test.go ├── signer.go ├── testutil ├── chain │ ├── .gitignore │ ├── package.json │ └── pnpm-lock.yaml ├── contracts.go ├── helpers.go ├── testutil.go └── testutil_test.go ├── tools ├── go.mod ├── go.sum └── tools.go ├── transactions.go ├── transactions_test.go ├── utils.go ├── utils_test.go ├── wallet.go └── wallet_test.go /.github/workflows/mockgen.yml: -------------------------------------------------------------------------------- 1 | name: Generate Mocks 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - 'api/api.gen.go' 9 | - 'indexer/indexer.gen.go' 10 | - 'marketplace/marketplace.gen.go' 11 | - 'metadata/metadata.gen.go' 12 | - 'relayer/relayer.gen.go' 13 | 14 | workflow_dispatch: 15 | 16 | jobs: 17 | generate-mocks: 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v3 23 | 24 | - name: Set up Go 25 | uses: actions/setup-go@v5 26 | with: 27 | go-version-file: 'go.mod' 28 | 29 | - name: Download dependencies 30 | run: go mod download 31 | 32 | - name: Run make mock 33 | run: make mock 34 | 35 | - name: Commit back 36 | uses: 0xsequence/actions/git-commit@v0.0.5 37 | env: 38 | API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN_GIT_COMMIT }} 39 | with: 40 | files: 'mock/' 41 | branch: 'master' 42 | commit_message: '[AUTOMATED] Generate mock clients' 43 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | 3 | name: test 4 | 5 | jobs: 6 | 7 | test: 8 | name: Test 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v4 14 | 15 | - name: Install Go 16 | uses: actions/setup-go@v5 17 | with: 18 | go-version: 1.24.x 19 | - uses: actions/cache@v4 20 | with: 21 | # In order: 22 | # * Module download cache 23 | # * Build cache (Linux) 24 | # * Build cache (Mac) 25 | # * Build cache (Windows) 26 | path: | 27 | ~/go/pkg/mod 28 | ~/.cache/go-build 29 | ~/Library/Caches/go-build 30 | %LocalAppData%\go-build 31 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 32 | restore-keys: | 33 | ${{ runner.os }}-go- 34 | 35 | - name: Install node 36 | uses: actions/setup-node@v4 37 | with: 38 | node-version: '23.x' 39 | 40 | - name: Install pnpm 41 | uses: pnpm/action-setup@v4 42 | with: 43 | version: 10 44 | 45 | - uses: actions/cache@v4 46 | id: pnpm-cache 47 | with: 48 | path: | 49 | ./testutil/chain/node_modules 50 | ./testutil/chain/*/*/node_modules 51 | key: ${{ runner.os }}-pnpm-${{ hashFiles('./testutil/chain/**/package.json', './testutil/chain/**/pnpm-lock.yaml') }} 52 | 53 | - name: pnpm install 54 | run: cd ./testutil/chain && pnpm install 55 | if: ${{ steps.pnpm-cache.outputs.cache-hit != 'true' }} 56 | 57 | - name: Boot testchain 58 | run: make start-testchain-verbose & 59 | 60 | - name: Test 61 | run: make test 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | intents/intent.gen.ts 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TEST_FLAGS ?= -p 1 -v 2 | 3 | all: 4 | @echo "See Makefile contents for details." 5 | 6 | bootstrap: 7 | cd ./testutil/chain && pnpm install 8 | 9 | build: 10 | go build ./... 11 | 12 | test: wait-on-chain check-testchain-running go-test 13 | 14 | go-test: 15 | go clean -testcache && go test $(TEST_FLAGS) -run=$(TEST) ./... 16 | 17 | test-concurrently: 18 | cd ./testutil/chain && pnpm test 19 | 20 | start-testchain: 21 | cd ./testutil/chain && pnpm start:geth 22 | 23 | start-testchain-verbose: 24 | cd ./testutil/chain && pnpm start:geth:verbose 25 | 26 | start-testchain-anvil: 27 | cd ./testutil/chain && pnpm start:anvil 28 | 29 | start-testchain-anvil-verbose: 30 | cd ./testutil/chain && pnpm start:anvil:verbose 31 | 32 | clean: 33 | @go clean -testcache 34 | 35 | check-testchain-running: 36 | @curl http://localhost:8545 -H"Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' --write-out '%{http_code}' --silent --output /dev/null | grep 200 > /dev/null \ 37 | || { echo "*****"; echo "Oops! testchain is not running. Please run 'make start-testchain' in another terminal or use 'test-concurrently'."; echo "*****"; exit 1; } 38 | 39 | wait-on-chain: 40 | cd ./testutil/chain && pnpm wait:server 41 | 42 | .PHONY: mock 43 | mock: 44 | go generate ./mock 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | go-sequence 2 | =========== 3 | 4 | Sequence Wallet client written in Go. 5 | 6 | 7 | ## Usage 8 | 9 | For documentation on sequence, please see our [docs](https://docs.sequence.xyz) page. 10 | 11 | ## Developing the go-sequence library 12 | 13 | 1. `make bootstrap` -- will install node modules of ./testutil/chain 14 | 2. `make start-testchain` -- starts the test ethereum chain (id 1337) 15 | 3. (in a separate terminal) `make test` -- runs test suite 16 | 17 | 18 | ## Testing 19 | 20 | Testing is super important, to run the tests just call `make test`. As well, you can 21 | run the testchain separately with `make start-testchain` then in another terminal run `make test`. 22 | 23 | **NOTE:** Go by default will execute tests in parallel if you run `go test -v ./...`, so ensure to pass `-p 1` 24 | to set parallelization to just 1 (so it runs serially). The `make test` command is already set to do this. 25 | 26 | 27 | ## Other Go dev related tips 28 | 29 | A. If you'd like to use a local version of a dependency/module, you can use the `replace` directive in go.mod, 30 | for example, lets say you want to use a local version of "ethkit" that hasn't been released with go-sequence, 31 | you can add `replace github.com/0xsequence/ethkit => /home/peter/Dev/0xsequence/ethkit` to your go.mod 32 | 33 | 34 | ## LICENSE 35 | 36 | Apache 2.0 37 | -------------------------------------------------------------------------------- /_examples/indexer/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/0xsequence/go-sequence/indexer" 8 | "github.com/davecgh/go-spew/spew" 9 | ) 10 | 11 | func main() { 12 | seqIndexer := indexer.NewIndexer("https://polygon-indexer.sequence.app", "kzk9Hdk0EJRoj9qgHWncKtHAAAAAAAAA") 13 | 14 | accountAddress := "0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9" 15 | includeMetadata := true 16 | metadataOptions := indexer.MetadataOptions{ 17 | VerifiedOnly: true, 18 | } 19 | 20 | _, tokenBalances, err := seqIndexer.GetTokenBalances(context.Background(), &accountAddress, nil, nil, &includeMetadata, &metadataOptions, nil) 21 | if err != nil { 22 | log.Fatal(err) 23 | } 24 | 25 | for _, tokenBalance := range tokenBalances { 26 | spew.Dump(tokenBalance) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /_examples/metadata/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/0xsequence/go-sequence/metadata" 8 | "github.com/davecgh/go-spew/spew" 9 | ) 10 | 11 | func main() { 12 | seqMetadata := metadata.NewMetadata("kzk9Hdk0EJRoj9qgHWncKtHAAAAAAAAA") 13 | 14 | contractInfo, err := seqMetadata.GetContractInfo(context.Background(), "polygon", "0x631998e91476DA5B870D741192fc5Cbc55F5a52E") 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | spew.Dump(contractInfo) 19 | 20 | collectibleInfo, err := seqMetadata.GetTokenMetadata(context.Background(), "polygon", "0x631998e91476DA5B870D741192fc5Cbc55F5a52E", []string{"1", "2"}) 21 | if err != nil { 22 | log.Fatal(err) 23 | } 24 | spew.Dump(collectibleInfo) 25 | 26 | // 27 | // Collections service example 28 | // 29 | 30 | // serviceToken := "" 31 | // seqCollections := metadata.NewCollections(serviceToken) 32 | 33 | // page, cols, err := seqCollections.ListCollections(context.Background(), nil, nil) 34 | // if err != nil { 35 | // log.Fatal(err) 36 | // } 37 | // spew.Dump(page) 38 | // spew.Dump(cols) 39 | 40 | // // TODO: put in your own file here 41 | // data, _ := os.ReadFile("/Users/peter/Desktop/bw-gopher.png") 42 | 43 | // asset, err := seqCollections.UploadAsset(context.Background(), 1, 1, 1, bytes.NewReader(data)) 44 | // if err != nil { 45 | // log.Fatal(err) 46 | // } 47 | // fmt.Println("asset uploaded!", asset.URL) 48 | // spew.Dump(asset) 49 | } 50 | -------------------------------------------------------------------------------- /abi.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "github.com/0xsequence/ethkit/ethcoder" 5 | "github.com/0xsequence/ethkit/go-ethereum/accounts/abi" 6 | ) 7 | 8 | // abiTransactionsType represents abi coder of []Transaction 9 | var abiTransactionsType = ethcoder.MustNewArrayTypeTuple([]abi.ArgumentMarshaling{ 10 | {Name: "delegateCall", Type: "bool"}, 11 | {Name: "revertOnError", Type: "bool"}, 12 | {Name: "gasLimit", Type: "uint256"}, 13 | {Name: "target", Type: "address"}, 14 | {Name: "value", Type: "uint256"}, 15 | {Name: "data", Type: "bytes"}, 16 | }) 17 | 18 | // abiTransactionsDigestType represents abi coder of []Transaction nonce digest pre-image 19 | var abiTransactionsDigestType = abi.Arguments{ 20 | abi.Argument{Type: ethcoder.MustNewType("uint256")}, 21 | abi.Argument{Type: abiTransactionsType}, 22 | } 23 | 24 | // abiTransactionsStringDigestType represents abi coder of []Transaction string digest pre-image 25 | var abiTransactionsStringDigestType = abi.Arguments{ 26 | abi.Argument{Type: ethcoder.MustNewType("string")}, 27 | abi.Argument{Type: abiTransactionsType}, 28 | } 29 | -------------------------------------------------------------------------------- /api/api.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | type Options struct { 9 | HTTPClient HTTPClient 10 | JWTAuthToken string 11 | APIServiceURL string 12 | } 13 | 14 | // NewAPI creates a new Sequence API client instance. Please see https://sequence.build to 15 | // get a `projectAccessKey`. 16 | func NewAPI(projectAccessKey string, options ...Options) API { 17 | opts := Options{} 18 | if len(options) > 0 { 19 | opts = options[0] 20 | } 21 | 22 | client := &httpclient{ 23 | client: opts.HTTPClient, 24 | projectAccessKey: projectAccessKey, 25 | } 26 | if opts.HTTPClient == nil { 27 | client.client = http.DefaultClient 28 | } 29 | if opts.JWTAuthToken != "" { 30 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 31 | } 32 | 33 | apiServiceURL := "https://api.sequence.app" 34 | if opts.APIServiceURL != "" { 35 | apiServiceURL = opts.APIServiceURL 36 | } 37 | return NewAPIClient(apiServiceURL, client) 38 | } 39 | 40 | type httpclient struct { 41 | client HTTPClient 42 | jwtAuthHeader string 43 | projectAccessKey string 44 | } 45 | 46 | func (c *httpclient) Do(req *http.Request) (*http.Response, error) { 47 | if c.projectAccessKey != "" { 48 | req.Header.Set("X-Access-Key", c.projectAccessKey) 49 | } 50 | if c.jwtAuthHeader != "" { 51 | req.Header.Set("Authorization", c.jwtAuthHeader) 52 | } 53 | return c.client.Do(req) 54 | } 55 | -------------------------------------------------------------------------------- /auth_test.go: -------------------------------------------------------------------------------- 1 | package sequence_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | "time" 7 | 8 | "github.com/0xsequence/ethkit/ethwallet" 9 | "github.com/0xsequence/ethkit/go-ethereum/common" 10 | "github.com/0xsequence/ethkit/go-ethereum/common/hexutil" 11 | "github.com/0xsequence/go-ethauth" 12 | "github.com/0xsequence/go-sequence" 13 | "github.com/0xsequence/go-sequence/testutil" 14 | "github.com/goware/logger" 15 | "github.com/stretchr/testify/assert" 16 | ) 17 | 18 | func TestEthAuthEIP6492(t *testing.T) { 19 | signer, err := ethwallet.NewWalletFromRandomEntropy() 20 | assert.NoError(t, err) 21 | 22 | wallet, err := sequence.NewWalletSingleOwner(signer) 23 | assert.NoError(t, err) 24 | 25 | log := logger.NewLogger(logger.LogLevel_INFO) 26 | ethAuth, err := ethauth.New(sequence.ValidateSequenceAccountProof(log)) 27 | assert.NoError(t, err) 28 | err = ethAuth.ConfigJsonRpcProvider(testutil.DefaultTestChainOptions.NodeURL) 29 | assert.NoError(t, err) 30 | 31 | proof := ethauth.NewProof() 32 | proof.Address = wallet.Address().String() 33 | proof.Claims.App = "TestEthAuthEIP6492" 34 | proof.Claims.IssuedAt = time.Now().Unix() 35 | proof.Claims.ExpiresAt = proof.Claims.IssuedAt + 3600 36 | 37 | var digest common.Hash 38 | digest_, err := proof.Claims.MessageDigest() 39 | assert.NoError(t, err) 40 | copy(digest[:], digest_) 41 | 42 | signature, err := wallet.SignDigest(context.Background(), digest, testChain.ChainID()) 43 | assert.NoError(t, err) 44 | 45 | signature, err = sequence.EIP6492Signature(signature, wallet.GetWalletConfig()) 46 | assert.NoError(t, err) 47 | 48 | proof.Signature = hexutil.Encode(signature) 49 | _, err = ethAuth.EncodeProof(proof) 50 | assert.NoError(t, err) 51 | 52 | isValid, err := ethAuth.ValidateProof(proof) 53 | assert.NoError(t, err) 54 | assert.True(t, isValid) 55 | } 56 | -------------------------------------------------------------------------------- /compressor/cbuffer.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | type CBuffer struct { 4 | SignatureLevel uint 5 | 6 | Commited []byte 7 | Pending []byte 8 | 9 | Refs *References 10 | } 11 | 12 | type References struct { 13 | useContractStorage bool 14 | 15 | usedFlags map[string]int 16 | usedStorageFlags map[string]int 17 | } 18 | 19 | func NewCBuffer(useStorage bool) *CBuffer { 20 | return &CBuffer{ 21 | // Start with an empty byte, this 22 | // will be used as the method when calling the compressor 23 | // contract. 24 | Commited: make([]byte, 1), 25 | Pending: make([]byte, 0), 26 | 27 | Refs: &References{ 28 | useContractStorage: useStorage, 29 | usedFlags: make(map[string]int), 30 | usedStorageFlags: make(map[string]int), 31 | }, 32 | } 33 | } 34 | 35 | func (r *References) Copy() *References { 36 | usedFlags := make(map[string]int, len(r.usedFlags)) 37 | for k, v := range r.usedFlags { 38 | usedFlags[k] = v 39 | } 40 | 41 | usedStorageFlags := make(map[string]int, len(r.usedStorageFlags)) 42 | for k, v := range r.usedStorageFlags { 43 | usedStorageFlags[k] = v 44 | } 45 | 46 | return &References{ 47 | useContractStorage: r.useContractStorage, 48 | 49 | usedFlags: usedFlags, 50 | usedStorageFlags: usedStorageFlags, 51 | } 52 | } 53 | 54 | func (cb *CBuffer) Data() []byte { 55 | return cb.Commited 56 | } 57 | 58 | func (cb *CBuffer) Len() int { 59 | return len(cb.Commited) 60 | } 61 | 62 | func (cb *CBuffer) WriteByte(b byte) { 63 | cb.Pending = append(cb.Pending, b) 64 | } 65 | 66 | func (cb *CBuffer) WriteBytes(b []byte) { 67 | cb.Pending = append(cb.Pending, b...) 68 | } 69 | 70 | func (cb *CBuffer) WriteInt(i uint) { 71 | cb.WriteByte(byte(i)) 72 | } 73 | 74 | func (cb *CBuffer) End(uncompressed []byte, t EncodeType) { 75 | // We need 2 bytes to point to a flag, so any uncompressed value 76 | // that is 2 bytes or less is not worth saving. 77 | if len(uncompressed) > 2 { 78 | rindex := cb.Len() 79 | 80 | switch t { 81 | case ReadStorage: 82 | case Stateless: 83 | cb.Refs.usedFlags[string(uncompressed)] = rindex + 1 84 | case WriteStorage: 85 | cb.Refs.usedStorageFlags[string(uncompressed)] = rindex + 1 86 | default: 87 | } 88 | } 89 | 90 | cb.Commited = append(cb.Commited, cb.Pending...) 91 | cb.Pending = nil 92 | } 93 | 94 | type Snapshot struct { 95 | Commited []byte 96 | 97 | SignatureLevel uint 98 | 99 | Refs *References 100 | } 101 | 102 | func (cb *CBuffer) Snapshot() *Snapshot { 103 | // Create a copy of the commited buffer 104 | // and of the references. 105 | com := make([]byte, len(cb.Commited)) 106 | copy(com, cb.Commited) 107 | 108 | refs := cb.Refs.Copy() 109 | 110 | return &Snapshot{ 111 | Commited: com, 112 | SignatureLevel: cb.SignatureLevel, 113 | Refs: refs, 114 | } 115 | } 116 | 117 | func (cb *CBuffer) Restore(snap *Snapshot) { 118 | cb.Commited = snap.Commited 119 | cb.Refs = snap.Refs 120 | cb.SignatureLevel = snap.SignatureLevel 121 | } 122 | -------------------------------------------------------------------------------- /compressor/contract.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | import ( 4 | "context" 5 | "encoding/binary" 6 | "fmt" 7 | "math/big" 8 | 9 | "github.com/0xsequence/ethkit/ethrpc" 10 | "github.com/0xsequence/ethkit/go-ethereum" 11 | "github.com/0xsequence/ethkit/go-ethereum/common" 12 | ) 13 | 14 | func AddressIndex(i uint) []byte { 15 | padded32 := make([]byte, 32) 16 | binary.BigEndian.PutUint64(padded32[24:32], uint64(i+1)) 17 | return padded32 18 | } 19 | 20 | func Bytes32Index(i uint) []byte { 21 | padded32 := make([]byte, 32) 22 | binary.BigEndian.PutUint64(padded32[8:16], uint64(i)) 23 | return padded32 24 | } 25 | 26 | func GetTotals(ctx context.Context, provider *ethrpc.Provider, contract common.Address, skipBlocks uint) (uint, uint, error) { 27 | // Get the last block 28 | block, err := provider.BlockNumber(ctx) 29 | if err != nil { 30 | return 0, 0, err 31 | } 32 | 33 | block -= uint64(skipBlocks) 34 | 35 | res, err := provider.CallContract(ctx, ethereum.CallMsg{ 36 | To: &contract, 37 | Data: []byte{byte(METHOD_READ_SIZES)}, 38 | }, big.NewInt(int64(block))) 39 | 40 | if err != nil { 41 | return 0, 0, err 42 | } 43 | 44 | // First 16 bytes are the total number of addresses 45 | // Next 16 bytes are the total number of bytes32 46 | 47 | // Read only an uint64, since there will be no more than 2^64 addresses 48 | asize := uint(binary.BigEndian.Uint64(res[8:16])) + 1 49 | bsize := uint(binary.BigEndian.Uint64(res[24:32])) + 1 50 | 51 | return asize, bsize, nil 52 | } 53 | 54 | func DecompressTransaction(ctx context.Context, provider *ethrpc.Provider, contract common.Address, compressed []byte) (common.Address, []byte, error) { 55 | // Replace the first byte with `METHOD_DECOMPRESS_1` 56 | if len(compressed) == 0 { 57 | return common.Address{}, nil, fmt.Errorf("empty compressed data") 58 | } 59 | 60 | c2 := make([]byte, len(compressed)) 61 | copy(c2, compressed) 62 | c2[0] = byte(METHOD_DECOMPRESS_1) 63 | res, err := provider.CallContract(ctx, ethereum.CallMsg{ 64 | To: &contract, 65 | Data: c2, 66 | }, nil) 67 | 68 | if err != nil { 69 | return common.Address{}, nil, err 70 | } 71 | 72 | if len(res) < 32 { 73 | return common.Address{}, nil, fmt.Errorf("decompressed data too short") 74 | } 75 | 76 | // The last 32 bytes are the address 77 | addr := common.BytesToAddress(res[len(res)-32:]) 78 | 79 | // The rest is the transaction, encoded as a function call to execute 80 | return addr, res[:len(res)-32], nil 81 | } 82 | -------------------------------------------------------------------------------- /compressor/costmodel.go: -------------------------------------------------------------------------------- 1 | package compressor 2 | 3 | import "strings" 4 | 5 | type CostModel struct { 6 | ZeroByteCost int 7 | OneByteCost int 8 | 9 | FixedCost int 10 | OverHeadPersentage int // 0 - 1000 11 | } 12 | 13 | func NewCostModel(zeroByteCost, oneByteCost, fixedCost, overHeadPersentage int) *CostModel { 14 | return &CostModel{ 15 | ZeroByteCost: zeroByteCost, 16 | OneByteCost: oneByteCost, 17 | FixedCost: fixedCost, 18 | OverHeadPersentage: overHeadPersentage, 19 | } 20 | } 21 | 22 | func GetCostModel(network string) *CostModel { 23 | // Convert to lowerscase, trim spaces 24 | n := strings.ToLower(strings.TrimSpace(network)) 25 | 26 | switch n { 27 | case "mainnet": 28 | return NewCostModel(4, 16, 2300, 5) 29 | default: 30 | return GetCostModel("mainnet") 31 | } 32 | } 33 | 34 | func (cm *CostModel) Cost(data []byte) int { 35 | var calldataCost int 36 | 37 | for _, b := range data { 38 | if b == 0 { 39 | calldataCost += cm.ZeroByteCost 40 | } else { 41 | calldataCost += cm.OneByteCost 42 | } 43 | } 44 | 45 | return calldataCost 46 | } 47 | -------------------------------------------------------------------------------- /config.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "fmt" 5 | "sort" 6 | 7 | "github.com/0xsequence/ethkit/ethcoder" 8 | "github.com/0xsequence/ethkit/go-ethereum/common" 9 | "github.com/0xsequence/ethkit/go-ethereum/crypto" 10 | "github.com/0xsequence/go-sequence/core" 11 | v1 "github.com/0xsequence/go-sequence/core/v1" 12 | ) 13 | 14 | func AddressFromWalletConfig(walletConfig core.WalletConfig, context WalletContext) (common.Address, error) { 15 | return AddressFromImageHash(walletConfig.ImageHash().Hex(), context) 16 | } 17 | 18 | func AddressFromImageHash(imageHash string, context WalletContext) (common.Address, error) { 19 | mainModule32 := [32]byte{} 20 | copy(mainModule32[12:], context.MainModuleAddress.Bytes()) 21 | 22 | codePack, err := ethcoder.SolidityPack([]string{"bytes", "bytes32"}, []interface{}{walletContractBytecode, mainModule32}) 23 | if err != nil { 24 | return common.Address{}, fmt.Errorf("sequence, AddressFromImageHash: %w", err) 25 | } 26 | codeHash := crypto.Keccak256(codePack) 27 | 28 | hashPack, err := ethcoder.SolidityPack( 29 | []string{"bytes1", "address", "bytes32", "bytes32"}, 30 | []interface{}{[]byte{0xff}, context.FactoryAddress, common.FromHex(imageHash), codeHash}, 31 | ) 32 | if err != nil { 33 | return common.Address{}, fmt.Errorf("sequence, AddressFromImageHash: %w", err) 34 | } 35 | hash := crypto.Keccak256(hashPack)[12:] 36 | 37 | return common.BytesToAddress(hash), nil 38 | } 39 | 40 | func IsWalletConfigEqual(walletConfigA, walletConfigB core.WalletConfig) bool { 41 | return walletConfigA.ImageHash().Hex() == walletConfigB.ImageHash().Hex() 42 | } 43 | 44 | func V1SortWalletConfig(walletConfig *v1.WalletConfig) error { 45 | signers := walletConfig.Signers_ 46 | sort.Sort(signers) // Sort the signers 47 | 48 | // Ensure no duplicates 49 | for i := 0; i < len(signers)-1; i++ { 50 | if signers[i].Address == signers[i+1].Address { 51 | return fmt.Errorf("signer duplicate detected in the wallet config") 52 | } 53 | } 54 | 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /contracts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/interfaces/IERC1155Metadata.sol/IERC1155Metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1155Metadata", 4 | "sourceName": "contracts/interfaces/IERC1155Metadata.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": false, 11 | "internalType": "string", 12 | "name": "_uri", 13 | "type": "string" 14 | }, 15 | { 16 | "indexed": true, 17 | "internalType": "uint256", 18 | "name": "_id", 19 | "type": "uint256" 20 | } 21 | ], 22 | "name": "URI", 23 | "type": "event" 24 | }, 25 | { 26 | "inputs": [ 27 | { 28 | "internalType": "uint256", 29 | "name": "_id", 30 | "type": "uint256" 31 | } 32 | ], 33 | "name": "uri", 34 | "outputs": [ 35 | { 36 | "internalType": "string", 37 | "name": "", 38 | "type": "string" 39 | } 40 | ], 41 | "stateMutability": "view", 42 | "type": "function" 43 | } 44 | ], 45 | "bytecode": "0x", 46 | "deployedBytecode": "0x", 47 | "linkReferences": {}, 48 | "deployedLinkReferences": {} 49 | } 50 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/interfaces/IERC1155MintBurn.sol/IERC1155MintBurn.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1155MintBurn", 4 | "sourceName": "contracts/interfaces/IERC1155MintBurn.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_from", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "uint256[]", 15 | "name": "_ids", 16 | "type": "uint256[]" 17 | }, 18 | { 19 | "internalType": "uint256[]", 20 | "name": "_amounts", 21 | "type": "uint256[]" 22 | } 23 | ], 24 | "name": "batchBurn", 25 | "outputs": [], 26 | "stateMutability": "nonpayable", 27 | "type": "function" 28 | }, 29 | { 30 | "inputs": [ 31 | { 32 | "internalType": "address", 33 | "name": "_to", 34 | "type": "address" 35 | }, 36 | { 37 | "internalType": "uint256[]", 38 | "name": "_ids", 39 | "type": "uint256[]" 40 | }, 41 | { 42 | "internalType": "uint256[]", 43 | "name": "_amounts", 44 | "type": "uint256[]" 45 | }, 46 | { 47 | "internalType": "bytes", 48 | "name": "_data", 49 | "type": "bytes" 50 | } 51 | ], 52 | "name": "batchMint", 53 | "outputs": [], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [ 59 | { 60 | "internalType": "address", 61 | "name": "_from", 62 | "type": "address" 63 | }, 64 | { 65 | "internalType": "uint256", 66 | "name": "_id", 67 | "type": "uint256" 68 | }, 69 | { 70 | "internalType": "uint256", 71 | "name": "_amount", 72 | "type": "uint256" 73 | } 74 | ], 75 | "name": "burn", 76 | "outputs": [], 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | }, 80 | { 81 | "inputs": [ 82 | { 83 | "internalType": "address", 84 | "name": "_to", 85 | "type": "address" 86 | }, 87 | { 88 | "internalType": "uint256", 89 | "name": "_id", 90 | "type": "uint256" 91 | }, 92 | { 93 | "internalType": "uint256", 94 | "name": "_amount", 95 | "type": "uint256" 96 | }, 97 | { 98 | "internalType": "bytes", 99 | "name": "_data", 100 | "type": "bytes" 101 | } 102 | ], 103 | "name": "mint", 104 | "outputs": [], 105 | "stateMutability": "nonpayable", 106 | "type": "function" 107 | } 108 | ], 109 | "bytecode": "0x", 110 | "deployedBytecode": "0x", 111 | "linkReferences": {}, 112 | "deployedLinkReferences": {} 113 | } 114 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/interfaces/IERC1155TokenReceiver.sol/IERC1155TokenReceiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1155TokenReceiver", 4 | "sourceName": "contracts/interfaces/IERC1155TokenReceiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_operator", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "_from", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256[]", 20 | "name": "_ids", 21 | "type": "uint256[]" 22 | }, 23 | { 24 | "internalType": "uint256[]", 25 | "name": "_amounts", 26 | "type": "uint256[]" 27 | }, 28 | { 29 | "internalType": "bytes", 30 | "name": "_data", 31 | "type": "bytes" 32 | } 33 | ], 34 | "name": "onERC1155BatchReceived", 35 | "outputs": [ 36 | { 37 | "internalType": "bytes4", 38 | "name": "", 39 | "type": "bytes4" 40 | } 41 | ], 42 | "stateMutability": "nonpayable", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [ 47 | { 48 | "internalType": "address", 49 | "name": "_operator", 50 | "type": "address" 51 | }, 52 | { 53 | "internalType": "address", 54 | "name": "_from", 55 | "type": "address" 56 | }, 57 | { 58 | "internalType": "uint256", 59 | "name": "_id", 60 | "type": "uint256" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "_amount", 65 | "type": "uint256" 66 | }, 67 | { 68 | "internalType": "bytes", 69 | "name": "_data", 70 | "type": "bytes" 71 | } 72 | ], 73 | "name": "onERC1155Received", 74 | "outputs": [ 75 | { 76 | "internalType": "bytes4", 77 | "name": "", 78 | "type": "bytes4" 79 | } 80 | ], 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | } 84 | ], 85 | "bytecode": "0x", 86 | "deployedBytecode": "0x", 87 | "linkReferences": {}, 88 | "deployedLinkReferences": {} 89 | } 90 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/interfaces/IERC1271Wallet.sol/IERC1271Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1271Wallet", 4 | "sourceName": "contracts/interfaces/IERC1271Wallet.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "_hash", 11 | "type": "bytes32" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "_signature", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "isValidSignature", 20 | "outputs": [ 21 | { 22 | "internalType": "bytes4", 23 | "name": "magicValue", 24 | "type": "bytes4" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "bytes", 34 | "name": "_data", 35 | "type": "bytes" 36 | }, 37 | { 38 | "internalType": "bytes", 39 | "name": "_signature", 40 | "type": "bytes" 41 | } 42 | ], 43 | "name": "isValidSignature", 44 | "outputs": [ 45 | { 46 | "internalType": "bytes4", 47 | "name": "magicValue", 48 | "type": "bytes4" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | } 54 | ], 55 | "bytecode": "0x", 56 | "deployedBytecode": "0x", 57 | "linkReferences": {}, 58 | "deployedLinkReferences": {} 59 | } 60 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/interfaces/IERC165.sol/IERC165.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC165", 4 | "sourceName": "contracts/interfaces/IERC165.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_interfaceId", 11 | "type": "bytes4" 12 | } 13 | ], 14 | "name": "supportsInterface", 15 | "outputs": [ 16 | { 17 | "internalType": "bool", 18 | "name": "", 19 | "type": "bool" 20 | } 21 | ], 22 | "stateMutability": "view", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x", 27 | "deployedBytecode": "0x", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/mocks/ERC1271WalletValidationMock.sol/LibEIP712.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibEIP712", 4 | "sourceName": "contracts/mocks/ERC1271WalletValidationMock.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "domain_hash_1155", 11 | "type": "bytes32" 12 | } 13 | ], 14 | "stateMutability": "nonpayable", 15 | "type": "constructor" 16 | } 17 | ], 18 | "bytecode": "0x6080604052348015600f57600080fd5b506040516080380380608083398181016040526020811015602f57600080fd5b5051600055603f8060416000396000f3fe6080604052600080fdfea2646970667358221220063f87e2343ff946c2d6b04d43f5f1a37ea1880917297aba5a44c95596dce24364736f6c63430007040033", 19 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220063f87e2343ff946c2d6b04d43f5f1a37ea1880917297aba5a44c95596dce24364736f6c63430007040033", 20 | "linkReferences": {}, 21 | "deployedLinkReferences": {} 22 | } 23 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/utils/Address.sol/Address.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Address", 4 | "sourceName": "contracts/utils/Address.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220336f665f431ee577a461c9ea3fd66128a524e04afae4d4732461f14d170879b864736f6c63430007040033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220336f665f431ee577a461c9ea3fd66128a524e04afae4d4732461f14d170879b864736f6c63430007040033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/utils/ERC165.sol/ERC165.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ERC165", 4 | "sourceName": "contracts/utils/ERC165.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_interfaceID", 11 | "type": "bytes4" 12 | } 13 | ], 14 | "name": "supportsInterface", 15 | "outputs": [ 16 | { 17 | "internalType": "bool", 18 | "name": "", 19 | "type": "bool" 20 | } 21 | ], 22 | "stateMutability": "pure", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x", 27 | "deployedBytecode": "0x", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/utils/LibBytes.sol/LibBytes.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibBytes", 4 | "sourceName": "contracts/utils/LibBytes.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203e1b0abe7a8b5d3d0a12758a86dc3b2111a49bb824f19d6b82d76e6f4b78b37164736f6c63430007040033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203e1b0abe7a8b5d3d0a12758a86dc3b2111a49bb824f19d6b82d76e6f4b78b37164736f6c63430007040033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/utils/LibEIP712.sol/LibEIP712.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibEIP712", 4 | "sourceName": "contracts/utils/LibEIP712.sol", 5 | "abi": [], 6 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220b4831d5b0663f4f8fc134911a0233f4f1716fbd1523ae0f10a81f5ef0904795564736f6c63430007040033", 7 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220b4831d5b0663f4f8fc134911a0233f4f1716fbd1523ae0f10a81f5ef0904795564736f6c63430007040033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1155/utils/SafeMath.sol/SafeMath.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SafeMath", 4 | "sourceName": "contracts/utils/SafeMath.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220aa8f341c20cb054f4a78fcaedd1a8c47c2626d420abeb7eaa4efea14ee00d22864736f6c63430007040033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220aa8f341c20cb054f4a78fcaedd1a8c47c2626d420abeb7eaa4efea14ee00d22864736f6c63430007040033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/erc1271/ierc1271.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1271", 4 | "abi": [ 5 | { 6 | "inputs": [ 7 | { 8 | "internalType": "bytes32", 9 | "name": "_hash", 10 | "type": "bytes32" 11 | }, 12 | { 13 | "internalType": "bytes", 14 | "name": "_signature", 15 | "type": "bytes" 16 | } 17 | ], 18 | "name": "isValidSignature", 19 | "outputs": [ 20 | { 21 | "internalType": "bytes4", 22 | "name": "magicValue", 23 | "type": "bytes4" 24 | } 25 | ], 26 | "stateMutability": "view", 27 | "type": "function" 28 | }, 29 | { 30 | "inputs": [ 31 | { 32 | "internalType": "bytes", 33 | "name": "_data", 34 | "type": "bytes" 35 | }, 36 | { 37 | "internalType": "bytes", 38 | "name": "_signature", 39 | "type": "bytes" 40 | } 41 | ], 42 | "name": "isValidSignature", 43 | "outputs": [ 44 | { 45 | "internalType": "bytes4", 46 | "name": "magicValue", 47 | "type": "bytes4" 48 | } 49 | ], 50 | "stateMutability": "view", 51 | "type": "function" 52 | } 53 | ], 54 | "bytecode": "0x", 55 | "deployedBytecode": "0x", 56 | "linkReferences": {}, 57 | "deployedLinkReferences": {} 58 | } 59 | -------------------------------------------------------------------------------- /contracts/artifacts/erc20/IERC20Errors.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC20Errors", 4 | "sourceName": "contracts/interfaces/draft-IERC6093.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "spender", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "allowance", 16 | "type": "uint256" 17 | }, 18 | { 19 | "internalType": "uint256", 20 | "name": "needed", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "ERC20InsufficientAllowance", 25 | "type": "error" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "address", 31 | "name": "sender", 32 | "type": "address" 33 | }, 34 | { 35 | "internalType": "uint256", 36 | "name": "balance", 37 | "type": "uint256" 38 | }, 39 | { 40 | "internalType": "uint256", 41 | "name": "needed", 42 | "type": "uint256" 43 | } 44 | ], 45 | "name": "ERC20InsufficientBalance", 46 | "type": "error" 47 | }, 48 | { 49 | "inputs": [ 50 | { 51 | "internalType": "address", 52 | "name": "approver", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "ERC20InvalidApprover", 57 | "type": "error" 58 | }, 59 | { 60 | "inputs": [ 61 | { 62 | "internalType": "address", 63 | "name": "receiver", 64 | "type": "address" 65 | } 66 | ], 67 | "name": "ERC20InvalidReceiver", 68 | "type": "error" 69 | }, 70 | { 71 | "inputs": [ 72 | { 73 | "internalType": "address", 74 | "name": "sender", 75 | "type": "address" 76 | } 77 | ], 78 | "name": "ERC20InvalidSender", 79 | "type": "error" 80 | }, 81 | { 82 | "inputs": [ 83 | { 84 | "internalType": "address", 85 | "name": "spender", 86 | "type": "address" 87 | } 88 | ], 89 | "name": "ERC20InvalidSpender", 90 | "type": "error" 91 | } 92 | ], 93 | "bytecode": "0x", 94 | "deployedBytecode": "0x", 95 | "linkReferences": {}, 96 | "deployedLinkReferences": {} 97 | } 98 | -------------------------------------------------------------------------------- /contracts/artifacts/erc20/IERC20Permit.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC20Permit", 4 | "sourceName": "contracts/token/ERC20/extensions/IERC20Permit.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "DOMAIN_SEPARATOR", 9 | "outputs": [ 10 | { 11 | "internalType": "bytes32", 12 | "name": "", 13 | "type": "bytes32" 14 | } 15 | ], 16 | "stateMutability": "view", 17 | "type": "function" 18 | }, 19 | { 20 | "inputs": [ 21 | { 22 | "internalType": "address", 23 | "name": "owner", 24 | "type": "address" 25 | } 26 | ], 27 | "name": "nonces", 28 | "outputs": [ 29 | { 30 | "internalType": "uint256", 31 | "name": "", 32 | "type": "uint256" 33 | } 34 | ], 35 | "stateMutability": "view", 36 | "type": "function" 37 | }, 38 | { 39 | "inputs": [ 40 | { 41 | "internalType": "address", 42 | "name": "owner", 43 | "type": "address" 44 | }, 45 | { 46 | "internalType": "address", 47 | "name": "spender", 48 | "type": "address" 49 | }, 50 | { 51 | "internalType": "uint256", 52 | "name": "value", 53 | "type": "uint256" 54 | }, 55 | { 56 | "internalType": "uint256", 57 | "name": "deadline", 58 | "type": "uint256" 59 | }, 60 | { 61 | "internalType": "uint8", 62 | "name": "v", 63 | "type": "uint8" 64 | }, 65 | { 66 | "internalType": "bytes32", 67 | "name": "r", 68 | "type": "bytes32" 69 | }, 70 | { 71 | "internalType": "bytes32", 72 | "name": "s", 73 | "type": "bytes32" 74 | } 75 | ], 76 | "name": "permit", 77 | "outputs": [], 78 | "stateMutability": "nonpayable", 79 | "type": "function" 80 | } 81 | ], 82 | "bytecode": "0x", 83 | "deployedBytecode": "0x", 84 | "linkReferences": {}, 85 | "deployedLinkReferences": {} 86 | } 87 | -------------------------------------------------------------------------------- /contracts/artifacts/erc721/IERC721Errors.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC721Errors", 4 | "sourceName": "contracts/interfaces/draft-IERC6093.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "sender", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "tokenId", 16 | "type": "uint256" 17 | }, 18 | { 19 | "internalType": "address", 20 | "name": "owner", 21 | "type": "address" 22 | } 23 | ], 24 | "name": "ERC721IncorrectOwner", 25 | "type": "error" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "address", 31 | "name": "operator", 32 | "type": "address" 33 | }, 34 | { 35 | "internalType": "uint256", 36 | "name": "tokenId", 37 | "type": "uint256" 38 | } 39 | ], 40 | "name": "ERC721InsufficientApproval", 41 | "type": "error" 42 | }, 43 | { 44 | "inputs": [ 45 | { 46 | "internalType": "address", 47 | "name": "approver", 48 | "type": "address" 49 | } 50 | ], 51 | "name": "ERC721InvalidApprover", 52 | "type": "error" 53 | }, 54 | { 55 | "inputs": [ 56 | { 57 | "internalType": "address", 58 | "name": "operator", 59 | "type": "address" 60 | } 61 | ], 62 | "name": "ERC721InvalidOperator", 63 | "type": "error" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "owner", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "ERC721InvalidOwner", 74 | "type": "error" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "receiver", 81 | "type": "address" 82 | } 83 | ], 84 | "name": "ERC721InvalidReceiver", 85 | "type": "error" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "sender", 92 | "type": "address" 93 | } 94 | ], 95 | "name": "ERC721InvalidSender", 96 | "type": "error" 97 | }, 98 | { 99 | "inputs": [ 100 | { 101 | "internalType": "uint256", 102 | "name": "tokenId", 103 | "type": "uint256" 104 | } 105 | ], 106 | "name": "ERC721NonexistentToken", 107 | "type": "error" 108 | } 109 | ], 110 | "bytecode": "0x", 111 | "deployedBytecode": "0x", 112 | "linkReferences": {}, 113 | "deployedLinkReferences": {} 114 | } 115 | -------------------------------------------------------------------------------- /contracts/artifacts/erc721/IERC721Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC721Receiver", 4 | "sourceName": "contracts/token/ERC721/IERC721Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "operator", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "from", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256", 20 | "name": "tokenId", 21 | "type": "uint256" 22 | }, 23 | { 24 | "internalType": "bytes", 25 | "name": "data", 26 | "type": "bytes" 27 | } 28 | ], 29 | "name": "onERC721Received", 30 | "outputs": [ 31 | { 32 | "internalType": "bytes4", 33 | "name": "", 34 | "type": "bytes4" 35 | } 36 | ], 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | } 40 | ], 41 | "bytecode": "0x", 42 | "deployedBytecode": "0x", 43 | "linkReferences": {}, 44 | "deployedLinkReferences": {} 45 | } 46 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/interfaces/IERC2981.sol/IERC2981.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC2981", 4 | "sourceName": "contracts/interfaces/IERC2981.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "uint256", 10 | "name": "_tokenId", 11 | "type": "uint256" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "_salePrice", 16 | "type": "uint256" 17 | } 18 | ], 19 | "name": "royaltyInfo", 20 | "outputs": [ 21 | { 22 | "internalType": "address", 23 | "name": "receiver", 24 | "type": "address" 25 | }, 26 | { 27 | "internalType": "uint256", 28 | "name": "royaltyAmount", 29 | "type": "uint256" 30 | } 31 | ], 32 | "stateMutability": "view", 33 | "type": "function" 34 | }, 35 | { 36 | "inputs": [ 37 | { 38 | "internalType": "bytes4", 39 | "name": "_interfaceId", 40 | "type": "bytes4" 41 | } 42 | ], 43 | "name": "supportsInterface", 44 | "outputs": [ 45 | { 46 | "internalType": "bool", 47 | "name": "", 48 | "type": "bool" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | } 54 | ], 55 | "bytecode": "0x", 56 | "deployedBytecode": "0x", 57 | "linkReferences": {}, 58 | "deployedLinkReferences": {} 59 | } 60 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/interfaces/INiftyswapFactory.sol/INiftyswapFactory.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "INiftyswapFactory", 4 | "sourceName": "contracts/interfaces/INiftyswapFactory.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": true, 11 | "internalType": "address", 12 | "name": "token", 13 | "type": "address" 14 | }, 15 | { 16 | "indexed": true, 17 | "internalType": "address", 18 | "name": "currency", 19 | "type": "address" 20 | }, 21 | { 22 | "indexed": true, 23 | "internalType": "uint256", 24 | "name": "currencyID", 25 | "type": "uint256" 26 | }, 27 | { 28 | "indexed": false, 29 | "internalType": "address", 30 | "name": "exchange", 31 | "type": "address" 32 | } 33 | ], 34 | "name": "NewExchange", 35 | "type": "event" 36 | }, 37 | { 38 | "inputs": [ 39 | { 40 | "internalType": "address", 41 | "name": "_token", 42 | "type": "address" 43 | }, 44 | { 45 | "internalType": "address", 46 | "name": "_currency", 47 | "type": "address" 48 | }, 49 | { 50 | "internalType": "uint256", 51 | "name": "_currencyID", 52 | "type": "uint256" 53 | } 54 | ], 55 | "name": "createExchange", 56 | "outputs": [], 57 | "stateMutability": "nonpayable", 58 | "type": "function" 59 | }, 60 | { 61 | "inputs": [ 62 | { 63 | "internalType": "address", 64 | "name": "_token", 65 | "type": "address" 66 | }, 67 | { 68 | "internalType": "address", 69 | "name": "_currency", 70 | "type": "address" 71 | }, 72 | { 73 | "internalType": "uint256", 74 | "name": "_currencyID", 75 | "type": "uint256" 76 | } 77 | ], 78 | "name": "tokensToExchange", 79 | "outputs": [ 80 | { 81 | "internalType": "address", 82 | "name": "", 83 | "type": "address" 84 | } 85 | ], 86 | "stateMutability": "view", 87 | "type": "function" 88 | } 89 | ], 90 | "bytecode": "0x", 91 | "deployedBytecode": "0x", 92 | "linkReferences": {}, 93 | "deployedLinkReferences": {} 94 | } 95 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/interfaces/INiftyswapFactory20.sol/INiftyswapFactory20.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "INiftyswapFactory20", 4 | "sourceName": "contracts/interfaces/INiftyswapFactory20.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": true, 11 | "internalType": "address", 12 | "name": "token", 13 | "type": "address" 14 | }, 15 | { 16 | "indexed": true, 17 | "internalType": "address", 18 | "name": "currency", 19 | "type": "address" 20 | }, 21 | { 22 | "indexed": true, 23 | "internalType": "uint256", 24 | "name": "salt", 25 | "type": "uint256" 26 | }, 27 | { 28 | "indexed": false, 29 | "internalType": "address", 30 | "name": "exchange", 31 | "type": "address" 32 | } 33 | ], 34 | "name": "NewExchange", 35 | "type": "event" 36 | }, 37 | { 38 | "inputs": [ 39 | { 40 | "internalType": "address", 41 | "name": "_token", 42 | "type": "address" 43 | }, 44 | { 45 | "internalType": "address", 46 | "name": "_currency", 47 | "type": "address" 48 | }, 49 | { 50 | "internalType": "uint256", 51 | "name": "_instance", 52 | "type": "uint256" 53 | } 54 | ], 55 | "name": "createExchange", 56 | "outputs": [], 57 | "stateMutability": "nonpayable", 58 | "type": "function" 59 | }, 60 | { 61 | "inputs": [ 62 | { 63 | "internalType": "address", 64 | "name": "_token", 65 | "type": "address" 66 | }, 67 | { 68 | "internalType": "address", 69 | "name": "_currency", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "getPairExchanges", 74 | "outputs": [ 75 | { 76 | "internalType": "address[]", 77 | "name": "", 78 | "type": "address[]" 79 | } 80 | ], 81 | "stateMutability": "view", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "_token", 89 | "type": "address" 90 | }, 91 | { 92 | "internalType": "address", 93 | "name": "_currency", 94 | "type": "address" 95 | }, 96 | { 97 | "internalType": "uint256", 98 | "name": "_instance", 99 | "type": "uint256" 100 | } 101 | ], 102 | "name": "tokensToExchange", 103 | "outputs": [ 104 | { 105 | "internalType": "address", 106 | "name": "", 107 | "type": "address" 108 | } 109 | ], 110 | "stateMutability": "view", 111 | "type": "function" 112 | } 113 | ], 114 | "bytecode": "0x", 115 | "deployedBytecode": "0x", 116 | "linkReferences": {}, 117 | "deployedLinkReferences": {} 118 | } 119 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/interfaces/IOwnable.sol/IOwnable.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IOwnable", 4 | "sourceName": "contracts/interfaces/IOwnable.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "getOwner", 9 | "outputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "", 13 | "type": "address" 14 | } 15 | ], 16 | "stateMutability": "view", 17 | "type": "function" 18 | }, 19 | { 20 | "inputs": [ 21 | { 22 | "internalType": "address", 23 | "name": "_newOwner", 24 | "type": "address" 25 | } 26 | ], 27 | "name": "transferOwnership", 28 | "outputs": [], 29 | "stateMutability": "nonpayable", 30 | "type": "function" 31 | } 32 | ], 33 | "bytecode": "0x", 34 | "deployedBytecode": "0x", 35 | "linkReferences": {}, 36 | "deployedLinkReferences": {} 37 | } 38 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/interfaces/IWrapAndNiftyswap.sol/IWrapAndNiftyswap.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IWrapAndNiftyswap", 4 | "sourceName": "contracts/interfaces/IWrapAndNiftyswap.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "_from", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256[]", 20 | "name": "_ids", 21 | "type": "uint256[]" 22 | }, 23 | { 24 | "internalType": "uint256[]", 25 | "name": "_amounts", 26 | "type": "uint256[]" 27 | }, 28 | { 29 | "internalType": "bytes", 30 | "name": "_data", 31 | "type": "bytes" 32 | } 33 | ], 34 | "name": "onERC1155BatchReceived", 35 | "outputs": [ 36 | { 37 | "internalType": "bytes4", 38 | "name": "", 39 | "type": "bytes4" 40 | } 41 | ], 42 | "stateMutability": "nonpayable", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [ 47 | { 48 | "internalType": "address", 49 | "name": "_operator", 50 | "type": "address" 51 | }, 52 | { 53 | "internalType": "address", 54 | "name": "_from", 55 | "type": "address" 56 | }, 57 | { 58 | "internalType": "uint256", 59 | "name": "_id", 60 | "type": "uint256" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "_amount", 65 | "type": "uint256" 66 | }, 67 | { 68 | "internalType": "bytes", 69 | "name": "_data", 70 | "type": "bytes" 71 | } 72 | ], 73 | "name": "onERC1155Received", 74 | "outputs": [ 75 | { 76 | "internalType": "bytes4", 77 | "name": "", 78 | "type": "bytes4" 79 | } 80 | ], 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [ 86 | { 87 | "internalType": "uint256", 88 | "name": "_maxAmount", 89 | "type": "uint256" 90 | }, 91 | { 92 | "internalType": "address", 93 | "name": "_recipient", 94 | "type": "address" 95 | }, 96 | { 97 | "internalType": "bytes", 98 | "name": "_niftyswapOrder", 99 | "type": "bytes" 100 | } 101 | ], 102 | "name": "wrapAndSwap", 103 | "outputs": [], 104 | "stateMutability": "nonpayable", 105 | "type": "function" 106 | } 107 | ], 108 | "bytecode": "0x", 109 | "deployedBytecode": "0x", 110 | "linkReferences": {}, 111 | "deployedLinkReferences": {} 112 | } 113 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/utils/ReentrancyGuard.sol/ReentrancyGuard.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ReentrancyGuard", 4 | "sourceName": "contracts/utils/ReentrancyGuard.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "stateMutability": "nonpayable", 9 | "type": "constructor" 10 | } 11 | ], 12 | "bytecode": "0x6080604052348015600f57600080fd5b506000805460ff19166001179055603f80602a6000396000f3fe6080604052600080fdfea2646970667358221220417874421562e1280390e26a4387b0d8e1051c0f92c764d60dacf11704f5621264736f6c63430007040033", 13 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220417874421562e1280390e26a4387b0d8e1051c0f92c764d60dacf11704f5621264736f6c63430007040033", 14 | "linkReferences": {}, 15 | "deployedLinkReferences": {} 16 | } 17 | -------------------------------------------------------------------------------- /contracts/artifacts/niftyswap/utils/SafeMath.sol/SafeMath.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SafeMath", 4 | "sourceName": "contracts/utils/SafeMath.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220af718c91e58ed4a4d1a310e4258428615697bf01c9d036f64a479a1b1bbbf09164736f6c63430007040033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220af718c91e58ed4a4d1a310e4258428615697bf01c9d036f64a479a1b1bbbf09164736f6c63430007040033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/Factory.sol/Factory.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Factory", 4 | "sourceName": "contracts/Factory.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_mainModule", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes32", 15 | "name": "_salt", 16 | "type": "bytes32" 17 | } 18 | ], 19 | "name": "DeployFailed", 20 | "type": "error" 21 | }, 22 | { 23 | "inputs": [ 24 | { 25 | "internalType": "address", 26 | "name": "_mainModule", 27 | "type": "address" 28 | }, 29 | { 30 | "internalType": "bytes32", 31 | "name": "_salt", 32 | "type": "bytes32" 33 | } 34 | ], 35 | "name": "deploy", 36 | "outputs": [ 37 | { 38 | "internalType": "address", 39 | "name": "_contract", 40 | "type": "address" 41 | } 42 | ], 43 | "stateMutability": "payable", 44 | "type": "function" 45 | } 46 | ], 47 | "bytecode": "0x608060405234801561001057600080fd5b5061020b806100206000396000f3fe60806040526004361061001e5760003560e01c806332c02a1414610023575b600080fd5b610036610031366004610136565b61005f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000806040518060600160405280602881526020016101ae602891398473ffffffffffffffffffffffffffffffffffffffff166040516020016100a392919061017b565b60405160208183030381529060405290508281516020830134f5915073ffffffffffffffffffffffffffffffffffffffff821661012f576040517f8caac80500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024810184905260440160405180910390fd5b5092915050565b6000806040838503121561014957600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461016d57600080fd5b946020939093013593505050565b6000835160005b8181101561019c5760208187018101518583015201610182565b50919091019182525060200191905056fe603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3a26469706673582212203e46c5b0f3a6bebab844eb5e4594ebb07eac1ae451f779e533ead5e744b1a2a664736f6c63430008120033", 48 | "deployedBytecode": "0x60806040526004361061001e5760003560e01c806332c02a1414610023575b600080fd5b610036610031366004610136565b61005f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000806040518060600160405280602881526020016101ae602891398473ffffffffffffffffffffffffffffffffffffffff166040516020016100a392919061017b565b60405160208183030381529060405290508281516020830134f5915073ffffffffffffffffffffffffffffffffffffffff821661012f576040517f8caac80500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024810184905260440160405180910390fd5b5092915050565b6000806040838503121561014957600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461016d57600080fd5b946020939093013593505050565b6000835160005b8181101561019c5760208187018101518583015201610182565b50919091019182525060200191905056fe603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3a26469706673582212203e46c5b0f3a6bebab844eb5e4594ebb07eac1ae451f779e533ead5e744b1a2a664736f6c63430008120033", 49 | "linkReferences": {}, 50 | "deployedLinkReferences": {} 51 | } 52 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/Wallet.sol/Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Wallet", 4 | "sourceName": "contracts/Wallet.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122052bfa58d46a4be200bab062b01124719353438ddddea437973ed824200e2df4664736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122052bfa58d46a4be200bab062b01124719353438ddddea437973ed824200e2df4664736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/interfaces/IERC1271Wallet.sol/IERC1271Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1271Wallet", 4 | "sourceName": "contracts/interfaces/IERC1271Wallet.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "_hash", 11 | "type": "bytes32" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "_signature", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "isValidSignature", 20 | "outputs": [ 21 | { 22 | "internalType": "bytes4", 23 | "name": "magicValue", 24 | "type": "bytes4" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "bytes", 34 | "name": "_data", 35 | "type": "bytes" 36 | }, 37 | { 38 | "internalType": "bytes", 39 | "name": "_signature", 40 | "type": "bytes" 41 | } 42 | ], 43 | "name": "isValidSignature", 44 | "outputs": [ 45 | { 46 | "internalType": "bytes4", 47 | "name": "magicValue", 48 | "type": "bytes4" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | } 54 | ], 55 | "bytecode": "0x", 56 | "deployedBytecode": "0x", 57 | "linkReferences": {}, 58 | "deployedLinkReferences": {} 59 | } 60 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/interfaces/receivers/IERC1155Receiver.sol/IERC1155Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1155Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC1155Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256[]", 20 | "name": "", 21 | "type": "uint256[]" 22 | }, 23 | { 24 | "internalType": "uint256[]", 25 | "name": "", 26 | "type": "uint256[]" 27 | }, 28 | { 29 | "internalType": "bytes", 30 | "name": "", 31 | "type": "bytes" 32 | } 33 | ], 34 | "name": "onERC1155BatchReceived", 35 | "outputs": [ 36 | { 37 | "internalType": "bytes4", 38 | "name": "", 39 | "type": "bytes4" 40 | } 41 | ], 42 | "stateMutability": "nonpayable", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [ 47 | { 48 | "internalType": "address", 49 | "name": "", 50 | "type": "address" 51 | }, 52 | { 53 | "internalType": "address", 54 | "name": "", 55 | "type": "address" 56 | }, 57 | { 58 | "internalType": "uint256", 59 | "name": "", 60 | "type": "uint256" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "", 65 | "type": "uint256" 66 | }, 67 | { 68 | "internalType": "bytes", 69 | "name": "", 70 | "type": "bytes" 71 | } 72 | ], 73 | "name": "onERC1155Received", 74 | "outputs": [ 75 | { 76 | "internalType": "bytes4", 77 | "name": "", 78 | "type": "bytes4" 79 | } 80 | ], 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | } 84 | ], 85 | "bytecode": "0x", 86 | "deployedBytecode": "0x", 87 | "linkReferences": {}, 88 | "deployedLinkReferences": {} 89 | } 90 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/interfaces/receivers/IERC223Receiver.sol/IERC223Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC223Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC223Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "", 16 | "type": "uint256" 17 | }, 18 | { 19 | "internalType": "bytes", 20 | "name": "", 21 | "type": "bytes" 22 | } 23 | ], 24 | "name": "tokenFallback", 25 | "outputs": [], 26 | "stateMutability": "nonpayable", 27 | "type": "function" 28 | } 29 | ], 30 | "bytecode": "0x", 31 | "deployedBytecode": "0x", 32 | "linkReferences": {}, 33 | "deployedLinkReferences": {} 34 | } 35 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/interfaces/receivers/IERC721Receiver.sol/IERC721Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC721Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC721Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256", 20 | "name": "", 21 | "type": "uint256" 22 | }, 23 | { 24 | "internalType": "bytes", 25 | "name": "", 26 | "type": "bytes" 27 | } 28 | ], 29 | "name": "onERC721Received", 30 | "outputs": [ 31 | { 32 | "internalType": "bytes4", 33 | "name": "", 34 | "type": "bytes4" 35 | } 36 | ], 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | } 40 | ], 41 | "bytecode": "0x", 42 | "deployedBytecode": "0x", 43 | "linkReferences": {}, 44 | "deployedLinkReferences": {} 45 | } 46 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/mocks/ERC165CheckerMock.sol/ERC165CheckerMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ERC165CheckerMock", 4 | "sourceName": "contracts/mocks/ERC165CheckerMock.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_contract", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes4", 15 | "name": "_interfaceId", 16 | "type": "bytes4" 17 | } 18 | ], 19 | "name": "doesContractImplementInterface", 20 | "outputs": [ 21 | { 22 | "internalType": "bool", 23 | "name": "", 24 | "type": "bool" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | } 30 | ], 31 | "bytecode": "0x608060405234801561001057600080fd5b50610226806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e9c5438414610030575b600080fd5b61004361003e366004610179565b610057565b604051901515815260200160405180910390f35b60008080610085857f01ffc9a70000000000000000000000000000000000000000000000000000000061012c565b9092509050811580610095575080155b156100a557600092505050610126565b6100cf857fffffffff0000000000000000000000000000000000000000000000000000000061012c565b90925090508115806100e057508015155b156100f057600092505050610126565b6100fa858561012c565b909250905060018214801561010f5750806001145b1561011f57600192505050610126565b6000925050505b92915050565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa905190969095509350505050565b6000806040838503121561018c57600080fd5b823573ffffffffffffffffffffffffffffffffffffffff811681146101b057600080fd5b915060208301357fffffffff00000000000000000000000000000000000000000000000000000000811681146101e557600080fd5b80915050925092905056fea2646970667358221220cad7ad3f1dd01ac2d086945dd543c7f9b91eabb4054b6b6fe0ac49e9d652316e64736f6c63430008120033", 32 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e9c5438414610030575b600080fd5b61004361003e366004610179565b610057565b604051901515815260200160405180910390f35b60008080610085857f01ffc9a70000000000000000000000000000000000000000000000000000000061012c565b9092509050811580610095575080155b156100a557600092505050610126565b6100cf857fffffffff0000000000000000000000000000000000000000000000000000000061012c565b90925090508115806100e057508015155b156100f057600092505050610126565b6100fa858561012c565b909250905060018214801561010f5750806001145b1561011f57600192505050610126565b6000925050505b92915050565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa905190969095509350505050565b6000806040838503121561018c57600080fd5b823573ffffffffffffffffffffffffffffffffffffffff811681146101b057600080fd5b915060208301357fffffffff00000000000000000000000000000000000000000000000000000000811681146101e557600080fd5b80915050925092905056fea2646970667358221220cad7ad3f1dd01ac2d086945dd543c7f9b91eabb4054b6b6fe0ac49e9d652316e64736f6c63430008120033", 33 | "linkReferences": {}, 34 | "deployedLinkReferences": {} 35 | } 36 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/mocks/GasBurnerMock.sol/GasBurnerMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "GasBurnerMock", 4 | "sourceName": "contracts/mocks/GasBurnerMock.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": false, 11 | "internalType": "uint256", 12 | "name": "_val", 13 | "type": "uint256" 14 | } 15 | ], 16 | "name": "ProvidedGas", 17 | "type": "event" 18 | }, 19 | { 20 | "inputs": [ 21 | { 22 | "internalType": "uint256", 23 | "name": "_burn", 24 | "type": "uint256" 25 | } 26 | ], 27 | "name": "burnGas", 28 | "outputs": [], 29 | "stateMutability": "nonpayable", 30 | "type": "function" 31 | } 32 | ], 33 | "bytecode": "0x608060405234801561001057600080fd5b5061014e806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80634ad5d16f14610030575b600080fd5b61004361003e3660046100bf565b610045565b005b7fb5769a7bae701ca7bcd4ed2e803959a466a236728fcb0dc25fa836e3a38bc2225a60405190815260200160405180910390a16000805a90505b825a61008b90836100d8565b10156100ba5760408051602081018490520160405160208183030381529060405280519060200120915061007f565b505050565b6000602082840312156100d157600080fd5b5035919050565b81810381811115610112577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea2646970667358221220093291b6187a85653e5d8ad9af618c99979ff7bd17f7a6a2f40087e59a7eaaae64736f6c63430008120033", 34 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80634ad5d16f14610030575b600080fd5b61004361003e3660046100bf565b610045565b005b7fb5769a7bae701ca7bcd4ed2e803959a466a236728fcb0dc25fa836e3a38bc2225a60405190815260200160405180910390a16000805a90505b825a61008b90836100d8565b10156100ba5760408051602081018490520160405160208183030381529060405280519060200120915061007f565b505050565b6000602082840312156100d157600080fd5b5035919050565b81810381811115610112577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea2646970667358221220093291b6187a85653e5d8ad9af618c99979ff7bd17f7a6a2f40087e59a7eaaae64736f6c63430008120033", 35 | "linkReferences": {}, 36 | "deployedLinkReferences": {} 37 | } 38 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/mocks/HookMock.sol/HookMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "HookMock", 4 | "sourceName": "contracts/mocks/HookMock.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "uint256", 10 | "name": "_num", 11 | "type": "uint256" 12 | } 13 | ], 14 | "name": "onHookMockCall", 15 | "outputs": [ 16 | { 17 | "internalType": "uint256", 18 | "name": "", 19 | "type": "uint256" 20 | } 21 | ], 22 | "stateMutability": "pure", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x608060405234801561001057600080fd5b5060ea8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063b68fe6cf14602d575b600080fd5b603c6038366004605f565b604e565b60405190815260200160405180910390f35b600060598260026077565b92915050565b600060208284031215607057600080fd5b5035919050565b80820281158282048414176059577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220f9b1a4f4bf00938631890dcaba8b6a831befbdee3349e47bc935e59c1ae3ea1364736f6c63430008120033", 27 | "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063b68fe6cf14602d575b600080fd5b603c6038366004605f565b604e565b60405190815260200160405180910390f35b600060598260026077565b92915050565b600060208284031215607057600080fd5b5035919050565b80820281158282048414176059577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220f9b1a4f4bf00938631890dcaba8b6a831befbdee3349e47bc935e59c1ae3ea1364736f6c63430008120033", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/mocks/ModuleMock.sol/ModuleMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleMock", 4 | "sourceName": "contracts/mocks/ModuleMock.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [], 9 | "name": "Pong", 10 | "type": "event" 11 | }, 12 | { 13 | "inputs": [], 14 | "name": "ping", 15 | "outputs": [], 16 | "stateMutability": "nonpayable", 17 | "type": "function" 18 | } 19 | ], 20 | "bytecode": "0x6080604052348015600f57600080fd5b5060968061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80635c36b18614602d575b600080fd5b60336035565b005b6040517f4d015fcc2a20c24d7be893b3a525eac864b5a53a5f88ef7201a600465c73314e90600090a156fea26469706673582212203904834e87e80d5ef1cbc8cfe81668e9b8ce7423cf9d9e393ef4ccd7d8e5582e64736f6c63430008120033", 21 | "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80635c36b18614602d575b600080fd5b60336035565b005b6040517f4d015fcc2a20c24d7be893b3a525eac864b5a53a5f88ef7201a600465c73314e90600090a156fea26469706673582212203904834e87e80d5ef1cbc8cfe81668e9b8ce7423cf9d9e393ef4ccd7d8e5582e64736f6c63430008120033", 22 | "linkReferences": {}, 23 | "deployedLinkReferences": {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/Implementation.sol/Implementation.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Implementation", 4 | "sourceName": "contracts/modules/commons/Implementation.sol", 5 | "abi": [], 6 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea26469706673582212203b7171d353041344d97bfa62976322ade9881839c8d8fc0a436ff620f6adfa2164736f6c63430008120033", 7 | "deployedBytecode": "0x6080604052600080fdfea26469706673582212203b7171d353041344d97bfa62976322ade9881839c8d8fc0a436ff620f6adfa2164736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/ModuleERC165.sol/ModuleERC165.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleERC165", 4 | "sourceName": "contracts/modules/commons/ModuleERC165.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_interfaceID", 11 | "type": "bytes4" 12 | } 13 | ], 14 | "name": "supportsInterface", 15 | "outputs": [ 16 | { 17 | "internalType": "bool", 18 | "name": "", 19 | "type": "bool" 20 | } 21 | ], 22 | "stateMutability": "pure", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x", 27 | "deployedBytecode": "0x", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/ModuleNonce.sol/ModuleNonce.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleNonce", 4 | "sourceName": "contracts/modules/commons/ModuleNonce.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "uint256", 10 | "name": "_space", 11 | "type": "uint256" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "_provided", 16 | "type": "uint256" 17 | }, 18 | { 19 | "internalType": "uint256", 20 | "name": "_current", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "BadNonce", 25 | "type": "error" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": false, 32 | "internalType": "uint256", 33 | "name": "_space", 34 | "type": "uint256" 35 | }, 36 | { 37 | "indexed": false, 38 | "internalType": "uint256", 39 | "name": "_newNonce", 40 | "type": "uint256" 41 | } 42 | ], 43 | "name": "NonceChange", 44 | "type": "event" 45 | }, 46 | { 47 | "inputs": [], 48 | "name": "nonce", 49 | "outputs": [ 50 | { 51 | "internalType": "uint256", 52 | "name": "", 53 | "type": "uint256" 54 | } 55 | ], 56 | "stateMutability": "view", 57 | "type": "function" 58 | }, 59 | { 60 | "inputs": [ 61 | { 62 | "internalType": "uint256", 63 | "name": "_space", 64 | "type": "uint256" 65 | } 66 | ], 67 | "name": "readNonce", 68 | "outputs": [ 69 | { 70 | "internalType": "uint256", 71 | "name": "", 72 | "type": "uint256" 73 | } 74 | ], 75 | "stateMutability": "view", 76 | "type": "function" 77 | } 78 | ], 79 | "bytecode": "0x608060405234801561001057600080fd5b50610158806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638c3f55631461003b578063affed0e014610060575b600080fd5b61004e610049366004610109565b610068565b60405190815260200160405180910390f35b61004e61009a565b60006100947f8d0bf1fd623d628c741362c1289948e57b3e2905218c676d3e69abee36d6ae2e836100ab565b92915050565b60006100a66000610068565b905090565b60008083836040516020016100ca929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012054949350505050565b60006020828403121561011b57600080fd5b503591905056fea26469706673582212206e5fd9e5cfc12ecf5317977f97e2dad5498ba71fc8a71a481f25e825689a9d1364736f6c63430008120033", 80 | "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638c3f55631461003b578063affed0e014610060575b600080fd5b61004e610049366004610109565b610068565b60405190815260200160405180910390f35b61004e61009a565b60006100947f8d0bf1fd623d628c741362c1289948e57b3e2905218c676d3e69abee36d6ae2e836100ab565b92915050565b60006100a66000610068565b905090565b60008083836040516020016100ca929190918252602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012054949350505050565b60006020828403121561011b57600080fd5b503591905056fea26469706673582212206e5fd9e5cfc12ecf5317977f97e2dad5498ba71fc8a71a481f25e825689a9d1364736f6c63430008120033", 81 | "linkReferences": {}, 82 | "deployedLinkReferences": {} 83 | } 84 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/ModuleOnlyDelegatecall.sol/ModuleOnlyDelegatecall.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleOnlyDelegatecall", 4 | "sourceName": "contracts/modules/commons/ModuleOnlyDelegatecall.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "stateMutability": "nonpayable", 9 | "type": "constructor" 10 | }, 11 | { 12 | "inputs": [], 13 | "name": "OnlyDelegatecall", 14 | "type": "error" 15 | } 16 | ], 17 | "bytecode": "0x60a0604052348015600f57600080fd5b5030608052608051603f602960003960005050603f6000f3fe6080604052600080fdfea2646970667358221220cd5d7c7953e9f62653360defd85ac5914fc196d6fccccfa76107635e1a607ca764736f6c63430008120033", 18 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220cd5d7c7953e9f62653360defd85ac5914fc196d6fccccfa76107635e1a607ca764736f6c63430008120033", 19 | "linkReferences": {}, 20 | "deployedLinkReferences": {} 21 | } 22 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/ModuleSelfAuth.sol/ModuleSelfAuth.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleSelfAuth", 4 | "sourceName": "contracts/modules/commons/ModuleSelfAuth.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_sender", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "_self", 16 | "type": "address" 17 | } 18 | ], 19 | "name": "OnlySelfAuth", 20 | "type": "error" 21 | } 22 | ], 23 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220caabd715757d0c669e6583be5fe5d515ba9d8cde71ce64e3022d9c4df0d4213764736f6c63430008120033", 24 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220caabd715757d0c669e6583be5fe5d515ba9d8cde71ce64e3022d9c4df0d4213764736f6c63430008120033", 25 | "linkReferences": {}, 26 | "deployedLinkReferences": {} 27 | } 28 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/ModuleStorage.sol/ModuleStorage.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleStorage", 4 | "sourceName": "contracts/modules/commons/ModuleStorage.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220dd1498f556efd32c9f0f12272ba7f5e32975f772be1a52c8342d2d2ba6ff94b664736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220dd1498f556efd32c9f0f12272ba7f5e32975f772be1a52c8342d2d2ba6ff94b664736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/interfaces/IModuleAuth.sol/IModuleAuth.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleAuth", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleAuth.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "ImageHashIsZero", 9 | "type": "error" 10 | }, 11 | { 12 | "inputs": [ 13 | { 14 | "internalType": "bytes1", 15 | "name": "_type", 16 | "type": "bytes1" 17 | } 18 | ], 19 | "name": "InvalidSignatureType", 20 | "type": "error" 21 | }, 22 | { 23 | "anonymous": false, 24 | "inputs": [ 25 | { 26 | "indexed": false, 27 | "internalType": "bytes32", 28 | "name": "newImageHash", 29 | "type": "bytes32" 30 | } 31 | ], 32 | "name": "ImageHashUpdated", 33 | "type": "event" 34 | }, 35 | { 36 | "inputs": [ 37 | { 38 | "internalType": "bytes32", 39 | "name": "_digest", 40 | "type": "bytes32" 41 | }, 42 | { 43 | "internalType": "bytes", 44 | "name": "_signature", 45 | "type": "bytes" 46 | } 47 | ], 48 | "name": "signatureRecovery", 49 | "outputs": [ 50 | { 51 | "internalType": "uint256", 52 | "name": "threshold", 53 | "type": "uint256" 54 | }, 55 | { 56 | "internalType": "uint256", 57 | "name": "weight", 58 | "type": "uint256" 59 | }, 60 | { 61 | "internalType": "bytes32", 62 | "name": "imageHash", 63 | "type": "bytes32" 64 | }, 65 | { 66 | "internalType": "bytes32", 67 | "name": "subdigest", 68 | "type": "bytes32" 69 | }, 70 | { 71 | "internalType": "uint256", 72 | "name": "checkpoint", 73 | "type": "uint256" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | }, 79 | { 80 | "inputs": [ 81 | { 82 | "internalType": "bytes32", 83 | "name": "_imageHash", 84 | "type": "bytes32" 85 | } 86 | ], 87 | "name": "updateImageHash", 88 | "outputs": [], 89 | "stateMutability": "nonpayable", 90 | "type": "function" 91 | } 92 | ], 93 | "bytecode": "0x", 94 | "deployedBytecode": "0x", 95 | "linkReferences": {}, 96 | "deployedLinkReferences": {} 97 | } 98 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/interfaces/IModuleAuthUpgradable.sol/IModuleAuthUpgradable.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleAuthUpgradable", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleAuthUpgradable.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "imageHash", 9 | "outputs": [ 10 | { 11 | "internalType": "bytes32", 12 | "name": "", 13 | "type": "bytes32" 14 | } 15 | ], 16 | "stateMutability": "view", 17 | "type": "function" 18 | } 19 | ], 20 | "bytecode": "0x", 21 | "deployedBytecode": "0x", 22 | "linkReferences": {}, 23 | "deployedLinkReferences": {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/interfaces/IModuleCreator.sol/IModuleCreator.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleCreator", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleCreator.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes", 10 | "name": "_code", 11 | "type": "bytes" 12 | } 13 | ], 14 | "name": "CreateFailed", 15 | "type": "error" 16 | }, 17 | { 18 | "inputs": [ 19 | { 20 | "internalType": "bytes", 21 | "name": "_code", 22 | "type": "bytes" 23 | } 24 | ], 25 | "name": "createContract", 26 | "outputs": [ 27 | { 28 | "internalType": "address", 29 | "name": "addr", 30 | "type": "address" 31 | } 32 | ], 33 | "stateMutability": "payable", 34 | "type": "function" 35 | } 36 | ], 37 | "bytecode": "0x", 38 | "deployedBytecode": "0x", 39 | "linkReferences": {}, 40 | "deployedLinkReferences": {} 41 | } 42 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/interfaces/IModuleHooks.sol/IModuleHooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleHooks", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleHooks.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_signature", 11 | "type": "bytes4" 12 | } 13 | ], 14 | "name": "HookAlreadyExists", 15 | "type": "error" 16 | }, 17 | { 18 | "inputs": [ 19 | { 20 | "internalType": "bytes4", 21 | "name": "_signature", 22 | "type": "bytes4" 23 | } 24 | ], 25 | "name": "HookDoesNotExist", 26 | "type": "error" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": false, 33 | "internalType": "bytes4", 34 | "name": "_signature", 35 | "type": "bytes4" 36 | }, 37 | { 38 | "indexed": false, 39 | "internalType": "address", 40 | "name": "_implementation", 41 | "type": "address" 42 | } 43 | ], 44 | "name": "DefinedHook", 45 | "type": "event" 46 | }, 47 | { 48 | "inputs": [ 49 | { 50 | "internalType": "bytes4", 51 | "name": "_signature", 52 | "type": "bytes4" 53 | }, 54 | { 55 | "internalType": "address", 56 | "name": "_implementation", 57 | "type": "address" 58 | } 59 | ], 60 | "name": "addHook", 61 | "outputs": [], 62 | "stateMutability": "nonpayable", 63 | "type": "function" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "bytes4", 69 | "name": "_signature", 70 | "type": "bytes4" 71 | } 72 | ], 73 | "name": "readHook", 74 | "outputs": [ 75 | { 76 | "internalType": "address", 77 | "name": "", 78 | "type": "address" 79 | } 80 | ], 81 | "stateMutability": "view", 82 | "type": "function" 83 | }, 84 | { 85 | "inputs": [ 86 | { 87 | "internalType": "bytes4", 88 | "name": "_signature", 89 | "type": "bytes4" 90 | } 91 | ], 92 | "name": "removeHook", 93 | "outputs": [], 94 | "stateMutability": "nonpayable", 95 | "type": "function" 96 | } 97 | ], 98 | "bytecode": "0x", 99 | "deployedBytecode": "0x", 100 | "linkReferences": {}, 101 | "deployedLinkReferences": {} 102 | } 103 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/interfaces/IModuleUpdate.sol/IModuleUpdate.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleUpdate", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleUpdate.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_implementation", 11 | "type": "address" 12 | } 13 | ], 14 | "name": "InvalidImplementation", 15 | "type": "error" 16 | }, 17 | { 18 | "inputs": [ 19 | { 20 | "internalType": "address", 21 | "name": "_implementation", 22 | "type": "address" 23 | } 24 | ], 25 | "name": "updateImplementation", 26 | "outputs": [], 27 | "stateMutability": "nonpayable", 28 | "type": "function" 29 | } 30 | ], 31 | "bytecode": "0x", 32 | "deployedBytecode": "0x", 33 | "linkReferences": {}, 34 | "deployedLinkReferences": {} 35 | } 36 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/submodules/auth/SequenceBaseSig.sol/SequenceBaseSig.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SequenceBaseSig", 4 | "sourceName": "contracts/modules/commons/submodules/auth/SequenceBaseSig.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "_hash", 11 | "type": "bytes32" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "_addr", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "bytes", 20 | "name": "_signature", 21 | "type": "bytes" 22 | } 23 | ], 24 | "name": "InvalidNestedSignature", 25 | "type": "error" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "uint256", 31 | "name": "_flag", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "InvalidSignatureFlag", 36 | "type": "error" 37 | } 38 | ], 39 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122051d050e151e43f14b224bdac8815469e77826b24b4321fea4ed098a089dd534364736f6c63430008120033", 40 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122051d050e151e43f14b224bdac8815469e77826b24b4321fea4ed098a089dd534364736f6c63430008120033", 41 | "linkReferences": {}, 42 | "deployedLinkReferences": {} 43 | } 44 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/submodules/auth/SequenceDynamicSig.sol/SequenceDynamicSig.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SequenceDynamicSig", 4 | "sourceName": "contracts/modules/commons/submodules/auth/SequenceDynamicSig.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209121e54161aa9502d59f3aa7ebd924de709bd7c9c3ccf52f54af93435adfe1f264736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209121e54161aa9502d59f3aa7ebd924de709bd7c9c3ccf52f54af93435adfe1f264736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/submodules/auth/SequenceNoChainIdSig.sol/SequenceNoChainIdSig.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SequenceNoChainIdSig", 4 | "sourceName": "contracts/modules/commons/submodules/auth/SequenceNoChainIdSig.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220dcb6ad84adca1faf6759f58ec948b1faad096f2b6d8f3ba540ffd3996b9344c064736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220dcb6ad84adca1faf6759f58ec948b1faad096f2b6d8f3ba540ffd3996b9344c064736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/modules/commons/submodules/nonce/SubModuleNonce.sol/SubModuleNonce.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SubModuleNonce", 4 | "sourceName": "contracts/modules/commons/submodules/nonce/SubModuleNonce.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e631adfe43742d6e5857bfae44f6da7f61ae58f22bbf524bd6e831a1c960de1b64736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e631adfe43742d6e5857bfae44f6da7f61ae58f22bbf524bd6e831a1c960de1b64736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/LibAddress.sol/LibAddress.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibAddress", 4 | "sourceName": "contracts/utils/LibAddress.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122098bd9e2ee7c83a96d44eaaab9e475ab57bc2edd54b5997adf8f8975261f9f4ee64736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122098bd9e2ee7c83a96d44eaaab9e475ab57bc2edd54b5997adf8f8975261f9f4ee64736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/LibBytes.sol/LibBytes.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibBytes", 4 | "sourceName": "contracts/utils/LibBytes.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d66340f8534de5aeb4eb756f1ec6be295d9a723ac17083ae0789724b3893860e64736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d66340f8534de5aeb4eb756f1ec6be295d9a723ac17083ae0789724b3893860e64736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/LibBytesPointer.sol/LibBytesPointer.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibBytesPointer", 4 | "sourceName": "contracts/utils/LibBytesPointer.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207655e7e5b89018e1c3d02bc296dc70602f25136e6daddc3f1d8e9cf465d61ac664736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207655e7e5b89018e1c3d02bc296dc70602f25136e6daddc3f1d8e9cf465d61ac664736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/LibOptim.sol/LibOptim.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibOptim", 4 | "sourceName": "contracts/utils/LibOptim.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f3b52a0cb2eb660b4e44b6cceeeac3523ec653c2cc825d4e6c36962e51d2f81d64736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f3b52a0cb2eb660b4e44b6cceeeac3523ec653c2cc825d4e6c36962e51d2f81d64736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/LibString.sol/LibString.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibString", 4 | "sourceName": "contracts/utils/LibString.sol", 5 | "abi": [], 6 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209a3f2ae38a7b8d3d5f9889e283b454eb49aa128e329c19c4cce3ff8a80211acb64736f6c63430008120033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209a3f2ae38a7b8d3d5f9889e283b454eb49aa128e329c19c4cce3ff8a80211acb64736f6c63430008120033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts-v2/utils/SignatureValidator.sol/SignatureValidator.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SignatureValidator", 4 | "sourceName": "contracts/utils/SignatureValidator.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "EmptySignature", 9 | "type": "error" 10 | }, 11 | { 12 | "inputs": [ 13 | { 14 | "internalType": "bytes", 15 | "name": "_signature", 16 | "type": "bytes" 17 | }, 18 | { 19 | "internalType": "bytes32", 20 | "name": "_s", 21 | "type": "bytes32" 22 | } 23 | ], 24 | "name": "InvalidSValue", 25 | "type": "error" 26 | }, 27 | { 28 | "inputs": [ 29 | { 30 | "internalType": "bytes", 31 | "name": "_signature", 32 | "type": "bytes" 33 | } 34 | ], 35 | "name": "InvalidSignatureLength", 36 | "type": "error" 37 | }, 38 | { 39 | "inputs": [ 40 | { 41 | "internalType": "bytes", 42 | "name": "_signature", 43 | "type": "bytes" 44 | }, 45 | { 46 | "internalType": "uint256", 47 | "name": "_v", 48 | "type": "uint256" 49 | } 50 | ], 51 | "name": "InvalidVValue", 52 | "type": "error" 53 | }, 54 | { 55 | "inputs": [ 56 | { 57 | "internalType": "bytes", 58 | "name": "_signature", 59 | "type": "bytes" 60 | } 61 | ], 62 | "name": "SignerIsAddress0", 63 | "type": "error" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "bytes", 69 | "name": "_signature", 70 | "type": "bytes" 71 | }, 72 | { 73 | "internalType": "uint256", 74 | "name": "_type", 75 | "type": "uint256" 76 | }, 77 | { 78 | "internalType": "bool", 79 | "name": "_recoverMode", 80 | "type": "bool" 81 | } 82 | ], 83 | "name": "UnsupportedSignatureType", 84 | "type": "error" 85 | } 86 | ], 87 | "bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f107e932ba7bf1aaf33dfac83df6cd83089ca20bb3709794136e6428c3e4ea0164736f6c63430008120033", 88 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f107e932ba7bf1aaf33dfac83df6cd83089ca20bb3709794136e6428c3e4ea0164736f6c63430008120033", 89 | "linkReferences": {}, 90 | "deployedLinkReferences": {} 91 | } 92 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/Factory.sol/Factory.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Factory", 4 | "sourceName": "contracts/Factory.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_mainModule", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes32", 15 | "name": "_salt", 16 | "type": "bytes32" 17 | } 18 | ], 19 | "name": "deploy", 20 | "outputs": [ 21 | { 22 | "internalType": "address", 23 | "name": "_contract", 24 | "type": "address" 25 | } 26 | ], 27 | "stateMutability": "payable", 28 | "type": "function" 29 | } 30 | ], 31 | "bytecode": "0x608060405234801561001057600080fd5b506101c8806100206000396000f3fe60806040526004361061001e5760003560e01c806332c02a1414610023575b600080fd5b61005c6004803603604081101561003957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610085565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008060405180606001604052806028815260200161016b602891398473ffffffffffffffffffffffffffffffffffffffff166040516020018083805190602001908083835b6020831061010857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100cb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152938201905282519294508693508401905034f594935050505056fe603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3a26469706673582212209b0bce93afab3297b9ebf4e58fa642ef123d74bcbd3bdb4e48b662eb12b430ca64736f6c63430007060033", 32 | "deployedBytecode": "0x60806040526004361061001e5760003560e01c806332c02a1414610023575b600080fd5b61005c6004803603604081101561003957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610085565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008060405180606001604052806028815260200161016b602891398473ffffffffffffffffffffffffffffffffffffffff166040516020018083805190602001908083835b6020831061010857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100cb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052920193845250604080518085038152938201905282519294508693508401905034f594935050505056fe603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3a26469706673582212209b0bce93afab3297b9ebf4e58fa642ef123d74bcbd3bdb4e48b662eb12b430ca64736f6c63430007060033", 33 | "linkReferences": {}, 34 | "deployedLinkReferences": {} 35 | } 36 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/Wallet.sol/Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Wallet", 4 | "sourceName": "contracts/Wallet.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220203aadfe20d245b8742a4b45935c5779be6672217c8fccc461db72013f07d70164736f6c63430007060033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220203aadfe20d245b8742a4b45935c5779be6672217c8fccc461db72013f07d70164736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/interfaces/IERC1271Wallet.sol/IERC1271Wallet.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1271Wallet", 4 | "sourceName": "contracts/interfaces/IERC1271Wallet.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "_hash", 11 | "type": "bytes32" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "_signature", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "isValidSignature", 20 | "outputs": [ 21 | { 22 | "internalType": "bytes4", 23 | "name": "magicValue", 24 | "type": "bytes4" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "bytes", 34 | "name": "_data", 35 | "type": "bytes" 36 | }, 37 | { 38 | "internalType": "bytes", 39 | "name": "_signature", 40 | "type": "bytes" 41 | } 42 | ], 43 | "name": "isValidSignature", 44 | "outputs": [ 45 | { 46 | "internalType": "bytes4", 47 | "name": "magicValue", 48 | "type": "bytes4" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | } 54 | ], 55 | "bytecode": "0x", 56 | "deployedBytecode": "0x", 57 | "linkReferences": {}, 58 | "deployedLinkReferences": {} 59 | } 60 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/interfaces/receivers/IERC1155Receiver.sol/IERC1155Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC1155Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC1155Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256[]", 20 | "name": "", 21 | "type": "uint256[]" 22 | }, 23 | { 24 | "internalType": "uint256[]", 25 | "name": "", 26 | "type": "uint256[]" 27 | }, 28 | { 29 | "internalType": "bytes", 30 | "name": "", 31 | "type": "bytes" 32 | } 33 | ], 34 | "name": "onERC1155BatchReceived", 35 | "outputs": [ 36 | { 37 | "internalType": "bytes4", 38 | "name": "", 39 | "type": "bytes4" 40 | } 41 | ], 42 | "stateMutability": "nonpayable", 43 | "type": "function" 44 | }, 45 | { 46 | "inputs": [ 47 | { 48 | "internalType": "address", 49 | "name": "", 50 | "type": "address" 51 | }, 52 | { 53 | "internalType": "address", 54 | "name": "", 55 | "type": "address" 56 | }, 57 | { 58 | "internalType": "uint256", 59 | "name": "", 60 | "type": "uint256" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "", 65 | "type": "uint256" 66 | }, 67 | { 68 | "internalType": "bytes", 69 | "name": "", 70 | "type": "bytes" 71 | } 72 | ], 73 | "name": "onERC1155Received", 74 | "outputs": [ 75 | { 76 | "internalType": "bytes4", 77 | "name": "", 78 | "type": "bytes4" 79 | } 80 | ], 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | } 84 | ], 85 | "bytecode": "0x", 86 | "deployedBytecode": "0x", 87 | "linkReferences": {}, 88 | "deployedLinkReferences": {} 89 | } 90 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/interfaces/receivers/IERC223Receiver.sol/IERC223Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC223Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC223Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "uint256", 15 | "name": "", 16 | "type": "uint256" 17 | }, 18 | { 19 | "internalType": "bytes", 20 | "name": "", 21 | "type": "bytes" 22 | } 23 | ], 24 | "name": "tokenFallback", 25 | "outputs": [], 26 | "stateMutability": "nonpayable", 27 | "type": "function" 28 | } 29 | ], 30 | "bytecode": "0x", 31 | "deployedBytecode": "0x", 32 | "linkReferences": {}, 33 | "deployedLinkReferences": {} 34 | } 35 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/interfaces/receivers/IERC721Receiver.sol/IERC721Receiver.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IERC721Receiver", 4 | "sourceName": "contracts/interfaces/receivers/IERC721Receiver.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "", 16 | "type": "address" 17 | }, 18 | { 19 | "internalType": "uint256", 20 | "name": "", 21 | "type": "uint256" 22 | }, 23 | { 24 | "internalType": "bytes", 25 | "name": "", 26 | "type": "bytes" 27 | } 28 | ], 29 | "name": "onERC721Received", 30 | "outputs": [ 31 | { 32 | "internalType": "bytes4", 33 | "name": "", 34 | "type": "bytes4" 35 | } 36 | ], 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | } 40 | ], 41 | "bytecode": "0x", 42 | "deployedBytecode": "0x", 43 | "linkReferences": {}, 44 | "deployedLinkReferences": {} 45 | } 46 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/mocks/ERC165CheckerMock.sol/ERC165CheckerMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ERC165CheckerMock", 4 | "sourceName": "contracts/mocks/ERC165CheckerMock.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_contract", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes4", 15 | "name": "_interfaceId", 16 | "type": "bytes4" 17 | } 18 | ], 19 | "name": "doesContractImplementInterface", 20 | "outputs": [ 21 | { 22 | "internalType": "bool", 23 | "name": "", 24 | "type": "bool" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | } 30 | ], 31 | "bytecode": "0x608060405234801561001057600080fd5b506101f7806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e9c5438414610030575b600080fd5b61008b6004803603604081101561004657600080fd5b50803573ffffffffffffffffffffffffffffffffffffffff1690602001357fffffffff000000000000000000000000000000000000000000000000000000001661009f565b604080519115158252519081900360200190f35b600080806100cd857f01ffc9a700000000000000000000000000000000000000000000000000000000610174565b90925090508115806100dd575080155b156100ed5760009250505061016e565b610117857fffffffff00000000000000000000000000000000000000000000000000000000610174565b909250905081158061012857508015155b156101385760009250505061016e565b6101428585610174565b90925090506001821480156101575750806001145b156101675760019250505061016e565b6000925050505b92915050565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea2646970667358221220ffd8b9286609a59fb40fbfbdaf44c7adc2c9ebb4c714fe1f5324b9b4a5dd31c064736f6c63430007060033", 32 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063e9c5438414610030575b600080fd5b61008b6004803603604081101561004657600080fd5b50803573ffffffffffffffffffffffffffffffffffffffff1690602001357fffffffff000000000000000000000000000000000000000000000000000000001661009f565b604080519115158252519081900360200190f35b600080806100cd857f01ffc9a700000000000000000000000000000000000000000000000000000000610174565b90925090508115806100dd575080155b156100ed5760009250505061016e565b610117857fffffffff00000000000000000000000000000000000000000000000000000000610174565b909250905081158061012857508015155b156101385760009250505061016e565b6101428585610174565b90925090506001821480156101575750806001145b156101675760019250505061016e565b6000925050505b92915050565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea2646970667358221220ffd8b9286609a59fb40fbfbdaf44c7adc2c9ebb4c714fe1f5324b9b4a5dd31c064736f6c63430007060033", 33 | "linkReferences": {}, 34 | "deployedLinkReferences": {} 35 | } 36 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/mocks/GasBurnerMock.sol/GasBurnerMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "GasBurnerMock", 4 | "sourceName": "contracts/mocks/GasBurnerMock.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": false, 11 | "internalType": "uint256", 12 | "name": "_val", 13 | "type": "uint256" 14 | } 15 | ], 16 | "name": "ProvidedGas", 17 | "type": "event" 18 | }, 19 | { 20 | "inputs": [ 21 | { 22 | "internalType": "uint256", 23 | "name": "_burn", 24 | "type": "uint256" 25 | } 26 | ], 27 | "name": "burnGas", 28 | "outputs": [], 29 | "stateMutability": "nonpayable", 30 | "type": "function" 31 | } 32 | ], 33 | "bytecode": "0x608060405234801561001057600080fd5b5060f48061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634ad5d16f14602d575b600080fd5b604760048036036020811015604157600080fd5b50356049565b005b7fb5769a7bae701ca7bcd4ed2e803959a466a236728fcb0dc25fa836e3a38bc2225a60408051918252519081900360200190a16000805a90505b825a8203101560b95781604051602001808281526020019150506040516020818303038152906040528051906020012091506083565b50505056fea2646970667358221220fe3bc71490d62993ef7dffc7b978918d19a2693eb8a337dc0037b381bf59da8564736f6c63430007060033", 34 | "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80634ad5d16f14602d575b600080fd5b604760048036036020811015604157600080fd5b50356049565b005b7fb5769a7bae701ca7bcd4ed2e803959a466a236728fcb0dc25fa836e3a38bc2225a60408051918252519081900360200190a16000805a90505b825a8203101560b95781604051602001808281526020019150506040516020818303038152906040528051906020012091506083565b50505056fea2646970667358221220fe3bc71490d62993ef7dffc7b978918d19a2693eb8a337dc0037b381bf59da8564736f6c63430007060033", 35 | "linkReferences": {}, 36 | "deployedLinkReferences": {} 37 | } 38 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/mocks/HookMock.sol/HookMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "HookMock", 4 | "sourceName": "contracts/mocks/HookMock.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "uint256", 10 | "name": "_num", 11 | "type": "uint256" 12 | } 13 | ], 14 | "name": "onHookMockCall", 15 | "outputs": [ 16 | { 17 | "internalType": "uint256", 18 | "name": "", 19 | "type": "uint256" 20 | } 21 | ], 22 | "stateMutability": "pure", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x6080604052348015600f57600080fd5b5060958061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063b68fe6cf14602d575b600080fd5b604760048036036020811015604157600080fd5b50356059565b60408051918252519081900360200190f35b6002029056fea264697066735822122029a1e312dcefda1bc536e0d465373c6d97a053313911fb1a8d3e3c7806aeac1764736f6c63430007060033", 27 | "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063b68fe6cf14602d575b600080fd5b604760048036036020811015604157600080fd5b50356059565b60408051918252519081900360200190f35b6002029056fea264697066735822122029a1e312dcefda1bc536e0d465373c6d97a053313911fb1a8d3e3c7806aeac1764736f6c63430007060033", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/mocks/ModuleMock.sol/ModuleMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleMock", 4 | "sourceName": "contracts/mocks/ModuleMock.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [], 9 | "name": "Pong", 10 | "type": "event" 11 | }, 12 | { 13 | "inputs": [], 14 | "name": "ping", 15 | "outputs": [], 16 | "stateMutability": "nonpayable", 17 | "type": "function" 18 | } 19 | ], 20 | "bytecode": "0x6080604052348015600f57600080fd5b5060968061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80635c36b18614602d575b600080fd5b60336035565b005b6040517f4d015fcc2a20c24d7be893b3a525eac864b5a53a5f88ef7201a600465c73314e90600090a156fea26469706673582212201d4403fc62713fef9a01884050dcb3a8fdc4556f1617d27e2024feff5616936364736f6c63430007060033", 21 | "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80635c36b18614602d575b600080fd5b60336035565b005b6040517f4d015fcc2a20c24d7be893b3a525eac864b5a53a5f88ef7201a600465c73314e90600090a156fea26469706673582212201d4403fc62713fef9a01884050dcb3a8fdc4556f1617d27e2024feff5616936364736f6c63430007060033", 22 | "linkReferences": {}, 23 | "deployedLinkReferences": {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/Implementation.sol/Implementation.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "Implementation", 4 | "sourceName": "contracts/modules/commons/Implementation.sol", 5 | "abi": [], 6 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220bae35032c4ed14c6edbc34bd83e444d535c192f734c87a0220cb5775e33316db64736f6c63430007060033", 7 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220bae35032c4ed14c6edbc34bd83e444d535c192f734c87a0220cb5775e33316db64736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleAuth.sol/ModuleAuth.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleAuth", 4 | "sourceName": "contracts/modules/commons/ModuleAuth.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes32", 10 | "name": "_hash", 11 | "type": "bytes32" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "_signatures", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "isValidSignature", 20 | "outputs": [ 21 | { 22 | "internalType": "bytes4", 23 | "name": "", 24 | "type": "bytes4" 25 | } 26 | ], 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "bytes", 34 | "name": "_data", 35 | "type": "bytes" 36 | }, 37 | { 38 | "internalType": "bytes", 39 | "name": "_signatures", 40 | "type": "bytes" 41 | } 42 | ], 43 | "name": "isValidSignature", 44 | "outputs": [ 45 | { 46 | "internalType": "bytes4", 47 | "name": "", 48 | "type": "bytes4" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | }, 54 | { 55 | "inputs": [ 56 | { 57 | "internalType": "bytes4", 58 | "name": "_interfaceID", 59 | "type": "bytes4" 60 | } 61 | ], 62 | "name": "supportsInterface", 63 | "outputs": [ 64 | { 65 | "internalType": "bool", 66 | "name": "", 67 | "type": "bool" 68 | } 69 | ], 70 | "stateMutability": "pure", 71 | "type": "function" 72 | } 73 | ], 74 | "bytecode": "0x", 75 | "deployedBytecode": "0x", 76 | "linkReferences": {}, 77 | "deployedLinkReferences": {} 78 | } 79 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleAuthFixed.sol/ModuleAuthFixed.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleAuthFixed", 4 | "sourceName": "contracts/modules/commons/ModuleAuthFixed.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "FACTORY", 9 | "outputs": [ 10 | { 11 | "internalType": "address", 12 | "name": "", 13 | "type": "address" 14 | } 15 | ], 16 | "stateMutability": "view", 17 | "type": "function" 18 | }, 19 | { 20 | "inputs": [], 21 | "name": "INIT_CODE_HASH", 22 | "outputs": [ 23 | { 24 | "internalType": "bytes32", 25 | "name": "", 26 | "type": "bytes32" 27 | } 28 | ], 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [ 34 | { 35 | "internalType": "bytes32", 36 | "name": "_hash", 37 | "type": "bytes32" 38 | }, 39 | { 40 | "internalType": "bytes", 41 | "name": "_signatures", 42 | "type": "bytes" 43 | } 44 | ], 45 | "name": "isValidSignature", 46 | "outputs": [ 47 | { 48 | "internalType": "bytes4", 49 | "name": "", 50 | "type": "bytes4" 51 | } 52 | ], 53 | "stateMutability": "view", 54 | "type": "function" 55 | }, 56 | { 57 | "inputs": [ 58 | { 59 | "internalType": "bytes", 60 | "name": "_data", 61 | "type": "bytes" 62 | }, 63 | { 64 | "internalType": "bytes", 65 | "name": "_signatures", 66 | "type": "bytes" 67 | } 68 | ], 69 | "name": "isValidSignature", 70 | "outputs": [ 71 | { 72 | "internalType": "bytes4", 73 | "name": "", 74 | "type": "bytes4" 75 | } 76 | ], 77 | "stateMutability": "view", 78 | "type": "function" 79 | }, 80 | { 81 | "inputs": [ 82 | { 83 | "internalType": "bytes4", 84 | "name": "_interfaceID", 85 | "type": "bytes4" 86 | } 87 | ], 88 | "name": "supportsInterface", 89 | "outputs": [ 90 | { 91 | "internalType": "bool", 92 | "name": "", 93 | "type": "bool" 94 | } 95 | ], 96 | "stateMutability": "pure", 97 | "type": "function" 98 | } 99 | ], 100 | "bytecode": "0x", 101 | "deployedBytecode": "0x", 102 | "linkReferences": {}, 103 | "deployedLinkReferences": {} 104 | } 105 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleAuthUpgradable.sol/ModuleAuthUpgradable.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleAuthUpgradable", 4 | "sourceName": "contracts/modules/commons/ModuleAuthUpgradable.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": false, 11 | "internalType": "bytes32", 12 | "name": "newImageHash", 13 | "type": "bytes32" 14 | } 15 | ], 16 | "name": "ImageHashUpdated", 17 | "type": "event" 18 | }, 19 | { 20 | "inputs": [], 21 | "name": "imageHash", 22 | "outputs": [ 23 | { 24 | "internalType": "bytes32", 25 | "name": "", 26 | "type": "bytes32" 27 | } 28 | ], 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [ 34 | { 35 | "internalType": "bytes32", 36 | "name": "_hash", 37 | "type": "bytes32" 38 | }, 39 | { 40 | "internalType": "bytes", 41 | "name": "_signatures", 42 | "type": "bytes" 43 | } 44 | ], 45 | "name": "isValidSignature", 46 | "outputs": [ 47 | { 48 | "internalType": "bytes4", 49 | "name": "", 50 | "type": "bytes4" 51 | } 52 | ], 53 | "stateMutability": "view", 54 | "type": "function" 55 | }, 56 | { 57 | "inputs": [ 58 | { 59 | "internalType": "bytes", 60 | "name": "_data", 61 | "type": "bytes" 62 | }, 63 | { 64 | "internalType": "bytes", 65 | "name": "_signatures", 66 | "type": "bytes" 67 | } 68 | ], 69 | "name": "isValidSignature", 70 | "outputs": [ 71 | { 72 | "internalType": "bytes4", 73 | "name": "", 74 | "type": "bytes4" 75 | } 76 | ], 77 | "stateMutability": "view", 78 | "type": "function" 79 | }, 80 | { 81 | "inputs": [ 82 | { 83 | "internalType": "bytes4", 84 | "name": "_interfaceID", 85 | "type": "bytes4" 86 | } 87 | ], 88 | "name": "supportsInterface", 89 | "outputs": [ 90 | { 91 | "internalType": "bool", 92 | "name": "", 93 | "type": "bool" 94 | } 95 | ], 96 | "stateMutability": "pure", 97 | "type": "function" 98 | }, 99 | { 100 | "inputs": [ 101 | { 102 | "internalType": "bytes32", 103 | "name": "_imageHash", 104 | "type": "bytes32" 105 | } 106 | ], 107 | "name": "updateImageHash", 108 | "outputs": [], 109 | "stateMutability": "nonpayable", 110 | "type": "function" 111 | } 112 | ], 113 | "bytecode": "0x", 114 | "deployedBytecode": "0x", 115 | "linkReferences": {}, 116 | "deployedLinkReferences": {} 117 | } 118 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleERC165.sol/ModuleERC165.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleERC165", 4 | "sourceName": "contracts/modules/commons/ModuleERC165.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_interfaceID", 11 | "type": "bytes4" 12 | } 13 | ], 14 | "name": "supportsInterface", 15 | "outputs": [ 16 | { 17 | "internalType": "bool", 18 | "name": "", 19 | "type": "bool" 20 | } 21 | ], 22 | "stateMutability": "pure", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x", 27 | "deployedBytecode": "0x", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleIgnoreAuthUpgradable.sol/ModuleIgnoreAuthUpgradable.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleIgnoreAuthUpgradable", 4 | "sourceName": "contracts/modules/commons/ModuleIgnoreAuthUpgradable.sol", 5 | "abi": [ 6 | { 7 | "anonymous": false, 8 | "inputs": [ 9 | { 10 | "indexed": false, 11 | "internalType": "bytes32", 12 | "name": "newImageHash", 13 | "type": "bytes32" 14 | } 15 | ], 16 | "name": "ImageHashUpdated", 17 | "type": "event" 18 | }, 19 | { 20 | "inputs": [], 21 | "name": "imageHash", 22 | "outputs": [ 23 | { 24 | "internalType": "bytes32", 25 | "name": "", 26 | "type": "bytes32" 27 | } 28 | ], 29 | "stateMutability": "view", 30 | "type": "function" 31 | }, 32 | { 33 | "inputs": [ 34 | { 35 | "internalType": "bytes32", 36 | "name": "_hash", 37 | "type": "bytes32" 38 | }, 39 | { 40 | "internalType": "bytes", 41 | "name": "_signatures", 42 | "type": "bytes" 43 | } 44 | ], 45 | "name": "isValidSignature", 46 | "outputs": [ 47 | { 48 | "internalType": "bytes4", 49 | "name": "", 50 | "type": "bytes4" 51 | } 52 | ], 53 | "stateMutability": "view", 54 | "type": "function" 55 | }, 56 | { 57 | "inputs": [ 58 | { 59 | "internalType": "bytes", 60 | "name": "_data", 61 | "type": "bytes" 62 | }, 63 | { 64 | "internalType": "bytes", 65 | "name": "_signatures", 66 | "type": "bytes" 67 | } 68 | ], 69 | "name": "isValidSignature", 70 | "outputs": [ 71 | { 72 | "internalType": "bytes4", 73 | "name": "", 74 | "type": "bytes4" 75 | } 76 | ], 77 | "stateMutability": "view", 78 | "type": "function" 79 | }, 80 | { 81 | "inputs": [ 82 | { 83 | "internalType": "bytes4", 84 | "name": "_interfaceID", 85 | "type": "bytes4" 86 | } 87 | ], 88 | "name": "supportsInterface", 89 | "outputs": [ 90 | { 91 | "internalType": "bool", 92 | "name": "", 93 | "type": "bool" 94 | } 95 | ], 96 | "stateMutability": "pure", 97 | "type": "function" 98 | }, 99 | { 100 | "inputs": [ 101 | { 102 | "internalType": "bytes32", 103 | "name": "_imageHash", 104 | "type": "bytes32" 105 | } 106 | ], 107 | "name": "updateImageHash", 108 | "outputs": [], 109 | "stateMutability": "nonpayable", 110 | "type": "function" 111 | } 112 | ], 113 | "bytecode": "0x", 114 | "deployedBytecode": "0x", 115 | "linkReferences": {}, 116 | "deployedLinkReferences": {} 117 | } 118 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleSelfAuth.sol/ModuleSelfAuth.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleSelfAuth", 4 | "sourceName": "contracts/modules/commons/ModuleSelfAuth.sol", 5 | "abi": [], 6 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220f0984fadf5ac9e03d398fff3f454e36cc469835e62f8126d11433a7959a7554a64736f6c63430007060033", 7 | "deployedBytecode": "0x6080604052600080fdfea2646970667358221220f0984fadf5ac9e03d398fff3f454e36cc469835e62f8126d11433a7959a7554a64736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/ModuleStorage.sol/ModuleStorage.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "ModuleStorage", 4 | "sourceName": "contracts/modules/commons/ModuleStorage.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122094247b90b4c97b2bddb096f58531bc8febf82a04889cb36a85af209c822b36e064736f6c63430007060033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122094247b90b4c97b2bddb096f58531bc8febf82a04889cb36a85af209c822b36e064736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/interfaces/IModuleAuth.sol/IModuleAuth.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleAuth", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleAuth.sol", 5 | "abi": [], 6 | "bytecode": "0x", 7 | "deployedBytecode": "0x", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/interfaces/IModuleAuthUpgradable.sol/IModuleAuthUpgradable.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleAuthUpgradable", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleAuthUpgradable.sol", 5 | "abi": [ 6 | { 7 | "inputs": [], 8 | "name": "imageHash", 9 | "outputs": [ 10 | { 11 | "internalType": "bytes32", 12 | "name": "", 13 | "type": "bytes32" 14 | } 15 | ], 16 | "stateMutability": "view", 17 | "type": "function" 18 | }, 19 | { 20 | "inputs": [ 21 | { 22 | "internalType": "bytes32", 23 | "name": "_imageHash", 24 | "type": "bytes32" 25 | } 26 | ], 27 | "name": "updateImageHash", 28 | "outputs": [], 29 | "stateMutability": "nonpayable", 30 | "type": "function" 31 | } 32 | ], 33 | "bytecode": "0x", 34 | "deployedBytecode": "0x", 35 | "linkReferences": {}, 36 | "deployedLinkReferences": {} 37 | } 38 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/interfaces/IModuleCreator.sol/IModuleCreator.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleCreator", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleCreator.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes", 10 | "name": "_code", 11 | "type": "bytes" 12 | } 13 | ], 14 | "name": "createContract", 15 | "outputs": [ 16 | { 17 | "internalType": "address", 18 | "name": "addr", 19 | "type": "address" 20 | } 21 | ], 22 | "stateMutability": "payable", 23 | "type": "function" 24 | } 25 | ], 26 | "bytecode": "0x", 27 | "deployedBytecode": "0x", 28 | "linkReferences": {}, 29 | "deployedLinkReferences": {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/interfaces/IModuleHooks.sol/IModuleHooks.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleHooks", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleHooks.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "bytes4", 10 | "name": "_signature", 11 | "type": "bytes4" 12 | }, 13 | { 14 | "internalType": "address", 15 | "name": "_implementation", 16 | "type": "address" 17 | } 18 | ], 19 | "name": "addHook", 20 | "outputs": [], 21 | "stateMutability": "nonpayable", 22 | "type": "function" 23 | }, 24 | { 25 | "inputs": [ 26 | { 27 | "internalType": "bytes4", 28 | "name": "_signature", 29 | "type": "bytes4" 30 | } 31 | ], 32 | "name": "readHook", 33 | "outputs": [ 34 | { 35 | "internalType": "address", 36 | "name": "", 37 | "type": "address" 38 | } 39 | ], 40 | "stateMutability": "view", 41 | "type": "function" 42 | }, 43 | { 44 | "inputs": [ 45 | { 46 | "internalType": "bytes4", 47 | "name": "_signature", 48 | "type": "bytes4" 49 | } 50 | ], 51 | "name": "removeHook", 52 | "outputs": [], 53 | "stateMutability": "nonpayable", 54 | "type": "function" 55 | } 56 | ], 57 | "bytecode": "0x", 58 | "deployedBytecode": "0x", 59 | "linkReferences": {}, 60 | "deployedLinkReferences": {} 61 | } 62 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/commons/interfaces/IModuleUpdate.sol/IModuleUpdate.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "IModuleUpdate", 4 | "sourceName": "contracts/modules/commons/interfaces/IModuleUpdate.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_implementation", 11 | "type": "address" 12 | } 13 | ], 14 | "name": "updateImplementation", 15 | "outputs": [], 16 | "stateMutability": "nonpayable", 17 | "type": "function" 18 | } 19 | ], 20 | "bytecode": "0x", 21 | "deployedBytecode": "0x", 22 | "linkReferences": {}, 23 | "deployedLinkReferences": {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/modules/utils/GasEstimator.sol/GasEstimator.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "GasEstimator", 4 | "sourceName": "contracts/modules/utils/GasEstimator.sol", 5 | "abi": [ 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "_to", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "_data", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "estimate", 20 | "outputs": [ 21 | { 22 | "internalType": "bool", 23 | "name": "success", 24 | "type": "bool" 25 | }, 26 | { 27 | "internalType": "bytes", 28 | "name": "result", 29 | "type": "bytes" 30 | }, 31 | { 32 | "internalType": "uint256", 33 | "name": "gas", 34 | "type": "uint256" 35 | } 36 | ], 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | } 40 | ], 41 | "bytecode": "0x608060405234801561001057600080fd5b50610208806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630eb34cd314610030575b600080fd5b6100bd6004803603604081101561004657600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561007e57600080fd5b82018360208201111561009057600080fd5b803590602001918460018302840111640100000000831117156100b257600080fd5b509092509050610145565b60405180841515815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b838110156101085781810151838201526020016100f0565b50505050905090810190601f1680156101355780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b600060606000805a90508673ffffffffffffffffffffffffffffffffffffffff168686604051808383808284376040519201945060009350909150508083038183865af19150503d80600081146101b8576040519150601f19603f3d011682016040523d82523d6000602084013e6101bd565b606091505b5090945092505a81039150509350935093905056fea26469706673582212202294382602e928b6c962b89f8f706713a73b32b446a191ebcfa9b77f7004d19064736f6c63430007060033", 42 | "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80630eb34cd314610030575b600080fd5b6100bd6004803603604081101561004657600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561007e57600080fd5b82018360208201111561009057600080fd5b803590602001918460018302840111640100000000831117156100b257600080fd5b509092509050610145565b60405180841515815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b838110156101085781810151838201526020016100f0565b50505050905090810190601f1680156101355780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b600060606000805a90508673ffffffffffffffffffffffffffffffffffffffff168686604051808383808284376040519201945060009350909150508083038183865af19150503d80600081146101b8576040519150601f19603f3d011682016040523d82523d6000602084013e6101bd565b606091505b5090945092505a81039150509350935093905056fea26469706673582212202294382602e928b6c962b89f8f706713a73b32b446a191ebcfa9b77f7004d19064736f6c63430007060033", 43 | "linkReferences": {}, 44 | "deployedLinkReferences": {} 45 | } 46 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/utils/LibAddress.sol/LibAddress.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibAddress", 4 | "sourceName": "contracts/utils/LibAddress.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202a95e8c7366103cb14200c1d797e311e6de9cdc284df796f16a2375fcee5215764736f6c63430007060033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202a95e8c7366103cb14200c1d797e311e6de9cdc284df796f16a2375fcee5215764736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/utils/LibBytes.sol/LibBytes.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "LibBytes", 4 | "sourceName": "contracts/utils/LibBytes.sol", 5 | "abi": [], 6 | "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220820a315b2e2d815ea66570fe28915249047e6787e8dd3ce1436d2900c2018a5964736f6c63430007060033", 7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220820a315b2e2d815ea66570fe28915249047e6787e8dd3ce1436d2900c2018a5964736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/artifacts/wallet-contracts/utils/SignatureValidator.sol/SignatureValidator.json: -------------------------------------------------------------------------------- 1 | { 2 | "_format": "hh-sol-artifact-1", 3 | "contractName": "SignatureValidator", 4 | "sourceName": "contracts/utils/SignatureValidator.sol", 5 | "abi": [], 6 | "bytecode": "0x6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea26469706673582212208d54edf10c68fba231fbb8dddf675fdae19b4581c53958e8b4fd5d9387f0d16164736f6c63430007060033", 7 | "deployedBytecode": "0x6080604052600080fdfea26469706673582212208d54edf10c68fba231fbb8dddf675fdae19b4581c53958e8b4fd5d9387f0d16164736f6c63430007060033", 8 | "linkReferences": {}, 9 | "deployedLinkReferences": {} 10 | } 11 | -------------------------------------------------------------------------------- /contracts/gen/ierc1271/ierc1271.go: -------------------------------------------------------------------------------- 1 | package ierc1271 2 | 3 | var IsValidSignatureBytes32_MagicReturnValue = "0x1626ba7e" 4 | -------------------------------------------------------------------------------- /contracts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "contracts", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "none", 6 | "scripts": { 7 | "gen": "pnpm artifacts", 8 | "artifacts": "pnpm artifacts-copy:erc20 && pnpm artifacts-copy:erc721 && pnpm artifacts-copy:erc6909 && pnpm generate", 9 | "artifacts-copy:erc20": "rm -rf ./artifacts/erc20 && mkdir ./artifacts/erc20 && cp -r ./node_modules/@openzeppelin/contracts/build/contracts/IERC20*.json ./artifacts/erc20", 10 | "artifacts-copy:erc721": "rm -rf ./artifacts/erc721 && mkdir ./artifacts/erc721 && cp -r ./node_modules/@openzeppelin/contracts/build/contracts/IERC721*.json ./artifacts/erc721", 11 | "artifacts-copy:erc6909": "rm -rf ./artifacts/erc6909 && mkdir ./artifacts/erc6909 && cp -r ./node_modules/@openzeppelin/contracts/build/contracts/IERC6909*.json ./artifacts/erc6909", 12 | "generate": "go generate ./gen" 13 | }, 14 | "devDependencies": { 15 | "@openzeppelin/contracts": "^5.3.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /contracts/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '9.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | importers: 8 | 9 | .: 10 | devDependencies: 11 | '@openzeppelin/contracts': 12 | specifier: ^5.3.0 13 | version: 5.3.0 14 | 15 | packages: 16 | 17 | '@openzeppelin/contracts@5.3.0': 18 | resolution: {integrity: sha512-zj/KGoW7zxWUE8qOI++rUM18v+VeLTTzKs/DJFkSzHpQFPD/jKKF0TrMxBfGLl3kpdELCNccvB3zmofSzm4nlA==} 19 | 20 | snapshots: 21 | 22 | '@openzeppelin/contracts@5.3.0': {} 23 | -------------------------------------------------------------------------------- /core/core_test.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/0xsequence/ethkit/go-ethereum/common" 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | func TestSigningOrchestrator(t *testing.T) { 12 | signers := map[common.Address]uint16{ 13 | common.HexToAddress("0x00"): 1, 14 | common.HexToAddress("0x01"): 1, 15 | common.HexToAddress("0x02"): 1, 16 | } 17 | 18 | mockSignatures := map[common.Address]struct { 19 | sigType SignerSignatureType 20 | sig []byte 21 | }{ 22 | common.HexToAddress("0x00"): { 23 | sigType: SignerSignatureTypeEthSign, 24 | sig: []byte("signature"), 25 | }, 26 | common.HexToAddress("0x01"): { 27 | sigType: SignerSignatureTypeEthSign, 28 | sig: []byte("signature2"), 29 | }, 30 | common.HexToAddress("0x02"): { 31 | sigType: SignerSignatureTypeEIP1271, 32 | sig: []byte("signature3"), 33 | }, 34 | } 35 | 36 | signer0Retried := false 37 | signingFunction := func(ctx context.Context, signer common.Address, signatures []SignerSignature) (SignerSignatureType, []byte, error) { 38 | if signer == common.HexToAddress("0x00") && !signer0Retried { 39 | signer0Retried = true 40 | return 0, nil, ErrSigningFunctionNotReady 41 | } 42 | 43 | return mockSignatures[signer].sigType, mockSignatures[signer].sig, nil 44 | } 45 | 46 | signaturesChan := SigningOrchestrator(context.Background(), signers, signingFunction) 47 | 48 | signatures := make([]SignerSignature, 0, len(signers)) 49 | for i := 0; i < len(signers); i++ { 50 | signature := <-signaturesChan 51 | signatures = append(signatures, signature) 52 | } 53 | 54 | assert.True(t, signer0Retried) 55 | for _, signature := range signatures { 56 | assert.Equal(t, mockSignatures[signature.Signer].sigType, signature.Type) 57 | assert.Equal(t, mockSignatures[signature.Signer].sig, signature.Signature) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /deployer/deployer_test.go: -------------------------------------------------------------------------------- 1 | package deployer_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/0xsequence/go-sequence/contracts" 8 | "github.com/0xsequence/go-sequence/deployer" 9 | "github.com/0xsequence/go-sequence/testutil" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | var ( 14 | testChain *testutil.TestChain 15 | ) 16 | 17 | func init() { 18 | var err error 19 | testChain, err = testutil.NewTestChain() 20 | if err != nil { 21 | panic(err) 22 | } 23 | if err := testChain.Connect(); err != nil { 24 | panic(err) 25 | } 26 | } 27 | 28 | func TestDeployer(t *testing.T) { 29 | assert.Equal(t, testChain.ChainID().Uint64(), uint64(1337)) 30 | 31 | testWallet := testChain.MustWallet(5) 32 | 33 | ud, err := deployer.NewUniversalDeployer(testWallet) 34 | assert.NoError(t, err) 35 | 36 | testSequenceContext := testutil.V1SequenceContext() 37 | 38 | // Deploy sequence wallet-contract factory and ensure it equals the expected value in testutil 39 | walletFactoryAddress, err := ud.Deploy(context.Background(), contracts.V1.WalletFactory.ABI, contracts.V1.WalletFactory.Bin, 0, nil, 1000000) 40 | assert.NoError(t, err) 41 | assert.Equal(t, testSequenceContext.FactoryAddress, walletFactoryAddress) 42 | } 43 | -------------------------------------------------------------------------------- /deployer/eip2740_deployer_test.go: -------------------------------------------------------------------------------- 1 | package deployer_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/0xsequence/go-sequence/contracts" 8 | "github.com/0xsequence/go-sequence/deployer" 9 | "github.com/0xsequence/go-sequence/testutil" 10 | "github.com/stretchr/testify/assert" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func TestEIP2740Deployer(t *testing.T) { 15 | assert.Equal(t, testChain.ChainID().Uint64(), uint64(1337)) 16 | 17 | testWallet := testChain.MustWallet(5) 18 | 19 | eip2740Deployer, err := deployer.NewEIP2740Deployer(testWallet) 20 | require.NoError(t, err) 21 | 22 | testSequenceContext := testutil.V2SequenceContext() 23 | 24 | // Deploy sequence wallet-contract factory and ensure it equals the expected value in testutil 25 | walletFactoryAddress, err := eip2740Deployer.Deploy(context.Background(), contracts.V2.WalletFactory.ABI, contracts.V2.WalletFactory.Bin, 0, nil, 1000000) 26 | assert.NoError(t, err) 27 | assert.Equal(t, testSequenceContext.FactoryAddress, walletFactoryAddress) 28 | } 29 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/0xsequence/go-sequence 2 | 3 | go 1.23.0 4 | 5 | toolchain go1.24.1 6 | 7 | // replace github.com/0xsequence/ethkit => /Users/peter/Dev/0xsequence/ethkit 8 | 9 | require ( 10 | github.com/0xsequence/ethkit v1.30.7 11 | github.com/0xsequence/go-ethauth v0.14.0 12 | github.com/BurntSushi/toml v1.2.1 13 | github.com/davecgh/go-spew v1.1.1 14 | github.com/gibson042/canonicaljson-go v1.0.3 15 | github.com/goware/cachestore v0.9.0 16 | github.com/goware/logger v0.3.0 17 | github.com/shopspring/decimal v1.4.0 18 | github.com/stretchr/testify v1.9.0 19 | go.uber.org/mock v0.5.0 20 | ) 21 | 22 | require ( 23 | github.com/Microsoft/go-winio v0.6.2 // indirect 24 | github.com/bits-and-blooms/bitset v1.19.1 // indirect 25 | github.com/btcsuite/btcd v0.24.2 // indirect 26 | github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect 27 | github.com/btcsuite/btcd/btcutil v1.1.6 // indirect 28 | github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect 29 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 30 | github.com/consensys/bavard v0.1.24 // indirect 31 | github.com/consensys/gnark-crypto v0.14.0 // indirect 32 | github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect 33 | github.com/deckarep/golang-set/v2 v2.7.0 // indirect 34 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect 35 | github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect 36 | github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect 37 | github.com/google/uuid v1.6.0 // indirect 38 | github.com/gorilla/websocket v1.5.3 // indirect 39 | github.com/goware/breaker v0.1.2 // indirect 40 | github.com/goware/calc v0.2.0 // indirect 41 | github.com/goware/channel v0.4.1 // indirect 42 | github.com/goware/singleflight v0.2.0 // indirect 43 | github.com/goware/superr v0.0.2 // indirect 44 | github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect 45 | github.com/holiman/uint256 v1.3.2 // indirect 46 | github.com/mmcloughlin/addchain v0.4.0 // indirect 47 | github.com/pmezard/go-difflib v1.0.0 // indirect 48 | github.com/redis/go-redis/v9 v9.6.1 // indirect 49 | github.com/stretchr/objx v0.5.2 // indirect 50 | github.com/supranational/blst v0.3.13 // indirect 51 | github.com/tyler-smith/go-bip39 v1.1.0 // indirect 52 | golang.org/x/crypto v0.35.0 // indirect 53 | golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect 54 | golang.org/x/net v0.36.0 // indirect 55 | golang.org/x/sync v0.11.0 // indirect 56 | golang.org/x/sys v0.30.0 // indirect 57 | golang.org/x/text v0.22.0 // indirect 58 | gopkg.in/yaml.v3 v3.0.1 // indirect 59 | rsc.io/tmplfunc v0.0.3 // indirect 60 | ) 61 | -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.23.0 2 | 3 | toolchain go1.24.1 4 | 5 | use ( 6 | . 7 | ./tools 8 | ) 9 | -------------------------------------------------------------------------------- /indexer/indexer.go: -------------------------------------------------------------------------------- 1 | package indexer 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | type Options struct { 9 | HTTPClient HTTPClient 10 | JWTAuthToken string 11 | } 12 | 13 | // NewIndexer creates a new Sequence Indexer client instance. See https://docs.sequence.xyz for a list of 14 | // indexer urls, and please see https://sequence.build to get a `projectAccessKey`. 15 | func NewIndexer(indexerURL string, projectAccessKey string, options ...Options) IndexerClient { 16 | opts := Options{} 17 | if len(options) > 0 { 18 | opts = options[0] 19 | } 20 | 21 | client := &httpclient{ 22 | client: opts.HTTPClient, 23 | projectAccessKey: projectAccessKey, 24 | } 25 | if opts.HTTPClient == nil { 26 | client.client = http.DefaultClient 27 | } 28 | if opts.JWTAuthToken != "" { 29 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 30 | } 31 | 32 | return NewIndexerClient(indexerURL, client) 33 | } 34 | 35 | type httpclient struct { 36 | client HTTPClient 37 | jwtAuthHeader string 38 | projectAccessKey string 39 | } 40 | 41 | func (c *httpclient) Do(req *http.Request) (*http.Response, error) { 42 | if c.projectAccessKey != "" { 43 | req.Header.Set("X-Access-Key", c.projectAccessKey) 44 | } 45 | if c.jwtAuthHeader != "" { 46 | req.Header.Set("Authorization", c.jwtAuthHeader) 47 | } 48 | return c.client.Do(req) 49 | } 50 | -------------------------------------------------------------------------------- /intents/intent_data_ext.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/0xsequence/ethkit/go-ethereum/common" 7 | ) 8 | 9 | func (id *IntentDataOpenSession) IsValid() error { 10 | if id.SessionID == "" { 11 | return fmt.Errorf("session id is empty") 12 | } 13 | 14 | return nil 15 | } 16 | 17 | func (id *IntentDataSessionAuthProof) IsValidInterpretation(sessionID string, message string) error { 18 | message2 := "0x" + common.Bytes2Hex( 19 | []byte(SessionAuthProofMessage(sessionID, id.Wallet, id.Nonce)), 20 | ) 21 | if message != message2 { 22 | return fmt.Errorf("proof message does not match: '%s' != '%s'", message, message2) 23 | } 24 | return nil 25 | } 26 | -------------------------------------------------------------------------------- /intents/intent_data_get_transaction_receipt_ext.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | 7 | "github.com/0xsequence/ethkit/go-ethereum/common" 8 | 9 | "github.com/0xsequence/go-sequence" 10 | ) 11 | 12 | func (p *IntentDataGetTransactionReceipt) chainID() (*big.Int, error) { 13 | n, ok := sequence.ParseHexOrDec(p.Network) 14 | if !ok { 15 | return nil, fmt.Errorf("invalid network id '%s'", p.Network) 16 | } 17 | 18 | return n, nil 19 | } 20 | 21 | func (p *IntentDataGetTransactionReceipt) wallet() common.Address { 22 | return common.HexToAddress(p.Wallet) 23 | } 24 | -------------------------------------------------------------------------------- /intents/intent_data_sign_712_ext.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "math/big" 7 | 8 | "github.com/0xsequence/ethkit/go-ethereum/common" 9 | "github.com/0xsequence/go-sequence" 10 | ) 11 | 12 | func (p *IntentDataSignTypedData) chainID() (*big.Int, error) { 13 | n, ok := sequence.ParseHexOrDec(p.Network) 14 | if !ok { 15 | return nil, fmt.Errorf("invalid network id '%s'", p.Network) 16 | } 17 | return n, nil 18 | } 19 | 20 | func (p *IntentDataSignTypedData) message() ([]byte, error) { 21 | // typedData, ok := p.TypedData.(*ethcoder.TypedData) 22 | // if !ok { 23 | // return nil, fmt.Errorf("typedData field is not a valid typed data object") 24 | // } 25 | 26 | _, encodedMessage, err := p.TypedData.Encode() 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | return encodedMessage, nil 32 | } 33 | 34 | func (p *IntentDataSignTypedData) wallet() common.Address { 35 | return common.HexToAddress(p.Wallet) 36 | } 37 | 38 | func (p *IntentDataSignTypedData) subdigest() ([]byte, error) { 39 | chainID, err := p.chainID() 40 | if err != nil { 41 | return nil, err 42 | } 43 | msgData, err := p.message() 44 | if err != nil { 45 | return nil, err 46 | } 47 | return sequence.SubDigest(chainID, p.wallet(), sequence.MessageDigest(msgData)) 48 | } 49 | 50 | func (p *IntentDataSignTypedData) IsValidInterpretation(subdigest common.Hash) bool { 51 | selfSubDigest, err := p.subdigest() 52 | if err != nil { 53 | return false 54 | } 55 | 56 | return bytes.Equal(selfSubDigest, subdigest[:]) 57 | } 58 | 59 | // func (p *IntentDataSignTypedData) UnmarshalJSON(data []byte) error { 60 | // type Raw struct { 61 | // Network string `json:"network"` 62 | // Wallet string `json:"wallet"` 63 | // TypedData json.RawMessage `json:"typedData"` 64 | // } 65 | 66 | // dec := json.NewDecoder(bytes.NewReader(data)) 67 | // var raw Raw 68 | // if err := dec.Decode(&raw); err != nil { 69 | // return err 70 | // } 71 | 72 | // typedData, err := ethcoder.TypedDataFromJSON(string(raw.TypedData)) 73 | // if err != nil { 74 | // return err 75 | // } 76 | 77 | // p.Network = raw.Network 78 | // p.Wallet = raw.Wallet 79 | // p.TypedData = typedData 80 | // return nil 81 | // } 82 | -------------------------------------------------------------------------------- /intents/intent_data_sign_712_ext_test.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "encoding/json" 5 | "math/big" 6 | "testing" 7 | "time" 8 | 9 | "github.com/0xsequence/ethkit/ethwallet" 10 | "github.com/0xsequence/ethkit/go-ethereum/common" 11 | "github.com/0xsequence/go-sequence" 12 | "github.com/stretchr/testify/assert" 13 | "github.com/stretchr/testify/require" 14 | ) 15 | 16 | func TestRecoverTypedDataIntent(t *testing.T) { 17 | data := `{ 18 | "version": "1", 19 | "name": "signTypedData", 20 | "issued": 0, 21 | "expires": 0, 22 | "data": { 23 | "wallet": "0xD67FC48b298B09Ed3D03403d930769C527186c4e", 24 | "network": "1", 25 | "typedData": { 26 | "types": { 27 | "EIP712Domain": [ 28 | {"name": "name", "type": "string"}, 29 | {"name": "version", "type": "string"}, 30 | {"name": "chainId", "type": "uint256"}, 31 | {"name": "verifyingContract", "type": "address"} 32 | ], 33 | "Person": [ 34 | {"name": "name", "type": "string"}, 35 | {"name": "wallet", "type": "address"}, 36 | {"name": "count", "type": "uint8"} 37 | ] 38 | }, 39 | "primaryType": "Person", 40 | "domain": { 41 | "name": "Ether Mail", 42 | "version": "1", 43 | "chainId": 1, 44 | "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" 45 | }, 46 | "message": { 47 | "name": "Bob", 48 | "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", 49 | "count": 4 50 | } 51 | } 52 | }, 53 | "signatures": [] 54 | }` 55 | 56 | intent := &Intent{} 57 | err := json.Unmarshal([]byte(data), intent) 58 | require.Nil(t, err) 59 | 60 | require.Equal(t, "1", intent.Version) 61 | require.Equal(t, IntentName_signTypedData, intent.Name) 62 | 63 | hash, err := intent.Hash() 64 | require.Nil(t, err) 65 | require.NotNil(t, common.Bytes2Hex(hash)) 66 | 67 | intent.IssuedAt = uint64(time.Now().Unix()) 68 | intent.ExpiresAt = uint64(time.Now().Unix()) + 60 69 | 70 | wallet, err := ethwallet.NewWalletFromRandomEntropy() 71 | require.Nil(t, err) 72 | 73 | session := NewSessionP256K1(wallet) 74 | 75 | err = session.Sign(intent) 76 | require.Nil(t, err) 77 | 78 | intentTyped, err := NewIntentTypedFromIntent[IntentDataSignTypedData](intent) 79 | require.NoError(t, err) 80 | 81 | signers := intent.Signers() 82 | require.Equal(t, 1, len(signers)) 83 | require.Equal(t, "0x"+common.Bytes2Hex(append([]byte{0x00}, wallet.Address().Bytes()...)), signers[0]) 84 | 85 | messageDigest, err := intentTyped.Data.TypedData.EncodeDigest() 86 | require.NoError(t, err) 87 | require.NotNil(t, messageDigest) 88 | 89 | subdigest, err := sequence.SubDigest( 90 | big.NewInt(1), 91 | common.HexToAddress("0xD67FC48b298B09Ed3D03403d930769C527186c4e"), 92 | common.BytesToHash(messageDigest), 93 | ) 94 | 95 | assert.Nil(t, err) 96 | assert.True(t, intentTyped.Data.IsValidInterpretation(common.BytesToHash(subdigest))) 97 | 98 | } 99 | -------------------------------------------------------------------------------- /intents/intent_data_sign_message_ext.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "math/big" 7 | 8 | "github.com/0xsequence/ethkit/go-ethereum/common" 9 | "github.com/0xsequence/go-sequence" 10 | ) 11 | 12 | func (p *IntentDataSignMessage) chainID() (*big.Int, error) { 13 | n, ok := sequence.ParseHexOrDec(p.Network) 14 | if !ok { 15 | return nil, fmt.Errorf("invalid network id '%s'", p.Network) 16 | } 17 | 18 | return n, nil 19 | } 20 | 21 | func (p *IntentDataSignMessage) message() []byte { 22 | return common.FromHex(p.Message) 23 | } 24 | 25 | func (p *IntentDataSignMessage) wallet() common.Address { 26 | return common.HexToAddress(p.Wallet) 27 | } 28 | 29 | func (p *IntentDataSignMessage) subdigest() ([]byte, error) { 30 | chainID, err := p.chainID() 31 | if err != nil { 32 | return nil, err 33 | } 34 | 35 | // Make sure the message is EIP191 encoded 36 | msgData := p.message() 37 | if !sequence.IsEIP191Message(msgData) { 38 | msgData = sequence.MessageToEIP191(msgData) 39 | } 40 | 41 | return sequence.SubDigest(chainID, p.wallet(), sequence.MessageDigest(msgData)) 42 | } 43 | 44 | // A SignMessagePacket (intent) *MUST* be mapped to a regular "SignMessage" Sequence action, this means that 45 | // it must adhere to the following rules: 46 | // - the subdigest must match `SubDigest(chainID, Wallet, Digest(Message))` 47 | func (p *IntentDataSignMessage) IsValidInterpretation(subdigest common.Hash) bool { 48 | selfSubDigest, err := p.subdigest() 49 | if err != nil { 50 | return false 51 | } 52 | 53 | return bytes.Equal(selfSubDigest, subdigest[:]) 54 | } 55 | -------------------------------------------------------------------------------- /intents/intent_data_sign_message_ext_test.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "encoding/json" 5 | "math/big" 6 | "testing" 7 | "time" 8 | 9 | "github.com/0xsequence/ethkit/ethwallet" 10 | "github.com/0xsequence/ethkit/go-ethereum/common" 11 | "github.com/stretchr/testify/assert" 12 | "github.com/stretchr/testify/require" 13 | 14 | "github.com/0xsequence/go-sequence" 15 | ) 16 | 17 | func TestRecoverMessageIntent(t *testing.T) { 18 | data := `{ 19 | "version": "1", 20 | "name": "signMessage", 21 | "issued": 0, 22 | "expires": 0, 23 | "data": { 24 | "wallet": "0xD67FC48b298B09Ed3D03403d930769C527186c4e", 25 | "network": "1", 26 | "message": "0xdeadbeef" 27 | }, 28 | "signatures": [] 29 | }` 30 | 31 | intent := &Intent{} 32 | err := json.Unmarshal([]byte(data), intent) 33 | assert.Nil(t, err) 34 | 35 | assert.Equal(t, "1", intent.Version) 36 | assert.Equal(t, IntentName_signMessage, intent.Name) 37 | 38 | hash, err := intent.Hash() 39 | assert.Nil(t, err) 40 | assert.NotNil(t, common.Bytes2Hex(hash)) 41 | 42 | intent.IssuedAt = uint64(time.Now().Unix()) 43 | intent.ExpiresAt = uint64(time.Now().Unix()) + 60 44 | 45 | wallet, err := ethwallet.NewWalletFromRandomEntropy() 46 | require.Nil(t, err) 47 | 48 | session := NewSessionP256K1(wallet) 49 | 50 | err = session.Sign(intent) 51 | require.Nil(t, err) 52 | 53 | intentTyped, err := NewIntentTypedFromIntent[IntentDataSignMessage](intent) 54 | require.NoError(t, err) 55 | 56 | signers := intent.Signers() 57 | assert.Equal(t, 1, len(signers)) 58 | assert.Equal(t, "0x"+common.Bytes2Hex(append([]byte{0x00}, wallet.Address().Bytes()...)), signers[0]) 59 | 60 | subdigest, err := sequence.SubDigest( 61 | big.NewInt(1), 62 | common.HexToAddress("0xD67FC48b298B09Ed3D03403d930769C527186c4e"), 63 | sequence.MessageDigest(sequence.MessageToEIP191(common.Hex2Bytes("deadbeef"))), 64 | ) 65 | 66 | assert.Nil(t, err) 67 | assert.True(t, intentTyped.Data.IsValidInterpretation(common.BytesToHash(subdigest))) 68 | } 69 | -------------------------------------------------------------------------------- /intents/intent_data_transaction_contract_abi.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "github.com/0xsequence/ethkit/ethcoder" 5 | ) 6 | 7 | type contractCallType struct { 8 | Abi string `json:"abi"` 9 | Func string `json:"func"` 10 | Args []any `json:"args"` 11 | } 12 | 13 | // EncodeContractCall encodes a contract call as a hex encoded calldata. 14 | // NOTE: see ethcoder.EncodeContractCall for more details. 15 | func EncodeContractCall(data *contractCallType) (string, error) { 16 | callDef := ethcoder.ContractCallDef{ 17 | ABI: data.Abi, 18 | Func: data.Func, 19 | Args: data.Args, 20 | } 21 | return ethcoder.EncodeContractCall(callDef) 22 | } 23 | -------------------------------------------------------------------------------- /intents/intent_ext.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | "github.com/0xsequence/ethkit/go-ethereum/crypto" 8 | "github.com/gibson042/canonicaljson-go" 9 | ) 10 | 11 | const IntentValidTimeInSec = 60 12 | const IntentAllowedTimeDriftInSec = 5 13 | 14 | type IntentDataValidator interface { 15 | IsValid() error 16 | } 17 | 18 | func (intent *Intent) Hash() ([]byte, error) { 19 | // copy intent and remove signatures 20 | var intentCopy = *intent 21 | intentCopy.Signatures = nil 22 | 23 | // Convert packet to bytes 24 | packetBytes, err := canonicaljson.Marshal(intentCopy) 25 | if err != nil { 26 | return nil, err 27 | } 28 | 29 | // Calculate keccak256 hash 30 | return crypto.Keccak256(packetBytes), nil 31 | } 32 | 33 | func (intent *Intent) IsValid() error { 34 | if len(intent.Signatures) == 0 { 35 | return fmt.Errorf("no signatures") 36 | } 37 | 38 | // check if the intent is expired 39 | if intent.ExpiresAt+IntentAllowedTimeDriftInSec < uint64(time.Now().Unix()) { 40 | return fmt.Errorf("intent expired") 41 | } 42 | 43 | // check if the intent is issued in the future 44 | if intent.IssuedAt-IntentAllowedTimeDriftInSec > uint64(time.Now().Unix()) { 45 | return fmt.Errorf("intent issued in the future") 46 | } 47 | 48 | // check if all signatures are valid 49 | if validSingers := len(intent.Signers()); validSingers == 0 || validSingers != len(intent.Signatures) { 50 | return fmt.Errorf("invalid signature") 51 | } 52 | 53 | // the intent is valid 54 | return nil 55 | } 56 | 57 | func (intent *Intent) Signers() []string { 58 | var signers []string 59 | for _, signature := range intent.Signatures { 60 | if err := IsValidSessionSignature(signature.SessionID, signature.Signature, intent); err == nil { 61 | signers = append(signers, signature.SessionID) 62 | } 63 | } 64 | return signers 65 | } 66 | 67 | // IntentName stringer helper method, even thought IntentName is a string type, it's useful to 68 | // have a String() method to satisfy the fmt.Stringer interface 69 | func (n IntentName) String() string { 70 | return string(n) 71 | } 72 | -------------------------------------------------------------------------------- /intents/intent_response_typed.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | func IntentResponseTypeToCode[T any](t *T) IntentResponseCode { 9 | var data any = t 10 | switch data.(type) { 11 | case *IntentResponseAuthInitiated: 12 | return IntentResponseCode_authInitiated 13 | case *IntentResponseSessionOpened: 14 | return IntentResponseCode_sessionOpened 15 | case *IntentResponseSessionClosed: 16 | return IntentResponseCode_sessionClosed 17 | case *IntentResponseValidationStarted: 18 | return IntentResponseCode_validationStarted 19 | case *IntentResponseValidationFinished: 20 | return IntentResponseCode_validationFinished 21 | case *IntentResponseSessionAuthProof: 22 | return IntentResponseCode_sessionAuthProof 23 | case *IntentResponseSignedMessage: 24 | return IntentResponseCode_signedMessage 25 | case *IntentResponseSignedTypedData: 26 | return IntentResponseCode_signedTypedData 27 | case *IntentResponseFeeOptions: 28 | return IntentResponseCode_feeOptions 29 | case *IntentResponseTransactionReceipt: 30 | return IntentResponseCode_transactionReceipt 31 | case *IntentResponseTransactionFailed: 32 | return IntentResponseCode_transactionFailed 33 | case *IntentResponseGetSession: 34 | return IntentResponseCode_getSessionResponse 35 | case *IntentResponseAccountList: 36 | return IntentResponseCode_accountList 37 | case *IntentResponseAccountFederated: 38 | return IntentResponseCode_accountFederated 39 | case *IntentResponseAccountRemoved: 40 | return IntentResponseCode_accountRemoved 41 | case *IntentResponseChildWalletAdopted: 42 | return IntentResponseCode_childWalletAdopted 43 | case *IntentResponseAdopter: 44 | return IntentResponseCode_adopter 45 | case *IntentResponseConfirmationRequired: 46 | return IntentResponseCode_confirmationRequired 47 | case *IntentResponseIdToken: 48 | return IntentResponseCode_idToken 49 | default: 50 | return "" 51 | } 52 | } 53 | 54 | type IntentResponseTyped[T any] struct { 55 | IntentResponse 56 | Data T `json:"data"` 57 | } 58 | 59 | func NewIntentResponseTyped[T any](data T) *IntentResponseTyped[T] { 60 | return &IntentResponseTyped[T]{ 61 | IntentResponse: IntentResponse{ 62 | Code: IntentResponseTypeToCode(&data), 63 | Data: data, 64 | }, 65 | Data: data, 66 | } 67 | } 68 | 69 | func NewIntentResponseTypedFromIntentResponse[T any](res *IntentResponse) (*IntentResponseTyped[T], error) { 70 | switch res.Data.(type) { 71 | case T: 72 | return &IntentResponseTyped[T]{ 73 | IntentResponse: *res, 74 | Data: res.Data.(T), 75 | }, nil 76 | case map[string]any: 77 | data := res.Data.(map[string]any) 78 | 79 | // convert to json 80 | dataJSON, err := json.Marshal(data) 81 | if err != nil { 82 | return nil, err 83 | } 84 | 85 | // convert to typed data 86 | var typedData T 87 | err = json.Unmarshal(dataJSON, &typedData) 88 | if err != nil { 89 | return nil, err 90 | } 91 | 92 | // check if intent response code and data type match 93 | if IntentResponseTypeToCode(&typedData) != res.Code { 94 | return nil, fmt.Errorf("intent response code and data type mismatch") 95 | } 96 | 97 | return &IntentResponseTyped[T]{ 98 | IntentResponse: *res, 99 | Data: typedData, 100 | }, nil 101 | default: 102 | return nil, fmt.Errorf("invalid intent data type") 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /intents/proto.go: -------------------------------------------------------------------------------- 1 | // Client 2 | //go:generate go run github.com/webrpc/webrpc/cmd/webrpc-gen -schema=intent.ridl -target=golang -pkg=intents -out=./intent.gen.go 3 | //go:generate go run github.com/webrpc/webrpc/cmd/webrpc-gen -schema=intent.ridl -target=typescript -out=./intent.gen.ts 4 | 5 | package intents 6 | -------------------------------------------------------------------------------- /intents/session_test.go: -------------------------------------------------------------------------------- 1 | package intents 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/0xsequence/ethkit" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestSessionAuthProofMessage(t *testing.T) { 11 | // no nonce provided 12 | assert.Equal(t, "SessionAuthProof r1:0x01 0x02", SessionAuthProofMessage("r1:0x01", "0x02", nil)) 13 | 14 | // nonce provided 15 | assert.Equal(t, "SessionAuthProof r1:0x01 0x02 0x03", SessionAuthProofMessage("r1:0x01", "0x02", ethkit.ToPtr("0x03"))) 16 | } 17 | -------------------------------------------------------------------------------- /lib/prototyp/_hash_text.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "database/sql/driver" 5 | "encoding/hex" 6 | "strings" 7 | 8 | "github.com/0xsequence/ethkit/go-ethereum/common" 9 | ) 10 | 11 | // Hash is a type alias for common.Hash used for data normalization 12 | // with JSON/Database marshalling. 13 | // 14 | // NOTE: when used with a db like postgres, the column type must be a `varchar`, 15 | // `text` or string equivalent. 16 | type HashText string 17 | 18 | func HashTextFromString(s string) HashText { 19 | return HashText(strings.ToLower(s)) 20 | } 21 | 22 | func HashTextFromBytes(src []byte) HashText { 23 | return HashText("0x" + hex.EncodeToString(src)) 24 | } 25 | 26 | func ToHashText(h Hexer) HashText { 27 | return HashTextFromString(h.Hex()) 28 | } 29 | 30 | func (h HashText) ToAddress() common.Address { 31 | return common.HexToAddress(string(h)) 32 | } 33 | 34 | func (h HashText) ToHash() common.Hash { 35 | return common.HexToHash(string(h)) 36 | } 37 | 38 | // UnmarshalText implements encoding.TextMarshaler. 39 | func (h *HashText) MarshalText() ([]byte, error) { 40 | return []byte(h.String()), nil 41 | } 42 | 43 | // UnmarshalText implements encoding.TextUnmarshaler. 44 | func (h *HashText) UnmarshalText(src []byte) error { 45 | *h = HashTextFromString(string(src)) 46 | return nil 47 | } 48 | 49 | func (h HashText) String() string { 50 | return string(h) 51 | } 52 | 53 | func (h HashText) IsZeroValue() bool { 54 | if h.String() == "" { 55 | return true 56 | } 57 | if h.String() == "0x" { 58 | return true 59 | } 60 | if h.String() == "0x00000000" { 61 | return true 62 | } 63 | if h.String() == "0x0000000000000000000000000000000000000000" { 64 | return true 65 | } 66 | if h.String() == "0x0000000000000000000000000000000000000000000000000000000000000000" { 67 | return true 68 | } 69 | return false 70 | } 71 | 72 | func (h HashText) IsValidAddress() bool { 73 | if h[0:2] != "0x" { 74 | return false 75 | } 76 | if len(h) != 42 { 77 | return false 78 | } 79 | return true 80 | } 81 | 82 | func (h HashText) IsValidTxnHash() bool { 83 | if h[0:2] != "0x" { 84 | return false 85 | } 86 | if len(h) != 66 { 87 | return false 88 | } 89 | return true 90 | } 91 | 92 | func (h *HashText) Hash() common.Hash { 93 | return common.HexToHash(h.String()) 94 | } 95 | 96 | func (h HashText) Value() (driver.Value, error) { 97 | return h.String(), nil 98 | } 99 | 100 | func (h *HashText) Scan(src interface{}) error { 101 | // NOTE: the 'scany' package we use is unable to scan values of 102 | // *string, aka *prototyp.Hash, when needing to have a nullable Hash 103 | // please use the HashMaybe type instead. 104 | *h = HashText(src.(string)) 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /lib/prototyp/bigint_maybe.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | // TODO: copy from pgkit/dbtype 4 | -------------------------------------------------------------------------------- /lib/prototyp/hash_maybe.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "database/sql/driver" 5 | "encoding/hex" 6 | "fmt" 7 | ) 8 | 9 | // HashMaybe is a nullable Hash value useful for database fields which accept NULL type. 10 | type HashMaybe struct { 11 | Hash 12 | 13 | // IsAssigned=false means value is nil. IsAssigned=true means value in .Hash is the value. 14 | IsAssigned bool 15 | } 16 | 17 | func HashMaybeFromString(s string) HashMaybe { 18 | if s == "" { 19 | return HashMaybe{} 20 | } else { 21 | return HashMaybe{ 22 | Hash: HashFromString(s), 23 | IsAssigned: true, 24 | } 25 | } 26 | } 27 | 28 | func (h *HashMaybe) SetValue(hash Hash) { 29 | h.Hash = hash 30 | h.IsAssigned = true 31 | } 32 | 33 | func (h *HashMaybe) SetNil() { 34 | h.Hash = "" 35 | h.IsAssigned = false 36 | } 37 | 38 | // UnmarshalText implements encoding.TextMarshaler. 39 | func (h HashMaybe) MarshalText() ([]byte, error) { 40 | return []byte(h.String()), nil 41 | } 42 | 43 | // UnmarshalText implements encoding.TextUnmarshaler. 44 | func (h *HashMaybe) UnmarshalText(src []byte) error { 45 | t := string(src) 46 | if t == "null" || t == "" { 47 | return nil 48 | } 49 | *h = HashMaybeFromString(t) 50 | return nil 51 | } 52 | 53 | // MarshalBinary implements encoding.BinaryMarshaler. 54 | func (h HashMaybe) MarshalBinary() ([]byte, error) { 55 | if h.IsAssigned { 56 | return h.Hash.MarshalBinary() 57 | } else { 58 | return []byte{}, nil 59 | } 60 | } 61 | 62 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 63 | func (h *HashMaybe) UnmarshalBinary(b []byte) error { 64 | if len(b) == 0 { 65 | h.IsAssigned = false 66 | return nil 67 | } else { 68 | h.IsAssigned = true 69 | h.Hash = Hash(HexBytesToString(b)) 70 | return nil 71 | } 72 | } 73 | 74 | func (h HashMaybe) Value() (driver.Value, error) { 75 | if h.IsAssigned { 76 | s := h.String() 77 | if len(s) < 2 { 78 | return []byte{}, nil 79 | } 80 | return hex.DecodeString(s[2:]) 81 | } 82 | return nil, nil 83 | } 84 | 85 | func (h *HashMaybe) Scan(src interface{}) error { 86 | h.IsAssigned = false 87 | if src == nil { 88 | return nil 89 | } 90 | b, ok := src.([]byte) 91 | if !ok { 92 | return fmt.Errorf("expected []byte, got %T", src) 93 | } 94 | 95 | h.Hash = HashFromBytes(b) 96 | h.IsAssigned = true 97 | return nil 98 | } 99 | 100 | func (h HashMaybe) Len() int { 101 | return len(h.Hash.String()) 102 | } 103 | 104 | func (h HashMaybe) ByteSize() int { 105 | if h.IsAssigned { 106 | return h.Hash.ByteSize() 107 | } 108 | return 0 109 | } 110 | 111 | func ToHashMaybe(h Hexer) HashMaybe { 112 | return HashMaybeFromString(h.Hex()) 113 | } 114 | 115 | func BytesToHashMaybe(src []byte) HashMaybe { 116 | return HashMaybeFromString("0x" + hex.EncodeToString(src)) 117 | } 118 | -------------------------------------------------------------------------------- /lib/prototyp/hash_maybe_test.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestHashMaybe(t *testing.T) { 10 | hm := HashMaybeFromString("") 11 | 12 | hm.SetValue(HashFromString("0xf0245f6251bef9447a08766b9da2b07b28ad80b0")) 13 | assert.True(t, hm.IsValidAddress()) 14 | assert.True(t, hm.IsAssigned) 15 | 16 | hm.SetNil() 17 | assert.False(t, hm.IsValidAddress()) 18 | assert.False(t, hm.IsAssigned) 19 | } 20 | -------------------------------------------------------------------------------- /lib/prototyp/hash_test.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestHexStringToBytes(t *testing.T) { 10 | hexString := "0x1234567890abcdef" 11 | bytes := HexStringToBytes(hexString) 12 | require.Equal(t, []byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}, bytes) 13 | require.Len(t, bytes, 8) 14 | 15 | hexString2 := HexBytesToString(bytes) 16 | require.Equal(t, hexString, hexString2) 17 | } 18 | 19 | func TestHash(t *testing.T) { 20 | hash := Hash("0x1234567890abcdef") 21 | require.Equal(t, []byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}, hash.Bytes()) 22 | require.Len(t, hash.Bytes(), 8) 23 | require.Equal(t, 8, hash.ByteSize()) 24 | require.True(t, hash.IsValidHex()) 25 | } 26 | 27 | func TestHashBinaryMarshaler(t *testing.T) { 28 | hash := Hash("0x1234567890abcdef") 29 | bytes, err := hash.MarshalBinary() 30 | require.NoError(t, err) 31 | require.Equal(t, []byte{0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef}, bytes) 32 | 33 | hash2 := Hash("") 34 | err = hash2.UnmarshalBinary(bytes) 35 | require.NoError(t, err) 36 | require.Equal(t, hash, hash2) 37 | 38 | require.Equal(t, hash.String(), "0x1234567890abcdef") 39 | } 40 | -------------------------------------------------------------------------------- /lib/prototyp/json_string.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "database/sql" 7 | "database/sql/driver" 8 | ) 9 | 10 | // JSONString is a custom database type that gets serialized into a text value. 11 | type JSONString struct { 12 | v interface{} 13 | } 14 | 15 | func NewJSONString(v interface{}) *JSONString { 16 | return &JSONString{v} 17 | } 18 | 19 | func (s JSONString) Data() interface{} { 20 | return s.v 21 | } 22 | 23 | func (s JSONString) Value() (driver.Value, error) { 24 | return s.MarshalJSON() 25 | } 26 | 27 | func (s JSONString) MarshalJSON() ([]byte, error) { 28 | buf, err := json.Marshal(s.v) 29 | if err != nil { 30 | return nil, err 31 | } 32 | return buf, nil 33 | } 34 | 35 | func (s *JSONString) Scan(in interface{}) error { 36 | var buf []byte 37 | switch t := in.(type) { 38 | case string: 39 | buf = []byte(t) 40 | case []byte: 41 | buf = t 42 | } 43 | return s.UnmarshalJSON(buf) 44 | } 45 | 46 | func (s *JSONString) UnmarshalJSON(buf []byte) error { 47 | return json.Unmarshal(buf, &s.v) 48 | } 49 | 50 | var _ = interface { 51 | sql.Scanner 52 | driver.Valuer 53 | }(&JSONString{}) 54 | -------------------------------------------------------------------------------- /lib/prototyp/json_string_test.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestJSONStringValuer(t *testing.T) { 10 | { 11 | s := NewJSONString("hello world") 12 | v, err := s.Value() 13 | 14 | assert.NoError(t, err) 15 | assert.Equal(t, []byte(`"hello world"`), v.([]byte)) 16 | } 17 | { 18 | s := NewJSONString(map[string]interface{}{"foo": 1}) 19 | v, err := s.Value() 20 | 21 | assert.NoError(t, err) 22 | assert.Equal(t, []byte(`{"foo":1}`), v.([]byte)) 23 | } 24 | { 25 | s := NewJSONString(nil) 26 | v, err := s.Value() 27 | 28 | assert.NoError(t, err) 29 | assert.Equal(t, []byte(`null`), v.([]byte)) 30 | } 31 | } 32 | 33 | func TestJSONStringScan(t *testing.T) { 34 | { 35 | var s JSONString 36 | err := s.Scan([]byte(`"hello world"`)) 37 | assert.NoError(t, err) 38 | 39 | assert.Equal(t, "hello world", s.Data().(string)) 40 | } 41 | { 42 | var s JSONString 43 | err := s.Scan(`123`) 44 | assert.NoError(t, err) 45 | 46 | assert.Equal(t, float64(123), s.Data().(float64)) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/prototyp/key.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | 3 | import ( 4 | "database/sql/driver" 5 | "encoding/hex" 6 | "fmt" 7 | ) 8 | 9 | var ( 10 | EmptyKey = [16]byte{} 11 | EmptyKeySlice = EmptyKey[:] 12 | ) 13 | 14 | type Key [16]byte 15 | 16 | func (k Key) String() string { 17 | return fmt.Sprintf("0x%s", hex.EncodeToString(k[:])) 18 | } 19 | 20 | func (k Key) IsValid() bool { 21 | return k != EmptyKey 22 | } 23 | 24 | func (k Key) IsZeroValue() bool { 25 | return k == EmptyKey 26 | } 27 | 28 | func (k Key) Bytes() []byte { 29 | return k[:] 30 | } 31 | 32 | func (k *Key) Scan(src interface{}) error { 33 | copy(k[:16], src.([]byte)) 34 | return nil 35 | } 36 | 37 | func (k Key) Value() (driver.Value, error) { 38 | return k[:], nil 39 | } 40 | 41 | func (k *Key) Len() int { 42 | return 16 43 | } 44 | 45 | func (k *Key) ByteSize() int { 46 | return 16 47 | } 48 | 49 | // MarshalBinary implements encoding.BinaryMarshaler. 50 | func (k Key) MarshalBinary() ([]byte, error) { 51 | return k[:], nil 52 | } 53 | 54 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 55 | func (k *Key) UnmarshalBinary(b []byte) error { 56 | copy(k[:], b) 57 | return nil 58 | } 59 | -------------------------------------------------------------------------------- /lib/prototyp/prototyp.go: -------------------------------------------------------------------------------- 1 | package prototyp 2 | -------------------------------------------------------------------------------- /marketplace/marketplace.go: -------------------------------------------------------------------------------- 1 | package marketplace 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | type Options struct { 9 | MarketplaceAPIURL string 10 | JWTAuthToken string 11 | HTTPClient HTTPClient 12 | } 13 | 14 | func NewMarketplaceAdmin(projectAccessKey string, chainHandle string, options ...Options) AdminClient { 15 | opts := Options{} 16 | if len(options) > 0 { 17 | opts = options[0] 18 | } 19 | 20 | client := &httpclient{ 21 | client: opts.HTTPClient, 22 | projectAccessKey: projectAccessKey, 23 | } 24 | 25 | if client.client == nil { 26 | client.client = http.DefaultClient 27 | } 28 | 29 | if opts.JWTAuthToken != "" { 30 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 31 | } 32 | 33 | // prod: https://marketplace-api.sequence.app 34 | // dev: https://dev-marketplace-api.sequence.app 35 | apiURL := fmt.Sprintf("https://marketplace-api.sequence.app/%s", chainHandle) 36 | if opts.MarketplaceAPIURL != "" { 37 | apiURL = opts.MarketplaceAPIURL + "/" + chainHandle 38 | } 39 | 40 | return NewAdminClient(apiURL, client) 41 | } 42 | 43 | type httpclient struct { 44 | client HTTPClient 45 | jwtAuthHeader string 46 | projectAccessKey string 47 | } 48 | 49 | func (c *httpclient) Do(req *http.Request) (*http.Response, error) { 50 | if c.projectAccessKey != "" { 51 | req.Header.Set("X-Access-Key", c.projectAccessKey) 52 | } 53 | 54 | if c.jwtAuthHeader != "" { 55 | req.Header.Set("Authorization", c.jwtAuthHeader) 56 | } 57 | 58 | return c.client.Do(req) 59 | } 60 | -------------------------------------------------------------------------------- /message.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | func IsEIP191Message(msg []byte) bool { 9 | return bytes.HasPrefix(msg, []byte("\x19Ethereum Signed Message:\n")) 10 | } 11 | 12 | func MessageToEIP191(msg []byte) []byte { 13 | if !IsEIP191Message(msg) { 14 | return bytes.Join([][]byte{ 15 | []byte("\x19Ethereum Signed Message:\n"), 16 | []byte(fmt.Sprintf("%v", len(msg))), 17 | msg}, nil) 18 | } 19 | return msg 20 | } 21 | -------------------------------------------------------------------------------- /message_test.go: -------------------------------------------------------------------------------- 1 | package sequence_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/0xsequence/go-sequence" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestIsEIP191Message(t *testing.T) { 11 | t.Run("EIP191", func(t *testing.T) { 12 | // EIP191 message 13 | msg := []byte("\x19Ethereum Signed Message:\n5hello") 14 | ok := sequence.IsEIP191Message(msg) 15 | if !ok { 16 | t.Error("expected EIP191 message") 17 | } 18 | }) 19 | 20 | t.Run("non-EIP191", func(t *testing.T) { 21 | // non-EIP191 message 22 | msg := []byte("hello") 23 | ok := sequence.IsEIP191Message(msg) 24 | if ok { 25 | t.Error("expected non-EIP191 message") 26 | } 27 | }) 28 | 29 | t.Run("empty-EIP191", func(t *testing.T) { 30 | // non-EIP191 message 31 | msg := []byte("") 32 | ok := sequence.IsEIP191Message(msg) 33 | if ok { 34 | t.Error("expected non-EIP191 message") 35 | } 36 | }) 37 | } 38 | 39 | func TestMessageToEIP191(t *testing.T) { 40 | t.Run("EIP191_none", func(t *testing.T) { 41 | // EIP191 message 42 | msg := []byte("hello") 43 | expectedEIP191 := []byte("\x19Ethereum Signed Message:\n5hello") 44 | 45 | eip191 := sequence.MessageToEIP191(msg) 46 | assert.Equal(t, eip191, expectedEIP191) 47 | }) 48 | 49 | t.Run("EIP191_already", func(t *testing.T) { 50 | // EIP191 message 51 | msg := []byte("\x19Ethereum Signed Message:\n5hello") 52 | eip191 := sequence.MessageToEIP191(msg) 53 | 54 | assert.Equal(t, msg, eip191) 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /metadata/collections.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "io" 9 | "mime/multipart" 10 | "net/http" 11 | ) 12 | 13 | type CollectionsService struct { 14 | Collections 15 | options Options 16 | httpclient HTTPClient 17 | } 18 | 19 | // NewCollections creates a new Sequence Metadata Collections client instance. Please see 20 | // https://sequence.build to get a `projectServiceJWTToken` service-level account jwt token. 21 | func NewCollections(projectServiceJWTToken string, options ...Options) CollectionsService { 22 | opts := Options{} 23 | if len(options) > 0 { 24 | opts = options[0] 25 | } 26 | 27 | client := &httpclient{client: opts.HTTPClient} 28 | if opts.HTTPClient == nil { 29 | client.client = http.DefaultClient 30 | } 31 | if opts.JWTAuthToken == "" { 32 | opts.JWTAuthToken = projectServiceJWTToken 33 | } 34 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 35 | 36 | metadataServiceURL := "https://metadata.sequence.app" 37 | if opts.MetadataServiceURL != "" { 38 | metadataServiceURL = opts.MetadataServiceURL 39 | } else { 40 | opts.MetadataServiceURL = metadataServiceURL 41 | } 42 | 43 | serviceClient := NewCollectionsClient(metadataServiceURL, client) 44 | 45 | return CollectionsService{ 46 | Collections: serviceClient, 47 | options: opts, 48 | httpclient: client, 49 | } 50 | } 51 | 52 | func (c *CollectionsService) UploadAsset(ctx context.Context, projectID, collectionID, assetID uint64, assetContent io.Reader) (*Asset, error) { 53 | body := &bytes.Buffer{} 54 | writer := multipart.NewWriter(body) 55 | 56 | fileWriter, err := writer.CreateFormFile("file", "asset") 57 | if err != nil { 58 | return nil, fmt.Errorf("create form file: %w", err) 59 | } 60 | 61 | _, err = io.Copy(fileWriter, assetContent) 62 | if err != nil { 63 | return nil, fmt.Errorf("copy bytes: %w", err) 64 | } 65 | 66 | writer.Close() 67 | 68 | endpointURL := fmt.Sprintf("%s/projects/%d/collections/%d/assets/%d/upload", c.options.MetadataServiceURL, projectID, collectionID, assetID) 69 | req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpointURL, body) 70 | if err != nil { 71 | return nil, fmt.Errorf("create request: %w", err) 72 | } 73 | 74 | req.Header.Set("Content-Type", writer.FormDataContentType()) 75 | 76 | resp, err := c.httpclient.Do(req) 77 | if err != nil { 78 | return nil, fmt.Errorf("do: %w", err) 79 | } 80 | defer resp.Body.Close() 81 | 82 | if resp.StatusCode != 200 { 83 | return nil, fmt.Errorf("upload asset failed: %s", resp.Status) 84 | } 85 | 86 | respBody, err := io.ReadAll(resp.Body) 87 | if err != nil { 88 | return nil, fmt.Errorf("failed to read body: %w", err) 89 | 90 | } 91 | 92 | asset := &Asset{} 93 | err = json.Unmarshal(respBody, asset) 94 | if err != nil { 95 | return nil, fmt.Errorf("failed to unmarshal response: %w", err) 96 | } 97 | 98 | return asset, nil 99 | } 100 | -------------------------------------------------------------------------------- /metadata/metadata.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | type Options struct { 9 | HTTPClient HTTPClient 10 | JWTAuthToken string 11 | MetadataServiceURL string 12 | } 13 | 14 | // NewMetadata creates a new Sequence Metadata client instance. Please see 15 | // https://sequence.build to get a `projectAccessKey`. 16 | func NewMetadata(projectAccessKey string, options ...Options) MetadataClient { 17 | opts := Options{} 18 | if len(options) > 0 { 19 | opts = options[0] 20 | } 21 | 22 | client := &httpclient{ 23 | client: opts.HTTPClient, 24 | projectAccessKey: projectAccessKey, 25 | } 26 | if opts.HTTPClient == nil { 27 | client.client = http.DefaultClient 28 | } 29 | if opts.JWTAuthToken != "" { 30 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 31 | } 32 | 33 | metadataServiceURL := "https://metadata.sequence.app" 34 | if opts.MetadataServiceURL != "" { 35 | metadataServiceURL = opts.MetadataServiceURL 36 | } 37 | return NewMetadataClient(metadataServiceURL, client) 38 | } 39 | 40 | type httpclient struct { 41 | client HTTPClient 42 | jwtAuthHeader string 43 | projectAccessKey string 44 | } 45 | 46 | func (c *httpclient) Do(req *http.Request) (*http.Response, error) { 47 | if c.projectAccessKey != "" { 48 | req.Header.Set("X-Access-Key", c.projectAccessKey) 49 | } 50 | if c.jwtAuthHeader != "" { 51 | req.Header.Set("Authorization", c.jwtAuthHeader) 52 | } 53 | return c.client.Do(req) 54 | } 55 | -------------------------------------------------------------------------------- /mock/mock.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | //go:generate go run go.uber.org/mock/mockgen -destination api.mock.go -package mock -mock_names API=API ../api API 4 | //go:generate go run go.uber.org/mock/mockgen -destination indexer.mock.go -package mock -mock_names Indexer=Indexer,IndexerClient=IndexerClient,IndexerGateway=IndexerGateway,IndexerGatewayClient=IndexerGatewayClient ../indexer Indexer,IndexerClient,IndexerGateway,IndexerGatewayClient 5 | //go:generate go run go.uber.org/mock/mockgen -destination marketplace.mock.go -package mock -mock_names Marketplace=Marketplace ../marketplace Marketplace 6 | //go:generate go run go.uber.org/mock/mockgen -destination metadata.mock.go -package mock -mock_names Metadata=Metadata ../metadata Metadata 7 | //go:generate go run go.uber.org/mock/mockgen -destination relayer.mock.go -package mock -mock_names Relayer=Relayer ../relayer/proto Relayer 8 | -------------------------------------------------------------------------------- /network.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "math/big" 5 | 6 | "github.com/0xsequence/ethkit/ethrpc" 7 | "github.com/0xsequence/ethkit/go-ethereum/common" 8 | "github.com/0xsequence/go-sequence/core" 9 | v1 "github.com/0xsequence/go-sequence/core/v1" 10 | v2 "github.com/0xsequence/go-sequence/core/v2" 11 | ) 12 | 13 | // WalletContext is the module addresses deployed on a network, aka the context / environment 14 | // of the Sequence Smart Wallet system on Ethereum. 15 | type WalletContext struct { 16 | FactoryAddress common.Address `json:"factory" toml:"factory_address"` 17 | MainModuleAddress common.Address `json:"mainModule" toml:"main_module_address"` 18 | MainModuleUpgradableAddress common.Address `json:"mainModuleUpgradable" toml:"main_module_upgradable_address"` 19 | GuestModuleAddress common.Address `json:"guestModule" toml:"guest_module_address"` 20 | UtilsAddress common.Address `json:"utils" toml:"utils_address"` 21 | } 22 | 23 | // A map of a wallet context for each version 24 | type WalletContexts map[uint16]WalletContext 25 | 26 | type NetworkConfig struct { 27 | Name string 28 | ChainID big.Int 29 | ENSAddress *common.Address 30 | 31 | RpcURL string 32 | Provider *ethrpc.Provider 33 | 34 | RelayerURL *string // optional, one of the these should be set 35 | Relayer Relayer 36 | 37 | IndexerURL *string // optional, one of these should be set 38 | // Indexer Indexer 39 | 40 | IsDefaultChain bool 41 | IsAuthChain bool 42 | 43 | SequenceAPIURL string 44 | } 45 | 46 | type Networks []NetworkConfig 47 | 48 | // TODO, etc..... 49 | // var MainnetNetworks = createNetworkConfig() 50 | // 51 | // var TestnetNetworks = createNetworkConfig() 52 | 53 | // sequenceContextV1 are the deployed addresses of modules available on public networks. 54 | var sequenceContextV1 = WalletContext{ 55 | FactoryAddress: common.HexToAddress("0xf9D09D634Fb818b05149329C1dcCFAeA53639d96"), 56 | MainModuleAddress: common.HexToAddress("0xd01F11855bCcb95f88D7A48492F66410d4637313"), 57 | MainModuleUpgradableAddress: common.HexToAddress("0x7EFE6cE415956c5f80C6530cC6cc81b4808F6118"), 58 | GuestModuleAddress: common.HexToAddress("0x02390F3E6E5FD1C6786CB78FD3027C117a9955A7"), 59 | UtilsAddress: common.HexToAddress("0xd130B43062D875a4B7aF3f8fc036Bc6e9D3E1B3E"), 60 | } 61 | 62 | var sequenceContextV2 = WalletContext{ 63 | FactoryAddress: common.HexToAddress("0xFaA5c0b14d1bED5C888Ca655B9a8A5911F78eF4A"), 64 | MainModuleAddress: common.HexToAddress("0xfBf8f1A5E00034762D928f46d438B947f5d4065d"), 65 | MainModuleUpgradableAddress: common.HexToAddress("0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911"), 66 | GuestModuleAddress: common.HexToAddress("0xfea230Ee243f88BC698dD8f1aE93F8301B6cdfaE"), 67 | } 68 | 69 | // V1SequenceContext returns copy of the package-level internal variable, to prevent change 70 | // by other packages. 71 | func V1SequenceContext() WalletContext { 72 | return sequenceContextV1 73 | } 74 | 75 | func V2SequenceContext() WalletContext { 76 | return sequenceContextV2 77 | } 78 | 79 | func SequenceContext() WalletContext { 80 | return V2SequenceContext() 81 | } 82 | 83 | func SequenceContexts() WalletContexts { 84 | return WalletContexts{ 85 | 1: sequenceContextV1, 86 | 2: sequenceContextV2, 87 | } 88 | } 89 | 90 | func SequenceContextForWalletConfig(walletConfig core.WalletConfig) WalletContext { 91 | if _, ok := walletConfig.(*v1.WalletConfig); ok { 92 | return sequenceContextV1 93 | } else if _, ok := walletConfig.(*v2.WalletConfig); ok { 94 | return sequenceContextV2 95 | } 96 | return WalletContext{} 97 | } 98 | -------------------------------------------------------------------------------- /relayer/relayer.go: -------------------------------------------------------------------------------- 1 | package relayer 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/0xsequence/go-sequence" 8 | "github.com/0xsequence/go-sequence/relayer/proto" 9 | ) 10 | 11 | type Options struct { 12 | HTTPClient proto.HTTPClient 13 | JWTAuthToken string 14 | } 15 | 16 | // NewRpcRelayer creates a new Sequence Relayer client instance. See https://docs.sequence.xyz for a list of 17 | // relayer urls, and please see https://sequence.build to get a `projectAccessKey`. 18 | func NewRelayer(relayerURL string, projectAccessKey string, options ...Options) proto.RelayerClient { 19 | opts := Options{} 20 | if len(options) > 0 { 21 | opts = options[0] 22 | } 23 | 24 | client := &httpclient{ 25 | client: opts.HTTPClient, 26 | projectAccessKey: projectAccessKey, 27 | } 28 | if opts.HTTPClient == nil { 29 | client.client = http.DefaultClient 30 | } 31 | if opts.JWTAuthToken != "" { 32 | client.jwtAuthHeader = fmt.Sprintf("BEARER %s", opts.JWTAuthToken) 33 | } 34 | 35 | return proto.NewRelayerClient(relayerURL, client) 36 | } 37 | 38 | type httpclient struct { 39 | client proto.HTTPClient 40 | jwtAuthHeader string 41 | projectAccessKey string 42 | } 43 | 44 | func (c *httpclient) Do(req *http.Request) (*http.Response, error) { 45 | if c.projectAccessKey != "" { 46 | req.Header.Set("X-Access-Key", c.projectAccessKey) 47 | } 48 | if c.jwtAuthHeader != "" { 49 | req.Header.Set("Authorization", c.jwtAuthHeader) 50 | } 51 | return c.client.Do(req) 52 | } 53 | 54 | func MetaTxnStatusFromString(s string) sequence.MetaTxnStatus { 55 | var ethTxnStatus proto.ETHTxnStatus 56 | ethTxnStatus.UnmarshalText([]byte(s)) 57 | 58 | switch ethTxnStatus { 59 | case proto.ETHTxnStatus_UNKNOWN: 60 | return sequence.MetaTxnStatusUnknown 61 | case proto.ETHTxnStatus_DROPPED: 62 | return sequence.MetaTxnStatusUnknown 63 | case proto.ETHTxnStatus_QUEUED: 64 | return sequence.MetaTxnStatusUnknown 65 | case proto.ETHTxnStatus_SENT: 66 | return sequence.MetaTxnStatusUnknown 67 | case proto.ETHTxnStatus_SUCCEEDED: 68 | return sequence.MetaTxnExecuted 69 | case proto.ETHTxnStatus_PARTIALLY_FAILED: 70 | return sequence.MetaTxnFailed 71 | case proto.ETHTxnStatus_FAILED: 72 | return sequence.MetaTxnFailed 73 | default: 74 | return sequence.MetaTxnStatusUnknown 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /sequence.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | -------------------------------------------------------------------------------- /sequence_test.go: -------------------------------------------------------------------------------- 1 | package sequence_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/0xsequence/go-sequence/testutil" 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | var ( 11 | testChain *testutil.TestChain 12 | ) 13 | 14 | func init() { 15 | var err error 16 | testChain, err = testutil.NewTestChain() 17 | if err != nil { 18 | panic(err) 19 | } 20 | if err := testChain.Connect(); err != nil { 21 | panic(err) 22 | } 23 | testChain.MustDeploySequenceContext() 24 | } 25 | 26 | func TestChainID(t *testing.T) { 27 | assert.Equal(t, testChain.ChainID().Uint64(), uint64(1337)) 28 | } 29 | -------------------------------------------------------------------------------- /signer.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "context" 5 | "math/big" 6 | 7 | "github.com/0xsequence/ethkit/go-ethereum/common" 8 | ) 9 | 10 | type MessageSigner interface { 11 | SignMessage(msg []byte) ([]byte, error) 12 | } 13 | 14 | type DigestSigner interface { 15 | SignDigest(ctx context.Context, digest common.Hash, optChainID ...*big.Int) ([]byte, error) 16 | } 17 | 18 | type Signer interface { 19 | Address() common.Address 20 | } 21 | 22 | type SignerMessageSigner interface { 23 | Signer 24 | MessageSigner 25 | } 26 | 27 | type SignerDigestSigner interface { 28 | Signer 29 | DigestSigner 30 | } 31 | -------------------------------------------------------------------------------- /testutil/chain/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /testutil/chain/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-chain", 3 | "version": "0.0.0", 4 | "private": true, 5 | "license": "none", 6 | "scripts": { 7 | "test": "concurrently -k --success first 'pnpm start:geth' 'cd ../../ && make go-test'", 8 | "start:geth": "docker run -p 8545:8545 --log-driver none --rm ethereum/client-go:v1.15.2 --dev --dev.period 2 --networkid ${npm_package_config_testchainChainID} --miner.gaslimit ${npm_package_config_testchainGasLimit} --miner.gasprice 1 --http --http.addr 0.0.0.0 --rpc.allow-unprotected-txs --verbosity 1", 9 | "start:geth:verbose": "docker run -p 8545:8545 --rm ethereum/client-go:v1.15.2 --dev --dev.period 2 --networkid ${npm_package_config_testchainChainID} --miner.gaslimit ${npm_package_config_testchainGasLimit} --miner.gasprice 1 --http --http.addr 0.0.0.0 --rpc.allow-unprotected-txs", 10 | "start:anvil": "anvil --mnemonic \"${npm_package_config_mnemonic}\" --block-time 1 --balance ${npm_package_config_etherBalance} --host 0.0.0.0 --chain-id ${npm_package_config_testchainChainID} --gas-limit ${npm_package_config_testchainGasLimit} --gas-price ${npm_package_config_testchainGasPrice}", 11 | "start:anvil:verbose": "anvil --mnemonic \"${npm_package_config_mnemonic}\" --block-time 1 --balance ${npm_package_config_etherBalance} --host 0.0.0.0 --chain-id ${npm_package_config_testchainChainID} --gas-limit ${npm_package_config_testchainGasLimit} --gas-price ${npm_package_config_testchainGasPrice} --verbose", 12 | "wait:server": "wait-on -t 120000 tcp:127.0.0.1:8545" 13 | }, 14 | "devDependencies": { 15 | "concurrently": "^9.1.2", 16 | "wait-on": "^8.0.2" 17 | }, 18 | "config": { 19 | "mnemonic": "major danger this key only test please avoid main net use okay", 20 | "testchainChainID": 1337, 21 | "testchainPort": 8545, 22 | "testchainGasLimit": "15000000", 23 | "testchainGasPrice": "20000000000", 24 | "etherBalance": "100000" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /testutil/contracts.go: -------------------------------------------------------------------------------- 1 | package testutil 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/0xsequence/ethkit/ethartifact" 7 | "github.com/0xsequence/ethkit/ethrpc" 8 | "github.com/0xsequence/ethkit/ethtxn" 9 | "github.com/0xsequence/ethkit/ethwallet" 10 | "github.com/0xsequence/ethkit/go-ethereum" 11 | "github.com/0xsequence/ethkit/go-ethereum/accounts/abi" 12 | "github.com/0xsequence/ethkit/go-ethereum/common" 13 | "github.com/0xsequence/ethkit/go-ethereum/core/types" 14 | "github.com/0xsequence/go-sequence/contracts" 15 | "github.com/0xsequence/go-sequence/contracts/gen/walletcallmock" 16 | ) 17 | 18 | var ( 19 | Contracts = ethartifact.NewContractRegistry() 20 | ) 21 | 22 | func init() { 23 | Contracts.MustAdd(contracts.ERC20Mock) 24 | Contracts.MustAdd(contracts.V1.WalletFactory) 25 | 26 | Contracts.MustRegisterJSON("WALLET_CALL_RECV_MOCK", walletcallmock.CallReceiverMockABI, common.FromHex(walletcallmock.CallReceiverMockBin)) 27 | } 28 | 29 | func ContractCall(provider *ethrpc.Provider, contractAddress common.Address, contractABI abi.ABI, result interface{}, method string, args ...interface{}) ([]byte, error) { 30 | calldata, err := contractABI.Pack(method, args...) 31 | if err != nil { 32 | return nil, err 33 | } 34 | 35 | msg := ethereum.CallMsg{ 36 | To: &contractAddress, 37 | Data: calldata, 38 | } 39 | 40 | output, err := provider.CallContract(context.Background(), msg, nil) 41 | if err != nil { 42 | return nil, err 43 | } 44 | if result == nil { 45 | return output, nil 46 | } 47 | 48 | err = contractABI.UnpackIntoInterface(result, method, output) 49 | if err != nil { 50 | return output, err 51 | } 52 | return output, nil 53 | } 54 | 55 | func ContractQuery(provider *ethrpc.Provider, contractAddress common.Address, inputExpr, outputExpr string, args []string) ([]string, error) { 56 | return provider.ContractQuery(context.Background(), contractAddress.Hex(), inputExpr, outputExpr, args) 57 | } 58 | 59 | func ContractTransact(signer *ethwallet.Wallet, contractAddress common.Address, contractABI abi.ABI, method string, args ...interface{}) (*types.Receipt, error) { 60 | calldata, err := contractABI.Pack(method, args...) 61 | if err != nil { 62 | return nil, err 63 | } 64 | 65 | signedTxn, err := signer.NewTransaction(context.Background(), ðtxn.TransactionRequest{ 66 | To: &contractAddress, 67 | Data: calldata, 68 | }) 69 | if err != nil { 70 | return nil, err 71 | } 72 | 73 | _, waitReceipt, err := signer.SendTransaction(context.Background(), signedTxn) 74 | if err != nil { 75 | return nil, err 76 | } 77 | 78 | receipt, err := waitReceipt(context.Background()) 79 | if err != nil { 80 | return nil, err 81 | } 82 | 83 | return receipt, nil 84 | } 85 | -------------------------------------------------------------------------------- /testutil/testutil_test.go: -------------------------------------------------------------------------------- 1 | package testutil_test 2 | 3 | import ( 4 | "math/big" 5 | "testing" 6 | 7 | "github.com/0xsequence/ethkit/ethcoder" 8 | "github.com/0xsequence/ethkit/go-ethereum/core/types" 9 | "github.com/0xsequence/go-sequence/testutil" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | // yes, we even have to test the testutil 14 | 15 | var ( 16 | testChain *testutil.TestChain 17 | ) 18 | 19 | func init() { 20 | var err error 21 | testChain, err = testutil.NewTestChain() 22 | if err != nil { 23 | panic(err) 24 | } 25 | if err := testChain.Connect(); err != nil { 26 | panic(err) 27 | } 28 | } 29 | 30 | func TestTestutil(t *testing.T) { 31 | assert.Equal(t, testChain.ChainID().Uint64(), uint64(1337)) 32 | 33 | // V1DeploySequenceContext 34 | sequenceContext, err := testChain.V1DeploySequenceContext() 35 | assert.NoError(t, err) 36 | 37 | sequenceContextV2, err := testChain.V2DeploySequenceContext() 38 | assert.NoError(t, err) 39 | 40 | // Compare against "expexcted" testutil.V1SequenceContext 41 | expectedContext := testutil.V1SequenceContext() 42 | 43 | expectedContextV2 := testutil.V2SequenceContext() 44 | 45 | assert.Equal(t, expectedContext.FactoryAddress, sequenceContext.FactoryAddress) 46 | assert.Equal(t, expectedContext.MainModuleAddress, sequenceContext.MainModuleAddress) 47 | assert.Equal(t, expectedContext.MainModuleUpgradableAddress, sequenceContext.MainModuleUpgradableAddress) 48 | assert.Equal(t, expectedContext.GuestModuleAddress, sequenceContext.GuestModuleAddress) 49 | assert.Equal(t, expectedContext.UtilsAddress, sequenceContext.UtilsAddress) 50 | 51 | assert.Equal(t, expectedContextV2.FactoryAddress, sequenceContextV2.FactoryAddress) 52 | assert.Equal(t, expectedContextV2.MainModuleAddress, sequenceContextV2.MainModuleAddress) 53 | assert.Equal(t, expectedContextV2.MainModuleUpgradableAddress, sequenceContextV2.MainModuleUpgradableAddress) 54 | assert.Equal(t, expectedContextV2.GuestModuleAddress, sequenceContextV2.GuestModuleAddress) 55 | assert.Equal(t, expectedContextV2.UtilsAddress, sequenceContextV2.UtilsAddress) 56 | } 57 | 58 | func TestContractHelpers(t *testing.T) { 59 | callmockContract := testChain.UniDeploy(t, "WALLET_CALL_RECV_MOCK", 0) 60 | 61 | // Update contract value on CallReceiver by calling 'testCall' contract function 62 | receipt, err := testutil.ContractTransact( 63 | testChain.MustWallet(2), 64 | callmockContract.Address, callmockContract.ABI, 65 | "testCall", big.NewInt(143), ethcoder.MustHexDecode("0x112233"), 66 | ) 67 | assert.NoError(t, err) 68 | assert.NotNil(t, receipt) 69 | assert.Equal(t, types.ReceiptStatusSuccessful, receipt.Status) 70 | 71 | // Query the value ensuring its been updated on-chain 72 | ret, err := testutil.ContractQuery(testChain.Provider, callmockContract.Address, "lastValA()", "uint256", nil) 73 | assert.NoError(t, err) 74 | assert.Equal(t, []string{"143"}, ret) 75 | 76 | // Query the value using different method, where we unpack the value 77 | var result *big.Int 78 | _, err = testutil.ContractCall(testChain.Provider, callmockContract.Address, callmockContract.ABI, &result, "lastValA") 79 | assert.NoError(t, err) 80 | assert.Equal(t, uint64(143), result.Uint64()) 81 | } 82 | -------------------------------------------------------------------------------- /tools/go.mod: -------------------------------------------------------------------------------- 1 | module tools 2 | 3 | go 1.23.0 4 | 5 | toolchain go1.24.1 6 | 7 | require ( 8 | github.com/0xsequence/ethkit v1.32.0 9 | github.com/webrpc/webrpc v0.24.0 10 | go.uber.org/mock v0.5.1-0.20250204205401-bb4128ea0af2 11 | ) 12 | 13 | require ( 14 | github.com/bits-and-blooms/bitset v1.22.0 // indirect 15 | github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect 16 | github.com/consensys/bavard v0.1.30 // indirect 17 | github.com/consensys/gnark-crypto v0.17.0 // indirect 18 | github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect 19 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect 20 | github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect 21 | github.com/holiman/uint256 v1.3.2 // indirect 22 | github.com/mmcloughlin/addchain v0.4.0 // indirect 23 | github.com/supranational/blst v0.3.14 // indirect 24 | golang.org/x/crypto v0.36.0 // indirect 25 | golang.org/x/sync v0.12.0 // indirect 26 | golang.org/x/sys v0.31.0 // indirect 27 | rsc.io/tmplfunc v0.0.3 // indirect 28 | ) 29 | -------------------------------------------------------------------------------- /tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | package tools 5 | 6 | // CLI tools used for the dev environment. 7 | // -- 8 | // 9 | // If you'd like to add a cli tool, simply add its import path below 10 | // here, then add it to go.mod via `go get -u `. 11 | // 12 | // To use a CLI package from below, instead of compiling the bin 13 | // and using it locally (which you can do with GOBIN=$PWD/bin; go install ), 14 | // it's easier to manage by just running the cli via `go run`. 15 | // 16 | // For instance, if you want to use the `rerun` CLI, previously you'd 17 | // use it from your global system with `rerun `. Now, you should run it 18 | // via: `go run github.com/goware/rerun/cmd/rerun `. 19 | // 20 | // This is considered best practice in the Go space. For more info on this 21 | // technique see https://gist.github.com/tschaub/66f5feb20ae1b5166e9fe928c5cba5e4 22 | 23 | import ( 24 | _ "github.com/0xsequence/ethkit" 25 | _ "github.com/webrpc/webrpc" 26 | _ "go.uber.org/mock/gomock" 27 | ) 28 | -------------------------------------------------------------------------------- /utils.go: -------------------------------------------------------------------------------- 1 | package sequence 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "math/big" 7 | 8 | "github.com/0xsequence/ethkit/ethtxn" 9 | "github.com/0xsequence/ethkit/ethwallet" 10 | "github.com/0xsequence/ethkit/go-ethereum/common" 11 | "github.com/0xsequence/ethkit/go-ethereum/core/types" 12 | "github.com/0xsequence/go-sequence/contracts" 13 | "github.com/0xsequence/go-sequence/core" 14 | v1 "github.com/0xsequence/go-sequence/core/v1" 15 | v2 "github.com/0xsequence/go-sequence/core/v2" 16 | ) 17 | 18 | var zeroAddress = common.Address{} 19 | 20 | func DeploySequenceWallet(sender *ethwallet.Wallet, walletConfig core.WalletConfig, walletContext WalletContext) (common.Address, *types.Transaction, ethtxn.WaitReceipt, error) { 21 | if sender.GetProvider() == nil { 22 | return common.Address{}, nil, nil, ErrProviderNotSet 23 | } 24 | 25 | provider := sender.GetProvider() 26 | chainID, err := provider.ChainID(context.Background()) 27 | if err != nil { 28 | return common.Address{}, nil, nil, err 29 | } 30 | 31 | walletAddress, _, deployData, err := EncodeWalletDeployment(walletConfig, walletContext) 32 | if err != nil { 33 | return common.Address{}, nil, nil, err 34 | } 35 | 36 | deployTx, err := sender.NewTransaction(context.Background(), ðtxn.TransactionRequest{ 37 | To: &walletContext.FactoryAddress, 38 | Data: deployData, 39 | // TODO: Move this hardcoded gas limit to a configuration 40 | // or fix it with a contract patch 41 | GasLimit: 131072, 42 | }) 43 | 44 | signedDeployTx, err := sender.SignTx(deployTx, chainID) 45 | if err != nil { 46 | return common.Address{}, nil, nil, err 47 | } 48 | 49 | tx, waitReceipt, err := sender.SendTransaction(context.Background(), signedDeployTx) 50 | 51 | return walletAddress, tx, waitReceipt, nil 52 | } 53 | 54 | func EncodeWalletDeployment(walletConfig core.WalletConfig, walletContext WalletContext) (common.Address, common.Address, []byte, error) { 55 | walletImageHash := walletConfig.ImageHash().Hex() 56 | walletAddress, err := AddressFromImageHash(walletImageHash, walletContext) 57 | if err != nil { 58 | return common.Address{}, common.Address{}, nil, err 59 | } 60 | 61 | if _, ok := walletConfig.(*v1.WalletConfig); ok { 62 | deployData, err := contracts.V1.WalletFactory.ABI.Pack("deploy", walletContext.MainModuleAddress, common.HexToHash(walletImageHash)) 63 | if err != nil { 64 | return common.Address{}, common.Address{}, nil, err 65 | } 66 | 67 | return walletAddress, walletContext.FactoryAddress, deployData, nil 68 | } else if _, ok := walletConfig.(*v2.WalletConfig); ok { 69 | deployData, err := contracts.V2.WalletFactory.ABI.Pack("deploy", walletContext.MainModuleAddress, common.HexToHash(walletImageHash)) 70 | if err != nil { 71 | return common.Address{}, common.Address{}, nil, err 72 | } 73 | return walletAddress, walletContext.FactoryAddress, deployData, nil 74 | } 75 | return common.Address{}, common.Address{}, nil, fmt.Errorf("unsupported wallet config version") 76 | } 77 | 78 | func DecodeRevertReason(logs []*types.Log) []string { 79 | reasons := []string{} 80 | for _, log := range logs { 81 | _, reason, err := V1DecodeTxFailedEvent(log) 82 | if err != nil { 83 | _, reason, _, _ = V2DecodeTxFailedEvent(log) 84 | } 85 | 86 | reasons = append(reasons, reason) 87 | } 88 | return reasons 89 | } 90 | 91 | func ParseHexOrDec(s string) (*big.Int, bool) { 92 | if len(s) > 2 && s[0:2] == "0x" { 93 | return new(big.Int).SetString(s[2:], 16) 94 | } 95 | return new(big.Int).SetString(s, 10) 96 | } 97 | -------------------------------------------------------------------------------- /utils_test.go: -------------------------------------------------------------------------------- 1 | package sequence_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/0xsequence/ethkit/ethwallet" 8 | "github.com/0xsequence/ethkit/go-ethereum/core/types" 9 | "github.com/0xsequence/go-sequence" 10 | v1 "github.com/0xsequence/go-sequence/core/v1" 11 | v2 "github.com/0xsequence/go-sequence/core/v2" 12 | "github.com/0xsequence/go-sequence/testutil" 13 | "github.com/stretchr/testify/assert" 14 | ) 15 | 16 | func TestDeploySequenceWallet(t *testing.T) { 17 | 18 | t.Run("v1", func(t *testing.T) { 19 | // Create new single owner smart wallet (initially undeployed, of course) 20 | eoa, err := ethwallet.NewWalletFromRandomEntropy() 21 | assert.NoError(t, err) 22 | 23 | wallet, err := sequence.GenericNewWalletSingleOwner[*v1.WalletConfig](eoa, testutil.V1SequenceContext()) 24 | assert.NoError(t, err) 25 | 26 | wallet.SetProvider(testChain.Provider) 27 | chainID := wallet.GetChainID() 28 | assert.Equal(t, uint64(1337), chainID.Uint64()) 29 | 30 | // Confirm the wallet is not deployed 31 | isDeployed, err := wallet.IsDeployed() 32 | if err != nil { 33 | t.Fatalf("wallet is deployed, but expecting it to be undeployed") 34 | } 35 | assert.False(t, isDeployed) 36 | 37 | relayWallet := testChain.GetRelayerWallet() 38 | 39 | walletAddress, tx, waitReceipt, err := sequence.DeploySequenceWallet(relayWallet, wallet.GetWalletConfig(), wallet.GetWalletContext()) 40 | assert.NoError(t, err) 41 | assert.NotNil(t, tx) 42 | 43 | receipt, err := waitReceipt(context.Background()) 44 | assert.NoError(t, err) 45 | assert.True(t, receipt.Status == types.ReceiptStatusSuccessful) 46 | 47 | // Confirm wallet is now deployed 48 | isDeployed, err = wallet.IsDeployed() 49 | assert.NoError(t, err) 50 | assert.True(t, isDeployed) 51 | 52 | assert.Equal(t, wallet.Address(), walletAddress) 53 | }) 54 | 55 | t.Run("v2", func(t *testing.T) { 56 | // Create new single owner smart wallet (initially undeployed, of course) 57 | eoa, err := ethwallet.NewWalletFromRandomEntropy() 58 | assert.NoError(t, err) 59 | 60 | wallet, err := sequence.GenericNewWalletSingleOwner[*v2.WalletConfig](eoa, testutil.V2SequenceContext()) 61 | assert.NoError(t, err) 62 | 63 | wallet.SetProvider(testChain.Provider) 64 | chainID := wallet.GetChainID() 65 | assert.Equal(t, uint64(1337), chainID.Uint64()) 66 | 67 | // Confirm the wallet is not deployed 68 | isDeployed, err := wallet.IsDeployed() 69 | if err != nil { 70 | t.Fatalf("wallet is deployed, but expecting it to be undeployed") 71 | } 72 | assert.False(t, isDeployed) 73 | 74 | relayWallet := testChain.GetRelayerWallet() 75 | 76 | walletAddress, tx, waitReceipt, err := sequence.DeploySequenceWallet(relayWallet, wallet.GetWalletConfig(), wallet.GetWalletContext()) 77 | assert.NoError(t, err) 78 | assert.NotNil(t, tx) 79 | 80 | receipt, err := waitReceipt(context.Background()) 81 | assert.NoError(t, err) 82 | assert.True(t, receipt.Status == types.ReceiptStatusSuccessful) 83 | 84 | // Confirm wallet is now deployed 85 | isDeployed, err = wallet.IsDeployed() 86 | assert.NoError(t, err) 87 | assert.True(t, isDeployed) 88 | 89 | assert.Equal(t, wallet.Address(), walletAddress) 90 | }) 91 | 92 | } 93 | --------------------------------------------------------------------------------