ropods-cashify
Version:
Modern, lightweight currency conversion library with real-time exchange rates, INR support, and free API integration. Production-ready TypeScript library for RoPods organization with zero dependencies and comprehensive testing.
52 lines • 1.38 kB
TypeScript
/**
* RoPods Rate Fetcher Service
* Fetches latest exchange rates from multiple sources
*/
export interface RateSource {
name: string;
url: string;
apiKey?: string;
}
export interface ExchangeRates {
base: string;
rates: Record<string, number>;
lastUpdated: string;
source: string;
}
export declare class RoPodsRateFetcher {
private static instance;
private cache;
private cacheTimeout;
private readonly sources;
static getInstance(): RoPodsRateFetcher;
/**
* Get latest exchange rates for RoPods
* @param base Base currency (default: USD)
* @param currencies Array of currencies to fetch
* @returns Promise<ExchangeRates>
*/
getLatestRates(base?: string, currencies?: string[]): Promise<ExchangeRates>;
/**
* Get RoPods specific currency rates (INR, USD focus)
*/
getRoPodsRates(): Promise<ExchangeRates>;
private fetchFromSources;
private fetchFromSource;
private filterRates;
private isCacheValid;
private getFallbackRates;
/**
* Clear cache to force fresh fetch
*/
clearCache(): void;
/**
* Get cache status
*/
getCacheInfo(): Array<{
key: string;
lastUpdated: string;
source: string;
}>;
}
export declare const ropodsRateFetcher: RoPodsRateFetcher;
//# sourceMappingURL=rate-fetcher.d.ts.map