/** * Prices API Client - price.api.cx.metamask.io * * Handles all price-related API calls including: * - Supported networks * - Exchange rates * - Spot prices (v1, v2, v3) * - Historical prices * - Price graphs */ import type { FetchQueryOptions } from "@tanstack/query-core"; import { BaseApiClient } from "../base-client.mjs"; import type { FetchOptions, MarketDataDetails, SupportedCurrency } from "../shared-types.mjs"; import type { CoinGeckoSpotPrice, V1ExchangeRatesResponse, PriceSupportedNetworksResponse, V1HistoricalPricesResponse, V3SpotPricesResponse, V3HistoricalPricesResponse } from "./types.mjs"; /** * Prices API Client. * Provides methods for interacting with the Price API. */ export declare class PricesApiClient extends BaseApiClient { /** * Invalidate all price queries. */ invalidatePrices(): Promise; /** * Returns the TanStack Query options object for price v1 supported networks. * * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getPriceV1SupportedNetworksQueryOptions(options?: FetchOptions): FetchQueryOptions; /** * Get price supported networks (v1 endpoint). * * @param options - Fetch options including cache settings. * @returns The supported networks response. */ fetchPriceV1SupportedNetworks(options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for price v2 supported networks. * * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getPriceV2SupportedNetworksQueryOptions(options?: FetchOptions): FetchQueryOptions; /** * Get price supported networks in CAIP format (v2 endpoint). * * @param options - Fetch options including cache settings. * @returns The supported networks response. */ fetchPriceV2SupportedNetworks(options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 exchange rates. * * @param baseCurrency - The base currency code. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1ExchangeRatesQueryOptions(baseCurrency: string, options?: FetchOptions): FetchQueryOptions; /** * Get all exchange rates for a base currency (v1 endpoint). * * @param baseCurrency - The base currency code. * @param options - Fetch options including cache settings. * @returns The exchange rates response. */ fetchV1ExchangeRates(baseCurrency: string, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 fiat exchange rates. * * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1FiatExchangeRatesQueryOptions(options?: FetchOptions): FetchQueryOptions; /** * Get fiat exchange rates (v1 endpoint). * * @param options - Fetch options including cache settings. * @returns The exchange rates response. */ fetchV1FiatExchangeRates(options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 crypto exchange rates. * * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1CryptoExchangeRatesQueryOptions(options?: FetchOptions): FetchQueryOptions; /** * Get crypto exchange rates (v1 endpoint). * * @param options - Fetch options including cache settings. * @returns The exchange rates response. */ fetchV1CryptoExchangeRates(options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 spot prices by coin IDs. * * @param coinIds - Array of CoinGecko coin IDs. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1SpotPricesByCoinIdsQueryOptions(coinIds: string[], options?: FetchOptions): FetchQueryOptions>; /** * Get spot prices by CoinGecko coin IDs (v1 endpoint). * * @param coinIds - Array of CoinGecko coin IDs. * @param options - Fetch options including cache settings. * @returns The spot prices by coin ID. */ fetchV1SpotPricesByCoinIds(coinIds: string[], options?: FetchOptions): Promise>; /** * Returns the TanStack Query options object for v1 spot price by coin ID. * * @param coinId - The CoinGecko coin ID. * @param currency - The currency for prices. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1SpotPriceByCoinIdQueryOptions(coinId: string, currency?: SupportedCurrency, options?: FetchOptions): FetchQueryOptions; /** * Get spot price for a single CoinGecko coin ID (v1 endpoint). * * @param coinId - The CoinGecko coin ID. * @param currency - The currency for prices. * @param options - Fetch options including cache settings. * @returns The spot price data. */ fetchV1SpotPriceByCoinId(coinId: string, currency?: SupportedCurrency, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 token prices. * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1TokenPricesQueryOptions(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; }, options?: FetchOptions): FetchQueryOptions>>; /** * Get spot prices for tokens on a chain (v1 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param options - Fetch options including cache settings. * @returns The token prices by address. */ fetchV1TokenPrices(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; }, options?: FetchOptions): Promise>>; /** * Returns the TanStack Query options object for v1 token price. * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param currency - The currency for prices. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1TokenPriceQueryOptions(chainId: string, tokenAddress: string, currency?: SupportedCurrency, options?: FetchOptions): FetchQueryOptions; /** * Get spot price for a single token (v1 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param currency - The currency for prices. * @param options - Fetch options including cache settings. * @returns The market data. */ fetchV1TokenPrice(chainId: string, tokenAddress: string, currency?: SupportedCurrency, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v2 spot prices. * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV2SpotPricesQueryOptions(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; }, options?: FetchOptions): FetchQueryOptions>; /** * Get spot prices for tokens on a chain with market data (v2 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param options - Fetch options including cache settings. * @returns The spot prices with market data. */ fetchV2SpotPrices(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; }, options?: FetchOptions): Promise>; /** * Returns the TanStack Query options object for v3 spot prices. * * @param assetIds - Array of CAIP-19 asset IDs. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param queryOptions.cacheOnly - Whether to use cache only. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV3SpotPricesQueryOptions(assetIds: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; cacheOnly?: boolean; }, options?: FetchOptions): FetchQueryOptions; /** * Get spot prices by CAIP-19 asset IDs (v3 endpoint). * * @param assetIds - Array of CAIP-19 asset IDs. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeMarketData - Whether to include market data. * @param queryOptions.cacheOnly - Whether to use cache only. * @param options - Fetch options including cache settings. * @returns The spot prices response. */ fetchV3SpotPrices(assetIds: string[], queryOptions?: { currency?: SupportedCurrency; includeMarketData?: boolean; cacheOnly?: boolean; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 historical prices by coin ID. * * @param coinId - The CoinGecko coin ID. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1HistoricalPricesByCoinIdQueryOptions(coinId: string, queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical prices by CoinGecko coin ID (v1 endpoint). * * @param coinId - The CoinGecko coin ID. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param options - Fetch options including cache settings. * @returns The historical prices response. */ fetchV1HistoricalPricesByCoinId(coinId: string, queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 historical prices by token addresses. * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1HistoricalPricesByTokenAddressesQueryOptions(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical prices for tokens on a chain (v1 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddresses - Array of token addresses. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param options - Fetch options including cache settings. * @returns The historical prices response. */ fetchV1HistoricalPricesByTokenAddresses(chainId: string, tokenAddresses: string[], queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 historical prices. * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timeRange - The time range. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1HistoricalPricesQueryOptions(chainId: string, tokenAddress: string, queryOptions?: { currency?: SupportedCurrency; timeRange?: string; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical prices for a single token (v1 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timeRange - The time range. * @param options - Fetch options including cache settings. * @returns The historical prices response. */ fetchV1HistoricalPrices(chainId: string, tokenAddress: string, queryOptions?: { currency?: SupportedCurrency; timeRange?: string; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v3 historical prices. * * @param chainId - The CAIP-2 chain ID. * @param assetType - The asset type portion of CAIP-19. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param queryOptions.interval - Data interval. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV3HistoricalPricesQueryOptions(chainId: string, assetType: string, queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; interval?: '5m' | 'hourly' | 'daily'; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical prices by CAIP-19 asset ID (v3 endpoint). * * @param chainId - The CAIP-2 chain ID. * @param assetType - The asset type portion of CAIP-19. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.timePeriod - The time period. * @param queryOptions.from - Start timestamp. * @param queryOptions.to - End timestamp. * @param queryOptions.interval - Data interval. * @param options - Fetch options including cache settings. * @returns The historical prices response. */ fetchV3HistoricalPrices(chainId: string, assetType: string, queryOptions?: { currency?: SupportedCurrency; timePeriod?: string; from?: number; to?: number; interval?: '5m' | 'hourly' | 'daily'; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 historical price graph by coin ID. * * @param coinId - The CoinGecko coin ID. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeOHLC - Whether to include OHLC data. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1HistoricalPriceGraphByCoinIdQueryOptions(coinId: string, queryOptions?: { currency?: SupportedCurrency; includeOHLC?: boolean; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical price graph data by CoinGecko coin ID (v1 endpoint). * * @param coinId - The CoinGecko coin ID. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeOHLC - Whether to include OHLC data. * @param options - Fetch options including cache settings. * @returns The historical price graph response. */ fetchV1HistoricalPriceGraphByCoinId(coinId: string, queryOptions?: { currency?: SupportedCurrency; includeOHLC?: boolean; }, options?: FetchOptions): Promise; /** * Returns the TanStack Query options object for v1 historical price graph by token address. * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeOHLC - Whether to include OHLC data. * @param options - Fetch options including cache settings. * @returns TanStack Query options for use with useQuery, useSuspenseQuery, etc. */ getV1HistoricalPriceGraphByTokenAddressQueryOptions(chainId: string, tokenAddress: string, queryOptions?: { currency?: SupportedCurrency; includeOHLC?: boolean; }, options?: FetchOptions): FetchQueryOptions; /** * Get historical price graph data by token address (v1 endpoint). * * @param chainId - The chain ID (hex format). * @param tokenAddress - The token address. * @param queryOptions - Query options. * @param queryOptions.currency - The currency for prices. * @param queryOptions.includeOHLC - Whether to include OHLC data. * @param options - Fetch options including cache settings. * @returns The historical price graph response. */ fetchV1HistoricalPriceGraphByTokenAddress(chainId: string, tokenAddress: string, queryOptions?: { currency?: SupportedCurrency; includeOHLC?: boolean; }, options?: FetchOptions): Promise; } //# sourceMappingURL=client.d.mts.map