@multiversx/sdk-event-processor
v1.0.2
Published
MultiversX logs&events processor
Downloads
77
Readme
Event Processor for JavaScript
Event processor for JavaScript and TypeScript (written in TypeScript).
Distribution
Usage
let lastProcessedTimestamp = 1727858320;
const eventProcessor = new EventProcessor();
await eventProcessor.start({
elasticUrl: 'https://index.multiversx.com',
eventIdentifiers: ['swapTokensFixedInput'],
emitterAddresses: ['erd1qqqqqqqqqqqqqpgqt0uek344kaerr4gf9g2r8l0f4l8ygyha2jps82u9r6'],
pageSize: 1000,
scrollTimeout: "1m",
delayBetweenRequestsInMilliseconds: 100,
getLastProcessedTimestamp: async () => {
return lastProcessedTimestamp;
},
setLastProcessedTimestamp: async (timestamp: number) => {
lastProcessedTimestamp = timestamp;
},
onEventsReceived: async (highestTimestamp, events) => {
console.log(`Received ${events.length} events with the highest timestamp ${highestTimestamp}`);
},
});
Example
The example directory contains an example script that illustrates how to use the event processor.
ts-node example/example.ts