/** * allratestoday — lightweight currency exchange rates library. * * Fetches real-time mid-market rates from the AllRatesToday API * (Refinitiv / Reuters / interbank feeds, 160+ currencies). * * Basic usage: * import { rate } from "allratestoday"; * const r = await rate("USD", "INR"); * // { date: "2026-04-20", base: "USD", target: "INR", rate: 83.2145 } */ interface RateResult { date: string; base: string; target: string; rate: number; } interface RateOptions { /** API key. Falls back to process.env.ALLRATESTODAY_API_KEY. */ apiKey?: string; /** Override the base URL (for staging / self-hosted proxies). */ baseUrl?: string; /** Custom fetch implementation (for older runtimes / testing). */ fetch?: typeof fetch; /** Request timeout in milliseconds (default 15000). */ timeoutMs?: number; } declare class AllRatesTodayError extends Error { status?: number; constructor(message: string, status?: number); } /** * Fetch the current mid-market exchange rate for a single pair. * * @example * const r = await rate("USD", "INR"); * // { date: "2026-04-20", base: "USD", target: "INR", rate: 83.2145 } */ declare function rate(base: string, target: string, options?: RateOptions): Promise; /** * Convert an amount from one currency to another using the current rate. * * @example * const out = await convert(100, "USD", "EUR"); * // { from: { currency: "USD", amount: 100 }, to: { currency: "EUR", amount: 92.34 }, rate: 0.9234, date: "..." } */ declare function convert(amount: number, from: string, to: string, options?: RateOptions): Promise<{ from: { currency: string; amount: number; }; to: { currency: string; amount: number; }; rate: number; date: string; }>; declare const _default: { rate: typeof rate; convert: typeof convert; AllRatesTodayError: typeof AllRatesTodayError; }; export { AllRatesTodayError, type RateOptions, type RateResult, convert, _default as default, rate };