Skip to content

Event processor library useful for processing MultiversX logs&events

Notifications You must be signed in to change notification settings

multiversx/mx-sdk-event-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8d98873 · Jan 31, 2025

History

13 Commits
Jan 31, 2025
Nov 14, 2024
Oct 23, 2024
Oct 23, 2024
Sep 24, 2024
Sep 23, 2024
Oct 23, 2024
Jan 30, 2025
Jan 30, 2025
Sep 23, 2024

Repository files navigation

Event Processor for JavaScript

Event processor for JavaScript and TypeScript (written in TypeScript).

Distribution

npm

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