Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

event-log-harvester

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-log-harvester - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

dist/fetchAndDecodeLogs.d.ts

@@ -1,3 +0,3 @@

import { Config, EventFiltersRecord, Log, LogDecodedRecord } from './types';
import { BaseLog, Config, EventFiltersRecord, LogDecodedRecord } from './types';
export declare function fetchAndDecodeLogs<T extends EventFiltersRecord, D extends Log>(getLogs: Config<D, T>["getLogs"], eventFiltersRecord: T, fromBlock: number, toBlock: number, failOnDecodeError?: boolean): Promise<LogDecodedRecord<T>>;
export declare function fetchAndDecodeLogs<T extends EventFiltersRecord, D extends BaseLog>(getLogs: Config<T, D>["getLogs"], eventFiltersRecord: T, fromBlock: number, toBlock: number, failOnDecodeError?: boolean): Promise<LogDecodedRecord<T>>;

@@ -1,2 +0,2 @@

import { Config, EventFiltersRecord, Log } from './types';
import { BaseLog, Config, EventFiltersRecord } from './types';

@@ -13,2 +13,2 @@ /**

*/
export declare function fetchAndDecodeLogsWithRetries<T extends EventFiltersRecord, D extends Log>(getLogs: Config<D, T>["getLogs"], eventFiltersRecord: T, fromBlock: number, toBlock: number, maxRetries: number, failOnDecodeError?: boolean): Promise<import('./types').LogDecodedRecord<T>>;
export declare function fetchAndDecodeLogsWithRetries<T extends EventFiltersRecord, D extends BaseLog>(getLogs: Config<T, D>["getLogs"], eventFiltersRecord: T, fromBlock: number, toBlock: number, maxRetries: number, failOnDecodeError?: boolean): Promise<import('./types').LogDecodedRecord<T>>;

@@ -1,2 +0,2 @@

import { Config, EventFiltersRecord, Log, LogDecodedRecord } from './types';
import { BaseLog, Config, EventFiltersRecord, ExtractEventType } from './types';

@@ -8,2 +8,4 @@ /**

*/
export declare function harvestLogs<T extends EventFiltersRecord, D extends Log>(config: Config<D, T>): Promise<LogDecodedRecord<T>>;
export declare function harvestLogs<T extends EventFiltersRecord, D extends BaseLog>(config: Config<T, D>): Promise<{
[K in keyof T]: Array<ExtractEventType<T[K][number]>>;
}>;

@@ -7,3 +7,3 @@ async function F(i, t, r, s, c) {

for (const f in t)
t[f].forEach((h) => {
d[f] = [], t[f].forEach((h) => {
!h.addresses || h.addresses.length === 0 ? k = !0 : h.addresses.forEach((n) => o.add(n)), h.topics.forEach((n) => e.add(n));

@@ -10,0 +10,0 @@ });

@@ -1,2 +0,2 @@

export type Log = {
export type BaseLog = {
blockNumber: number;

@@ -8,4 +8,3 @@ address: string;

};
export type Logs = Array<Log>;
export interface Config<TLog extends Log, T extends Record<string, EventFilter<any>[]>> {
export interface Config<T extends Record<string, EventFilter<any>[]>, TLog extends BaseLog = BaseLog> {
batchSize?: number;

@@ -23,3 +22,3 @@ maxRetries?: number;

}
export interface EventFilter<TValue extends Record<string, unknown> & Log> {
export interface EventFilter<TValue extends Record<string, unknown>> {
addresses?: string[];

@@ -29,3 +28,3 @@ topics: (string | null)[];

toBlock: number;
decodeLog: (log: Log) => Promise<TValue> | TValue;
decodeLog: (log: BaseLog) => Promise<TValue & BaseLog> | (TValue & BaseLog);
callback?: (logs: TValue[], metadata: {

@@ -37,5 +36,6 @@ startBlock: number;

export type EventFiltersRecord = Record<string, EventFilter<any>[]>;
export type LogDecoded<T extends EventFiltersRecord> = Awaited<ReturnType<T[keyof T][number]["decodeLog"]>>;
export type LogDecoded<T extends EventFiltersRecord> = ExtractEventType<T[keyof T][number]>;
export type LogDecodedRecord<T extends EventFiltersRecord> = {
[K in keyof T]: Array<LogDecoded<T>>;
};
export type ExtractEventType<T> = T extends EventFilter<infer TValue> ? TValue & BaseLog : never;
{
"name": "event-log-harvester",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc