mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-23 10:48:00 +00:00
20bc4b89ca
* Add docs for subxt-rpcs and fix example * Add docs bits in Cargo.toml * add missing docsrs cfg_attr --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
613 B
613 B
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..
}