reth_provider

Trait TransactionsProvider

pub trait TransactionsProvider:
    BlockNumReader
    + Send
    + Sync {
    // Required methods
    fn transaction_id(
        &self,
        tx_hash: FixedBytes<32>,
    ) -> Result<Option<u64>, ProviderError>;
    fn transaction_by_id(
        &self,
        id: u64,
    ) -> Result<Option<TransactionSigned>, ProviderError>;
    fn transaction_by_id_no_hash(
        &self,
        id: u64,
    ) -> Result<Option<TransactionSignedNoHash>, ProviderError>;
    fn transaction_by_hash(
        &self,
        hash: FixedBytes<32>,
    ) -> Result<Option<TransactionSigned>, ProviderError>;
    fn transaction_by_hash_with_meta(
        &self,
        hash: FixedBytes<32>,
    ) -> Result<Option<(TransactionSigned, TransactionMeta)>, ProviderError>;
    fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>;
    fn transactions_by_block(
        &self,
        block: HashOrNumber,
    ) -> Result<Option<Vec<TransactionSigned>>, ProviderError>;
    fn transactions_by_block_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<Vec<TransactionSigned>>, ProviderError>;
    fn transactions_by_tx_range(
        &self,
        range: impl RangeBounds<u64>,
    ) -> Result<Vec<TransactionSignedNoHash>, 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 [TransactionSigned] related data.

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<TransactionSigned>, ProviderError>

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

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

Get transaction by id without computing the hash.

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

Get transaction by transaction hash.

fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(TransactionSigned, 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<TransactionSigned>>, ProviderError>

Get transactions by block id.

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

Get transactions by block range.

fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<TransactionSignedNoHash>, 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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<TransactionSignedNoHash>, 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>

§

impl<T> TransactionsProvider for Arc<T>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<TransactionSignedNoHash>, 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>

Implementors§