tovarish-relayer/lib/services/events.d.ts
2024-11-13 01:42:13 +00:00

145 lines
6.6 KiB
TypeScript
Vendored

import { BaseTornadoService, BaseEncryptedNotesService, BaseGovernanceService, BaseRegistryService, BaseTornadoServiceConstructor, BaseEncryptedNotesServiceConstructor, BaseGovernanceServiceConstructor, BaseRegistryServiceConstructor, BaseEchoServiceConstructor, BaseEchoService, CachedRelayers, BatchEventsService, BaseEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, AllGovernanceEvents, EchoEvents, BatchEventServiceConstructor, BatchEventOnProgress, NetIdType, AllRelayerRegistryEvents, BaseRevenueService, BaseRevenueServiceConstructor, StakeBurnedEvents } from '@tornado/core';
import type { Logger } from 'winston';
import { TreeCache } from './treeCache';
export interface NodeEventsConstructor extends BatchEventServiceConstructor {
netId: NetIdType;
logger: Logger;
getInstanceName: () => string;
}
export declare class NodeEventsService extends BatchEventsService {
netId: NetIdType;
logger: Logger;
getInstanceName: () => string;
constructor(serviceConstructor: NodeEventsConstructor);
}
export interface NodeTornadoServiceConstructor extends BaseTornadoServiceConstructor {
cacheDirectory: string;
userDirectory: string;
nativeCurrency: string;
logger: Logger;
treeCache?: TreeCache;
}
export declare class NodeTornadoService extends BaseTornadoService {
cacheDirectory: string;
userDirectory: string;
nativeCurrency: string;
logger: Logger;
treeCache?: TreeCache;
constructor(serviceConstructor: NodeTornadoServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<DepositsEvents | WithdrawalsEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<DepositsEvents | WithdrawalsEvents>>;
validateEvents<S>({ events, lastBlock, hasNewEvents, }: BaseEvents<DepositsEvents | WithdrawalsEvents> & {
hasNewEvents?: boolean;
}): Promise<S>;
saveEvents({ events, lastBlock }: BaseEvents<DepositsEvents | WithdrawalsEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: (DepositsEvents | WithdrawalsEvents)[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
}
export interface NodeEchoServiceConstructor extends BaseEchoServiceConstructor {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
}
export declare class NodeEchoService extends BaseEchoService {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
constructor(serviceConstructor: NodeEchoServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<EchoEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<EchoEvents>>;
saveEvents({ events, lastBlock }: BaseEvents<EchoEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: EchoEvents[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
}
export interface NodeEncryptedNotesServiceConstructor extends BaseEncryptedNotesServiceConstructor {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
}
export declare class NodeEncryptedNotesService extends BaseEncryptedNotesService {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
constructor(serviceConstructor: NodeEncryptedNotesServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<EncryptedNotesEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<EncryptedNotesEvents>>;
saveEvents({ events, lastBlock }: BaseEvents<EncryptedNotesEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: EncryptedNotesEvents[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
}
export interface NodeGovernanceServiceConstructor extends BaseGovernanceServiceConstructor {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
}
export declare class NodeGovernanceService extends BaseGovernanceService {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
constructor(serviceConstructor: NodeGovernanceServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<AllGovernanceEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<AllGovernanceEvents>>;
saveEvents({ events, lastBlock }: BaseEvents<AllGovernanceEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: AllGovernanceEvents[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
}
export interface NodeRegistryServiceConstructor extends BaseRegistryServiceConstructor {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
}
export declare class NodeRegistryService extends BaseRegistryService {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
constructor(serviceConstructor: NodeRegistryServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<AllRelayerRegistryEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<AllRelayerRegistryEvents>>;
saveEvents({ events, lastBlock }: BaseEvents<AllRelayerRegistryEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: AllRelayerRegistryEvents[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
getRelayersFromDB(): Promise<CachedRelayers>;
getRelayersFromCache(): Promise<CachedRelayers>;
saveRelayers({ lastBlock, timestamp, relayers }: CachedRelayers): Promise<void>;
}
export interface NodeRevenueServiceConstructor extends BaseRevenueServiceConstructor {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
}
export declare class NodeRevenueService extends BaseRevenueService {
cacheDirectory: string;
userDirectory: string;
logger: Logger;
constructor(serviceConstructor: NodeRevenueServiceConstructor);
updateEventProgress({ fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
getEventsFromDB(): Promise<BaseEvents<StakeBurnedEvents>>;
getEventsFromCache(): Promise<import("@tornado/core").CachedEvents<StakeBurnedEvents>>;
saveEvents({ events, lastBlock }: BaseEvents<StakeBurnedEvents>): Promise<void>;
updateEvents<S>(): Promise<{
events: StakeBurnedEvents[];
lastBlock: number;
validateResult: Awaited<S>;
}>;
}