pub trait TransactionsProvider: BlockNumReader + Send {
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 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>;
}provider only.Expand description
Client trait for fetching transactions related data.
Required Associated Types§
Sourcetype Transaction: Send + Sync + SignedTransaction
type Transaction: Send + Sync + SignedTransaction
The transaction type this provider reads.
Required Methods§
Sourcefn transaction_id(
&self,
tx_hash: FixedBytes<32>,
) -> Result<Option<u64>, ProviderError>
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.
Sourcefn transaction_by_id(
&self,
id: u64,
) -> Result<Option<Self::Transaction>, ProviderError>
fn transaction_by_id( &self, id: u64, ) -> Result<Option<Self::Transaction>, ProviderError>
Get transaction by id, computes hash every time so more expensive.
Sourcefn transaction_by_id_unhashed(
&self,
id: u64,
) -> Result<Option<Self::Transaction>, ProviderError>
fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<Self::Transaction>, ProviderError>
Get transaction by id without computing the hash.
Sourcefn transaction_by_hash(
&self,
hash: FixedBytes<32>,
) -> Result<Option<Self::Transaction>, ProviderError>
fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Self::Transaction>, ProviderError>
Get transaction by transaction hash.
Sourcefn transaction_by_hash_with_meta(
&self,
hash: FixedBytes<32>,
) -> Result<Option<(Self::Transaction, TransactionMeta)>, ProviderError>
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
Sourcefn transactions_by_block(
&self,
block: HashOrNumber,
) -> Result<Option<Vec<Self::Transaction>>, ProviderError>
fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<Self::Transaction>>, ProviderError>
Get transactions by block id.
Sourcefn transactions_by_block_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<Vec<Self::Transaction>>, ProviderError>
fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<Self::Transaction>>, ProviderError>
Get transactions by block range.
Sourcefn transactions_by_tx_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<Self::Transaction>, ProviderError>
fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Self::Transaction>, ProviderError>
Get transactions by tx range.
Sourcefn senders_by_tx_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<Vec<Address>, ProviderError>
fn senders_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Address>, ProviderError>
Get Senders from a tx range.
Sourcefn transaction_sender(&self, id: u64) -> Result<Option<Address>, ProviderError>
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".