Event Processors
Learn about structure of a custom event processor script
Last updated
Was this helpful?
Learn about structure of a custom event processor script
Last updated
Was this helpful?
As defined in each custom event processor has a handler.ts
and an abi.json
. When a custom processor is deployed it listens for all the "event" topics defined in the abi.json, and executes handler.js for every single event.
As mentioned in Getting Started guide, you can see the basic structure of a processor in the repo.
handler.ts
handler.js must export a function named processEvent
processEvent
function will receive 1 argument:
An object that gives you event
that gives you access to the received transaction log and parsed event.
processEvent
function must return either:
true
which means event was processed
false
which means event was skipped for any reason
undefined
which is considered a success
processEvent
has a timeout of 60 seconds (a soft-limit that can be increased if you needed).
The boolean value returned by processEvent
is only used for statistics reasons, so it won't impact your processor logic if anything (or nothing) is returned.
abi.json
This file is used to know which event topics to listen to and parse incoming transaction logs, before they are handed over to your processor handler function above.
Reach out to 🙂
You can import any .ts, .js, and .json file relative your handler.ts processor as long as they are under the same src/ directory. If you need any help 🙂