dexscreener-sdk
Version:
A TypeScript wrapper for the DEX Screener API, providing easy access to token profiles, boosts, orders, pairs, and more.
26 lines (25 loc) • 976 B
JavaScript
import axios from 'axios';
import { BASE_URL } from '../config.js';
import { TokenBoost } from '../models/TokenBoost.js';
/**
* Fetches the latest token boosts.
* @returns A promise that resolves to an array of TokenBoost instances.
*/
export const getLatestTokenBoosts = async () => {
const url = `${BASE_URL}/token-boosts/latest/v1`;
const response = await axios.get(url);
return Array.isArray(response.data)
? response.data.map((data) => new TokenBoost(data))
: [new TokenBoost(response.data)];
};
/**
* Fetches the tokens with the most active boosts.
* @returns A promise that resolves to an array of TokenBoost instances.
*/
export const getTopTokenBoosts = async () => {
const url = `${BASE_URL}/token-boosts/top/v1`;
const response = await axios.get(url);
return Array.isArray(response.data)
? response.data.map((data) => new TokenBoost(data))
: [new TokenBoost(response.data)];
};