pharos-agent-kit
Version:
Connect AI Agents to Pharos protocols
20 lines • 826 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTrendingPools = getTrendingPools;
async function getTrendingPools(agent, duration = "24h") {
try {
if (!agent.config?.COINGECKO_PRO_API_KEY) {
throw new Error("No CoinGecko Pro API key provided");
}
const url = `https://pro-api.coingecko.com/api/v3/onchain/networks/trending_pools?include=base_token&duration=${duration}&x_cg_pro_api_key=${agent.config?.COINGECKO_PRO_API_KEY}`;
const res = await fetch(url);
const data = await res.json();
return data;
}
catch (e) {
throw new Error(
// @ts-expect-error - error is an object
`Error fetching trending pools from CoinGecko: ${e.message}`);
}
}
//# sourceMappingURL=get_trending_pools.js.map