MultiProviderWeb3
Documentation for eth_defi.provider.multi_provider.MultiProviderWeb3 Python class.
- class MultiProviderWeb3
Bases:
web3.main.Web3A web3 instance that knows about multiple RPC endpoints it is using.
Can use
eth_defi.provider.mev_blocker.MEVBlockerProviderfor making transactions to prevent frontrunningThere might be several call (read) providers for reading on-chain data with fallbacks using
eth_defi.provider.fallback.FallbackProvider
See
Attributes summary
apiclient_versionensmiddleware_onionproviderstrict_bytes_type_checkingMethods summary
__init__([provider, middleware, modules, ...])attach_modules(modules)Attach modules to the Web3 instance.
batch_requests()from_wei(number, unit)Takes a number of wei and converts it to any other ether unit.
Get active call provider.
Get active transact provider.
How many times different APIs where called.
Get configured transact provider.
Get the fallback provider multiplexer.
is_address(value)Is the given string an address in any of the known formats?
is_checksum_address(value)is_connected([show_traceback])is_encodable(_type, value)keccak([primitive, text, hexstr])normalize_values(w3, abi_types, values)solidity_keccak(abi_types, values)Executes keccak256 exactly as Solidity does.
Recycles to the next call provider (if available).
to_bytes([primitive, hexstr, text])to_checksum_address(value)Makes a checksum address given a supported format.
to_hex([primitive, hexstr, text])Auto converts any supported value into its hex representation.
to_int([primitive, hexstr, text])Converts value to its integer representation.
to_json(obj)Convert a complex object (like a transaction object) to a JSON string
to_text([primitive, hexstr, text])to_wei(number, unit)Takes a number of a unit and converts it to wei.
- get_active_transact_provider()
Get active transact provider.
Can be a call provider if not configured.
- Return type
eth_defi.provider.named.BaseNamedProvider | web3.providers.rpc.rpc.HTTPProvider
- get_configured_transact_provider()
Get configured transact provider.
- Return type
- get_active_call_provider()
Get active call provider.
- Return type
eth_defi.provider.named.BaseNamedProvider | web3.providers.rpc.rpc.HTTPProvider
- get_fallback_provider()
Get the fallback provider multiplexer.
- Return type
- switch_to_next_call_provider()
Recycles to the next call provider (if available).
- get_api_call_counts()
How many times different APIs where called.
- __init__(provider=None, middleware=None, modules=None, external_modules=None, ens=<web3._utils.empty.Empty object>)
- Parameters
- Return type
None
- attach_modules(modules)
Attach modules to the Web3 instance.
- static from_wei(number, unit)
Takes a number of wei and converts it to any other ether unit.
- Parameters
- Return type
- static is_address(value)
Is the given string an address in any of the known formats?
- solidity_keccak(abi_types, values)
Executes keccak256 exactly as Solidity does. Takes list of abi_types as inputs – [uint24, int8[], bool] and list of corresponding values – [20, [-1, 5, 0], True]
- static to_checksum_address(value)
Makes a checksum address given a supported format.
- Parameters
value (Union[eth_typing.evm.AnyAddress, str, bytes]) –
- Return type
- static to_hex(primitive=None, hexstr=None, text=None)
Auto converts any supported value into its hex representation. Trims leading zeros, as defined in: https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding
- Parameters
- Return type
- static to_int(primitive=None, hexstr=None, text=None)
Converts value to its integer representation. Values are converted this way:
primitive:
bytes, bytearray, memoryview: big-endian integer
bool: True => 1, False => 0
int: unchanged
hexstr: interpret hex as integer
text: interpret as string of digits, like ‘12’ => 12
- static to_json(obj)
Convert a complex object (like a transaction object) to a JSON string