import { IPriceOracle, PriceSourceConfig } from "../interfaces/chunks/price-oracle.i"; export declare class PriceOracleModule implements IPriceOracle { private sources; /** * The locked production set. Every signed-price flow uses exactly these three * providers. The set was narrowed from five to three (dropping Binance and * Coinbase) after Binance returned HTTP 451 from the Lit TEE egress IP — the * two exchange APIs geofence/restrict in ways the global-egress data APIs do * not. Each provider here MUST be invoked with an API key (per-key rate * limiting + revokability + tenant attribution). * * Adding to this list re-opens the 2-of-3-consensus manipulation path flagged * in audit H-2 — do not extend without an explicit design review. */ private static readonly ACTIVE_PROVIDER_NAMES; /** * Number of DISTINCT providers required for a price signature. Strict 3-of-3 * — not "at least 3"; not "3 of N." Callers MUST pass exactly three entries * from {@link PriceOracleModule.ACTIVE_PROVIDER_NAMES}. Names are deduplicated * before the count is checked, so three CoinGecko entries still count as one. */ private static readonly REQUIRED_PROVIDER_COUNT; /** * Hardhat-only single-provider mode. When true the oracle requires exactly ONE * plaintext provider instead of the locked 3-of-3 encrypted set. Set ONLY by a * validator that has already verified `chain-policy.allowDevSinglePriceProvider` * (true only for hardhat). It NEVER relaxes consensus on sepolia/mainnet, and a * price signed under it is bound to the hardhat chainId domain (unusable elsewhere). */ private readonly devSingleProvider; /** Distinct providers required for the active mode: 1 in hardhat dev, else 3. */ private requiredCount; /** * @param priceProvidersOrConfig - REQUIRED in production flows. An array of * exactly 3 `{name, apiKey}` entries, one per locked provider. Every entry * needs an apiKey. Names are deduplicated so three entries with * `name: "coingecko"` collapse to a single provider — which then fails the * strict count check. * @param legacySources - Test-only back door. When supplied, the constructor * trusts the caller-supplied array verbatim and skips credential checks. * The strict count is still enforced (exactly 3). * @param _mode - Ignored. Retained for backward-compatible call sites. */ constructor(priceProvidersOrConfig?: Array<{ name: string; apiKey?: string; apiSecret?: string; }> | any, legacySources?: PriceSourceConfig[], _mode?: "dev" | "prod", opts?: { devSingleProvider?: boolean; }); /** * Enforces strict 3-of-3. Any deviation re-opens the consensus-manipulation * path flagged as H-2 in the audit. There is no "≥3" or "3 of N" mode. */ private validateProviderCount; /** * Build price sources from the caller-supplied config. * * Rules (all unconditional): * - Exactly 3 entries — reject fewer and reject more. * - Every entry must be a supported provider name from the locked set. * - Every entry must carry an `apiKey`. * - Duplicates by `name` are rejected outright. * * Throws as soon as any rule is violated. */ private buildSources; /** * Create CryptoCompare price source * Requires API key for access */ private createCryptoCompareSource; /** * Create shared fetch helper with timeout * LIT runtime rejects custom User-Agent headers */ private createFetchJson; /** * Create CoinGecko price source. * * CoinGecko's public endpoint has no authentication, but we intentionally * require the caller to supply either a Demo (`x-cg-demo-api-key`) or Pro * (`x-cg-pro-api-key`) key. */ private createCoinGeckoSource; private createCoinMarketCapSource; /** * Get BTC price in USD with 8 decimals. * * Strict 3-of-3: queries all sources in parallel; if any one fails, the whole * call fails (no fallback). All three prices must lie within 1% of each other * (`(hi - lo) / lo <= 0.01`). Returns the median of the three. * * This is the only signed-price path in the codebase. The previously-exposed * `getBTCPriceConsensus()` (with outlier filtering + lenient survivor median) * was removed in the H-2 fix. */ getBTCPrice(): Promise; } //# sourceMappingURL=price-oracle.module.d.ts.map