import { Logger } from 'pino'; import { IRegistry } from '@hyperlane-xyz/registry'; import { type MultiProtocolProvider, type MultiProvider } from '@hyperlane-xyz/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; import { RebalancerConfig } from '../config/RebalancerConfig.js'; import type { IActionTracker } from '../tracking/IActionTracker.js'; export interface RebalancerServiceConfig { /** Execution mode: 'manual' for one-off execution, 'daemon' for continuous monitoring */ mode: 'manual' | 'daemon'; /** Frequency to check balances in milliseconds (daemon mode only) */ checkFrequency?: number; /** Enable monitor-only mode (no transactions executed) */ monitorOnly?: boolean; /** Enable Prometheus metrics collection */ withMetrics?: boolean; /** CoinGecko API key for token price fetching (required for metrics) */ coingeckoApiKey?: string; /** Logger instance */ logger: Logger; /** Service version for logging */ version?: string; /** * Optional pre-configured ActionTracker. * If provided, skips ActionTracker creation and uses this directly. * Useful for simulation/testing where tracking is mocked externally. */ actionTracker?: IActionTracker; } export interface ManualRebalanceRequest { origin: string; destination: string; amount: string; } /** * RebalancerService is the main orchestrator for the Hyperlane Warp Route Rebalancer. * It supports both manual one-off rebalances and continuous daemon mode. * * @example Manual execution * ```typescript * const service = new RebalancerService( * multiProvider, * multiProtocolProvider, * registry, * rebalancerConfig, * { * mode: 'manual', * logger: console, * } * ); * await service.executeManual({ * origin: 'ethereum', * destination: 'arbitrum', * amount: '1000', * }); * ``` * * @example Daemon mode * ```typescript * const service = new RebalancerService( * multiProvider, * multiProtocolProvider, * registry, * rebalancerConfig, * { * mode: 'daemon', * checkFrequency: 60_000, * withMetrics: true, * coingeckoApiKey: process.env.COINGECKO_API_KEY, * logger: console, * } * ); * await service.start(); * ``` */ export declare class RebalancerService { private readonly multiProvider; private readonly multiProtocolProvider; private readonly registry; private readonly rebalancerConfig; private readonly config; private readonly inventorySignerKeysByProtocol?; private isExiting; private logger; private contextFactory?; private monitor?; private strategy?; private rebalancer?; private metrics?; private mode; private actionTracker?; private inflightContextAdapter?; private orchestrator?; constructor(multiProvider: MultiProvider, multiProtocolProvider: MultiProtocolProvider | undefined, registry: IRegistry, rebalancerConfig: RebalancerConfig, config: RebalancerServiceConfig, inventorySignerKeysByProtocol?: Partial> | undefined); /** * Initialize the service components */ private initialize; /** * Execute a manual one-off rebalance */ executeManual(request: ManualRebalanceRequest): Promise; /** * Start the rebalancer in daemon mode (continuous monitoring) */ start(): Promise; /** * Stop the rebalancer daemon */ stop(): Promise; /** * Gracefully shutdown the service */ gracefulShutdown(): Promise; /** * Handle token info events from monitor by delegating to orchestrator */ private onTokenInfo; /** * Event handler for monitor errors */ private onMonitorError; /** * Event handler for monitor start */ private onMonitorStart; } //# sourceMappingURL=RebalancerService.d.ts.map