dexpaprika-sdk
Version:
JavaScript SDK for the DexPaprika API
71 lines (70 loc) • 3.62 kB
TypeScript
import { BaseAPI } from './base';
import { TokenDetails, TokenSearchResponse, TokenPrice } from '../models/tokens';
import { PoolSearchResponse } from '../models/base';
import { TokenPoolsOptions, TopTokensOptions, TokenFilterOptions } from '../models/options';
/**
* API service for token-related endpoints.
*/
export declare class TokensAPI extends BaseAPI {
/**
* Get detailed information about a specific token on a network.
*
* @param networkId - Network ID (e.g., "ethereum", "solana")
* @param tokenAddress - Token address or identifier
* @returns Detailed information about the token
*/
getDetails(networkId: string, tokenAddress: string): Promise<TokenDetails>;
/**
* Get a list of top liquidity pools that contain a specific token on a network.
*
* Backed by the unified /networks/{network}/pools/search endpoint with its
* `token_address` parameter (the old /tokens/{address}/pools endpoint was
* removed, HTTP 410). The filter is network-scoped only: the cross-network
* /pools/search endpoint accepts `token_address` but silently ignores it, so
* a network is always required here. Legacy `orderBy` values (e.g.
* 'volume_usd') are mapped to canonical sort fields; the endpoint is
* cursor-paginated (pass `cursor`; read `has_next_page`/`next_cursor` from
* the response; `page` is ignored). An unknown token address returns an
* empty result set, not an error.
*
* @param networkId - Network ID (e.g., "ethereum", "solana")
* @param tokenAddress - Token address or identifier
* @param options - Sorting, limit and cursor pagination options
* @returns Search response with pools that contain the specified token
*/
getPools(networkId: string, tokenAddress: string, options?: TokenPoolsOptions): Promise<PoolSearchResponse>;
/**
* Get top tokens on a network ranked by volume, liquidity, or other metrics.
*
* Backed by the unified /networks/{network}/tokens/search endpoint. Legacy
* `orderBy` values (e.g. 'volume_24h') are accepted and mapped to canonical
* sort fields; the endpoint is cursor-paginated (pass `cursor`; read
* `has_next_page`/`next_cursor` from the response).
*
* @param networkId - Network ID (e.g., "ethereum", "solana")
* @param options - Sorting, limit and cursor pagination options
* @returns Search response with token results
*/
getTop(networkId: string, options?: TopTokensOptions): Promise<TokenSearchResponse>;
/**
* Filter tokens on a network by volume, liquidity, FDV, transactions, and creation date.
*
* Backed by the unified /networks/{network}/tokens/search endpoint. The request
* sends `order_by` (mapped from the legacy `sortBy`) and `sort` (direction),
* and is cursor-paginated (pass `cursor`; read `has_next_page`/`next_cursor`
* from the response). Legacy filter param names are mapped to canonical ones.
*
* @param networkId - Network ID (e.g., "ethereum", "solana")
* @param options - Filter criteria and cursor pagination options
* @returns Search response with filtered token results
*/
filter(networkId: string, options?: TokenFilterOptions): Promise<TokenSearchResponse>;
/**
* Get batch prices for multiple tokens on a network.
*
* @param networkId - Network ID (e.g., "ethereum", "solana")
* @param tokens - Array of token addresses (max 10)
* @returns Array of token prices
*/
getMultiPrices(networkId: string, tokens: string[]): Promise<TokenPrice[]>;
}