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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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<'a, T> TransactionsProvider for &'a T
type Transaction = <T as TransactionsProvider>::Transaction
fn transaction_id( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>
fn transaction_by_id( &self, id: u64, ) -> Result<Option<<&'a T as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<<&'a T as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<&'a T as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(<&'a T as TransactionsProvider>::Transaction, TransactionMeta)>, ProviderError>
fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>
fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<&'a T as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<<&'a T as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<&'a T as TransactionsProvider>::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>
§impl<T> TransactionsProvider for Arc<T>
impl<T> TransactionsProvider for Arc<T>
type Transaction = <T as TransactionsProvider>::Transaction
fn transaction_id( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<u64>, ProviderError>
fn transaction_by_id( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_id_unhashed( &self, id: u64, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<Arc<T> as TransactionsProvider>::Transaction>, ProviderError>
fn transaction_by_hash_with_meta( &self, hash: FixedBytes<32>, ) -> Result<Option<(<Arc<T> as TransactionsProvider>::Transaction, TransactionMeta)>, ProviderError>
fn transaction_block(&self, id: u64) -> Result<Option<u64>, ProviderError>
fn transactions_by_block( &self, block: HashOrNumber, ) -> Result<Option<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_block_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<Vec<<Arc<T> as TransactionsProvider>::Transaction>>, ProviderError>
fn transactions_by_tx_range( &self, range: impl RangeBounds<u64>, ) -> Result<Vec<<Arc<T> as TransactionsProvider>::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>
Implementors§
Source§impl TransactionsProvider for MockEthProvider
Available on crate feature test-utils
only.
impl TransactionsProvider for MockEthProvider
test-utils
only.