blocks: Move parsing logic to the RPC for the chainHead methods

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-11-30 17:30:38 +00:00
parent e7192f350a
commit 1645a1d3a3
4 changed files with 179 additions and 86 deletions
+1
View File
@@ -19,3 +19,4 @@ futures = "0.3.13"
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
hex = "0.4.3"
tracing-subscriber = "0.3.11"
array-bytes = "4.1"
+2 -2
View File
@@ -28,7 +28,7 @@ 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?;
let genesis = api.rpc().chainhead_genesis_hash().await?;
println!("Genesis: {:?}", genesis);
let mut follow_sub = api.blocks().subscribe_chainhead_finalized(true).await?;
@@ -53,7 +53,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let call_params = AccountKeyring::Alice.to_account_id().encode();
let call = block
.call("AccountNonceApi_account_nonce".into(), &call_params)
.call("AccountNonceApi_account_nonce".into(), Some(&call_params))
.await?;
println!("[hash={:?}] call={:?}", block.hash(), call);
}