/** * Web3 Price Oracle Service - 100% Decentralized * * Uses on-chain Chainlink price feeds for truly decentralized pricing * No external APIs, no centralized services */ export interface PriceData { currency: string; price: number; lastUpdated: number; source: 'chainlink' | 'dex' | 'cache'; } export interface PriceServiceConfig { rpcUrl?: string; cacheTTL?: number; autoUpdate?: boolean; updateInterval?: number; customPriceFeeds?: Record; } /** * 100% Decentralized Price Service using Chainlink Oracles */ export declare class Web3PriceService { private cache; private config; private provider; private updateTimer; private static readonly STORAGE_KEY; private static readonly DEFAULT_CACHE_TTL; private static readonly DEFAULT_UPDATE_INTERVAL; /** * Chainlink Price Feeds on Moonbeam * https://docs.chain.link/data-feeds/price-feeds/addresses */ private static readonly MOONBEAM_PRICE_FEEDS; constructor(config?: PriceServiceConfig); /** * Initialize Web3 provider */ private initializeProvider; /** * Get price feed address for a currency */ private getPriceFeedAddress; /** * Fetch price from Chainlink oracle (100% on-chain) */ fetchPriceFromChainlink(currency: string): Promise; /** * Fetch DOT price (the native token) */ fetchDOTPrice(vsCurrency?: string): Promise; /** * Update all cached prices from chain */ updatePrices(): Promise>; /** * Get price for a currency (from cache or fetch) */ getPrice(currency: string): Promise; /** * Get price data with metadata */ getPriceData(currency: string): PriceData | null; /** * Convert fiat amount to DOT */ convertFiatToDOT(amount: number, fiatCurrency: string): Promise; /** * Convert DOT amount to fiat */ convertDOTToFiat(dotAmount: string, fiatCurrency: string): Promise; /** * Check if price is stale */ isPriceStale(currency: string): boolean; /** * Check if prices are cached */ hasCachedPrices(): boolean; /** * Get all cached prices */ getAllPrices(): Map; /** * Get last update time */ getLastUpdateTime(): number; /** * Clear price cache */ clearCache(): void; /** * Start auto-updating prices */ private startAutoUpdate; /** * Stop auto-updating prices */ private stopAutoUpdate; /** * Load cache from localStorage */ private loadCacheFromStorage; /** * Save cache to localStorage */ private saveCacheToStorage; /** * Cleanup and destroy service */ destroy(): void; } /** * Utility: Format DOT amount for display */ export declare function formatDOTAmount(amount: string, decimals?: number): string; /** * Utility: Validate DOT amount */ export declare function validateDOTAmount(amount: string): boolean; /** * Utility: Validate fiat amount */ export declare function validateFiatAmount(amount: number, currency: string): boolean; //# sourceMappingURL=price.service.web3.d.ts.map