Listens for contract events from the blockchain.
import { watchContractEvents } from "thirdweb";const unwatch = watchContractEvents({ contract: myContract, onEvents: (events) => { // do something with the events },});
import { prepareEvent, watchContractEvents } from "thirdweb";const myEvent = prepareEvent({ event: "event MyEvent(uint256 myArg)",});const events = await watchContractEvents({ contract: myContract, events: [myEvent], onEvents: (events) => { // do something with the events },});
function watchContractEvents(options: { events?: abiEvents; latestBlockNumber?: bigint; onEvents: ( ) => void; strict?: TStrict; useIndexer?: boolean;}): () => void;
The options for retrieving contract events.
let options: { events?: abiEvents; latestBlockNumber?: bigint; onEvents: ( ) => void; strict?: TStrict; useIndexer?: boolean;};