gnosis.eth.clients package

Submodules

gnosis.eth.clients.blockscout_client module

exception gnosis.eth.clients.blockscout_client.BlockScoutConfigurationProblem

Bases: BlockscoutClientException

class gnosis.eth.clients.blockscout_client.BlockscoutClient(network: EthereumNetwork)

Bases: object

NETWORK_WITH_URL = {EthereumNetwork.ACALA_NETWORK: 'https://blockscout.acala.network/graphiql', EthereumNetwork.ARTHERA_MAINNET: 'https://explorer.arthera.net/graphiql', EthereumNetwork.ARTHERA_TESTNET: 'https://explorer-test.arthera.net/graphiql', EthereumNetwork.ASTAR: 'https://blockscout.com/astar/graphiql', EthereumNetwork.BOBA_NETWORK: 'https://blockexplorer.boba.network/graphiql', EthereumNetwork.CASCADIA_TESTNET: 'https://explorer.cascadia.foundation/graphiql', EthereumNetwork.CRONOS_MAINNET: 'https://cronos.org/explorer/graphiql', EthereumNetwork.CRONOS_TESTNET: 'https://cronos.org/explorer/testnet3/graphiql', EthereumNetwork.CROSSBELL: 'https://scan.crossbell.io/graphiql', EthereumNetwork.ENERGY_WEB_CHAIN: 'https://explorer.energyweb.org/graphiql', EthereumNetwork.ENERGY_WEB_VOLTA_TESTNET: 'https://volta-explorer.energyweb.org/graphiql', EthereumNetwork.ETHEREUM_CLASSIC: 'https://blockscout.com/etc/mainnet/graphiql', EthereumNetwork.EVMOS: 'https://evm.evmos.org/graphiql', EthereumNetwork.EVMOS_TESTNET: 'https://evm.evmos.dev/graphiql', EthereumNetwork.FUSE_MAINNET: 'https://explorer.fuse.io/graphiql', EthereumNetwork.GATHER_DEVNET_NETWORK: 'https://devnet-explorer.gather.network/graphiql', EthereumNetwork.GATHER_MAINNET_NETWORK: 'https://explorer.gather.network/graphiql', EthereumNetwork.GATHER_TESTNET_NETWORK: 'https://testnet-explorer.gather.network/graphiql', EthereumNetwork.GNOSIS: 'https://gnosis.blockscout.com/api/v1/graphql', EthereumNetwork.GODWOKEN_MAINNET: 'https://v1.gwscan.com/graphiql', EthereumNetwork.GODWOKEN_TESTNET_V1: 'https://v1.betanet.gwscan.com/graphiql', EthereumNetwork.HAQQ_CHAIN_TESTNET: 'https://explorer.testedge2.haqq.network/graphiql', EthereumNetwork.HAQQ_NETWORK: 'https://explorer.haqq.network/graphiql', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org/graphiql', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org/graphiql', EthereumNetwork.KARURA_NETWORK_TESTNET: 'https://blockscout.karura.network/graphiql', EthereumNetwork.KCC_MAINNET: 'https://scan.kcc.io/graphiql', EthereumNetwork.KCC_TESTNET: 'https://scan-testnet.kcc.network/graphiql', EthereumNetwork.KLAYTN_MAINNET_CYPRESS: 'https://scope.klaytn.com/graphiql', EthereumNetwork.KLAYTN_TESTNET_BAOBAB: 'https://baobab.scope.klaytn.com/graphiql', EthereumNetwork.KROMA: 'https://blockscout.kroma.network/graphiql', EthereumNetwork.KROMA_SEPOLIA: 'https://blockscout.sepolia.kroma.network/graphiql', EthereumNetwork.LINEA: 'https://explorer.linea.build/graphiql', EthereumNetwork.LINEA_TESTNET: 'https://explorer.goerli.linea.build/graphiql', EthereumNetwork.LISK_SEPOLIA_TESTNET: 'https://sepolia-blockscout.lisk.com/graphiql', EthereumNetwork.MANTA_PACIFIC_MAINNET: 'https://pacific-explorer.manta.network/graphiql', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz/graphiql', EthereumNetwork.MANTLE_SEPOLIA_TESTNET: 'https://explorer.sepolia.mantle.xyz/graphiql', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz/graphiql', EthereumNetwork.METER_MAINNET: 'https://scan.meter.io/graphiql', EthereumNetwork.METER_TESTNET: 'https://scan-warringstakes.meter.io/graphiql', EthereumNetwork.METIS_ANDROMEDA_MAINNET: 'https://andromeda-explorer.metis.io/graphiql', EthereumNetwork.METIS_GOERLI_TESTNET: 'https://goerli.explorer.metisdevops.link/graphiql', EthereumNetwork.MODE: 'https://explorer.mode.network/graphiql', EthereumNetwork.MODE_TESTNET: 'https://sepolia.explorer.mode.network/graphiql', EthereumNetwork.MORDOR_TESTNET: 'https://blockscout.com/etc/mordor/graphiql', EthereumNetwork.NEON_EVM_DEVNET: 'https://neon-devnet.blockscout.com/graphiql', EthereumNetwork.NEON_EVM_MAINNET: 'https://neon.blockscout.com/graphiql', EthereumNetwork.OASIS_SAPPHIRE: 'https://explorer.sapphire.oasis.io/graphiql', EthereumNetwork.OASIS_SAPPHIRE_TESTNET: 'https://testnet.explorer.sapphire.oasis.dev/graphiql', EthereumNetwork.OP_SEPOLIA_TESTNET: 'https://optimism-sepolia.blockscout.com/graphiql', EthereumNetwork.PGN_PUBLIC_GOODS_NETWORK: 'https://explorer.publicgoods.network/graphiql', EthereumNetwork.POLIS_MAINNET: 'https://explorer.polis.tech/graphiql', EthereumNetwork.REI_CHAIN_TESTNET: 'https://scan-test.rei.network/graphiql', EthereumNetwork.REI_NETWORK: 'https://scan.rei.network/graphiql', EthereumNetwork.ROOTSTOCK_MAINNET: 'https://rootstock.blockscout.com/graphiql', EthereumNetwork.ROOTSTOCK_TESTNET: 'https://rootstock-testnet.blockscout.com/graphiql', EthereumNetwork.SCROLL: 'https://blockscout.scroll.io/graphiql', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://sepolia-blockscout.scroll.io/graphiql', EthereumNetwork.SEI_DEVNET: 'https://seitrace.com/graphiql', EthereumNetwork.SEPOLIA_PGN_PUBLIC_GOODS_NETWORK: 'https://explorer.sepolia.publicgoods.network/graphiql', EthereumNetwork.SHIDEN: 'https://blockscout.com/shiden/graphiql', EthereumNetwork.TAIKO_KATLA_L2: 'https://explorer.katla.taiko.xyz/graphiql', EthereumNetwork.TENET: 'https://tenetscan.io/graphiql', EthereumNetwork.TENET_TESTNET: 'https://testnet.tenetscan.io/graphiql', EthereumNetwork.THUNDERCORE_MAINNET: 'https://explorer-mainnet.thundercore.com/graphiql', EthereumNetwork.THUNDERCORE_TESTNET: 'https://explorer-testnet.thundercore.com/graphiql', EthereumNetwork.UNREAL_TESTNET: 'https://unreal.blockscout.com/graphiql', EthereumNetwork.VELAS_EVM_MAINNET: 'https://evmexplorer.velas.com/graphiql', EthereumNetwork.VENIDIUM_MAINNET: 'https://evm.venidiumexplorer.com/graphiql', EthereumNetwork.VENIDIUM_TESTNET: 'https://evm-testnet.venidiumexplorer.com/graphiql', EthereumNetwork.ZETACHAIN_ATHENS_3_TESTNET: 'https://zetachain-athens-3.blockscout.com/graphiql', EthereumNetwork.ZORA: 'https://explorer.zora.energy/graphiql', EthereumNetwork.ZORA_SEPOLIA_TESTNET: 'https://sepolia.explorer.zora.energy/graphiql'}
build_url(path: str)
get_contract_metadata(address: ChecksumAddress) ContractMetadata | None
exception gnosis.eth.clients.blockscout_client.BlockscoutClientException

Bases: Exception

gnosis.eth.clients.contract_metadata module

class gnosis.eth.clients.contract_metadata.ContractMetadata(name: str | None, abi: List[Dict[str, Any]], partial_match: bool)

Bases: object

abi: List[Dict[str, Any]]
name: str | None
partial_match: bool

gnosis.eth.clients.etherscan_client module

class gnosis.eth.clients.etherscan_client.EtherscanClient(network: EthereumNetwork, api_key: str | None = None, request_timeout: int = 10)

Bases: object

HTTP_HEADERS = {'User-Agent': 'curl/7.77.0'}
NETWORK_WITH_API_URL = {EthereumNetwork.ARBITRUM_GOERLI: 'https://api-goerli.arbiscan.io', EthereumNetwork.ARBITRUM_NOVA: 'https://api-nova.arbiscan.io', EthereumNetwork.ARBITRUM_ONE: 'https://api.arbiscan.io', EthereumNetwork.ARBITRUM_SEPOLIA: 'https://api-sepolia.arbiscan.io', EthereumNetwork.AVALANCHE_C_CHAIN: 'https://api.snowtrace.io', EthereumNetwork.BASE_GOERLI_TESTNET: 'https://api-goerli.basescan.org', EthereumNetwork.BNB_SMART_CHAIN_MAINNET: 'https://api.bscscan.com', EthereumNetwork.CELO_MAINNET: 'https://api.celoscan.io', EthereumNetwork.CRONOS_MAINNET: 'https://api.cronoscan.com', EthereumNetwork.CRONOS_TESTNET: 'https://api-testnet.cronoscan.com', EthereumNetwork.FANTOM_OPERA: 'https://api.ftmscan.com', EthereumNetwork.FANTOM_TESTNET: 'https://api-testnet.ftmscan.com', EthereumNetwork.GNOSIS: 'https://api.gnosisscan.io', EthereumNetwork.GOERLI: 'https://api-goerli.etherscan.io', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org/api', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org/api', EthereumNetwork.KROMA: 'https://api.kromascan.com', EthereumNetwork.KROMA_SEPOLIA: 'https://api-sepolia.kromascan.com', EthereumNetwork.LINEA: 'https://api.lineascan.build', EthereumNetwork.LINEA_TESTNET: 'https://api-testnet.lineascan.build', EthereumNetwork.MAINNET: 'https://api.etherscan.io', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz', EthereumNetwork.MOONBASE_ALPHA: 'https://api-moonbase.moonscan.io', EthereumNetwork.MOONBEAM: 'https://api-moonbeam.moonscan.io', EthereumNetwork.MOONRIVER: 'https://api-moonriver.moonscan.io', EthereumNetwork.NEON_EVM_DEVNET: 'https://devnet-api.neonscan.org', EthereumNetwork.NEON_EVM_MAINNET: 'https://api.neonscan.org', EthereumNetwork.OPTIMISM: 'https://api-optimistic.etherscan.io', EthereumNetwork.POLYGON: 'https://api.polygonscan.com', EthereumNetwork.POLYGON_ZKEVM: 'https://api-zkevm.polygonscan.com', EthereumNetwork.RINKEBY: 'https://api-rinkeby.etherscan.io', EthereumNetwork.ROPSTEN: 'https://api-ropsten.etherscan.io', EthereumNetwork.SCROLL: 'https://api.scrollscan.com', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://api-sepolia.scrollscan.dev', EthereumNetwork.SEPOLIA: 'https://api-sepolia.etherscan.io', EthereumNetwork.ZKSYNC_MAINNET: 'https://block-explorer-api.mainnet.zksync.io/'}
NETWORK_WITH_URL = {EthereumNetwork.ARBITRUM_GOERLI: 'https://goerli.arbiscan.io', EthereumNetwork.ARBITRUM_NOVA: 'https://nova.arbiscan.io', EthereumNetwork.ARBITRUM_ONE: 'https://arbiscan.io', EthereumNetwork.AVALANCHE_C_CHAIN: 'https://snowtrace.io', EthereumNetwork.BASE_GOERLI_TESTNET: 'https://goerli.basescan.org', EthereumNetwork.BNB_SMART_CHAIN_MAINNET: 'https://bscscan.com', EthereumNetwork.CELO_MAINNET: 'https://celoscan.io', EthereumNetwork.CRONOS_MAINNET: 'https://cronoscan.com', EthereumNetwork.CRONOS_TESTNET: 'https://testnet.cronoscan.com', EthereumNetwork.FANTOM_OPERA: 'https://ftmscan.com', EthereumNetwork.FANTOM_TESTNET: 'https://testnet.ftmscan.com/', EthereumNetwork.GNOSIS: 'https://gnosisscan.io', EthereumNetwork.GOERLI: 'https://goerli.etherscan.io', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org', EthereumNetwork.KROMA: 'https://kromascan.com', EthereumNetwork.KROMA_SEPOLIA: 'https://sepolia.kromascan.com', EthereumNetwork.LINEA: 'https://www.lineascan.build', EthereumNetwork.LINEA_TESTNET: 'https://goerli.lineascan.build', EthereumNetwork.MAINNET: 'https://etherscan.io', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz', EthereumNetwork.MOONBASE_ALPHA: 'https://moonbase.moonscan.io', EthereumNetwork.MOONBEAM: 'https://moonscan.io', EthereumNetwork.MOONRIVER: 'https://moonriver.moonscan.io', EthereumNetwork.NEON_EVM_DEVNET: 'https://devnet.neonscan.org', EthereumNetwork.NEON_EVM_MAINNET: 'https://neonscan.org', EthereumNetwork.OPTIMISM: 'https://optimistic.etherscan.io', EthereumNetwork.POLYGON: 'https://polygonscan.com', EthereumNetwork.POLYGON_ZKEVM: 'https://zkevm.polygonscan.com', EthereumNetwork.RINKEBY: 'https://rinkeby.etherscan.io', EthereumNetwork.ROPSTEN: 'https://ropsten.etherscan.io', EthereumNetwork.SCROLL: 'https://scrollscan.com', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://sepolia.scrollscan.dev', EthereumNetwork.SEPOLIA: 'https://sepolia.etherscan.io', EthereumNetwork.ZKSYNC_MAINNET: 'https://explorer.zksync.io/'}
build_url(path: str)
get_contract_abi(contract_address: str, retry: bool = True)
get_contract_metadata(contract_address: str, retry: bool = True) ContractMetadata | None
get_contract_source_code(contract_address: str, retry: bool = True)

Get source code for a contract. Source code query also returns:

  • ContractName: “”,

  • CompilerVersion: “”,

  • OptimizationUsed: “”,

  • Runs: “”,

  • ConstructorArguments: “”

  • EVMVersion: “Default”,

  • Library: “”,

  • LicenseType: “”,

  • Proxy: “0”,

  • Implementation: “”,

  • SwarmSource: “”

Parameters:
  • contract_address

  • retry – if True, try again if there’s Rate Limit Error

Returns:

exception gnosis.eth.clients.etherscan_client.EtherscanClientConfigurationProblem

Bases: Exception

exception gnosis.eth.clients.etherscan_client.EtherscanClientException

Bases: Exception

exception gnosis.eth.clients.etherscan_client.EtherscanRateLimitError

Bases: EtherscanClientException

gnosis.eth.clients.sourcify_client module

class gnosis.eth.clients.sourcify_client.SourcifyClient(network: EthereumNetwork = EthereumNetwork.MAINNET, base_url_api: str = 'https://sourcify.dev', base_url_repo: str = 'https://repo.sourcify.dev/', request_timeout: int = 10)

Bases: object

Get contract metadata from Sourcify. Matches can be full or partial:

  • Full: Both the source files as well as the meta data files were an exact match between the deployed bytecode and the published files.

  • Partial: Source code compiles to the same bytecode and thus the contract behaves in the same way, but the source code can be different: Variables can have misleading names, comments can be different and especially the NatSpec comments could have been modified.

get_chains() Dict[str, Any]
get_contract_metadata(contract_address: str) ContractMetadata | None
is_chain_supported(chain_id: int) bool
exception gnosis.eth.clients.sourcify_client.SourcifyClientConfigurationProblem

Bases: Exception

exception gnosis.eth.clients.sourcify_client.SourcifyClientException

Bases: Exception

Module contents

exception gnosis.eth.clients.BlockScoutConfigurationProblem

Bases: BlockscoutClientException

class gnosis.eth.clients.BlockscoutClient(network: EthereumNetwork)

Bases: object

NETWORK_WITH_URL = {EthereumNetwork.ACALA_NETWORK: 'https://blockscout.acala.network/graphiql', EthereumNetwork.ARTHERA_MAINNET: 'https://explorer.arthera.net/graphiql', EthereumNetwork.ARTHERA_TESTNET: 'https://explorer-test.arthera.net/graphiql', EthereumNetwork.ASTAR: 'https://blockscout.com/astar/graphiql', EthereumNetwork.BOBA_NETWORK: 'https://blockexplorer.boba.network/graphiql', EthereumNetwork.CASCADIA_TESTNET: 'https://explorer.cascadia.foundation/graphiql', EthereumNetwork.CRONOS_MAINNET: 'https://cronos.org/explorer/graphiql', EthereumNetwork.CRONOS_TESTNET: 'https://cronos.org/explorer/testnet3/graphiql', EthereumNetwork.CROSSBELL: 'https://scan.crossbell.io/graphiql', EthereumNetwork.ENERGY_WEB_CHAIN: 'https://explorer.energyweb.org/graphiql', EthereumNetwork.ENERGY_WEB_VOLTA_TESTNET: 'https://volta-explorer.energyweb.org/graphiql', EthereumNetwork.ETHEREUM_CLASSIC: 'https://blockscout.com/etc/mainnet/graphiql', EthereumNetwork.EVMOS: 'https://evm.evmos.org/graphiql', EthereumNetwork.EVMOS_TESTNET: 'https://evm.evmos.dev/graphiql', EthereumNetwork.FUSE_MAINNET: 'https://explorer.fuse.io/graphiql', EthereumNetwork.GATHER_DEVNET_NETWORK: 'https://devnet-explorer.gather.network/graphiql', EthereumNetwork.GATHER_MAINNET_NETWORK: 'https://explorer.gather.network/graphiql', EthereumNetwork.GATHER_TESTNET_NETWORK: 'https://testnet-explorer.gather.network/graphiql', EthereumNetwork.GNOSIS: 'https://gnosis.blockscout.com/api/v1/graphql', EthereumNetwork.GODWOKEN_MAINNET: 'https://v1.gwscan.com/graphiql', EthereumNetwork.GODWOKEN_TESTNET_V1: 'https://v1.betanet.gwscan.com/graphiql', EthereumNetwork.HAQQ_CHAIN_TESTNET: 'https://explorer.testedge2.haqq.network/graphiql', EthereumNetwork.HAQQ_NETWORK: 'https://explorer.haqq.network/graphiql', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org/graphiql', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org/graphiql', EthereumNetwork.KARURA_NETWORK_TESTNET: 'https://blockscout.karura.network/graphiql', EthereumNetwork.KCC_MAINNET: 'https://scan.kcc.io/graphiql', EthereumNetwork.KCC_TESTNET: 'https://scan-testnet.kcc.network/graphiql', EthereumNetwork.KLAYTN_MAINNET_CYPRESS: 'https://scope.klaytn.com/graphiql', EthereumNetwork.KLAYTN_TESTNET_BAOBAB: 'https://baobab.scope.klaytn.com/graphiql', EthereumNetwork.KROMA: 'https://blockscout.kroma.network/graphiql', EthereumNetwork.KROMA_SEPOLIA: 'https://blockscout.sepolia.kroma.network/graphiql', EthereumNetwork.LINEA: 'https://explorer.linea.build/graphiql', EthereumNetwork.LINEA_TESTNET: 'https://explorer.goerli.linea.build/graphiql', EthereumNetwork.LISK_SEPOLIA_TESTNET: 'https://sepolia-blockscout.lisk.com/graphiql', EthereumNetwork.MANTA_PACIFIC_MAINNET: 'https://pacific-explorer.manta.network/graphiql', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz/graphiql', EthereumNetwork.MANTLE_SEPOLIA_TESTNET: 'https://explorer.sepolia.mantle.xyz/graphiql', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz/graphiql', EthereumNetwork.METER_MAINNET: 'https://scan.meter.io/graphiql', EthereumNetwork.METER_TESTNET: 'https://scan-warringstakes.meter.io/graphiql', EthereumNetwork.METIS_ANDROMEDA_MAINNET: 'https://andromeda-explorer.metis.io/graphiql', EthereumNetwork.METIS_GOERLI_TESTNET: 'https://goerli.explorer.metisdevops.link/graphiql', EthereumNetwork.MODE: 'https://explorer.mode.network/graphiql', EthereumNetwork.MODE_TESTNET: 'https://sepolia.explorer.mode.network/graphiql', EthereumNetwork.MORDOR_TESTNET: 'https://blockscout.com/etc/mordor/graphiql', EthereumNetwork.NEON_EVM_DEVNET: 'https://neon-devnet.blockscout.com/graphiql', EthereumNetwork.NEON_EVM_MAINNET: 'https://neon.blockscout.com/graphiql', EthereumNetwork.OASIS_SAPPHIRE: 'https://explorer.sapphire.oasis.io/graphiql', EthereumNetwork.OASIS_SAPPHIRE_TESTNET: 'https://testnet.explorer.sapphire.oasis.dev/graphiql', EthereumNetwork.OP_SEPOLIA_TESTNET: 'https://optimism-sepolia.blockscout.com/graphiql', EthereumNetwork.PGN_PUBLIC_GOODS_NETWORK: 'https://explorer.publicgoods.network/graphiql', EthereumNetwork.POLIS_MAINNET: 'https://explorer.polis.tech/graphiql', EthereumNetwork.REI_CHAIN_TESTNET: 'https://scan-test.rei.network/graphiql', EthereumNetwork.REI_NETWORK: 'https://scan.rei.network/graphiql', EthereumNetwork.ROOTSTOCK_MAINNET: 'https://rootstock.blockscout.com/graphiql', EthereumNetwork.ROOTSTOCK_TESTNET: 'https://rootstock-testnet.blockscout.com/graphiql', EthereumNetwork.SCROLL: 'https://blockscout.scroll.io/graphiql', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://sepolia-blockscout.scroll.io/graphiql', EthereumNetwork.SEI_DEVNET: 'https://seitrace.com/graphiql', EthereumNetwork.SEPOLIA_PGN_PUBLIC_GOODS_NETWORK: 'https://explorer.sepolia.publicgoods.network/graphiql', EthereumNetwork.SHIDEN: 'https://blockscout.com/shiden/graphiql', EthereumNetwork.TAIKO_KATLA_L2: 'https://explorer.katla.taiko.xyz/graphiql', EthereumNetwork.TENET: 'https://tenetscan.io/graphiql', EthereumNetwork.TENET_TESTNET: 'https://testnet.tenetscan.io/graphiql', EthereumNetwork.THUNDERCORE_MAINNET: 'https://explorer-mainnet.thundercore.com/graphiql', EthereumNetwork.THUNDERCORE_TESTNET: 'https://explorer-testnet.thundercore.com/graphiql', EthereumNetwork.UNREAL_TESTNET: 'https://unreal.blockscout.com/graphiql', EthereumNetwork.VELAS_EVM_MAINNET: 'https://evmexplorer.velas.com/graphiql', EthereumNetwork.VENIDIUM_MAINNET: 'https://evm.venidiumexplorer.com/graphiql', EthereumNetwork.VENIDIUM_TESTNET: 'https://evm-testnet.venidiumexplorer.com/graphiql', EthereumNetwork.ZETACHAIN_ATHENS_3_TESTNET: 'https://zetachain-athens-3.blockscout.com/graphiql', EthereumNetwork.ZORA: 'https://explorer.zora.energy/graphiql', EthereumNetwork.ZORA_SEPOLIA_TESTNET: 'https://sepolia.explorer.zora.energy/graphiql'}
build_url(path: str)
get_contract_metadata(address: ChecksumAddress) ContractMetadata | None
exception gnosis.eth.clients.BlockscoutClientException

Bases: Exception

class gnosis.eth.clients.ContractMetadata(name: str | None, abi: List[Dict[str, Any]], partial_match: bool)

Bases: object

abi: List[Dict[str, Any]]
name: str | None
partial_match: bool
class gnosis.eth.clients.EtherscanClient(network: EthereumNetwork, api_key: str | None = None, request_timeout: int = 10)

Bases: object

HTTP_HEADERS = {'User-Agent': 'curl/7.77.0'}
NETWORK_WITH_API_URL = {EthereumNetwork.ARBITRUM_GOERLI: 'https://api-goerli.arbiscan.io', EthereumNetwork.ARBITRUM_NOVA: 'https://api-nova.arbiscan.io', EthereumNetwork.ARBITRUM_ONE: 'https://api.arbiscan.io', EthereumNetwork.ARBITRUM_SEPOLIA: 'https://api-sepolia.arbiscan.io', EthereumNetwork.AVALANCHE_C_CHAIN: 'https://api.snowtrace.io', EthereumNetwork.BASE_GOERLI_TESTNET: 'https://api-goerli.basescan.org', EthereumNetwork.BNB_SMART_CHAIN_MAINNET: 'https://api.bscscan.com', EthereumNetwork.CELO_MAINNET: 'https://api.celoscan.io', EthereumNetwork.CRONOS_MAINNET: 'https://api.cronoscan.com', EthereumNetwork.CRONOS_TESTNET: 'https://api-testnet.cronoscan.com', EthereumNetwork.FANTOM_OPERA: 'https://api.ftmscan.com', EthereumNetwork.FANTOM_TESTNET: 'https://api-testnet.ftmscan.com', EthereumNetwork.GNOSIS: 'https://api.gnosisscan.io', EthereumNetwork.GOERLI: 'https://api-goerli.etherscan.io', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org/api', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org/api', EthereumNetwork.KROMA: 'https://api.kromascan.com', EthereumNetwork.KROMA_SEPOLIA: 'https://api-sepolia.kromascan.com', EthereumNetwork.LINEA: 'https://api.lineascan.build', EthereumNetwork.LINEA_TESTNET: 'https://api-testnet.lineascan.build', EthereumNetwork.MAINNET: 'https://api.etherscan.io', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz', EthereumNetwork.MOONBASE_ALPHA: 'https://api-moonbase.moonscan.io', EthereumNetwork.MOONBEAM: 'https://api-moonbeam.moonscan.io', EthereumNetwork.MOONRIVER: 'https://api-moonriver.moonscan.io', EthereumNetwork.NEON_EVM_DEVNET: 'https://devnet-api.neonscan.org', EthereumNetwork.NEON_EVM_MAINNET: 'https://api.neonscan.org', EthereumNetwork.OPTIMISM: 'https://api-optimistic.etherscan.io', EthereumNetwork.POLYGON: 'https://api.polygonscan.com', EthereumNetwork.POLYGON_ZKEVM: 'https://api-zkevm.polygonscan.com', EthereumNetwork.RINKEBY: 'https://api-rinkeby.etherscan.io', EthereumNetwork.ROPSTEN: 'https://api-ropsten.etherscan.io', EthereumNetwork.SCROLL: 'https://api.scrollscan.com', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://api-sepolia.scrollscan.dev', EthereumNetwork.SEPOLIA: 'https://api-sepolia.etherscan.io', EthereumNetwork.ZKSYNC_MAINNET: 'https://block-explorer-api.mainnet.zksync.io/'}
NETWORK_WITH_URL = {EthereumNetwork.ARBITRUM_GOERLI: 'https://goerli.arbiscan.io', EthereumNetwork.ARBITRUM_NOVA: 'https://nova.arbiscan.io', EthereumNetwork.ARBITRUM_ONE: 'https://arbiscan.io', EthereumNetwork.AVALANCHE_C_CHAIN: 'https://snowtrace.io', EthereumNetwork.BASE_GOERLI_TESTNET: 'https://goerli.basescan.org', EthereumNetwork.BNB_SMART_CHAIN_MAINNET: 'https://bscscan.com', EthereumNetwork.CELO_MAINNET: 'https://celoscan.io', EthereumNetwork.CRONOS_MAINNET: 'https://cronoscan.com', EthereumNetwork.CRONOS_TESTNET: 'https://testnet.cronoscan.com', EthereumNetwork.FANTOM_OPERA: 'https://ftmscan.com', EthereumNetwork.FANTOM_TESTNET: 'https://testnet.ftmscan.com/', EthereumNetwork.GNOSIS: 'https://gnosisscan.io', EthereumNetwork.GOERLI: 'https://goerli.etherscan.io', EthereumNetwork.JAPAN_OPEN_CHAIN_MAINNET: 'https://mainnet.japanopenchain.org', EthereumNetwork.JAPAN_OPEN_CHAIN_TESTNET: 'https://explorer.testnet.japanopenchain.org', EthereumNetwork.KROMA: 'https://kromascan.com', EthereumNetwork.KROMA_SEPOLIA: 'https://sepolia.kromascan.com', EthereumNetwork.LINEA: 'https://www.lineascan.build', EthereumNetwork.LINEA_TESTNET: 'https://goerli.lineascan.build', EthereumNetwork.MAINNET: 'https://etherscan.io', EthereumNetwork.MANTLE: 'https://explorer.mantle.xyz', EthereumNetwork.MANTLE_TESTNET: 'https://explorer.testnet.mantle.xyz', EthereumNetwork.MOONBASE_ALPHA: 'https://moonbase.moonscan.io', EthereumNetwork.MOONBEAM: 'https://moonscan.io', EthereumNetwork.MOONRIVER: 'https://moonriver.moonscan.io', EthereumNetwork.NEON_EVM_DEVNET: 'https://devnet.neonscan.org', EthereumNetwork.NEON_EVM_MAINNET: 'https://neonscan.org', EthereumNetwork.OPTIMISM: 'https://optimistic.etherscan.io', EthereumNetwork.POLYGON: 'https://polygonscan.com', EthereumNetwork.POLYGON_ZKEVM: 'https://zkevm.polygonscan.com', EthereumNetwork.RINKEBY: 'https://rinkeby.etherscan.io', EthereumNetwork.ROPSTEN: 'https://ropsten.etherscan.io', EthereumNetwork.SCROLL: 'https://scrollscan.com', EthereumNetwork.SCROLL_SEPOLIA_TESTNET: 'https://sepolia.scrollscan.dev', EthereumNetwork.SEPOLIA: 'https://sepolia.etherscan.io', EthereumNetwork.ZKSYNC_MAINNET: 'https://explorer.zksync.io/'}
build_url(path: str)
get_contract_abi(contract_address: str, retry: bool = True)
get_contract_metadata(contract_address: str, retry: bool = True) ContractMetadata | None
get_contract_source_code(contract_address: str, retry: bool = True)

Get source code for a contract. Source code query also returns:

  • ContractName: “”,

  • CompilerVersion: “”,

  • OptimizationUsed: “”,

  • Runs: “”,

  • ConstructorArguments: “”

  • EVMVersion: “Default”,

  • Library: “”,

  • LicenseType: “”,

  • Proxy: “0”,

  • Implementation: “”,

  • SwarmSource: “”

Parameters:
  • contract_address

  • retry – if True, try again if there’s Rate Limit Error

Returns:

exception gnosis.eth.clients.EtherscanClientConfigurationProblem

Bases: Exception

exception gnosis.eth.clients.EtherscanClientException

Bases: Exception

exception gnosis.eth.clients.EtherscanRateLimitError

Bases: EtherscanClientException

class gnosis.eth.clients.SourcifyClient(network: EthereumNetwork = EthereumNetwork.MAINNET, base_url_api: str = 'https://sourcify.dev', base_url_repo: str = 'https://repo.sourcify.dev/', request_timeout: int = 10)

Bases: object

Get contract metadata from Sourcify. Matches can be full or partial:

  • Full: Both the source files as well as the meta data files were an exact match between the deployed bytecode and the published files.

  • Partial: Source code compiles to the same bytecode and thus the contract behaves in the same way, but the source code can be different: Variables can have misleading names, comments can be different and especially the NatSpec comments could have been modified.

get_chains() Dict[str, Any]
get_contract_metadata(contract_address: str) ContractMetadata | None
is_chain_supported(chain_id: int) bool
exception gnosis.eth.clients.SourcifyClientConfigurationProblem

Bases: Exception

exception gnosis.eth.clients.SourcifyClientException

Bases: Exception