83 lines
2.8 KiB
TypeScript
Vendored
83 lines
2.8 KiB
TypeScript
Vendored
import type { Provider } from 'ethers';
|
|
import type { Logger } from 'winston';
|
|
import { NetIdType, TokenPriceOracle, TornadoFeeOracle, TovarishEventsStatus, TovarishSyncStatus } from '@tornado/core';
|
|
import { RelayerConfig } from '../config';
|
|
import { NodeEchoService, NodeEncryptedNotesService, NodeGovernanceService, NodeRegistryService, NodeRevenueService, NodeMultiTornadoService } from './events';
|
|
import { ErrorTypes, ErrorMessages } from './error';
|
|
export interface Services {
|
|
provider: Provider;
|
|
tokenPriceOracle: TokenPriceOracle;
|
|
tornadoFeeOracle: TornadoFeeOracle;
|
|
governanceService?: NodeGovernanceService;
|
|
registryService?: NodeRegistryService;
|
|
revenueService?: NodeRevenueService;
|
|
echoService: NodeEchoService;
|
|
encryptedNotesService: NodeEncryptedNotesService;
|
|
tornadoServices: NodeMultiTornadoService;
|
|
}
|
|
export interface CachedServices {
|
|
[index: NetIdType]: Services;
|
|
}
|
|
export interface CachedEventsStatus {
|
|
[index: NetIdType]: TovarishEventsStatus;
|
|
}
|
|
export interface TokenPrices {
|
|
[index: string]: bigint;
|
|
}
|
|
export interface TokenPricesString {
|
|
[index: string]: string;
|
|
}
|
|
export interface CachedPrices {
|
|
[index: NetIdType]: TokenPrices;
|
|
}
|
|
export interface CachedPricesString {
|
|
[index: NetIdType]: TokenPricesString;
|
|
}
|
|
export interface GasPrices {
|
|
gasPrice: string;
|
|
l1Fee?: string;
|
|
}
|
|
export interface CachedGasPrices {
|
|
[index: NetIdType]: GasPrices;
|
|
}
|
|
export interface LatestBlocks {
|
|
[index: NetIdType]: number;
|
|
}
|
|
export interface LatestBalances {
|
|
[index: NetIdType]: string;
|
|
}
|
|
export interface CachedSyncStatus {
|
|
[index: NetIdType]: TovarishSyncStatus;
|
|
}
|
|
export declare function syncGasPrice(syncManager: SyncManager, netId: NetIdType): Promise<void>;
|
|
export declare function syncPrices(syncManager: SyncManager, netId: NetIdType): Promise<void>;
|
|
export declare function syncNetworkEvents(syncManager: SyncManager, netId: NetIdType): Promise<void>;
|
|
export interface SyncManagerStatus {
|
|
cachedEvents: CachedEventsStatus;
|
|
cachedPrices: CachedPricesString;
|
|
cachedGasPrices: CachedGasPrices;
|
|
syncStatus: CachedSyncStatus;
|
|
latestBlocks: LatestBlocks;
|
|
latestBalances: LatestBalances;
|
|
errors: ErrorTypes[];
|
|
onSyncEvents: boolean;
|
|
}
|
|
export declare class SyncManager {
|
|
relayerConfig: RelayerConfig;
|
|
logger: Logger;
|
|
cachedServices: CachedServices;
|
|
cachedEvents: CachedEventsStatus;
|
|
cachedPrices: CachedPrices;
|
|
cachedGasPrices: CachedGasPrices;
|
|
syncStatus: CachedSyncStatus;
|
|
latestBlocks: LatestBlocks;
|
|
latestBalances: LatestBalances;
|
|
errors: ErrorMessages[];
|
|
onSyncEvents: boolean;
|
|
constructor(relayerConfig: RelayerConfig);
|
|
getStatus(): SyncManagerStatus;
|
|
getPrice(netId: NetIdType, token: string): bigint;
|
|
getGasPrice(netId: NetIdType): GasPrices;
|
|
syncEvents(): Promise<void>;
|
|
}
|