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§
Sourcefn best_number(&self) -> u32
fn best_number(&self) -> u32
Returns the number of best block.
Sourcefn calculate_median_time_past(&self, block_hash: BlockHash) -> Option<i64>
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).
Sourcefn get_block_metadata(&self, block_hash: BlockHash) -> Option<BlockMetadata>
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.
Sourcefn is_block_on_active_chain(&self, block_hash: BlockHash) -> bool
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.