Trait AnvilApiClient
pub trait AnvilApiClient: ClientT {
Show 34 methods
// Provided methods
fn anvil_impersonate_account(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_stop_impersonating_account(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_auto_impersonate_account(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_get_automine(
&self,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_mine(
&self,
blocks: Option<Uint<256, 4>>,
interval: Option<Uint<256, 4>>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_automine(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_interval_mining(
&self,
interval: u64,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_drop_transaction(
&self,
tx_hash: FixedBytes<32>,
) -> impl Future<Output = Result<Option<FixedBytes<32>>, Error>> + Send { ... }
fn anvil_reset(
&self,
fork: Option<Forking>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_rpc_url(
&self,
url: String,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_balance(
&self,
address: Address,
balance: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_code(
&self,
address: Address,
code: Bytes,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_nonce(
&self,
address: Address,
nonce: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_storage_at(
&self,
address: Address,
slot: Uint<256, 4>,
value: FixedBytes<32>,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_set_coinbase(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_chain_id(
&self,
chain_id: u64,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_logging_enabled(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_min_gas_price(
&self,
gas_price: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_next_block_base_fee_per_gas(
&self,
base_fee: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_time(
&self,
timestamp: u64,
) -> impl Future<Output = Result<u64, Error>> + Send { ... }
fn anvil_dump_state(
&self,
) -> impl Future<Output = Result<Bytes, Error>> + Send { ... }
fn anvil_load_state(
&self,
state: Bytes,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_node_info(
&self,
) -> impl Future<Output = Result<NodeInfo, Error>> + Send { ... }
fn anvil_metadata(
&self,
) -> impl Future<Output = Result<Metadata, Error>> + Send { ... }
fn anvil_snapshot(
&self,
) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send { ... }
fn anvil_revert(
&self,
id: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_increase_time(
&self,
seconds: Uint<256, 4>,
) -> impl Future<Output = Result<i64, Error>> + Send { ... }
fn anvil_set_next_block_timestamp(
&self,
seconds: u64,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_set_block_gas_limit(
&self,
gas_limit: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_set_block_timestamp_interval(
&self,
seconds: u64,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_remove_block_timestamp_interval(
&self,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn anvil_mine_detailed(
&self,
opts: Option<MineOptions>,
) -> impl Future<Output = Result<Vec<Block>, Error>> + Send { ... }
fn anvil_enable_traces(
&self,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn anvil_remove_pool_transactions(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
}
rpc
only.Expand description
Client implementation for the AnvilApi
RPC API.
Provided Methods§
fn anvil_impersonate_account(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_impersonate_account( &self, address: Address, ) -> impl Future<Output = Result<(), Error>> + Send
Sends transactions impersonating specific account and contract addresses.
fn anvil_stop_impersonating_account(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_stop_impersonating_account( &self, address: Address, ) -> impl Future<Output = Result<(), Error>> + Send
Stops impersonating an account if previously set with anvil_impersonateAccount
.
fn anvil_auto_impersonate_account(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_auto_impersonate_account( &self, enabled: bool, ) -> impl Future<Output = Result<(), Error>> + Send
If set to true will make every account impersonated.
fn anvil_get_automine(&self) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_get_automine(&self) -> impl Future<Output = Result<bool, Error>> + Send
Returns true
if auto mining is enabled, and false
.
fn anvil_mine(
&self,
blocks: Option<Uint<256, 4>>,
interval: Option<Uint<256, 4>>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_mine( &self, blocks: Option<Uint<256, 4>>, interval: Option<Uint<256, 4>>, ) -> impl Future<Output = Result<(), Error>> + Send
Mines a series of blocks.
fn anvil_set_automine(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_automine( &self, enabled: bool, ) -> impl Future<Output = Result<(), Error>> + Send
Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
fn anvil_set_interval_mining(
&self,
interval: u64,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_interval_mining( &self, interval: u64, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the mining behavior to interval with the given interval (seconds).
fn anvil_drop_transaction(
&self,
tx_hash: FixedBytes<32>,
) -> impl Future<Output = Result<Option<FixedBytes<32>>, Error>> + Send
fn anvil_drop_transaction( &self, tx_hash: FixedBytes<32>, ) -> impl Future<Output = Result<Option<FixedBytes<32>>, Error>> + Send
Removes transactions from the pool.
fn anvil_reset(
&self,
fork: Option<Forking>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_reset( &self, fork: Option<Forking>, ) -> impl Future<Output = Result<(), Error>> + Send
Resets the fork to a fresh forked state, and optionally update the fork config.
If forking
is None
then this will disable forking entirely.
fn anvil_set_rpc_url(
&self,
url: String,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_rpc_url( &self, url: String, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the backend rpc url.
fn anvil_set_balance(
&self,
address: Address,
balance: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_balance( &self, address: Address, balance: Uint<256, 4>, ) -> impl Future<Output = Result<(), Error>> + Send
Modifies the balance of an account.
fn anvil_set_code(
&self,
address: Address,
code: Bytes,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_code( &self, address: Address, code: Bytes, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the code of a contract.
fn anvil_set_nonce(
&self,
address: Address,
nonce: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_nonce( &self, address: Address, nonce: Uint<256, 4>, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the nonce of an address.
fn anvil_set_storage_at(
&self,
address: Address,
slot: Uint<256, 4>,
value: FixedBytes<32>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_set_storage_at( &self, address: Address, slot: Uint<256, 4>, value: FixedBytes<32>, ) -> impl Future<Output = Result<bool, Error>> + Send
Writes a single slot of the account’s storage.
fn anvil_set_coinbase(
&self,
address: Address,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_coinbase( &self, address: Address, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the coinbase address.
fn anvil_set_chain_id(
&self,
chain_id: u64,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_chain_id( &self, chain_id: u64, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the chain id.
fn anvil_set_logging_enabled(
&self,
enabled: bool,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_logging_enabled( &self, enabled: bool, ) -> impl Future<Output = Result<(), Error>> + Send
Enables or disable logging.
fn anvil_set_min_gas_price(
&self,
gas_price: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_min_gas_price( &self, gas_price: Uint<256, 4>, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the minimum gas price for the node.
fn anvil_set_next_block_base_fee_per_gas(
&self,
base_fee: Uint<256, 4>,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_next_block_base_fee_per_gas( &self, base_fee: Uint<256, 4>, ) -> impl Future<Output = Result<(), Error>> + Send
Sets the base fee of the next block.
fn anvil_set_time(
&self,
timestamp: u64,
) -> impl Future<Output = Result<u64, Error>> + Send
fn anvil_set_time( &self, timestamp: u64, ) -> impl Future<Output = Result<u64, Error>> + Send
Sets the minimum gas price for the node.
fn anvil_dump_state(&self) -> impl Future<Output = Result<Bytes, Error>> + Send
fn anvil_dump_state(&self) -> impl Future<Output = Result<Bytes, Error>> + Send
Creates a buffer that represents all state on the chain, which can be loaded to separate
process by calling anvil_loadState
.
fn anvil_load_state(
&self,
state: Bytes,
) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_load_state( &self, state: Bytes, ) -> impl Future<Output = Result<bool, Error>> + Send
Append chain state buffer to current chain. Will overwrite any conflicting addresses or storage.
fn anvil_node_info(
&self,
) -> impl Future<Output = Result<NodeInfo, Error>> + Send
fn anvil_node_info( &self, ) -> impl Future<Output = Result<NodeInfo, Error>> + Send
Retrieves the Anvil node configuration params.
fn anvil_metadata(&self) -> impl Future<Output = Result<Metadata, Error>> + Send
fn anvil_metadata(&self) -> impl Future<Output = Result<Metadata, Error>> + Send
Retrieves metadata about the Anvil instance.
fn anvil_snapshot(
&self,
) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send
fn anvil_snapshot( &self, ) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send
Snapshot the state of the blockchain at the current block.
fn anvil_revert(
&self,
id: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_revert( &self, id: Uint<256, 4>, ) -> impl Future<Output = Result<bool, Error>> + Send
Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
fn anvil_increase_time(
&self,
seconds: Uint<256, 4>,
) -> impl Future<Output = Result<i64, Error>> + Send
fn anvil_increase_time( &self, seconds: Uint<256, 4>, ) -> impl Future<Output = Result<i64, Error>> + Send
Jump forward in time by the given amount of time, in seconds.
fn anvil_set_next_block_timestamp(
&self,
seconds: u64,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_next_block_timestamp( &self, seconds: u64, ) -> impl Future<Output = Result<(), Error>> + Send
Similar to evm_increaseTime
but takes the exact timestamp that you want in the next block.
fn anvil_set_block_gas_limit(
&self,
gas_limit: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_set_block_gas_limit( &self, gas_limit: Uint<256, 4>, ) -> impl Future<Output = Result<bool, Error>> + Send
Sets the next block gas limit.
fn anvil_set_block_timestamp_interval(
&self,
seconds: u64,
) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_set_block_timestamp_interval( &self, seconds: u64, ) -> impl Future<Output = Result<(), Error>> + Send
Sets an interval for the block timestamp.
fn anvil_remove_block_timestamp_interval(
&self,
) -> impl Future<Output = Result<bool, Error>> + Send
fn anvil_remove_block_timestamp_interval( &self, ) -> impl Future<Output = Result<bool, Error>> + Send
Sets an interval for the block timestamp.
fn anvil_mine_detailed(
&self,
opts: Option<MineOptions>,
) -> impl Future<Output = Result<Vec<Block>, Error>> + Send
fn anvil_mine_detailed( &self, opts: Option<MineOptions>, ) -> impl Future<Output = Result<Vec<Block>, Error>> + Send
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.
fn anvil_enable_traces(&self) -> impl Future<Output = Result<(), Error>> + Send
fn anvil_enable_traces(&self) -> impl Future<Output = Result<(), Error>> + Send
Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
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.