tornado-core/dist/tovarishClient.d.ts

84 lines
2.6 KiB
TypeScript
Raw Normal View History

2024-09-29 14:24:36 +03:00
import { RelayerClient, RelayerClientConstructor, RelayerError, RelayerInfo, RelayerStatus } from './relayerClient';
import { CachedRelayerInfo, MinimalEvents } from './events';
export declare const MAX_TOVARISH_EVENTS = 5000;
export interface EventsStatus {
events: number;
lastBlock: number;
}
export interface InstanceEventsStatus {
[index: string]: {
deposits: EventsStatus;
withdrawals: EventsStatus;
};
}
export interface CurrencyEventsStatus {
[index: string]: InstanceEventsStatus;
}
export interface TovarishEventsStatus {
governance?: EventsStatus;
registered?: {
lastBlock: number;
timestamp: number;
relayers: number;
};
echo: EventsStatus;
encrypted_notes: EventsStatus;
instances: CurrencyEventsStatus;
}
export interface TovarishSyncStatus {
events: boolean;
tokenPrice: boolean;
gasPrice: boolean;
}
export interface TovarishStatus extends RelayerStatus {
2024-09-30 09:22:40 +03:00
latestBalance: string;
2024-09-29 14:24:36 +03:00
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;
onSyncEvents: boolean;
}
export interface TovarishInfo extends RelayerInfo {
latestBlock: number;
2024-09-30 09:22:40 +03:00
latestBalance: string;
2024-09-29 14:24:36 +03:00
version: string;
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;
}
export interface TovarishEventsQuery {
type: string;
currency?: string;
amount?: string;
fromBlock: number;
recent?: boolean;
}
export interface BaseTovarishEvents<T> {
events: T[];
lastSyncBlock: number;
}
export declare class TovarishClient extends RelayerClient {
selectedRelayer?: TovarishInfo;
2024-10-16 18:19:31 +03:00
constructor(clientConstructor: RelayerClientConstructor);
2024-09-29 14:24:36 +03:00
askRelayerStatus({ hostname, url, relayerAddress, }: {
hostname?: string;
url?: string;
relayerAddress?: string;
}): Promise<TovarishStatus>;
2024-10-16 17:19:49 +03:00
/**
* Ask status for all enabled chains for tovarish relayer
*/
askAllStatus({ hostname, url, relayerAddress, }: {
hostname?: string;
url?: string;
relayerAddress?: string;
}): Promise<TovarishStatus[]>;
2024-09-29 14:24:36 +03:00
filterRelayer(relayer: CachedRelayerInfo): Promise<TovarishInfo | RelayerError | undefined>;
getValidRelayers(relayers: CachedRelayerInfo[]): Promise<{
validRelayers: TovarishInfo[];
invalidRelayers: RelayerError[];
}>;
2024-10-16 17:19:49 +03:00
getTovarishRelayers(relayers: CachedRelayerInfo[]): Promise<{
validRelayers: TovarishInfo[];
invalidRelayers: RelayerError[];
}>;
2024-09-29 14:24:36 +03:00
getEvents<T extends MinimalEvents>({ type, currency, amount, fromBlock, recent, }: TovarishEventsQuery): Promise<BaseTovarishEvents<T>>;
}