Trait ClientExt

Source
pub trait ClientExt<Block> {
    // Required methods
    fn best_number(&self) -> u32;
    fn calculate_median_time_past(&self, block_hash: BlockHash) -> Option<i64>;
    fn get_block_metadata(&self, block_hash: BlockHash) -> Option<BlockMetadata>;
    fn is_block_on_active_chain(&self, block_hash: BlockHash) -> bool;
}
Expand description

A trait to extend the Substrate Client.

Required Methods§

Source

fn best_number(&self) -> u32

Returns the number of best block.

Source

fn calculate_median_time_past(&self, block_hash: BlockHash) -> Option<i64>

Calculate median time past for a given block (BIP113).

Returns the median timestamp of the last 11 blocks (including the given block).

Source

fn get_block_metadata(&self, block_hash: BlockHash) -> Option<BlockMetadata>

Get block metadata (height and median time past) for a given block hash.

Returns None if the block is not found in the chain.

Source

fn is_block_on_active_chain(&self, block_hash: BlockHash) -> bool

Check if a block is on the active (best) chain.

Returns false if the block is not found or is on a stale fork.

Implementations on Foreign Types§

Source§

impl<Block, Client> ClientExt<Block> for Arc<Client>
where Block: BlockT, Client: HeaderBackend<Block> + AuxStore,

Source§

fn best_number(&self) -> u32

Source§

fn calculate_median_time_past(&self, block_hash: BlockHash) -> Option<i64>

Source§

fn get_block_metadata(&self, block_hash: BlockHash) -> Option<BlockMetadata>

Source§

fn is_block_on_active_chain(&self, block_hash: BlockHash) -> bool

Implementors§