referrerpolicy=no-referrer-when-downgrade

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§

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

Structs§

  • Request builder that serializes RPC parameters to construct a valid batch parameter. This is the equivalent of chaining multiple RPC requests.
  • Stream of all finalized headers.
  • 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”
  • Generic asynchronous client.
  • Builder for WsClient.

Enums§

Traits§

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

Functions§

  • Create a new WebSocket connection with shared settings.

Type Aliases§