From 76ec7df2989913ab22bf4fd06141979ead71032a Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Wed, 8 Jan 2025 04:09:33 +0000 Subject: [PATCH] add curve base --- dexs/curve/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dexs/curve/index.ts b/dexs/curve/index.ts index d868c54f03..75df4d47e3 100644 --- a/dexs/curve/index.ts +++ b/dexs/curve/index.ts @@ -12,6 +12,7 @@ const endpoints: { [chain: string]: string } = { [CHAIN.XDAI]: "https://api.curve.fi/api/getSubgraphData/xdai", // [CHAIN.CELO]: "https://api.curve.fi/api/getSubgraphData/celo", [CHAIN.FRAXTAL]: "https://api.curve.fi/api/getSubgraphData/fraxtal", + [CHAIN.BASE]: "https://api.curve.fi/api/getVolumes/base" }; interface IAPIResponse { @@ -20,6 +21,9 @@ interface IAPIResponse { totalVolume: number, cryptoShare: number, generatedTimeMs: number + totalVolumes: { + totalVolume: number + } } } @@ -27,6 +31,12 @@ const fetch = (chain: string) => async (timestamp: number) => { try { const response: IAPIResponse = (await fetchURL(endpoints[chain])); const t = response.data.generatedTimeMs ? response.data.generatedTimeMs / 1000 : timestamp + if (chain === CHAIN.BASE) { + return { + dailyVolume: `${response.data.totalVolumes.totalVolume}`, + timestamp: t, + } + } return { dailyVolume: `${response.data.totalVolume}`, timestamp: t,