How to use the 0x.js.ExchangeEvents.LogFill function in 0x

To help you get started, we’ve selected a few 0x examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / pipeline / src / scripts / scrape_data.ts View on Github external
.then((data: any) => {
                const parsedEvents: any = {};
                parsedEvents[ExchangeEvents.LogFill] = [];
                parsedEvents[ExchangeEvents.LogCancel] = [];
                parsedEvents[ExchangeEvents.LogError] = [];

                for (const index in data) {
                    for (const datum of data[index]) {
                        const event = typeConverters.convertLogEventToEventObject(datum);
                        parsedEvents[event.event_type].push(event);
                    }
                }

                console.log(fromBlock + " : " + toBlock + " " + parsedEvents[ExchangeEvents.LogFill].length);

                for (const event_type in parsedEvents) {
                    if (parsedEvents[event_type].length > 0) {
                        insertDataScripts
                            .insertMultipleRows(
                                'events_raw',
                                parsedEvents[event_type],
                                Object.keys(parsedEvents[event_type][0]),
                            )
                            .then(() => {
                            })
                            .catch((error: any) => {
                            });
                    }
                }
                cb();
github 0xProject / 0x-monorepo / packages / pipeline / src / scripts / scrape_data.ts View on Github external
return new Promise((resolve, reject) => {
            const getLogsPromises: any[] = [];
            getLogsPromises.push(
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogFill,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogCancel,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogError,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
            );

            Promise.all(getLogsPromises)
github 0xProject / 0x-monorepo / packages / pipeline / src / scripts / scrape-data.ts View on Github external
return new Promise((resolve, reject) => {
            const getLogsPromises: any[] = [];
            getLogsPromises.push(
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogFill,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogCancel,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
                zrx.exchange.getLogsAsync(
                    ExchangeEvents.LogError,
                    { fromBlock: fromBlockNumber, toBlock: toBlockNumber },
                    {},
                ),
            );

            Promise.all(getLogsPromises)
github 0xProject / 0x-monorepo / packages / pipeline / src / scripts / scrape-data.ts View on Github external
.then((data: any) => {
                const parsedEvents: any = {};
                parsedEvents[ExchangeEvents.LogFill] = [];
                parsedEvents[ExchangeEvents.LogCancel] = [];
                parsedEvents[ExchangeEvents.LogError] = [];

                for (const index in data) {
                    for (const datum of data[index]) {
                        const event = typeConverters.convertLogEventToEventObject(datum);
                        parsedEvents[event.event_type].push(event);
                    }
                }

                for (const event_type in parsedEvents) {
                    insertDataScripts.insertMultipleRows('events_raw', parsedEvents[event_type]);
                }
                cb();
            })
            .catch((err: any) => {