reth_storage_api

Trait TransactionsProvider

Source
pub trait TransactionsProvider:
    BlockNumReader
    + Send
    + Sync {
    type Transaction: Send + Sync + SignedTransaction;

    // Required methods
    fn transaction_id(
        &self,
        tx_hash: TxHash,
    ) -> ProviderResult<Option<TxNumber>>;
    fn transaction_by_id(
        &self,
        id: TxNumber,
    ) -> ProviderResult<Option<Self::Transaction>>;
    fn transaction_by_id_unhashed(
        &self,
        id: TxNumber,
    ) -> ProviderResult<Option<Self::Transaction>>;
    fn transaction_by_hash(
        &self,
        hash: TxHash,
    ) -> ProviderResult<Option<Self::Transaction>>;
    fn transaction_by_hash_with_meta(
        &self,
        hash: TxHash,
    ) -> ProviderResult<Option<(Self::Transaction, TransactionMeta)>>;
    fn transaction_block(
        &self,
        id: TxNumber,
    ) -> ProviderResult<Option<BlockNumber>>;
    fn transactions_by_block(
        &self,
        block: BlockHashOrNumber,
    ) -> ProviderResult<Option<Vec<Self::Transaction>>>;
    fn transactions_by_block_range(
        &self,
        range: impl RangeBounds<BlockNumber>,
    ) -> ProviderResult<Vec<Vec<Self::Transaction>>>;
    fn transactions_by_tx_range(
        &self,
        range: impl RangeBounds<TxNumber>,
    ) -> ProviderResult<Vec<Self::Transaction>>;
    fn senders_by_tx_range(
        &self,
        range: impl RangeBounds<TxNumber>,
    ) -> ProviderResult<Vec<Address>>;
    fn transaction_sender(
        &self,
        id: TxNumber,
    ) -> ProviderResult<Option<Address>>;
}
Expand description

Client trait for fetching transactions related data.

Required Associated Types§

Source

type Transaction: Send + Sync + SignedTransaction

The transaction type this provider reads.

Required Methods§

Source

fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>>

Get internal transaction identifier by transaction hash.

This is the inverse of TransactionsProvider::transaction_by_id. Returns None if the transaction is not found.

Source

fn transaction_by_id( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Get transaction by id, computes hash every time so more expensive.

Source

fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Get transaction by id without computing the hash.

Source

fn transaction_by_hash( &self, hash: TxHash, ) -> ProviderResult<Option<Self::Transaction>>

Get transaction by transaction hash.

Source

fn transaction_by_hash_with_meta( &self, hash: TxHash, ) -> ProviderResult<Option<(Self::Transaction, TransactionMeta)>>

Get transaction by transaction hash and additional metadata of the block the transaction was mined in

Source

fn transaction_block(&self, id: TxNumber) -> ProviderResult<Option<BlockNumber>>

Get transaction block number

Source

fn transactions_by_block( &self, block: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<Self::Transaction>>>

Get transactions by block id.

Source

fn transactions_by_block_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<Vec<Vec<Self::Transaction>>>

Get transactions by block range.

Source

fn transactions_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Self::Transaction>>

Get transactions by tx range.

Source

fn senders_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Address>>

Get Senders from a tx range.

Source

fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>>

Get transaction sender.

Returns None if the transaction 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.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + TransactionsProvider + ?Sized> TransactionsProvider for &'a T

Source§

type Transaction = <T as TransactionsProvider>::Transaction

Source§

fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>>

Source§

fn transaction_by_id( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_hash( &self, hash: TxHash, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_hash_with_meta( &self, hash: TxHash, ) -> ProviderResult<Option<(Self::Transaction, TransactionMeta)>>

Source§

fn transaction_block(&self, id: TxNumber) -> ProviderResult<Option<BlockNumber>>

Source§

fn transactions_by_block( &self, block: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<Self::Transaction>>>

Source§

fn transactions_by_block_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<Vec<Vec<Self::Transaction>>>

Source§

fn transactions_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Self::Transaction>>

Source§

fn senders_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Address>>

Source§

fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>>

Source§

impl<T: TransactionsProvider + ?Sized> TransactionsProvider for Arc<T>
where Arc<T>: BlockNumReader + Send + Sync,

Source§

type Transaction = <T as TransactionsProvider>::Transaction

Source§

fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>>

Source§

fn transaction_by_id( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_id_unhashed( &self, id: TxNumber, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_hash( &self, hash: TxHash, ) -> ProviderResult<Option<Self::Transaction>>

Source§

fn transaction_by_hash_with_meta( &self, hash: TxHash, ) -> ProviderResult<Option<(Self::Transaction, TransactionMeta)>>

Source§

fn transaction_block(&self, id: TxNumber) -> ProviderResult<Option<BlockNumber>>

Source§

fn transactions_by_block( &self, block: BlockHashOrNumber, ) -> ProviderResult<Option<Vec<Self::Transaction>>>

Source§

fn transactions_by_block_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<Vec<Vec<Self::Transaction>>>

Source§

fn transactions_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Self::Transaction>>

Source§

fn senders_by_tx_range( &self, range: impl RangeBounds<TxNumber>, ) -> ProviderResult<Vec<Address>>

Source§

fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>>

Implementors§

Source§

impl<C: Send + Sync, N: NodePrimitives> TransactionsProvider for NoopProvider<C, N>

Source§

type Transaction = <N as NodePrimitives>::SignedTx