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: TThe receipt envelope, which contains the consensus receipt data.
transaction_hash: TxHashTransaction 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: u64Gas used by this transaction alone.
effective_gas_price: u128The 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: AddressAddress 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<T> TransactionReceipt<T>
impl<T> TransactionReceipt<T>
Sourcepub fn map_inner<U, F>(self, f: F) -> TransactionReceipt<U>where
F: FnOnce(T) -> U,
pub fn map_inner<U, F>(self, f: F) -> TransactionReceipt<U>where
F: FnOnce(T) -> U,
Maps the inner receipt value of this receipt.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the type and returns the wrapped receipt.
Sourcepub fn calculate_create_address(&self, nonce: u64) -> Option<Address>
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>>
impl<L> TransactionReceipt<ReceiptEnvelope<L>>
Sourcepub fn map_logs<U>(
self,
f: impl FnMut(L) -> U,
) -> TransactionReceipt<ReceiptEnvelope<U>>
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.
Sourcepub fn into_primitives_receipt(self) -> TransactionReceipt<ReceiptEnvelope<Log>>
pub fn into_primitives_receipt(self) -> TransactionReceipt<ReceiptEnvelope<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>
impl<T: TxReceipt> TransactionReceipt<T>
Source§impl<T: TxReceipt<Log: AsRef<Log>>> TransactionReceipt<T>
impl<T: TxReceipt<Log: AsRef<Log>>> TransactionReceipt<T>
Sourcepub fn decoded_log<E: SolEvent>(&self) -> Option<Log<E>>
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.
Sourcepub fn decode_first_log<E: SolEvent>(&self) -> Option<Log<E>>
pub fn decode_first_log<E: SolEvent>(&self) -> Option<Log<E>>
Attempts to decode the first log in the receipt to the provided log type.
Returns None if there are no logs or if decoding fails.
Sourcepub fn decode_nth_log<E: SolEvent>(&self, idx: usize) -> Option<Log<E>>
pub fn decode_nth_log<E: SolEvent>(&self, idx: usize) -> Option<Log<E>>
Decode the log at the given index as the given SolEvent type.
Sourcepub fn decode_last_log<E: SolEvent>(&self) -> Option<Log<E>>
pub fn decode_last_log<E: SolEvent>(&self) -> Option<Log<E>>
Decode the last log in the receipt.
Trait Implementations§
Source§impl AsRef<ReceiptEnvelope<Log>> for TransactionReceipt
impl AsRef<ReceiptEnvelope<Log>> for TransactionReceipt
Source§fn as_ref(&self) -> &ReceiptEnvelope<Log>
fn as_ref(&self) -> &ReceiptEnvelope<Log>
Source§impl<T: Clone> Clone for TransactionReceipt<T>
impl<T: Clone> Clone for TransactionReceipt<T>
Source§fn clone(&self) -> TransactionReceipt<T>
fn clone(&self) -> TransactionReceipt<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for TransactionReceipt<T>
impl<T: Debug> Debug for TransactionReceipt<T>
Source§impl<'de, T> Deserialize<'de> for TransactionReceipt<T>where
T: Deserialize<'de>,
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>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<TransactionReceipt> for TransactionReceipt<ReceiptEnvelope<Log>>
impl From<TransactionReceipt> for TransactionReceipt<ReceiptEnvelope<Log>>
Source§fn from(value: TransactionReceipt) -> Self
fn from(value: TransactionReceipt) -> Self
Source§impl<T: PartialEq> PartialEq for TransactionReceipt<T>
impl<T: PartialEq> PartialEq for TransactionReceipt<T>
Source§impl<T: TxReceipt<Log = Log>> ReceiptResponse for TransactionReceipt<T>
impl<T: TxReceipt<Log = Log>> ReceiptResponse for TransactionReceipt<T>
Source§fn contract_address(&self) -> Option<Address>
fn contract_address(&self) -> Option<Address>
None if the transaction was not a deployment.Source§fn block_hash(&self) -> Option<BlockHash>
fn block_hash(&self) -> Option<BlockHash>
Source§fn block_number(&self) -> Option<u64>
fn block_number(&self) -> Option<u64>
Source§fn transaction_hash(&self) -> TxHash
fn transaction_hash(&self) -> TxHash
Source§fn transaction_index(&self) -> Option<u64>
fn transaction_index(&self) -> Option<u64>
Source§fn effective_gas_price(&self) -> u128
fn effective_gas_price(&self) -> u128
Source§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
Source§fn blob_gas_price(&self) -> Option<u128>
fn blob_gas_price(&self) -> Option<u128>
Source§fn cumulative_gas_used(&self) -> u64
fn cumulative_gas_used(&self) -> u64
Source§impl<T> Serialize for TransactionReceipt<T>where
T: Serialize,
impl<T> Serialize for TransactionReceipt<T>where
T: Serialize,
impl<T: Eq> Eq for TransactionReceipt<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.