mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 12:11:09 +00:00
rpc: Expose chainHead_unpin method for blocks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -162,6 +162,22 @@ where
|
||||
"Failed to execute the runtime API call".into(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Unpin this block.
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// Call this method when you are no longer interested in making queries
|
||||
/// against this block.
|
||||
///
|
||||
/// Failing to call this method will eventually terminate the subscription.
|
||||
pub async fn unpin(self) -> Result<(), Error> {
|
||||
self.client
|
||||
.rpc()
|
||||
.chainhead_unpin(self.subscription_id, self.hash)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// A representation of a block.
|
||||
|
||||
@@ -698,6 +698,22 @@ impl<T: Config> Rpc<T> {
|
||||
Ok(header)
|
||||
}
|
||||
|
||||
/// Unpin a block reported by the `chainHead_follow` subscription.
|
||||
pub async fn chainhead_unpin(
|
||||
&self,
|
||||
subscription_id: String,
|
||||
hash: T::Hash,
|
||||
) -> Result<(), Error> {
|
||||
self.client
|
||||
.request(
|
||||
"chainHead_unstable_unpin",
|
||||
rpc_params![subscription_id, hash],
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Parse `chaiHead_header` response and return the block's header.
|
||||
///
|
||||
/// # Note
|
||||
|
||||
Reference in New Issue
Block a user