Skip to main content

TransactionResponse

Trait TransactionResponse 

Source
pub trait TransactionResponse: Transaction {
    // Required methods
    fn tx_hash(&self) -> FixedBytes<32>;
    fn block_hash(&self) -> Option<FixedBytes<32>>;
    fn block_number(&self) -> Option<u64>;
    fn transaction_index(&self) -> Option<u64>;
    fn from(&self) -> Address;

    // Provided methods
    fn block_hash_num(&self) -> Option<NumHash> { ... }
    fn gas_price(&self) -> Option<u128> { ... }
    fn max_fee_per_gas(&self) -> Option<u128> { ... }
    fn transaction_type(&self) -> Option<u8> { ... }
    fn inclusion_info(&self) -> Option<InclusionInfo> { ... }
}
Expand description

Transaction JSON-RPC response. Aggregates transaction data with its block and signer context.

The optional fee accessors split fixed-price and dynamic-fee consensus caps by transaction type and share names with differently typed methods on Transaction. Use trait-qualified calls such as TransactionResponse::max_fee_per_gas(tx) when the distinction matters.

Required Methods§

Source

fn tx_hash(&self) -> FixedBytes<32>

Hash of the transaction

Source

fn block_hash(&self) -> Option<FixedBytes<32>>

Returns the hash of the block this transaction was mined in.

Returns None when absent from the response, normally for a pending transaction.

Source

fn block_number(&self) -> Option<u64>

Returns the number of the block this transaction was mined in.

Returns None when absent from the response, normally for a pending transaction.

Source

fn transaction_index(&self) -> Option<u64>

Transaction Index

Source

fn from(&self) -> Address

Sender of the transaction

Provided Methods§

Source

fn block_hash_num(&self) -> Option<NumHash>

Returns the BlockNumHash of the block this transaction was mined in.

Returns None if either component is absent, as is normally the case for a pending transaction.

Source

fn gas_price(&self) -> Option<u128>

Returns the fixed gas price for standard Ethereum transaction type IDs 0 and 1.

The default returns the consensus fee cap for those type IDs and None for IDs 2 and above. Networks with different type numbering or RPC gasPrice semantics must override this method.

Source

fn max_fee_per_gas(&self) -> Option<u128>

Returns the maximum fee per gas for standard Ethereum transaction type IDs 2 and above.

The default returns None for type IDs 0 and 1 and the consensus fee cap for later IDs. Networks with different type numbering must override this method.

Source

fn transaction_type(&self) -> Option<u8>

Transaction type format for RPC. This field is included since eip-2930.

Source

fn inclusion_info(&self) -> Option<InclusionInfo>

Returns the InclusionInfo if the transaction has been included.

Returns None if this transaction is still pending (missing block number, hash, or index).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TransactionResponse for Transaction<T>

Source§

impl<T> TransactionResponse for WithOtherFields<T>

Implementors§