Struct ethcontract_mock::Mock [−][src]
pub struct Mock { /* fields omitted */ }Expand description
Mock ethereum node.
This struct implements a virtual ethereum node with a limited number
of supported RPC calls. You can interact with it via the standard
transport from web3.
The main feature of this struct is deploying mocked contracts
and interacting with them. Create new mocked contract with a call
to deploy function. Then use the returned struct to set up
expectations on contract methods, get deployed contract’s address
and Instance and make actual calls to it.
Deploying contracts with an RPC call is not supported at the moment.
Implementations
Creates a Web3 object that can be used to interact with
the mocked chain.
Creates a Transport object that can be used to interact with
the mocked chain.
Deploys a new mocked contract and returns an object that allows configuring expectations for contract methods.
Updates gas price that is returned by RPC call eth_gasPrice.
Mock node does not simulate gas consumption, so this value does not
affect anything if you don’t call eth_gasPrice.
Verifies that all expectations on all contracts have been met, then clears all expectations.
Sometimes its useful to validate all expectations mid-test, throw them away, and add new ones. That’s what checkpoints do. See mockall documentation for more info.
Note that all expectations returned from Contract::expect method
become invalid after checkpoint. Modifying them will result in panic.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Mock
impl UnwindSafe for Mock
Blanket Implementations
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745 Read more
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self