Trait reth::rpc::api::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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_get_automine<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<Uint<256, 4>>, interval: Option<Uint<256, 4>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_automine<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_drop_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<Option<FixedBytes<32>>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_reset<'life0, 'async_trait>( &'life0 self, fork: Option<Forking>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_nonce<'life0, 'async_trait>( &'life0 self, address: Address, nonce: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: Uint<256, 4>, value: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_coinbase<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_next_block_base_fee_per_gas<'life0, 'async_trait>( &'life0 self, base_fee: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_dump_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_node_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NodeInfo, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Metadata, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Uint<256, 4>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_revert<'life0, 'async_trait>( &'life0 self, id: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_increase_time<'life0, 'async_trait>( &'life0 self, seconds: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_set_block_gas_limit<'life0, 'async_trait>( &'life0 self, gas_limit: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... } fn anvil_enable_traces<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait { ... }
}
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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Returns true if auto mining is enabled, and false.

source

fn anvil_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<Uint<256, 4>>, interval: Option<Uint<256, 4>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<Option<FixedBytes<32>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Sets the backend rpc url.

source

fn anvil_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Sets the code of a contract.

source

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

Sets the nonce of an address.

source

fn anvil_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: Uint<256, 4>, value: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Enables or disable logging.

source

fn anvil_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Retrieves metadata about the Anvil instance.

source

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

Snapshot the state of the blockchain at the current block.

source

fn anvil_revert<'life0, 'async_trait>( &'life0 self, id: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<i64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + '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 'life0: 'async_trait, Self: Sync + 'async_trait,

Removes all transactions for that address from the transaction pool.

Object Safety§

This trait is not object safe.

Implementors§

source§

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