pub struct Log<T = LogData> {
pub inner: Log<T>,
pub block_hash: Option<BlockHash>,
pub block_number: Option<u64>,
pub block_timestamp: Option<u64>,
pub transaction_hash: Option<TxHash>,
pub transaction_index: Option<u64>,
pub log_index: Option<u64>,
pub removed: bool,
}
Expand description
Ethereum Log emitted by a transaction
Fields§
§inner: Log<T>
Consensus log object
block_hash: Option<BlockHash>
Hash of the block the transaction that emitted this log was mined in
block_number: Option<u64>
Number of the block the transaction that emitted this log was mined in
block_timestamp: Option<u64>
The timestamp of the block as proposed in: https://ethereum-magicians.org/t/proposal-for-adding-blocktimestamp-to-logs-object-returned-by-eth-getlogs-and-related-requests https://github.com/ethereum/execution-apis/issues/295
transaction_hash: Option<TxHash>
Transaction Hash
transaction_index: Option<u64>
Index of the Transaction in the block
log_index: Option<u64>
Log Index in Block
removed: bool
Geth Compatibility Field: whether this log was removed
Implementations§
Source§impl<T> Log<T>
impl<T> Log<T>
Sourcepub const fn address(&self) -> Address
pub const fn address(&self) -> Address
Getter for the address field. Shortcut for log.inner.address
.
Sourcepub fn into_inner(self) -> Log<T>
pub fn into_inner(self) -> Log<T>
Consumes the type and returns the wrapped alloy_primitives::Log
Source§impl Log<LogData>
impl Log<LogData>
Sourcepub fn topics_mut(&mut self) -> &mut [B256]
pub fn topics_mut(&mut self) -> &mut [B256]
Get the topic list, mutably. This gives access to the internal
array, without allowing extension of that array. Shortcut for
LogData::topics_mut
Sourcepub fn log_decode<T: SolEvent>(&self) -> Result<Log<T>>
pub fn log_decode<T: SolEvent>(&self) -> Result<Log<T>>
Decode the log data into a typed log.
Sourcepub fn log_decode_validate<T: SolEvent>(&self) -> Result<Log<T>>
pub fn log_decode_validate<T: SolEvent>(&self) -> Result<Log<T>>
Decode the log data with validation into a typed log.
Sourcepub fn collect_for_receipt<I, T>(
previous_log_count: usize,
meta: TransactionMeta,
logs: I,
) -> Vec<Log<T>>where
I: IntoIterator<Item = Log<T>>,
pub fn collect_for_receipt<I, T>(
previous_log_count: usize,
meta: TransactionMeta,
logs: I,
) -> Vec<Log<T>>where
I: IntoIterator<Item = Log<T>>,
Creates a collection of RPC logs from transaction receipt logs.
This function takes raw consensus logs and enriches them with RPC metadata needed for API responses, including block information and proper indexing.
§Arguments
previous_log_count
- The total number of logs from previous transactions in the same block. Used to calculate the correctlog_index
for each log.meta
- Transaction metadata containing block hash, number, timestamp, and transaction information needed to populate the RPC log fields.logs
- An iterator of consensus logs to be converted into RPC logs.
§Returns
A vector of RPC logs with all metadata fields populated, ready to be included in the transaction receipt.
Source§impl<T> Log<T>
impl<T> Log<T>
Sourcepub fn reserialize_inner(&self) -> Log
pub fn reserialize_inner(&self) -> Log
Reserialize the inner data, returning an alloy_primitives::Log
.
Sourcepub fn reserialize(&self) -> Log<LogData>
pub fn reserialize(&self) -> Log<LogData>
Reserialize the data, returning a new Log
object wrapping an
alloy_primitives::Log
. this copies the log metadata, preserving
the original object.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Log<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Log<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>,
impl<T: Eq> Eq for Log<T>
impl<T> StructuralPartialEq for Log<T>
Auto Trait Implementations§
impl<T> Freeze for Log<T>where
T: Freeze,
impl<T> RefUnwindSafe for Log<T>where
T: RefUnwindSafe,
impl<T> Send for Log<T>where
T: Send,
impl<T> Sync for Log<T>where
T: Sync,
impl<T> Unpin for Log<T>where
T: Unpin,
impl<T> UnwindSafe for Log<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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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 more