Add methods to get header and storage change set (#65)

This commit is contained in:
Yuanchao Sun
2020-01-21 17:43:10 +08:00
committed by Andrew Jones
parent 253a7d8b0b
commit 3618b03dee
2 changed files with 40 additions and 0 deletions
+19
View File
@@ -210,6 +210,25 @@ impl<T: System + Balances + Sync + Send + 'static, S: 'static> Client<T, S> {
Ok(result.unwrap_or_default())
}
/// Query historical storage entries
pub async fn query_storage(
&self,
keys: Vec<StorageKey>,
from: T::Hash,
to: Option<T::Hash>,
) -> Result<Vec<StorageChangeSet<<T as System>::Hash>>, Error> {
self.rpc.query_storage(keys, from, to).await
}
/// Get a header
pub async fn header<H>(&self, hash: Option<H>) -> Result<Option<T::Header>, Error>
where
H: Into<T::Hash> + 'static,
{
let header = self.rpc.header(hash.map(|h| h.into())).await?;
Ok(header)
}
/// Get a block hash. By default returns the latest block hash
pub async fn block_hash(
&self,