reth::providers

Trait ReceiptProviderIdExt

pub trait ReceiptProviderIdExt: ReceiptProvider + BlockIdReader {
    // Provided methods
    fn receipts_by_block_id(
        &self,
        block: BlockId,
    ) -> Result<Option<Vec<Self::Receipt>>, ProviderError> { ... }
    fn receipts_by_number_or_tag(
        &self,
        number_or_tag: BlockNumberOrTag,
    ) -> Result<Option<Vec<Self::Receipt>>, ProviderError> { ... }
}
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 BlockIds to block numbers or hashes, and retrieving the receipts should be done using the type’s ReceiptProvider methods.

Provided Methods§

fn receipts_by_block_id( &self, block: BlockId, ) -> Result<Option<Vec<Self::Receipt>>, ProviderError>

Get receipt by block id

fn receipts_by_number_or_tag( &self, number_or_tag: BlockNumberOrTag, ) -> Result<Option<Vec<Self::Receipt>>, ProviderError>

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.

Implementors§