reth_rpc_api::clients

Trait GanacheApiClient

Source
pub trait GanacheApiClient: ClientT {
    // Provided methods
    fn evm_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 evm_mine<'life0, 'async_trait>(
        &'life0 self,
        opts: Option<MineOptions>,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn evm_revert<'life0, 'async_trait>(
        &'life0 self,
        snapshot_id: U256,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn evm_set_time<'life0, 'async_trait>(
        &'life0 self,
        timestamp: u64,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn evm_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 { ... }
}
Available on crate feature client only.
Expand description

Client implementation for the GanacheApi RPC API.

Provided Methods§

Source

fn evm_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.

Returns the total time adjustment, in seconds.

Source

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

Force a single block to be mined.

Mines a block independent of whether or not mining is started or stopped. Will mine an empty block if there are no available transactions to mine.

Returns “0x0”. May return additional meta-data in the future.

Source

fn evm_revert<'life0, 'async_trait>( &'life0 self, snapshot_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. This deletes the given snapshot, as well as any snapshots taken after (e.g.: reverting to id 0x1 will delete snapshots with ids 0x1, 0x2, etc.).

Returns true if a snapshot was reverted, otherwise false.

Source

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

Sets the internal clock time to the given timestamp.

Warning This will allow you to move backwards in time, which may cause new blocks to appear to be mined before old blocks. This will result in an invalid state.

Returns the amount of seconds between the given timestamp and now.

Source

fn evm_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. Takes no parameters. Returns the id of the snapshot that was created. A snapshot can only be reverted once. After a successful evm_revert, the same snapshot id cannot be used again. Consider creating a new snapshot after each evm_revert if you need to revert to the same point multiple times.

Returns the hex-encoded identifier for this snapshot.

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> GanacheApiClient for TypeJsonRpseeInteral
where TypeJsonRpseeInteral: ClientT,