Expand description
Extended JsonRpcClient
abstraction.
This module contains custom implementation of ethers::providers::JsonRpcClient
which allows usage of non-reqwest
based HTTP clients.
The major type implemented in this module is the JsonRpcProviderClient
which implements the [ethers::providers::JsonRpcClient] trait. That makes it possible to use it with ethers
.
The JsonRpcProviderClient is abstract over the HttpPostRequestor trait, which makes it possible
to make the underlying HTTP client implementation easily replaceable. This is needed to make it possible
for ethers
to work with different async runtimes, since the HTTP client is typically not agnostic to
async runtimes (the default HTTP client in ethers
is using reqwest
, which is tokio
specific).
Secondly, this abstraction also allows implementing WASM-compatible HTTP client if needed at some point.
Modules§
Structs§
- Json
RpcProvider Client - Modified implementation of
ethers::providers::Http
so that it can operate with anyHttpPostRequestor
. Also contains possible retry actions to be taken on various failures, therefore it implements alsoethers::providers::RetryClient
functionality. - Requestor
Response Snapshot - Snapshot of a response cached by the
SnapshotRequestor
. - Simple
Json RpcRetry Policy - Defines a retry policy suitable for
JsonRpcProviderClient
. - Snapshot
Requestor - Replays an RPC response to a request if it is found in the snapshot YAML file.
If no such request has been seen before,
it captures the new request/response pair obtained from the inner
HttpPostRequestor
and stores it into the snapshot file.
Functions§
- create_
rpc_ client_ to_ anvil - Used for testing. Creates Ethers RPC client to the local Anvil instance.