Trait ChainApiClient

Source
pub trait ChainApiClient<Number, Hash, Header, SignedBlock>: SubscriptionClientT
where Number: Send + Sync + 'static, Hash: Send + Sync + 'static + Serialize + DeserializeOwned, Header: Send + Sync + 'static + DeserializeOwned, SignedBlock: Send + Sync + 'static + DeserializeOwned,
{ // Provided methods fn header<'life0, 'async_trait>( &'life0 self, hash: Option<Hash>, ) -> Pin<Box<dyn Future<Output = Result<Option<Header>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn block<'life0, 'async_trait>( &'life0 self, hash: Option<Hash>, ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn block_hash<'life0, 'async_trait>( &'life0 self, hash: Option<ListOrValue<NumberOrHex>>, ) -> Pin<Box<dyn Future<Output = Result<ListOrValue<Option<Hash>>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn finalized_head<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_all_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_new_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_finalized_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } }
Expand description

Client implementation for the ChainApi RPC API.

Provided Methods§

Source

fn header<'life0, 'async_trait>( &'life0 self, hash: Option<Hash>, ) -> Pin<Box<dyn Future<Output = Result<Option<Header>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get header.

Source

fn block<'life0, 'async_trait>( &'life0 self, hash: Option<Hash>, ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get header and body of a block.

Source

fn block_hash<'life0, 'async_trait>( &'life0 self, hash: Option<ListOrValue<NumberOrHex>>, ) -> Pin<Box<dyn Future<Output = Result<ListOrValue<Option<Hash>>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get hash of the n-th block in the canon chain.

By default returns latest block hash.

Source

fn finalized_head<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get hash of the last finalized block in the canon chain.

Source

fn subscribe_all_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

All head subscription.

Source

fn subscribe_new_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

New head subscription.

Source

fn subscribe_finalized_heads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Header>, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Finalized head subscription.

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§

Source§

impl<TypeJsonRpseeInteral, Number, Hash, Header, SignedBlock> ChainApiClient<Number, Hash, Header, SignedBlock> for TypeJsonRpseeInteral
where TypeJsonRpseeInteral: SubscriptionClientT, Number: Send + Sync + 'static, Hash: Send + Sync + 'static + Serialize + DeserializeOwned, Header: Send + Sync + 'static + DeserializeOwned, SignedBlock: Send + Sync + 'static + DeserializeOwned,