/** * Client-Side Price Oracle Service * * Fetches cryptocurrency prices directly from browser * Supports CoinGecko API and can be extended to Chainlink oracles */ export interface PriceData { currency: string; price: number; lastUpdated: number; } export interface PriceServiceConfig { coingeckoApiKey?: string; cacheTTL?: number; autoUpdate?: boolean; updateInterval?: number; } export declare class PriceService { private cache; private config; private updateTimer; private static readonly STORAGE_KEY; private static readonly DEFAULT_CACHE_TTL; private static readonly DEFAULT_UPDATE_INTERVAL; constructor(config?: PriceServiceConfig); /** * Fetch prices from CoinGecko API */ fetchPricesFromCoinGecko(coinId?: string, currencies?: string[]): Promise>; /** * Get price for a specific currency */ getPrice(currency: string): number | null; /** * Get price data with metadata */ getPriceData(currency: string): PriceData | null; /** * Convert fiat to DOT */ convertFiatToDOT(amount: number, fiatCurrency: string): string; /** * Convert DOT to fiat */ convertDOTToFiat(dotAmount: string, fiatCurrency: string): number; /** * Check if price is stale */ isPriceStale(currency: string): boolean; /** * Check if any cached prices exist */ hasCachedPrices(): boolean; /** * Get all cached prices */ getAllPrices(): Map; /** * Get last update timestamp */ getLastUpdateTime(): number; /** * Manually update prices */ updatePrices(coinId?: string, currencies?: string[]): Promise>; /** * Start automatic price updates */ startAutoUpdate(): void; /** * Stop automatic price updates */ stopAutoUpdate(): void; /** * Clear price cache */ clearCache(): void; /** * Save cache to localStorage for persistence across page reloads */ private saveCacheToStorage; /** * Load cache from localStorage */ private loadCacheFromStorage; /** * Remove cache from localStorage */ private removeCacheFromStorage; /** * Cleanup on destroy */ destroy(): void; } /** * Format DOT amount for display */ export declare function formatDOTAmount(amount: string, decimals?: number): string; /** * Validate DOT amount */ export declare function validateDOTAmount(amount: string): boolean; /** * Validate fiat amount */ export declare function validateFiatAmount(amount: number, currency: string): boolean; //# sourceMappingURL=price.service.d.ts.map