UNPKG

pharos-agent-kit

Version:
20 lines 772 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLatestPools = getLatestPools; async function getLatestPools(agent) { 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/new_pools?include=base_token&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 latest pools from CoinGecko: ${e.message}`); } } //# sourceMappingURL=get_latest_pools.js.map