mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 07:17:56 +00:00
rpc: Subscribe to chainHead_follow method
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
|
||||
use super::{
|
||||
rpc_params,
|
||||
subscription_events::FollowEvent,
|
||||
RpcClient,
|
||||
RpcClientT,
|
||||
Subscription,
|
||||
@@ -606,6 +607,23 @@ impl<T: Config> Rpc<T> {
|
||||
Ok(subscription)
|
||||
}
|
||||
|
||||
/// Subscribe to the chain head follow for newly added block hashes.
|
||||
pub async fn subscribe_chainhead_follow(
|
||||
&self,
|
||||
runtime_updates: bool,
|
||||
) -> Result<Subscription<FollowEvent<T::Hash>>, Error> {
|
||||
let subscription = self
|
||||
.client
|
||||
.subscribe(
|
||||
"chainHead_unstable_follow",
|
||||
rpc_params![runtime_updates],
|
||||
"chainHead_unstable_unfollow",
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(subscription)
|
||||
}
|
||||
|
||||
/// Subscribe to finalized block headers.
|
||||
///
|
||||
/// Note: this may not produce _every_ block in the finalized chain;
|
||||
|
||||
Reference in New Issue
Block a user