Skip to main content

event

Type Aliases

EventArgs

type EventArgs<T> = T extends TypedEvent<infer _, infer TObj> ? TObj : never;

Defined in: dataEntities/event.ts:10

The type of the event arguments. Gets the second generic arg

Type Parameters

Type Parameter
T

EventFromFilter

type EventFromFilter<TFilter> = TFilter extends TypedEventFilter<infer TEvent> ? TEvent : never;

Defined in: dataEntities/event.ts:18

The event type of a filter Gets the first generic arg

Type Parameters

Type Parameter
TFilter

TypeChainContractFactory

type TypeChainContractFactory<TContract> = object;

Defined in: dataEntities/event.ts:41

Typechain contract factories have additional properties

Type Parameters

Type Parameter
TContract extends Contract

Functions

parseTypedLog()

function parseTypedLog<TContract, TFilterName>(
contractFactory: TypeChainContractFactory<TContract>,
log: Log,
filterName: TFilterName):
| EventArgs<EventFromFilter<ReturnType<TContract["filters"][TFilterName]>>>
| null;

Defined in: dataEntities/event.ts:53

Parse a log that matches a given filter name.

Type Parameters

Type Parameter
TContract extends Contract
TFilterName extends string

Parameters

ParameterTypeDescription
contractFactoryTypeChainContractFactory<TContract>
logLogThe log to parse
filterNameTFilterName

Returns

| EventArgs<EventFromFilter<ReturnType<TContract["filters"][TFilterName]>>> | null

Null if filter name topic does not match log topic


parseTypedLogs()

function parseTypedLogs<TContract, TFilterName>(
contractFactory: TypeChainContractFactory<TContract>,
logs: Log[],
filterName: TFilterName): EventArgs<EventFromFilter<ReturnType<TContract["filters"][TFilterName]>>>[];

Defined in: dataEntities/event.ts:78

Parses an array of logs. Filters out any logs whose topic does not match provided the filter name topic.

Type Parameters

Type Parameter
TContract extends Contract
TFilterName extends string

Parameters

ParameterTypeDescription
contractFactoryTypeChainContractFactory<TContract>
logsLog[]The logs to parse
filterNameTFilterName

Returns

EventArgs<EventFromFilter<ReturnType<TContract["filters"][TFilterName]>>>[]