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§
Sourcefn block_height(&self) -> impl Send + Future<Output = Result<u64>>
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.
Sourcefn leaf_proof(
&self,
id: impl Into<LeafRequest> + Send,
finalized: Option<u64>,
) -> impl Send + Future<Output = Result<LeafProof>>
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.
Sourcefn header_proof(
&self,
root: u64,
id: BlockId<SeqTypes>,
) -> impl Send + Future<Output = Result<HeaderProof>>
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.
Sourcefn get_leaves_in_range(
&self,
start: usize,
end: usize,
) -> impl Send + Future<Output = Result<Vec<LeafQueryData<SeqTypes>>>>
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).
Sourcefn payload_proof(
&self,
height: u64,
) -> impl Send + Future<Output = Result<PayloadProof>>
fn payload_proof( &self, height: u64, ) -> impl Send + Future<Output = Result<PayloadProof>>
Sourcefn namespace_proof(
&self,
height: u64,
namespace: NamespaceId,
) -> impl Send + Future<Output = Result<NamespaceProof>>
fn namespace_proof( &self, height: u64, namespace: NamespaceId, ) -> impl Send + Future<Output = Result<NamespaceProof>>
Sourcefn namespace_proofs_in_range(
&self,
start: u64,
end: u64,
namespace: NamespaceId,
) -> impl Send + Future<Output = Result<Vec<NamespaceProof>>>
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).
Sourcefn stake_table_events(
&self,
epoch: EpochNumber,
) -> impl Send + Future<Output = Result<Vec<StakeTableEvent>>>
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.