Skip to main content

useContractEventListener()

function useContractEventListener<TContract, TEventName>(
contract,
address,
eventName,
listener,
options?): void;

Defined in: packages/react/src/hooks/use-contract-event-listener.ts:22

Hook for listening to contract events.

Type Parameters

Type Parameter
TContract extends Contract
TEventName extends string

Parameters

ParameterTypeDescription
contractTContractThe contract instance to listen to events from
addressAddress | undefinedThe contract address
eventNameTEventNameThe name of the event to listen for
listener(event) => voidCallback function invoked when the event is emitted
options?Partial<ChainOptions<string | number | undefined>>Additional options

Returns

void