pub trait ReceiptProviderIdExt: ReceiptProvider + BlockIdReader {
// Provided methods
fn receipts_by_block_id(
&self,
block: BlockId,
) -> ProviderResult<Option<Vec<Self::Receipt>>> { ... }
fn receipts_by_number_or_tag(
&self,
number_or_tag: BlockNumberOrTag,
) -> ProviderResult<Option<Vec<Self::Receipt>>> { ... }
}
Expand description
Trait extension for ReceiptProvider
, for types that implement BlockId
conversion.
The Receipt
trait should be implemented on types that can retrieve receipts from either
a block number or hash. However, it might be desirable to fetch receipts from a BlockId
type,
which can be a number, hash, or tag such as BlockNumberOrTag::Safe
.
Resolving tags requires keeping track of block hashes or block numbers associated with the tag,
so this trait can only be implemented for types that implement BlockIdReader
. The
BlockIdReader
methods should be used to resolve BlockId
s to block numbers or hashes, and
retrieving the receipts should be done using the type’s ReceiptProvider
methods.
Provided Methods§
Sourcefn receipts_by_block_id(
&self,
block: BlockId,
) -> ProviderResult<Option<Vec<Self::Receipt>>>
fn receipts_by_block_id( &self, block: BlockId, ) -> ProviderResult<Option<Vec<Self::Receipt>>>
Get receipt by block id
Sourcefn receipts_by_number_or_tag(
&self,
number_or_tag: BlockNumberOrTag,
) -> ProviderResult<Option<Vec<Self::Receipt>>>
fn receipts_by_number_or_tag( &self, number_or_tag: BlockNumberOrTag, ) -> ProviderResult<Option<Vec<Self::Receipt>>>
Returns the block with the matching BlockId
from the database.
Returns None
if block is not found.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.