pub trait GanacheApiClient: ClientT {
// Provided methods
fn evm_increase_time(
&self,
seconds: Uint<256, 4>,
) -> impl Future<Output = Result<i64, Error>> + Send { ... }
fn evm_mine(
&self,
opts: Option<MineOptions>,
) -> impl Future<Output = Result<String, Error>> + Send { ... }
fn evm_revert(
&self,
snapshot_id: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn evm_set_time(
&self,
timestamp: u64,
) -> impl Future<Output = Result<bool, Error>> + Send { ... }
fn evm_snapshot(
&self,
) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send { ... }
}
Expand description
Client implementation for the GanacheApi
RPC API.
Provided Methods§
Sourcefn evm_increase_time(
&self,
seconds: Uint<256, 4>,
) -> impl Future<Output = Result<i64, Error>> + Send
fn evm_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.
Returns the total time adjustment, in seconds.
Sourcefn evm_mine(
&self,
opts: Option<MineOptions>,
) -> impl Future<Output = Result<String, Error>> + Send
fn evm_mine( &self, opts: Option<MineOptions>, ) -> impl Future<Output = Result<String, Error>> + Send
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.
Sourcefn evm_revert(
&self,
snapshot_id: Uint<256, 4>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn evm_revert( &self, snapshot_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. 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
.
Sourcefn evm_set_time(
&self,
timestamp: u64,
) -> impl Future<Output = Result<bool, Error>> + Send
fn evm_set_time( &self, timestamp: u64, ) -> impl Future<Output = Result<bool, Error>> + Send
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.
Sourcefn evm_snapshot(
&self,
) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send
fn evm_snapshot( &self, ) -> impl Future<Output = Result<Uint<256, 4>, Error>> + Send
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.