reth_provider

Trait TransactionsProvider

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

    // Required methods
    fn transaction_id(
        &self,
        tx_hash: FixedBytes<32>,
    ) -> Result<Option<u64>, ProviderError>;
    fn transaction_by_id(
        &self,
        id: u64,
    ) -> Result<Option<Self::Transaction>, ProviderError>;
    fn transaction_by_id_unhashed(
        &self,
        id: u64,
    ) -> Result<Option<Self::Transaction>, ProviderError>;
    fn transaction_by_hash(
        &self,
        hash: FixedBytes<32>,
    ) -> Result<Option<Self::Transaction>, ProviderError>;
    fn transaction_by_hash_with_meta(
        &self,
        hash: FixedBytes<32>,
    ) -> Result<Option<(Self::Transaction, TransactionMeta)>, ProviderError>;
    fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>;
    fn transactions_by_block(
        &self,
        block: HashOrNumber,
    ) -> Result<Option<Vec<Self::Transaction>>, ProviderError>;
    fn transactions_by_block_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<Vec<Self::Transaction>>, ProviderError>;
    fn transactions_by_tx_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<Self::Transaction>, ProviderError>;
    fn senders_by_tx_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<Address>, ProviderError>;
    fn transaction_sender(
        &self,
        id: u64,
    ) -> Result<Option<Address>, ProviderError>;
}
Expand description

Client trait for fetching transactions related data.

Required Associated Types§

type Transaction: Send + Sync + SignedTransaction

The transaction type this provider reads.

Required Methods§

fn transaction_id( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>

Get internal transaction identifier by transaction hash.

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

fn transaction_by_id( &self, id: u64, ) -> Result<Option<Self::Transaction>, ProviderError>

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

fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<Self::Transaction>, ProviderError>

Get transaction by id without computing the hash.

fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Self::Transaction>, ProviderError>

Get transaction by transaction hash.

fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(Self::Transaction, TransactionMeta)>, ProviderError>

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

fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>

Get transaction block number

fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<Self::Transaction>>, ProviderError>

Get transactions by block id.

fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<Self::Transaction>>, ProviderError>

Get transactions by block range.

fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Self::Transaction>, ProviderError>

Get transactions by tx range.

fn senders_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Address>, ProviderError>

Get Senders from a tx range.

fn transaction_sender(&self, id: u64) -> Result<Option<Address>, ProviderError>

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§

§

impl<'a, T> TransactionsProvider for &'a T

§

impl<T> TransactionsProvider for Arc<T>

Implementors§

Source§

impl TransactionsProvider for MockEthProvider

Available on crate feature test-utils only.
Source§

type Transaction = TransactionSigned

§

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

§

type Transaction = <N as NodePrimitives>::SignedTx

Source§

impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider2<N>

Source§

type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx

Source§

impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N>

Source§

type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx

Source§

impl<N: ProviderNodeTypes> TransactionsProvider for ProviderFactory<N>

Source§

type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx

Source§

impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileJarProvider<'_, N>

Source§

type Transaction = <N as NodePrimitives>::SignedTx

Source§

impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileProvider<N>

Source§

type Transaction = <N as NodePrimitives>::SignedTx

Source§

impl<TX: DbTx + 'static, N: NodeTypesForProvider> TransactionsProvider for DatabaseProvider<TX, N>

Source§

type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx