Providers
Log
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
Property | Modifier | Type | Description |
---|---|---|---|
address | readonly | string | The address of the contract that emitted this log. |
blockHash | readonly | string | The block hash of the block this log occurred in. Use the Log.getBlock to get the Block. |
blockNumber | readonly | number | The 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. |
data | readonly | string | The data included in this log when it was emitted. |
index | readonly | number | The 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. |
provider | readonly | Provider | The provider connected to the log used to fetch additional details if necessary. |
removed | readonly | boolean | If 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. |
topics | readonly | readonly 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. |
transactionHash | readonly | string | The transaction hash of the transaction this log occurred in. Use the Log.getTransaction to get the **TransactionResponse. |
transactionIndex | readonly | number | The index within the transaction of this log. |
Methods
getBlock()
Returns the block that this log occurred in.
Parameters
Parameter | Type | Description |
---|---|---|
shard | Shard | The shard to fetch the block from. |
Returns
Promise
<Block
>
A promise resolving to the block.
Source
getTransaction()
Returns the transaction that this log occurred in.
Returns
Promise
<TransactionResponse
>
A promise resolving to the transaction.
Source
getTransactionReceipt()
Returns the transaction receipt fot the transaction that this log occurred in.
Returns
Promise
<TransactionReceipt
>
A promise resolving to the transaction receipt.
Source
toJSON()
Returns a JSON-compatible object.
Returns
any
Source
Was this page helpful?