Struct TransactionReceipt

Source
pub struct TransactionReceipt<T = ReceiptEnvelope<Log>> {
    pub inner: T,
    pub transaction_hash: TxHash,
    pub transaction_index: Option<u64>,
    pub block_hash: Option<BlockHash>,
    pub block_number: Option<u64>,
    pub gas_used: u64,
    pub effective_gas_price: u128,
    pub blob_gas_used: Option<u64>,
    pub blob_gas_price: Option<u128>,
    pub from: Address,
    pub to: Option<Address>,
    pub contract_address: Option<Address>,
}
Expand description

Transaction receipt

This type is generic over an inner ReceiptEnvelope which contains consensus data and metadata.

Fields§

§inner: T

The receipt envelope, which contains the consensus receipt data.

§transaction_hash: TxHash

Transaction Hash.

§transaction_index: Option<u64>

Index within the block.

§block_hash: Option<BlockHash>

Hash of the block this transaction was included within.

§block_number: Option<u64>

Number of the block this transaction was included within.

§gas_used: u64

Gas used by this transaction alone.

§effective_gas_price: u128

The price paid post-execution by the transaction (i.e. base fee + priority fee). Both fields in 1559-style transactions are maximums (max fee + max priority fee), the amount that’s actually paid by users can only be determined post-execution

§blob_gas_used: Option<u64>

Blob gas used by the eip-4844 transaction

This is None for non eip-4844 transactions

§blob_gas_price: Option<u128>

The price paid by the eip-4844 transaction per blob gas.

§from: Address

Address of the sender

§to: Option<Address>

Address of the receiver. None when its a contract creation transaction.

§contract_address: Option<Address>

Contract address created, or None if not a deployment.

Implementations§

Source§

impl TransactionReceipt

Source

pub const fn status(&self) -> bool

Returns the status of the transaction.

Source

pub const fn transaction_type(&self) -> TxType

Returns the transaction type.

Source§

impl<T> TransactionReceipt<T>

Source

pub fn map_inner<U, F>(self, f: F) -> TransactionReceipt<U>
where F: FnOnce(T) -> U,

Maps the inner receipt value of this receipt.

Source

pub fn into_inner(self) -> T

Consumes the type and returns the wrapped receipt.

Source

pub fn calculate_create_address(&self, nonce: u64) -> Option<Address>

Calculates the address that will be created by the transaction, if any.

Returns None if the transaction is not a contract creation (the to field is set).

Source§

impl<L> TransactionReceipt<ReceiptEnvelope<L>>

Source

pub fn map_logs<U>( self, f: impl FnMut(L) -> U, ) -> TransactionReceipt<ReceiptEnvelope<U>>

Converts the receipt’s log type by applying a function to each log.

Returns the receipt with the new log type.

Source

pub fn into_primitives_receipt(self) -> TransactionReceipt<ReceiptEnvelope<Log>>
where L: Into<Log>,

Converts the transaction receipt’s ReceiptEnvelope with a custom log type into a ReceiptEnvelope with the primitives alloy_primitives::Log type by converting the logs.

Source§

impl<T: TxReceipt> TransactionReceipt<T>

Source

pub fn logs(&self) -> &[T::Log]

Get the receipt logs.

Source§

impl<T: TxReceipt<Log: AsRef<Log>>> TransactionReceipt<T>

Source

pub fn decoded_log<E: SolEvent>(&self) -> Option<Log<E>>

Attempts to decode the logs to the provided log type.

Returns the first log that decodes successfully.

Returns None, if none of the logs could be decoded to the provided log type or if there are no logs.

Trait Implementations§

Source§

impl AsRef<ReceiptEnvelope<Log>> for TransactionReceipt

Source§

fn as_ref(&self) -> &ReceiptEnvelope<Log>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone> Clone for TransactionReceipt<T>

Source§

fn clone(&self) -> TransactionReceipt<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for TransactionReceipt<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for TransactionReceipt<T>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<TransactionReceipt> for TransactionReceipt<ReceiptEnvelope<Log>>

Source§

fn from(value: TransactionReceipt) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq> PartialEq for TransactionReceipt<T>

Source§

fn eq(&self, other: &TransactionReceipt<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: TxReceipt<Log = Log>> ReceiptResponse for TransactionReceipt<T>

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. Read more
Source§

fn block_hash(&self) -> Option<BlockHash>

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) -> TxHash

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.
Source§

fn cumulative_gas_used(&self) -> u64

Returns the cumulative gas used at this receipt.
Source§

fn state_root(&self) -> Option<B256>

The post-transaction state root (pre Byzantium) Read more
Source§

impl<T> Serialize for TransactionReceipt<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Eq> Eq for TransactionReceipt<T>

Source§

impl<T> StructuralPartialEq for TransactionReceipt<T>

Auto Trait Implementations§

§

impl<T> Freeze for TransactionReceipt<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TransactionReceipt<T>
where T: RefUnwindSafe,

§

impl<T> Send for TransactionReceipt<T>
where T: Send,

§

impl<T> Sync for TransactionReceipt<T>
where T: Sync,

§

impl<T> Unpin for TransactionReceipt<T>
where T: Unpin,

§

impl<T> UnwindSafe for TransactionReceipt<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,