Crate substrate_rpc_client

Source
Expand description

It exposes a WebSocket JSON-RPC client that implements the RPC interface in [sc-rpc-api] along with some abstractions.

§Usage


#[tokio::main]
async fn main() {

    let client = ws_client("ws://127.0.0.1:9944").await.unwrap();
    client.storage(StorageKey(vec![]), Some(H256::zero())).await.unwrap();

    // if all type params are not known you need to provide type params
    StateApi::<H256>::storage(&client, StorageKey(vec![]), None).await.unwrap();
}

Macros§

rpc_params
Convert the given values to a crate::params::ArrayParams as expected by a jsonrpsee Client (http or websocket).

Structs§

BatchRequestBuilder
Request builder that serializes RPC parameters to construct a valid batch parameter. This is the equivalent of chaining multiple RPC requests.
FinalizedHeaders
Stream of all finalized headers.
Subscription
Represent a client-side subscription which is implemented on top of a bounded channel where it’s possible that the receiver may not keep up with the sender side a.k.a “slow receiver problem”
WsClient
Generic asynchronous client.
WsClientBuilder
Builder for WsClient.

Enums§

Error
Error type.

Traits§

AuthorApi
Client implementation for the AuthorApi RPC API.
ChainApi
Client implementation for the ChainApi RPC API.
ChildStateApi
Client implementation for the ChildStateApi RPC API.
ClientT
JSON-RPC client interface that can make requests and notifications.
DevApi
Client implementation for the DevApi RPC API.
HeaderProvider
Abstraction over RPC calling for headers.
HeaderSubscription
Abstraction over RPC subscription for finalized headers.
OffchainApi
Client implementation for the OffchainApi RPC API.
StateApi
Client implementation for the StateApi RPC API.
SubscriptionClientT
JSON-RPC client interface that can make requests, notifications and subscriptions.
SystemApi
Client implementation for the SystemApi RPC API.

Functions§

ws_client
Create a new WebSocket connection with shared settings.

Type Aliases§

RpcResult
JSON-RPC result.