pub trait BlockIdReader:
BlockNumReader
+ Send
+ Sync {
// Required methods
fn pending_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>;
fn safe_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>;
fn finalized_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>;
// Provided methods
fn convert_block_number(
&self,
num: BlockNumberOrTag,
) -> ProviderResult<Option<BlockNumber>> { ... }
fn block_hash_for_id(
&self,
block_id: BlockId,
) -> ProviderResult<Option<B256>> { ... }
fn block_number_for_id(
&self,
block_id: BlockId,
) -> ProviderResult<Option<BlockNumber>> { ... }
fn safe_block_number(&self) -> ProviderResult<Option<BlockNumber>> { ... }
fn finalized_block_number(&self) -> ProviderResult<Option<BlockNumber>> { ... }
fn safe_block_hash(&self) -> ProviderResult<Option<B256>> { ... }
fn finalized_block_hash(&self) -> ProviderResult<Option<B256>> { ... }
}
Expand description
Client trait for transforming [BlockId
] into block numbers or hashes.
Types that implement this trait must be able to resolve all variants of [BlockNumberOrTag
] to
block numbers or hashes. Automatic implementations for resolving [BlockNumberOrTag
] variants
are provided if the type implements the pending_block_num_hash
, finalized_block_num
, and
safe_block_num
methods.
The resulting block numbers can be converted to hashes using the underlying BlockNumReader methods, and vice versa.
Required Methods§
Sourcefn pending_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
fn pending_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
Get the current pending block number and hash.
Sourcefn safe_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
fn safe_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
Get the current safe block number and hash.
Sourcefn finalized_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
fn finalized_block_num_hash(&self) -> ProviderResult<Option<BlockNumHash>>
Get the current finalized block number and hash.
Provided Methods§
Sourcefn convert_block_number(
&self,
num: BlockNumberOrTag,
) -> ProviderResult<Option<BlockNumber>>
fn convert_block_number( &self, num: BlockNumberOrTag, ) -> ProviderResult<Option<BlockNumber>>
Converts the BlockNumberOrTag
variants to a block number.
Sourcefn block_hash_for_id(&self, block_id: BlockId) -> ProviderResult<Option<B256>>
fn block_hash_for_id(&self, block_id: BlockId) -> ProviderResult<Option<B256>>
Get the hash of the block by matching the given id.
Sourcefn block_number_for_id(
&self,
block_id: BlockId,
) -> ProviderResult<Option<BlockNumber>>
fn block_number_for_id( &self, block_id: BlockId, ) -> ProviderResult<Option<BlockNumber>>
Get the number of the block by matching the given id.
Sourcefn safe_block_number(&self) -> ProviderResult<Option<BlockNumber>>
fn safe_block_number(&self) -> ProviderResult<Option<BlockNumber>>
Get the safe block number.
Sourcefn finalized_block_number(&self) -> ProviderResult<Option<BlockNumber>>
fn finalized_block_number(&self) -> ProviderResult<Option<BlockNumber>>
Get the finalized block number.
Sourcefn safe_block_hash(&self) -> ProviderResult<Option<B256>>
fn safe_block_hash(&self) -> ProviderResult<Option<B256>>
Get the safe block hash.
Sourcefn finalized_block_hash(&self) -> ProviderResult<Option<B256>>
fn finalized_block_hash(&self) -> ProviderResult<Option<B256>>
Get the finalized block hash.