diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index c12ce885e6..a0e42828a8 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -41,6 +41,7 @@ use super::{ rpc_params, + subscription_events::FollowEvent, RpcClient, RpcClientT, Subscription, @@ -606,6 +607,23 @@ impl Rpc { Ok(subscription) } + /// Subscribe to the chain head follow for newly added block hashes. + pub async fn subscribe_chainhead_follow( + &self, + runtime_updates: bool, + ) -> Result>, 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;