Skip to main content

Client

Trait Client 

Source
pub trait Client:
    Send
    + Sync
    + 'static {
Show 13 methods // 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 get_leaves_for_ranges( &self, ranges: &[Range<u64>], ) -> impl Send + Future<Output = Result<Vec<LeafQueryData<SeqTypes>>>>; fn payload_proof( &self, height: u64, ) -> impl Send + Future<Output = Result<PayloadProof>>; fn payload_proofs_in_range( &self, start: u64, end: u64, ) -> impl Send + Future<Output = Result<Vec<PayloadProof>>>; fn payload_proofs_for_ranges( &self, ranges: &[Range<u64>], ) -> impl Send + Future<Output = Result<Vec<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 namespaces_proofs_in_range( &self, start: u64, end: u64, namespaces: &[NamespaceId], ) -> impl Send + Future<Output = Result<Vec<HashMap<NamespaceId, NamespaceProof>>>>; fn stake_table_events( &self, epoch: EpochNumber, ) -> impl Send + Future<Output = Result<Vec<StakeTableEvent>>>; fn cert2( &self, height: u64, ) -> impl Send + Future<Output = Result<Option<Certificate2<SeqTypes>>>>;
}
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 get_leaves_for_ranges( &self, ranges: &[Range<u64>], ) -> impl Send + Future<Output = Result<Vec<LeafQueryData<SeqTypes>>>>

Get the leaves the server has in the given ranges, in one request.

The ranges must be ascending and disjoint. The leaves come without proofs, exactly as get_leaves_in_range does, so the caller must still verify them.

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 payload_proofs_in_range( &self, start: u64, end: u64, ) -> impl Send + Future<Output = Result<Vec<PayloadProof>>>

Get proofs for the payloads in [start, end).

Source

fn payload_proofs_for_ranges( &self, ranges: &[Range<u64>], ) -> impl Send + Future<Output = Result<Vec<PayloadProof>>>

Get payload proofs for a set of height ranges, in one request.

The ranges must be ascending and disjoint, so the proofs come back height-ascending, one per requested height; callers pair them with leaves positionally.

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 namespaces_proofs_in_range( &self, start: u64, end: u64, namespaces: &[NamespaceId], ) -> impl Send + Future<Output = Result<Vec<HashMap<NamespaceId, NamespaceProof>>>>

Get proofs for the requested namespaces 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.

Source

fn cert2( &self, height: u64, ) -> impl Send + Future<Output = Result<Option<Certificate2<SeqTypes>>>>

Get the finality certificate at the given height.

The returned certificate is unverified. Callers must check the threshold signature against the appropriate stake table and that it commits to the expected leaf.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Client for QueryServiceClient

Available on crate feature client only.
Source§

impl<T> Client for FallbackClient<T>
where T: Client,

Available on crate feature client only.