dexscreener-sdk
Version:
A TypeScript wrapper for the DEX Screener API, providing easy access to token profiles, boosts, orders, pairs, and more.
15 lines (14 loc) • 600 B
JavaScript
import axios from 'axios';
import { BASE_URL } from '../config.js';
import { Pair } from '../models/Pair.js';
/**
* Fetches liquidity pools for a given token address.
* @param chainId - The blockchain identifier (e.g., "solana").
* @param tokenAddress - The token address.
* @returns A promise that resolves to an array of Pair instances.
*/
export const getTokenPools = async (chainId, tokenAddress) => {
const url = `${BASE_URL}/token-pairs/v1/${chainId}/${tokenAddress}`;
const response = await axios.get(url);
return response.data.map((data) => new Pair(data));
};