Skip to main content

ReceiptResponse

Trait ReceiptResponse 

Source
pub trait ReceiptResponse {
Show 17 methods // Required methods fn contract_address(&self) -> Option<Address>; fn status(&self) -> bool; fn block_hash(&self) -> Option<FixedBytes<32>>; fn block_number(&self) -> Option<u64>; fn transaction_hash(&self) -> FixedBytes<32>; fn transaction_index(&self) -> Option<u64>; fn gas_used(&self) -> u64; fn effective_gas_price(&self) -> u128; fn blob_gas_used(&self) -> Option<u64>; fn blob_gas_price(&self) -> Option<u128>; fn from(&self) -> Address; fn to(&self) -> Option<Address>; fn cumulative_gas_used(&self) -> u64; fn state_root(&self) -> Option<FixedBytes<32>>; // Provided methods fn block_hash_num(&self) -> Option<NumHash> { ... } fn cost(&self) -> u128 { ... } fn ensure_success(&self) -> Result<(), TransactionFailedError> { ... }
}
Expand description

Receipt JSON-RPC response.

Required Methods§

Source

fn contract_address(&self) -> Option<Address>

Address of the created contract, or None if the transaction was not a deployment.

Source

fn status(&self) -> bool

Status of the transaction.

§Note

Caution must be taken when using this method for deep-historical receipts, as it may not accurately reflect the status of the transaction. The transaction status is not knowable from the receipt for transactions before EIP-658.

Source

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

Hash of the block this transaction was included within.

Source

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

Number of the block this transaction was included within.

Source

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

Transaction Hash.

Source

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

Index within the block.

Source

fn gas_used(&self) -> u64

Gas used by this transaction alone.

Source

fn effective_gas_price(&self) -> u128

Effective gas price.

Source

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

Blob gas used by the eip-4844 transaction.

Source

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

Blob gas price paid by the eip-4844 transaction.

Source

fn from(&self) -> Address

Address of the sender.

Source

fn to(&self) -> Option<Address>

Address of the receiver, or None for contract creation.

Source

fn cumulative_gas_used(&self) -> u64

Returns the gas used in the block up to and including this transaction.

Source

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

Returns the post-transaction state root carried by pre-EIP-658 receipts.

EIP-658 replaced this value with a status code, so post-Byzantium receipts normally return None.

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 cost(&self) -> u128

Returns the execution-gas cost in wei: gas_used * effective_gas_price.

This excludes blob-gas charges, transferred value, and network-specific fee components; it is not the sender’s total balance change. The ordinary u128 multiplication can overflow, panicking when overflow checks are enabled or wrapping otherwise.

Source

fn ensure_success(&self) -> Result<(), TransactionFailedError>

Ensures the transaction was successful, returning its hash in the error if it failed.

This does not recover revert data and has the same pre-EIP-658 limitation as Self::status.

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> ReceiptResponse for TransactionReceipt<T>
where T: TxReceipt<Log = Log>,

Source§

impl<T> ReceiptResponse for WithOtherFields<T>
where T: ReceiptResponse,

Implementors§