Skip to main content

Overview

EventLog represents Ethereum event logs emitted by smart contracts. Events are indexed by topic0 (event signature hash) and up to 3 additional indexed parameters. The EventLog primitive provides type-safe construction, filtering, sorting, and RPC conversion.

Type Definition

Constructor Methods

create

Create an EventLog from parameters with branded types.

from

Alias for create. Creates an EventLog from parameters.

fromRpc

Convert RPC log format (hex strings) to EventLog.

Conversion Methods

toRpc

Convert EventLog to RPC format (hex strings).

clone / copy

Create a deep copy of an EventLog.

Accessor Methods

getTopic0 / getSignature

Get the event signature hash (topic0).

getIndexedTopics / getIndexed

Get indexed parameters (topic1-topic3).

isRemoved / wasRemoved

Check if log was removed due to chain reorganization.

Filtering Methods

matchesAddress

Check if log matches an address filter.

matchesTopics

Check if log matches a topic filter. Use null as wildcard.

matchesFilter

Check if log matches a complete filter object.

filterLogs

Filter an array of logs by criteria.

Sorting

sortLogs

Sort logs by block number and log index.

Filter Type

Usage Patterns

Decoding Transfer Events

Filtering by Multiple Addresses

Handling Reorgs