Skip to main content

HardhatApiServer

Trait HardhatApiServer 

Source
pub trait HardhatApiServer:
    Sized
    + Send
    + Sync
    + 'static {
Show 17 methods // Required methods fn hardhat_drop_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<bool, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_impersonate_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_get_automine<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Metadata, ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<Uint<256, 4>>, interval: Option<Uint<256, 4>>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_reset<'life0, 'async_trait>( &'life0 self, fork: Option<Forking>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_code<'life0, 'async_trait>( &'life0 self, address: Address, code: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_coinbase<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_logging_enabled<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_next_block_base_fee_per_gas<'life0, 'async_trait>( &'life0 self, base_fee_per_gas: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_prev_randao<'life0, 'async_trait>( &'life0 self, prev_randao: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_nonce<'life0, 'async_trait>( &'life0 self, address: Address, nonce: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: Uint<256, 4>, value: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn hardhat_stop_impersonating_account<'life0, 'async_trait>( &'life0 self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided method fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the HardhatApi RPC API.

Required Methods§

Source

fn hardhat_drop_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<bool, ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Removes the given transaction from the mempool, if it exists.

Returns true if successful, otherwise false.

Source

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

Allows Hardhat Network to sign transactions as the given address.

Source

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

Returns true if automatic mining is enabled, and false otherwise.

Source

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

Returns an object with metadata about the instance of the Hardhat network.

Source

fn hardhat_mine<'life0, 'async_trait>( &'life0 self, blocks: Option<Uint<256, 4>>, interval: Option<Uint<256, 4>>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Mines a specified number of blocks at a given interval.

Source

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

Resets back to a fresh forked state, fork from another block number or disable forking.

Source

fn hardhat_set_balance<'life0, 'async_trait>( &'life0 self, address: Address, balance: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sets the balance for the given address.

Source

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

Modifies the bytecode stored at an account’s address.

Source

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

Sets the coinbase address to be used in new blocks.

Source

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

Enables or disables logging.

Source

fn hardhat_set_min_gas_price<'life0, 'async_trait>( &'life0 self, gas_price: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Changes the minimum gas price accepted by the network (in wei).

Source

fn hardhat_set_next_block_base_fee_per_gas<'life0, 'async_trait>( &'life0 self, base_fee_per_gas: Uint<256, 4>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sets the base fee of the next block.

Source

fn hardhat_set_prev_randao<'life0, 'async_trait>( &'life0 self, prev_randao: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sets the PREVRANDAO value of the next block.

Source

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

Modifies an account’s nonce by overwriting it.

Source

fn hardhat_set_storage_at<'life0, 'async_trait>( &'life0 self, address: Address, slot: Uint<256, 4>, value: FixedBytes<32>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorObject<'static>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Writes a single position of an account’s storage.

Source

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

Stops impersonating the given address.

Provided Methods§

Source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§