pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
Show 17 methods
// Required methods
fn signers(
&self,
) -> &RwLock<Vec<Box<dyn EthSigner<ProviderTx<Self::Provider>>>>>;
fn send_raw_transaction(
&self,
tx: Bytes,
) -> impl Future<Output = Result<B256, Self::Error>> + Send;
// Provided methods
fn transaction_by_hash(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<TransactionSource<ProviderTx<Self::Provider>>>, Self::Error>> + Send { ... }
fn transactions_by_block(
&self,
block: B256,
) -> impl Future<Output = Result<Option<Vec<ProviderTx<Self::Provider>>>, Self::Error>> + Send { ... }
fn raw_transaction_by_hash(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send { ... }
fn historical_transaction_by_hash_at(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<(TransactionSource<ProviderTx<Self::Provider>>, B256)>, Self::Error>> + Send { ... }
fn transaction_receipt(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<RpcReceipt<Self::NetworkTypes>>, Self::Error>> + Send
where Self: LoadReceipt + 'static { ... }
fn load_transaction_and_receipt(
&self,
hash: TxHash,
) -> impl Future<Output = Result<Option<(ProviderTx<Self::Provider>, TransactionMeta, ProviderReceipt<Self::Provider>)>, Self::Error>> + Send
where Self: 'static { ... }
fn transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Send
where Self: LoadBlock { ... }
fn get_transaction_by_sender_and_nonce(
&self,
sender: Address,
nonce: u64,
include_pending: bool,
) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Send
where Self: LoadBlock + LoadState { ... }
fn raw_transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send
where Self: LoadBlock { ... }
fn send_transaction(
&self,
request: TransactionRequest,
) -> impl Future<Output = Result<B256, Self::Error>> + Send
where Self: EthApiSpec + LoadBlock + EstimateCall { ... }
fn sign_request(
&self,
from: &Address,
txn: TransactionRequest,
) -> impl Future<Output = Result<ProviderTx<Self::Provider>, Self::Error>> + Send { ... }
fn sign(
&self,
account: Address,
message: Bytes,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send { ... }
fn sign_transaction(
&self,
request: TransactionRequest,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send { ... }
fn sign_typed_data(
&self,
data: &TypedData,
account: Address,
) -> Result<Bytes, Self::Error> { ... }
fn find_signer(
&self,
account: &Address,
) -> Result<Box<dyn EthSigner<ProviderTx<Self::Provider>> + 'static>, Self::Error> { ... }
}
Expand description
Transaction related functions for the EthApiServer
trait in
the eth_
namespace.
This includes utilities for transaction tracing, transacting and inspection.
Async functions that are spawned onto the
BlockingTaskPool
begin with spawn_
§Calls
There are subtle differences between when transacting [TransactionRequest
]:
The endpoints eth_call
and eth_estimateGas
and eth_createAccessList
should always
disable the base fee check in the
EnvWithHandlerCfg
.
The behaviour for tracing endpoints is not consistent across clients. Geth also disables the basefee check for tracing: https://github.com/ethereum/go-ethereum/blob/bc0b87ca196f92e5af49bd33cc190ef0ec32b197/eth/tracers/api.go#L955-L955 Erigon does not: https://github.com/ledgerwatch/erigon/blob/aefb97b07d1c4fd32a66097a24eddd8f6ccacae0/turbo/transactions/tracing.go#L209-L209
See also https://github.com/paradigmxyz/reth/issues/6240
This implementation follows the behaviour of Geth and disables the basefee check for tracing.
Required Methods§
Provided Methods§
Sourcefn transaction_by_hash(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<TransactionSource<ProviderTx<Self::Provider>>>, Self::Error>> + Send
fn transaction_by_hash( &self, hash: B256, ) -> impl Future<Output = Result<Option<TransactionSource<ProviderTx<Self::Provider>>>, Self::Error>> + Send
Returns the transaction by hash.
Checks the pool and state.
Returns Ok(None)
if no matching transaction was found.
Sourcefn transactions_by_block(
&self,
block: B256,
) -> impl Future<Output = Result<Option<Vec<ProviderTx<Self::Provider>>>, Self::Error>> + Send
fn transactions_by_block( &self, block: B256, ) -> impl Future<Output = Result<Option<Vec<ProviderTx<Self::Provider>>>, Self::Error>> + Send
Get all transactions in the block with the given hash.
Returns None
if block does not exist.
Sourcefn raw_transaction_by_hash(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send
fn raw_transaction_by_hash( &self, hash: B256, ) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Send
Returns the EIP-2718 encoded transaction by hash.
If this is a pooled EIP-4844 transaction, the blob sidecar is included.
Checks the pool and state.
Returns Ok(None)
if no matching transaction was found.
Sourcefn historical_transaction_by_hash_at(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<(TransactionSource<ProviderTx<Self::Provider>>, B256)>, Self::Error>> + Send
fn historical_transaction_by_hash_at( &self, hash: B256, ) -> impl Future<Output = Result<Option<(TransactionSource<ProviderTx<Self::Provider>>, B256)>, Self::Error>> + Send
Returns the historical transaction and the block it was mined in
Sourcefn transaction_receipt(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<RpcReceipt<Self::NetworkTypes>>, Self::Error>> + Sendwhere
Self: LoadReceipt + 'static,
fn transaction_receipt(
&self,
hash: B256,
) -> impl Future<Output = Result<Option<RpcReceipt<Self::NetworkTypes>>, Self::Error>> + Sendwhere
Self: LoadReceipt + 'static,
Returns the transaction receipt for the given hash.
Returns None if the transaction does not exist or is pending Note: The tx receipt is not available for pending transactions.
Sourcefn load_transaction_and_receipt(
&self,
hash: TxHash,
) -> impl Future<Output = Result<Option<(ProviderTx<Self::Provider>, TransactionMeta, ProviderReceipt<Self::Provider>)>, Self::Error>> + Sendwhere
Self: 'static,
fn load_transaction_and_receipt(
&self,
hash: TxHash,
) -> impl Future<Output = Result<Option<(ProviderTx<Self::Provider>, TransactionMeta, ProviderReceipt<Self::Provider>)>, Self::Error>> + Sendwhere
Self: 'static,
Helper method that loads a transaction and its receipt.
Sourcefn transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Sendwhere
Self: LoadBlock,
fn transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Sendwhere
Self: LoadBlock,
Get transaction by [BlockId
] and index of transaction within that block.
Returns Ok(None)
if the block does not exist, or index is out of range.
Sourcefn get_transaction_by_sender_and_nonce(
&self,
sender: Address,
nonce: u64,
include_pending: bool,
) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Send
fn get_transaction_by_sender_and_nonce( &self, sender: Address, nonce: u64, include_pending: bool, ) -> impl Future<Output = Result<Option<RpcTransaction<Self::NetworkTypes>>, Self::Error>> + Send
Find a transaction by sender’s address and nonce.
Sourcefn raw_transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Sendwhere
Self: LoadBlock,
fn raw_transaction_by_block_and_tx_index(
&self,
block_id: BlockId,
index: usize,
) -> impl Future<Output = Result<Option<Bytes>, Self::Error>> + Sendwhere
Self: LoadBlock,
Get transaction, as raw bytes, by [BlockId
] and index of transaction within that block.
Returns Ok(None)
if the block does not exist, or index is out of range.
Sourcefn send_transaction(
&self,
request: TransactionRequest,
) -> impl Future<Output = Result<B256, Self::Error>> + Send
fn send_transaction( &self, request: TransactionRequest, ) -> impl Future<Output = Result<B256, Self::Error>> + Send
Signs transaction with a matching signer, if any and submits the transaction to the pool. Returns the hash of the signed transaction.
Sourcefn sign_request(
&self,
from: &Address,
txn: TransactionRequest,
) -> impl Future<Output = Result<ProviderTx<Self::Provider>, Self::Error>> + Send
fn sign_request( &self, from: &Address, txn: TransactionRequest, ) -> impl Future<Output = Result<ProviderTx<Self::Provider>, Self::Error>> + Send
Signs a transaction, with configured signers.
Sourcefn sign(
&self,
account: Address,
message: Bytes,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send
fn sign( &self, account: Address, message: Bytes, ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send
Signs given message. Returns the signature.
Sourcefn sign_transaction(
&self,
request: TransactionRequest,
) -> impl Future<Output = Result<Bytes, Self::Error>> + Send
fn sign_transaction( &self, request: TransactionRequest, ) -> impl Future<Output = Result<Bytes, Self::Error>> + Send
Signs a transaction request using the given account in request Returns the EIP-2718 encoded signed transaction.
Sourcefn sign_typed_data(
&self,
data: &TypedData,
account: Address,
) -> Result<Bytes, Self::Error>
fn sign_typed_data( &self, data: &TypedData, account: Address, ) -> Result<Bytes, Self::Error>
Encodes and signs the typed data according EIP-712. Payload must implement Eip712 trait.
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.