Client

Trait Client 

Source
pub trait Client:
    Send
    + Sync
    + 'static {
    // Required methods
    fn block_height(&self) -> impl Send + Future<Output = Result<u64>>;
    fn leaf_proof(
        &self,
        id: impl Into<LeafRequest> + Send,
        finalized: Option<u64>,
    ) -> impl Send + Future<Output = Result<LeafProof>>;
    fn header_proof(
        &self,
        root: u64,
        id: BlockId<SeqTypes>,
    ) -> impl Send + Future<Output = Result<HeaderProof>>;
    fn get_leaves_in_range(
        &self,
        start: usize,
        end: usize,
    ) -> impl Send + Future<Output = Result<Vec<LeafQueryData<SeqTypes>>>>;
    fn payload_proof(
        &self,
        height: u64,
    ) -> impl Send + Future<Output = Result<PayloadProof>>;
    fn namespace_proof(
        &self,
        height: u64,
        namespace: NamespaceId,
    ) -> impl Send + Future<Output = Result<NamespaceProof>>;
    fn namespace_proofs_in_range(
        &self,
        start: u64,
        end: u64,
        namespace: NamespaceId,
    ) -> impl Send + Future<Output = Result<Vec<NamespaceProof>>>;
    fn stake_table_events(
        &self,
        epoch: EpochNumber,
    ) -> impl Send + Future<Output = Result<Vec<StakeTableEvent>>>;
}
Expand description

Interface to a query server providing the light client API.

Required Methods§

Source

fn block_height(&self) -> impl Send + Future<Output = Result<u64>>

Get the number of blocks known to be in the chain.

This is equivalent to one more than the block number of the latest known block.

Source

fn leaf_proof( &self, id: impl Into<LeafRequest> + Send, finalized: Option<u64>, ) -> impl Send + Future<Output = Result<LeafProof>>

Get a finality proof for the requested leaf.

Optionally, the client may specify the height of a known-finalized leaf. In this case, the server may terminate the proof in a leaf chain ending at this height, rather than a QC chain.

Source

fn header_proof( &self, root: u64, id: BlockId<SeqTypes>, ) -> impl Send + Future<Output = Result<HeaderProof>>

Get an inclusion proof for the requested header relative to the Merkle tree at height root.

Source

fn get_leaves_in_range( &self, start: usize, end: usize, ) -> impl Send + Future<Output = Result<Vec<LeafQueryData<SeqTypes>>>>

Get all leaves in the given range [start, end).

Source

fn payload_proof( &self, height: u64, ) -> impl Send + Future<Output = Result<PayloadProof>>

Get a proof for the requested payload.

This method accepts only a height, not the more flexible BlockId type, because a Header is needed to verify the resulting proof, so the height must already be known anyways.

Source

fn namespace_proof( &self, height: u64, namespace: NamespaceId, ) -> impl Send + Future<Output = Result<NamespaceProof>>

Get a proof for the requested namespace.

This method accepts only a height, not the more flexible BlockId type, because a Header is needed to verify the resulting proof, so the height must already be known anyways.

Source

fn namespace_proofs_in_range( &self, start: u64, end: u64, namespace: NamespaceId, ) -> impl Send + Future<Output = Result<Vec<NamespaceProof>>>

Get proofs for the requested namespace for each block in [start, end).

Source

fn stake_table_events( &self, epoch: EpochNumber, ) -> impl Send + Future<Output = Result<Vec<StakeTableEvent>>>

Get stake table events for the given epoch.

This returns the list of events that must be applied to transform the stake table from epoch - 1 into the stake table for epoch.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§