import { Provider } from 'ethers'; /** * Provider health tracking. */ interface ProviderHealth { failureCount: number; lastFailure: number; isHealthy: boolean; } /** * Provider manager configuration. */ export interface ProviderManagerConfig { /** Cooldown period in ms before retrying failed provider (default: 60000) */ failoverCooldown?: number; /** Max failures before marking provider unhealthy (default: 3) */ maxFailures?: number; } /** * RPC provider failover: health tracking and automatic fallback between URLs. */ export declare class ProviderManager { private providers; private health; private readonly config; constructor(config?: ProviderManagerConfig); /** * Add providers for a chain. * * @param chainName - Name of the chain (e.g., "Avalanche", "Fuji") * @param rpcUrls - List of RPC URLs (primary first, fallbacks after) */ addProviders(chainName: string, rpcUrls: string[]): void; /** * Get the first healthy provider for a chain. * Returns null if no healthy providers are available. * * @param chainName - Name of the chain * @returns Provider or null */ getProvider(chainName: string): Provider | null; /** * Get the number of providers for a chain. */ getProviderCount(chainName: string): number; /** * Get the index of a provider for a chain. */ getProviderIndex(chainName: string, provider: Provider): number | null; /** * Mark a provider as failed. * * @param chainName - Name of the chain * @param providerIndex - Index of the provider in the chain's provider list */ markFailure(chainName: string, providerIndex: number): void; /** * Mark a provider as successful (reset failure count). * * @param chainName - Name of the chain * @param providerIndex - Index of the provider */ markSuccess(chainName: string, providerIndex: number): void; /** * Get health status for all providers on a chain (for debugging/monitoring). */ getHealthStatus(chainName: string): ProviderHealth[] | null; /** * Reset all providers for a chain to healthy state. */ resetChain(chainName: string): void; /** * Get list of chain names with registered providers. */ getChainNames(): string[]; } export {}; //# sourceMappingURL=providerManager.d.ts.map