Crate substrate_rpc_client
source ·Expand description
Shared JSON-RPC client related code and abstractions.
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.
- Active subscription on the client.
- Generic asynchronous client.
- Builder for
WsClient
.
Enums
- Error type.
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 Definitions
- JSON-RPC result.