pub trait ChainApiBackend: Send + Sync {
    // Required methods
    fn header<'life0, 'async_trait>(
        &'life0 self,
        hash: Hash
    ) -> Pin<Box<dyn Future<Output = Result<Option<Header>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn info<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Info<Block>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn number<'life0, 'async_trait>(
        &'life0 self,
        hash: Hash
    ) -> Pin<Box<dyn Future<Output = Result<Option<<Header as HeaderT>::Number>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn hash<'life0, 'async_trait>(
        &'life0 self,
        number: NumberFor<Block>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Hash>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Offers header utilities.

This is a async wrapper trait for [‘HeaderBackend’] to be used with the ChainApiSubsystem.

Required Methods§

source

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

Get block header. Returns None if block is not found.

source

fn info<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Info<Block>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get blockchain info.

source

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

Get block number by hash. Returns None if the header is not in the chain.

source

fn hash<'life0, 'async_trait>( &'life0 self, number: NumberFor<Block> ) -> Pin<Box<dyn Future<Output = Result<Option<Hash>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get block hash by number. Returns None if the header is not in the chain.

Implementors§

source§

impl<T> ChainApiBackend for T
where T: HeaderBackend<Block>,