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 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§
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", so this trait is not object safe.
Implementations on Foreign Types§
Source§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 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>
Source§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 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<C, N> TransactionsProvider for NoopProvider<C, N>
impl<C, N> TransactionsProvider for NoopProvider<C, N>
type Transaction = <N as NodePrimitives>::SignedTx
Source§impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileJarProvider<'_, N>
impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileJarProvider<'_, N>
type Transaction = <N as NodePrimitives>::SignedTx
Source§impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileProvider<N>
impl<N: NodePrimitives<SignedTx: Decompress + SignedTransaction>> TransactionsProvider for StaticFileProvider<N>
type Transaction = <N as NodePrimitives>::SignedTx
Source§impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N>
impl<N: ProviderNodeTypes> TransactionsProvider for BlockchainProvider<N>
type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx
Source§impl<N: ProviderNodeTypes> TransactionsProvider for ProviderFactory<N>
impl<N: ProviderNodeTypes> TransactionsProvider for ProviderFactory<N>
type Transaction = <<N as NodeTypes>::Primitives as NodePrimitives>::SignedTx
Source§impl<T: NodePrimitives, ChainSpec: EthChainSpec + 'static> TransactionsProvider for MockEthProvider<T, ChainSpec>
Available on crate features test-utils only.
impl<T: NodePrimitives, ChainSpec: EthChainSpec + 'static> TransactionsProvider for MockEthProvider<T, ChainSpec>
test-utils only.