alloy-transport-2.0.3 has been yanked.
alloy-transport
Example
Send a JSON-RPC request through a mock transport using the tower::Service interface.
use ;
use alloy_json_rpc as j;
use Service;
// Prepare a mock response and a serialized request
let asserter = new;
asserter.push_success;
let req: SerializedRequest = new
.try_into
.unwrap;
let packet = from;
// Drive the service and assert the response
let mut transport = new;
let resp = new
.unwrap
.block_on
.unwrap;
if let Single = resp
Low-level Ethereum JSON-RPC transport abstraction.
This crate handles RPC connection and request management. It builds an
RpcClient on top of the tower Service abstraction, and provides
futures for simple and batch RPC requests as well as a unified TransportError
type.
Typically, this crate should not be used directly. Most EVM users will want to use the alloy-provider crate, which provides a high-level API for interacting with JSON-RPC servers that provide the standard Ethereum RPC endpoints, or the alloy-rpc-client crate, which provides a low-level JSON-RPC API without the specific Ethereum endpoints.
Transports
Alloy maintains the following transports:
- alloy-transport-http: JSON-RPC via HTTP.
- alloy-transport-ws: JSON-RPC via Websocket, supports pubsub via alloy-pubsub.
- alloy-transport-ipc: JSON-RPC via IPC, supports pubsub via alloy-pubsub.