pub trait GetChainInfo {
    type BlockNumber;
    type Hash;
    type Header;
    type Block;

    // Required methods
    fn get_finalized_head<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Hash>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_header<'life0, 'async_trait>(
        &'life0 self,
        hash: Option<Self::Hash>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Header>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_hash<'life0, 'async_trait>(
        &'life0 self,
        number: Option<Self::BlockNumber>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Hash>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_genesis_block<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Block>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block<'life0, 'async_trait>(
        &'life0 self,
        hash: Option<Self::Hash>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Block>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_by_num<'life0, 'async_trait>(
        &'life0 self,
        number: Option<Self::BlockNumber>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Block>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_signed_block<'life0, 'async_trait>(
        &'life0 self,
        hash: Option<Self::Hash>
    ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock<Self::Block>>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_signed_block_by_num<'life0, 'async_trait>(
        &'life0 self,
        number: Option<Self::BlockNumber>
    ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock<Self::Block>>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_finalized_block<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock<Self::Block>>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_signed_blocks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block_numbers: &'life1 [Self::BlockNumber]
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SignedBlock<Self::Block>>>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Associated Types§

Required Methods§

source

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

source

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

source

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

source

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

Returns the genesis block

source

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

source

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

source

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

A signed block is a block with Justification ,i.e., a Grandpa finality proof. The interval at which finality proofs are provided is set via the the GrandpaConfig.justification_period in a node’s service.rs. The Justification may be None.

source

fn get_signed_block_by_num<'life0, 'async_trait>( &'life0 self, number: Option<Self::BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<Option<SignedBlock<Self::Block>>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

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

Get the last finalized signed block.

source

fn get_signed_blocks<'life0, 'life1, 'async_trait>( &'life0 self, block_numbers: &'life1 [Self::BlockNumber] ) -> Pin<Box<dyn Future<Output = Result<Vec<SignedBlock<Self::Block>>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a vector containing the blocks with the block numbers given in the input parameter. If fetching any of the block fails then a Result::Err will be returned.

Implementors§

source§

impl<T, Client> GetChainInfo for Api<T, Client>
where T: Config, Client: Request,

§

type BlockNumber = <T as Config>::BlockNumber

§

type Hash = <T as Config>::Hash

§

type Header = <T as Config>::Header

§

type Block = <T as Config>::Block