mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 12:27:56 +00:00
Add support for RPC state_getReadProof (#106)
* Add support for RPC `state_getReadProof` * Format code * Add test
This commit is contained in:
+12
@@ -38,6 +38,7 @@ use jsonrpsee::{
|
||||
use num_traits::bounds::Bounded;
|
||||
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use sc_rpc_api::state::ReadProof;
|
||||
use serde::Serialize;
|
||||
use sp_core::{
|
||||
storage::{
|
||||
@@ -230,6 +231,17 @@ impl<T: System> Rpc<T> {
|
||||
Ok(block)
|
||||
}
|
||||
|
||||
/// Get proof of storage entries at a specific block's state.
|
||||
pub async fn read_proof(
|
||||
&self,
|
||||
keys: Vec<StorageKey>,
|
||||
hash: Option<T::Hash>,
|
||||
) -> Result<ReadProof<T::Hash>, Error> {
|
||||
let params = Params::Array(vec![to_json_value(keys)?, to_json_value(hash)?]);
|
||||
let proof = self.client.request("state_getReadProof", params).await?;
|
||||
Ok(proof)
|
||||
}
|
||||
|
||||
/// Fetch the runtime version
|
||||
pub async fn runtime_version(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user