import type { HexString, UnixTimestamp } from "@pythnetwork/hermes-client"; import type { Logger } from "pino"; import type { PricePusherMetrics } from "./metrics.js"; import type { DurationInSeconds } from "./utils.js"; export type PriceItem = { id: HexString; alias: string; }; export type PriceInfo = { price: string; conf: string; publishTime: UnixTimestamp; }; export type IPriceListener = { start(): Promise; getLatestPriceInfo(priceId: string): PriceInfo | undefined; }; export declare abstract class ChainPriceListener implements IPriceListener { private pollingFrequency; protected priceItems: PriceItem[]; private latestPriceInfo; protected priceIdToAlias: Map; constructor(pollingFrequency: DurationInSeconds, priceItems: PriceItem[]); start(): Promise; private pollPrices; protected updateLatestPriceInfo(priceId: HexString, observedPrice: PriceInfo): void; getLatestPriceInfo(priceId: string): PriceInfo | undefined; abstract getOnChainPriceInfo(priceId: HexString): Promise; } export type IPricePusher = { updatePriceFeed(priceIds: string[], pubTimesToPush: UnixTimestamp[]): Promise; }; /** * Common configuration properties for all balance trackers */ export type BaseBalanceTrackerConfig = { /** Address of the wallet to track */ address: string; /** Name/ID of the network/chain */ network: string; /** How often to update the balance */ updateInterval: DurationInSeconds; /** Metrics instance to report balance updates */ metrics: PricePusherMetrics; /** Logger instance */ logger: Logger; }; /** * Interface for all balance trackers to implement * Each chain will have its own implementation of this interface */ export type IBalanceTracker = { /** * Start tracking the wallet balance */ start(): Promise; /** * Stop tracking the wallet balance */ stop(): void; }; /** * Abstract base class that implements common functionality for all balance trackers */ export declare abstract class BaseBalanceTracker implements IBalanceTracker { protected address: string; protected network: string; protected updateInterval: DurationInSeconds; protected metrics: PricePusherMetrics; protected logger: Logger; protected isRunning: boolean; constructor(config: BaseBalanceTrackerConfig); start(): Promise; private startUpdateLoop; /** * Chain-specific balance update implementation * Each chain will implement this method differently */ protected abstract updateBalance(): Promise; stop(): void; }