ape-node
- class ape_node.EthereumNetworkConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_implicit_flags: bool | None = None, _secrets_dir: PathType | None = None, *, mainnet: dict = {'uri': 'https://eth.drpc.org'}, holesky: dict = {'uri': 'https://ethereum-holesky-rpc.publicnode.com'}, sepolia: dict = {'uri': 'https://sepolia.drpc.org'}, local: dict = {'chain_id': 1337, 'uri': 'http://localhost:8545'}, **values: Any)
- class ape_node.EthereumNodeConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_implicit_flags: bool | None = None, _secrets_dir: PathType | None = None, *, ethereum: EthereumNetworkConfig = EthereumNetworkConfig(mainnet={'uri': 'https://eth.drpc.org'}, holesky={'uri': 'https://ethereum-holesky-rpc.publicnode.com'}, sepolia={'uri': 'https://sepolia.drpc.org'}, local={'uri': 'http://localhost:8545', 'chain_id': 1337}), executable: str | None = None, data_dir: Path | None = None, ipc_path: Path | None = None, call_trace_approach: TraceApproach | None = None, request_headers: dict = {}, **values: Any)
Configure your
node:
in Ape, the default provider plugin for live-network nodes. Also,ape node
can start-up a local development node for testing purposes.- call_trace_approach: TraceApproach | None
Select the trace approach to use. Defaults to deducing one based on your node’s client-version and available RPCs.
- data_dir: Path | None
For node-management, choose where the geth data directory shall be located. Defaults to using a location within Ape’s DATA_FOLDER.
- ethereum: EthereumNetworkConfig
Configure the Ethereum network settings for the
ape node
provider, such as which URIs to use for each network.
- executable: str | None
For starting nodes, select the executable. Defaults to using
shutil.which("geth")
.
- ipc_path: Path | None
For IPC connections, select the IPC path. If managing a process, web3.py can determine the IPC w/o needing to manually configure.
- request_headers: dict
Optionally specify request headers to use whenever using this provider.
- class ape_node.GethDev(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict = {'User-Agent': "web3.py/6.20.1/<class 'web3.providers.rpc.HTTPProvider'>"}, block_page_size: int = 5000, concurrency: int = 16, PROCESS_WAIT_TIMEOUT: int = 15, process: Popen | None = None, is_stopping: bool = False, stdout_queue: JoinableQueue | None = None, stderr_queue: JoinableQueue | None = None)
- property auto_mine: bool
Whether automine is enabled.
- build_command() list[str]
Get the command as a list of
str
. Subclasses should override and add command arguments if needed.- Returns:
The command to pass to
subprocess.Popen
.- Return type:
list[str]
- connect()
Connect a to a provider, such as start-up a process or create an HTTP connection.
- disconnect()
Disconnect from a provider, such as tear-down a process or quit an HTTP session.
- get_test_account(index: int) TestAccountAPI
Retrieve one of the provider-generated test accounts.
- Parameters:
index (int) – The index of the test account in the HD-Path.
- Returns:
- mine(**kwargs)
Defined to make the
ProviderAPI
interchangeable with aTestProviderAPI
, as inape.managers.chain.ChainManager
.- Raises:
APINotImplementedError – Unless overriden.
- name: str
The name of the provider (should be the plugin name).
- property process_name: str
The name of the process, such as
Hardhat node
.
- restore(snapshot_id: str | int | bytes)
Defined to make the
ProviderAPI
interchangeable with aTestProviderAPI
, as inape.managers.chain.ChainManager
.- Raises:
APINotImplementedError – Unless overriden.
- set_timestamp(**kwargs)
Defined to make the
ProviderAPI
interchangeable with aTestProviderAPI
, as inape.managers.chain.ChainManager
.- Raises:
APINotImplementedError – Unless overriden.
- snapshot() str | int | bytes
Defined to make the
ProviderAPI
interchangeable with aTestProviderAPI
, as inape.managers.chain.ChainManager
.- Raises:
APINotImplementedError – Unless overriden.
- start(timeout: int = 20)
Start the process and wait for its RPC to be ready.
- class ape_node.Node(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict = {'User-Agent': "web3.py/6.20.1/<class 'web3.providers.rpc.HTTPProvider'>"}, block_page_size: int = 5000, concurrency: int = 16)
- class ape_node.OtterscanQueryEngine
- estimate_query(query: BlockQuery | BlockTransactionQuery | AccountTransactionQuery | ContractCreationQuery | ContractEventQuery | ContractMethodQuery) int | None
- estimate_query(query: ContractCreationQuery) int | None
Estimation of time needed to complete the query. The estimation is returned as an int representing milliseconds. A value of None indicates that the query engine is not available for use or is unable to complete the query.
- Parameters:
query (
QueryType
) – Query to estimate.- Returns:
Represents milliseconds, returns
None
if unable to execute.- Return type:
Optional[int]
- perform_query(query: BlockQuery | BlockTransactionQuery | AccountTransactionQuery | ContractCreationQuery | ContractEventQuery | ContractMethodQuery) Iterator
- perform_query(query: ContractCreationQuery) Iterator[ContractCreation]
Executes the query using best performing
estimate_query
query engine.- Parameters:
query (
QueryType
) – query to execute- Returns:
Iterator