mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 12:51:05 +00:00
rpc: Fetch chainHead genesis hash
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -81,8 +81,6 @@ where
|
||||
if let Some(event) = sub.next().await {
|
||||
let event = event?;
|
||||
|
||||
println!("Got event: {:?}", event);
|
||||
|
||||
return match event {
|
||||
ChainHeadEvent::Done(ChainHeadResult { result }) => {
|
||||
let bytes = hex::decode(result.trim_start_matches("0x"))
|
||||
@@ -148,8 +146,6 @@ where
|
||||
if let Some(event) = sub.next().await {
|
||||
let event = event?;
|
||||
|
||||
println!("Got event: {:?}", event);
|
||||
|
||||
return match event {
|
||||
ChainHeadEvent::Done(ChainHeadResult { result }) => {
|
||||
let result = match result {
|
||||
@@ -195,8 +191,6 @@ where
|
||||
if let Some(event) = sub.next().await {
|
||||
let event = event?;
|
||||
|
||||
println!("Got event: {:?}", event);
|
||||
|
||||
return match event {
|
||||
ChainHeadEvent::Done(ChainHeadResult { result }) => {
|
||||
let bytes = hex::decode(result.trim_start_matches("0x"))
|
||||
|
||||
@@ -662,6 +662,21 @@ impl<T: Config> Rpc<T> {
|
||||
Ok(header)
|
||||
}
|
||||
|
||||
/// Get the chain head genesis hash.
|
||||
pub async fn get_chainhead_genesis_hash(
|
||||
&self,
|
||||
) -> Result<T::Hash, Error> {
|
||||
let hash = self
|
||||
.client
|
||||
.request(
|
||||
"chainHead_unstable_genesisHash",
|
||||
rpc_params![],
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(hash)
|
||||
}
|
||||
|
||||
/// Subscribe to the chain head storage.
|
||||
pub async fn subscribe_chainhead_storage(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user