rpc: Fetch chainHead genesis hash

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-11-30 13:09:52 +00:00
parent c2dc0ce2cd
commit e7192f350a
3 changed files with 18 additions and 6 deletions
@@ -28,6 +28,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a client to use:
let api = OnlineClient::<PolkadotConfig>::new().await?;
let genesis = api.rpc().get_chainhead_genesis_hash().await?;
println!("Genesis: {:?}", genesis);
let mut follow_sub = api.blocks().subscribe_chainhead_finalized(true).await?;
// Handle all subscriptions from the `chainHead_follow`.
while let Some(block) = follow_sub.next().await {