/** * Provider registry. * * Single source of truth for which Fetcher implementation a given standard * query should route to. One named slot per data kind — plus a keyed map * for `price` so we can route per asset class (crypto → CoinGecko free tier, * fx/commodity/stock → BlockRun Gateway / Pyth) without the call sites * knowing which provider is active. * * Design note: this is intentionally not a dependency-injection framework. * Tests that need to stub a provider should call `setProvider*()` before * acting and reset with `resetProviders()` in a teardown. No magic. */ import type { Fetcher } from './fetcher.js'; import type { AssetClass, MarketCoinData, MarketOverviewQueryParams, OHLCVData, OHLCVQueryParams, PriceData, PriceQueryParams, TrendingCoinData, TrendingQueryParams } from './standard-models.js'; export type PriceFetcher = Fetcher; export interface TradingProviders { /** Per-asset-class price fetcher. `getPriceProvider(assetClass)` reads this. */ price: Record; ohlcv: Fetcher; trending: Fetcher; markets: Fetcher; } /** Read the active fetcher for a singleton data kind (not price). */ export declare function getProvider>(kind: K): TradingProviders[K]; /** Read the active price fetcher for a given asset class. Defaults to crypto. */ export declare function getPriceProvider(assetClass?: AssetClass): PriceFetcher; /** Replace one singleton fetcher. */ export declare function setProvider>(kind: K, fetcher: TradingProviders[K]): void; /** Replace one asset-class price fetcher. */ export declare function setPriceProvider(assetClass: AssetClass, fetcher: PriceFetcher): void; /** Restore the default wiring — primarily for test isolation. */ export declare function resetProviders(): void; /** * Describe the active wiring for introspection (Panel Markets page, debug). * Returns a per-asset-class listing plus the singleton kinds. */ export interface ProviderWiringRow { kind: string; assetClass?: AssetClass; provider: string; endpoint: string; paid: boolean; } export declare function describeWiring(): ProviderWiringRow[];