reth_rpc_api::clients

Trait AnvilApiClient

Source
pub trait AnvilApiClient: ClientT {
Show 34 methods // Provided methods fn anvil_impersonate_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_stop_impersonating_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_auto_impersonate_account<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_get_automine<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<U256>, interval: Option<U256>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_automine<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_interval_mining<'life0, 'async_trait>( &'life0 self, interval: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_drop_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: B256, ) -> Pin<Box<dyn Future<Output = Result<Option<B256>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_reset<'life0, 'async_trait>( &'life0 self, fork: Option<Forking>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_rpc_url<'life0, 'async_trait>( &'life0 self, url: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_code<'life0, 'async_trait>( &'life0 self, address: Address, code: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_nonce<'life0, 'async_trait>( &'life0 self, address: Address, nonce: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: U256, value: B256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_coinbase<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_chain_id<'life0, 'async_trait>( &'life0 self, chain_id: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_logging_enabled<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_next_block_base_fee_per_gas<'life0, 'async_trait>( &'life0 self, base_fee: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_time<'life0, 'async_trait>( &'life0 self, timestamp: u64, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_dump_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_load_state<'life0, 'async_trait>( &'life0 self, state: Bytes, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Metadata, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_revert<'life0, 'async_trait>( &'life0 self, id: U256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_increase_time<'life0, 'async_trait>( &'life0 self, seconds: U256, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_next_block_timestamp<'life0, 'async_trait>( &'life0 self, seconds: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_block_gas_limit<'life0, 'async_trait>( &'life0 self, gas_limit: U256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_set_block_timestamp_interval<'life0, 'async_trait>( &'life0 self, seconds: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_remove_block_timestamp_interval<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_mine_detailed<'life0, 'async_trait>( &'life0 self, opts: Option<MineOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Block>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_enable_traces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn anvil_remove_pool_transactions<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Available on crate feature client only.
Expand description

Client implementation for the AnvilApi RPC API.

Provided Methods§

Source

fn anvil_impersonate_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sends transactions impersonating specific account and contract addresses.

Source

fn anvil_stop_impersonating_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Stops impersonating an account if previously set with anvil_impersonateAccount.

Source

fn anvil_auto_impersonate_account<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

If set to true will make every account impersonated.

Source

fn anvil_get_automine<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns true if auto mining is enabled, and false.

Source

fn anvil_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<U256>, interval: Option<U256>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Mines a series of blocks.

Source

fn anvil_set_automine<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.

Source

fn anvil_set_interval_mining<'life0, 'async_trait>( &'life0 self, interval: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the mining behavior to interval with the given interval (seconds).

Source

fn anvil_drop_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: B256, ) -> Pin<Box<dyn Future<Output = Result<Option<B256>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Removes transactions from the pool.

Source

fn anvil_reset<'life0, 'async_trait>( &'life0 self, fork: Option<Forking>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Resets the fork to a fresh forked state, and optionally update the fork config.

If forking is None then this will disable forking entirely.

Source

fn anvil_set_rpc_url<'life0, 'async_trait>( &'life0 self, url: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the backend rpc url.

Source

fn anvil_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Modifies the balance of an account.

Source

fn anvil_set_code<'life0, 'async_trait>( &'life0 self, address: Address, code: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the code of a contract.

Source

fn anvil_set_nonce<'life0, 'async_trait>( &'life0 self, address: Address, nonce: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the nonce of an address.

Source

fn anvil_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: U256, value: B256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Writes a single slot of the account’s storage.

Source

fn anvil_set_coinbase<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the coinbase address.

Source

fn anvil_set_chain_id<'life0, 'async_trait>( &'life0 self, chain_id: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the chain id.

Source

fn anvil_set_logging_enabled<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Enables or disable logging.

Source

fn anvil_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the minimum gas price for the node.

Source

fn anvil_set_next_block_base_fee_per_gas<'life0, 'async_trait>( &'life0 self, base_fee: U256, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the base fee of the next block.

Source

fn anvil_set_time<'life0, 'async_trait>( &'life0 self, timestamp: u64, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the minimum gas price for the node.

Source

fn anvil_dump_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Creates a buffer that represents all state on the chain, which can be loaded to separate process by calling anvil_loadState.

Source

fn anvil_load_state<'life0, 'async_trait>( &'life0 self, state: Bytes, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Append chain state buffer to current chain.Will overwrite any conflicting addresses or storage.

Source

fn anvil_node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Retrieves the Anvil node configuration params.

Source

fn anvil_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Metadata, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Retrieves metadata about the Anvil instance.

Source

fn anvil_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<U256, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Snapshot the state of the blockchain at the current block.

Source

fn anvil_revert<'life0, 'async_trait>( &'life0 self, id: U256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.

Source

fn anvil_increase_time<'life0, 'async_trait>( &'life0 self, seconds: U256, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Jump forward in time by the given amount of time, in seconds.

Source

fn anvil_set_next_block_timestamp<'life0, 'async_trait>( &'life0 self, seconds: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Similar to evm_increaseTime but takes the exact timestamp that you want in the next block.

Source

fn anvil_set_block_gas_limit<'life0, 'async_trait>( &'life0 self, gas_limit: U256, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets the next block gas limit.

Source

fn anvil_set_block_timestamp_interval<'life0, 'async_trait>( &'life0 self, seconds: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets an interval for the block timestamp.

Source

fn anvil_remove_block_timestamp_interval<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Sets an interval for the block timestamp.

Source

fn anvil_mine_detailed<'life0, 'async_trait>( &'life0 self, opts: Option<MineOptions>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Block>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Mine blocks, instantly and return the mined blocks.

This will mine the blocks regardless of the configured mining mode.

Note: This behaves exactly as evm_mine but returns different output, for compatibility reasons, this is a separate call since evm_mine is not an anvil original. and ganache may change the 0x0 placeholder.

Source

fn anvil_enable_traces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).

Source

fn anvil_remove_pool_transactions<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Removes all transactions for that address from the transaction pool.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<TypeJsonRpseeInteral> AnvilApiClient for TypeJsonRpseeInteral
where TypeJsonRpseeInteral: ClientT,