mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
* Add RPC function state_getProof, resolves #1110 * Apply suggestions from code review * Update client/rpc/src/state/state_full.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update Cargo.lock * Make block hash optional * Wrap StorageProof as Bytes * Add struct ReadProof * Fix typo Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Copyright 2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Substrate is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Substrate state API helpers.
|
||||
|
||||
use sp_core::Bytes;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
/// ReadProof struct returned by the RPC
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ReadProof<Hash> {
|
||||
/// Block hash used to generate the proof
|
||||
pub at: Hash,
|
||||
/// A proof used to prove that storage entries are included in the storage trie
|
||||
pub proof: Vec<Bytes>,
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
//! Substrate state API.
|
||||
|
||||
pub mod error;
|
||||
pub mod helpers;
|
||||
|
||||
use jsonrpc_core::Result as RpcResult;
|
||||
use jsonrpc_core::futures::Future;
|
||||
@@ -28,6 +29,7 @@ use sp_version::RuntimeVersion;
|
||||
use self::error::FutureResult;
|
||||
|
||||
pub use self::gen_client::Client as StateClient;
|
||||
pub use self::helpers::ReadProof;
|
||||
|
||||
/// Substrate state API
|
||||
#[rpc]
|
||||
@@ -100,6 +102,10 @@ pub trait StateApi<Hash> {
|
||||
at: Option<Hash>,
|
||||
) -> FutureResult<Vec<StorageChangeSet<Hash>>>;
|
||||
|
||||
/// Returns proof of storage entries at a specific block's state.
|
||||
#[rpc(name = "state_getReadProof")]
|
||||
fn read_proof(&self, keys: Vec<StorageKey>, hash: Option<Hash>) -> FutureResult<ReadProof<Hash>>;
|
||||
|
||||
/// New runtime version subscription
|
||||
#[pubsub(
|
||||
subscription = "state_runtimeVersion",
|
||||
|
||||
Reference in New Issue
Block a user