import { PriceData, GetPriceOptions, RedstoneApiConfig, GetHistoricalPriceOptions, GetHistoricalPriceForSingleTokenOptions } from "./types"; export default class RedstoneApi { private defaultProvider; private useCache; private version; private verifySignature; private arweaveProxy; private cacheProxy; private signatureVerifier; constructor(redstoneConfig?: RedstoneApiConfig); setCacheApiUrl(cacheApiUrl: string): void; /** * Returns the latest price for a single symbol * * @param symbol - Token symbol (string) * @param opts - Optional params (object) * * opts.provider: provider name (string) * * opts.verifySignature: enable signature verification (boolean) * @returns The latest price for the token * */ getPrice(symbol: string, opts?: GetPriceOptions): Promise; /** * Returns the latest price for several symbols * * @param symbols - Token symbols (array of strings) * @param opts - Optional params (object) * * opts.provider: provider name (string) * * opts.verifySignature: enable signature verification (boolean) * @returns The latest price for the tokens * */ getPrice(symbols: string[], opts?: GetPriceOptions): Promise<{ [token: string]: PriceData; }>; /** * Returns the historical price for a single token * * @remarks * Full list of supported tokens is available at * {@link https://github.com/redstone-finance/redstone-api/blob/main/ALL_SUPPORTED_TOKENS.md} * * @param symbol - Token symbol (string) * @param opts - Optional params (object) * * opts.date: Date for the historical price * * opts.provider: provider name (string) * * opts.verifySignature: enable signature verification (boolean) * @returns The historical price for token * */ getHistoricalPrice(symbol: string, opts: GetHistoricalPriceOptions): Promise; /** * Returns the historical prices for a token in a time range with the specified interval * * @remarks * This method can be used to display charts with historical prices. * Full list of supported tokens is available at * {@link https://github.com/redstone-finance/redstone-api/blob/main/ALL_SUPPORTED_TOKENS.md} * * @param symbol - Token symbol * @param opts - Options object. * It must contain either a startDate, an endDate, and interval properties * or an offset and a limit (used for pagination) properties. * * opts.startDate: Start time for the time range (date | timestamp | string) * * opts.endDate: End time for the time range (date | timestamp | string) * * opts.interval: Interval in milliseconds (number) * * opts.provider: provider name (string) * * opts.offset: query offset (number) * * opts.limit: query limit (number) * * opts.verifySignature: enable signature verification (boolean) * @returns The historical prices for the symbol with the passed interval * */ getHistoricalPrice(symbol: string, opts: GetHistoricalPriceForSingleTokenOptions): Promise; /** * Returns the historical prices for several tokens * * @param symbols - Array of token symbols * @param opts - Options object. It must contain the date property. * * opts.date: Date for the historical price (date | timestamp | string) * * opts.provider: provider name (string) * * opts.verifySignature: enable signature verification (boolean) * @returns The historical prices for several tokens * */ getHistoricalPrice(symbols: string[], opts: GetHistoricalPriceOptions): Promise<{ [token: string]: PriceData; }>; /** * Returns the latest price for all the supported symbols * * @param opts - Optioanl options object. * * opts.provider: provider name (string) * * opts.verifySignature: enable signature verification (boolean) * @returns The latest price for all the supported tokens * */ getAllPrices(opts?: GetPriceOptions): Promise<{ [symbol: string]: PriceData; }>; private getLatestPriceForOneToken; private getPriceForManyTokens; private getPricesFromArweave; private getHistoricalPriceForOneSymbol; private tryToGetPriceFromGQL; private getHistoricalPricesForOneSymbol; private getProviderForSymbol; private getProviderForSymbols; }