Trait pallet_mmr_rpc::MmrApiServer
source · pub trait MmrApiServer<BlockHash>: Sized + Send + Sync + 'static {
fn generate_proof(
&self,
leaf_index: LeafIndex,
at: Option<BlockHash>
) -> RpcResult<LeafProof<BlockHash>>;
fn generate_batch_proof(
&self,
leaf_indices: Vec<LeafIndex>,
at: Option<BlockHash>
) -> RpcResult<LeafBatchProof<BlockHash>>;
fn into_rpc(self) -> RpcModule<Self>
where
BlockHash: Send + Sync + 'static + DeserializeOwned + Serialize,
{ ... }
}
Expand description
Server trait implementation for the MmrApi
RPC API.
Required Methods§
sourcefn generate_proof(
&self,
leaf_index: LeafIndex,
at: Option<BlockHash>
) -> RpcResult<LeafProof<BlockHash>>
fn generate_proof(
&self,
leaf_index: LeafIndex,
at: Option<BlockHash>
) -> RpcResult<LeafProof<BlockHash>>
Generate MMR proof for given leaf index.
This method calls into a runtime with MMR pallet included and attempts to generate
MMR proof for leaf at given leaf_index
.
Optionally, a block hash at which the runtime should be queried can be specified.
Returns the (full) leaf itself and a proof for this leaf (compact encoding, i.e. hash of the leaf). Both parameters are SCALE-encoded.
sourcefn generate_batch_proof(
&self,
leaf_indices: Vec<LeafIndex>,
at: Option<BlockHash>
) -> RpcResult<LeafBatchProof<BlockHash>>
fn generate_batch_proof(
&self,
leaf_indices: Vec<LeafIndex>,
at: Option<BlockHash>
) -> RpcResult<LeafBatchProof<BlockHash>>
Generate MMR proof for the given leaf indices.
This method calls into a runtime with MMR pallet included and attempts to generate
MMR proof for a set of leaves at the given leaf_indices
.
Optionally, a block hash at which the runtime should be queried can be specified.
Returns the leaves and a proof for these leaves (compact encoding, i.e. hash of
the leaves). Both parameters are SCALE-encoded.
The order of entries in the leaves
field of the returned struct
is the same as the order of the entries in leaf_indices
supplied