Struct ethers_core::utils::Ganache
source · pub struct Ganache { /* private fields */ }
Expand description
Builder for launching ganache-cli
.
§Panics
If spawn
is called without ganache-cli
being available in the user’s $PATH
§Example
use ethers_core::utils::Ganache;
let port = 8545u16;
let url = format!("http://localhost:{}", port).to_string();
let ganache = Ganache::new()
.port(port)
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
.spawn();
drop(ganache); // this will kill the instance
Implementations§
source§impl Ganache
impl Ganache
sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty Ganache builder. The default port is 8545. The mnemonic is chosen randomly.
sourcepub fn startup_timeout_millis<T: Into<u64>>(self, timeout: T) -> Self
pub fn startup_timeout_millis<T: Into<u64>>(self, timeout: T) -> Self
Sets the startup timeout which will be used when the ganache-cli
instance is launched in
miliseconds. 10_000 miliseconds by default).
sourcepub fn port<T: Into<u16>>(self, port: T) -> Self
pub fn port<T: Into<u16>>(self, port: T) -> Self
Sets the port which will be used when the ganache-cli
instance is launched.
sourcepub fn mnemonic<T: Into<String>>(self, mnemonic: T) -> Self
pub fn mnemonic<T: Into<String>>(self, mnemonic: T) -> Self
Sets the mnemonic which will be used when the ganache-cli
instance is launched.
sourcepub fn block_time<T: Into<u64>>(self, block_time: T) -> Self
pub fn block_time<T: Into<u64>>(self, block_time: T) -> Self
Sets the block-time which will be used when the ganache-cli
instance is launched.
sourcepub fn fork<T: Into<String>>(self, fork: T) -> Self
pub fn fork<T: Into<String>>(self, fork: T) -> Self
Sets the fork
argument to fork from another currently running Ethereum client
at a given block. Input should be the HTTP location and port of the other client,
e.g. http://localhost:8545
. You can optionally specify the block to fork from
using an @ sign: http://localhost:8545@1599200