1 unstable release

0.41.0 Mar 11, 2025

#10 in #subxt

Download history 50/week @ 2025-03-05 153/week @ 2025-03-12 235/week @ 2025-03-19 199/week @ 2025-03-26 294/week @ 2025-04-02 515/week @ 2025-04-09 361/week @ 2025-04-16

1,395 downloads per month
Used in 3 crates (2 directly)

Apache-2.0 OR GPL-3.0 and maybe GPL-3.0-or-later…

250KB
4.5K SLoC

This crate provides a low level RPC interface to Substrate based nodes.

See the client module for a client::RpcClient which is driven by implementations of client::RpcClientT (several of which are provided behind feature flags).

See the methods module for structs which implement sets of concrete RPC calls for communicating with Substrate based nodes. These structs are all driven by a client::RpcClient.

The RPC clients/methods here are made use of in subxt. Enabling the subxt feature flag ensures that all Subxt configurations are also valid RPC configurations.

The provided RPC client implementations can be used natively (with the default native feature flag) or in WASM based web apps (with the web feature flag).


subxt-rpcs

This crate provides an interface for interacting with Substrate nodes via the available RPC methods.

use subxt_rpcs::{RpcClient, ChainHeadRpcMethods};

// Connect to a local node:
let client = RpcClient::from_url("ws://127.0.0.1:9944").await?;
// Use a set of methods, here the V2 "chainHead" ones:
let methods = ChainHeadRpcMethods::new(client);

// Call some RPC methods (in this case a subscription):
let mut follow_subscription = methods.chainhead_v1_follow(false).await.unwrap();
while let Some(follow_event) = follow_subscription.next().await {
    // do something with events..
}

Dependencies

~7–26MB
~425K SLoC