Trait reth::core::rpc::api::servers::eth::helpers::transaction::LoadTransaction

source ·
pub trait LoadTransaction: SpawnBlocking {
    type Pool: TransactionPool;

    // Required methods
    fn provider(&self) -> impl TransactionsProvider;
    fn cache(&self) -> &EthStateCache;
    fn pool(&self) -> &Self::Pool;

    // Provided methods
    fn transaction_by_hash(
        &self,
        hash: FixedBytes<32>,
    ) -> impl Future<Output = Result<Option<TransactionSource>, EthApiError>> + Send { ... }
    fn transaction_by_hash_at(
        &self,
        transaction_hash: FixedBytes<32>,
    ) -> impl Future<Output = Result<Option<(TransactionSource, BlockId)>, EthApiError>> + Send { ... }
    fn transaction_and_block(
        &self,
        hash: FixedBytes<32>,
    ) -> impl Future<Output = Result<Option<(TransactionSource, SealedBlockWithSenders)>, EthApiError>> + Send { ... }
}
Expand description

Loads a transaction from database.

Behaviour shared by several eth_ RPC methods, not exclusive to eth_ transactions RPC methods.

Required Associated Types§

source

type Pool: TransactionPool

Transaction pool with pending transactions. TransactionPool::Transaction is the supported transaction type.

Required Methods§

source

fn provider(&self) -> impl TransactionsProvider

Returns a handle for reading data from disk.

Data access in default (L1) trait method implementations.

source

fn cache(&self) -> &EthStateCache

Returns a handle for reading data from memory.

Data access in default (L1) trait method implementations.

source

fn pool(&self) -> &Self::Pool

Returns a handle for reading data from pool.

Data access in default (L1) trait method implementations.

Provided Methods§

source

fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> impl Future<Output = Result<Option<TransactionSource>, EthApiError>> + Send

Returns the transaction by hash.

Checks the pool and state.

Returns Ok(None) if no matching transaction was found.

source

fn transaction_by_hash_at( &self, transaction_hash: FixedBytes<32>, ) -> impl Future<Output = Result<Option<(TransactionSource, BlockId)>, EthApiError>> + Send

Returns the transaction by including its corresponding BlockId.

Note: this supports pending transactions

source

fn transaction_and_block( &self, hash: FixedBytes<32>, ) -> impl Future<Output = Result<Option<(TransactionSource, SealedBlockWithSenders)>, EthApiError>> + Send

Fetches the transaction and the transaction’s block

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Provider, Pool, Network, EvmConfig> LoadTransaction for EthApi<Provider, Pool, Network, EvmConfig>
where EthApi<Provider, Pool, Network, EvmConfig>: SpawnBlocking, Provider: TransactionsProvider, Pool: TransactionPool,

§

type Pool = Pool