A Log in Ethereum represents an event that has been included in a transaction using the LOG* opcodes, which are most commonly used by Solidity’s emit for announcing events.

Extended by

Implements

Properties

PropertyModifierTypeDescription
addressreadonlystringThe address of the contract that emitted this log.
blockHashreadonlystringThe block hash of the block this log occurred in. Use the Log.getBlock to get the
Block.
blockNumberreadonlynumberThe block number of the block this log occurred in. It is preferred to use the Block.hash | Block.hash
when fetching the related Block, since in the case of an orphaned block, the block at that
height may have changed.
datareadonlystringThe data included in this log when it was emitted.
indexreadonlynumberThe index within the block this log occurred at. This is generally not useful to developers, but can be used with
the various roots to proof inclusion within a block.
providerreadonlyProviderThe provider connected to the log used to fetch additional details if necessary.
removedreadonlybooleanIf the Log represents a block that was removed due to an orphaned block, this will be true.

This can only happen within an orphan event listener.
topicsreadonlyreadonly string[]The indexed topics included in this log when it was emitted.

All topics are included in the bloom filters, so they can be efficiently filtered using the
Provider.getLogs method.
transactionHashreadonlystringThe transaction hash of the transaction this log occurred in. Use the
Log.getTransaction to get the
**TransactionResponse.
transactionIndexreadonlynumberThe index within the transaction of this log.

Methods

getBlock()

getBlock(shard): Promise<Block>

Returns the block that this log occurred in.

Parameters

ParameterTypeDescription
shardShardThe shard to fetch the block from.

Returns

Promise<Block>

A promise resolving to the block.

Source

providers/provider.ts:1090


getTransaction()

getTransaction(): Promise<TransactionResponse>

Returns the transaction that this log occurred in.

Returns

Promise<TransactionResponse>

A promise resolving to the transaction.

Source

providers/provider.ts:1101


getTransactionReceipt()

getTransactionReceipt(): Promise<TransactionReceipt>

Returns the transaction receipt fot the transaction that this log occurred in.

Returns

Promise<TransactionReceipt>

A promise resolving to the transaction receipt.

Source

providers/provider.ts:1112


toJSON()

toJSON(): any

Returns a JSON-compatible object.

Returns

any

Source

providers/provider.ts:1066