From 98ec5c1b48a9648188d573949560c053fd270a91 Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Mon, 19 Aug 2024 13:40:24 +0000 Subject: [PATCH] fix version of api --- dexs/dexalot/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dexs/dexalot/index.ts b/dexs/dexalot/index.ts index 9457de19d0..ca9811fb93 100644 --- a/dexs/dexalot/index.ts +++ b/dexs/dexalot/index.ts @@ -6,7 +6,7 @@ const historicalVolumeEndpoint = "https://api.dexalot.com/api/stats/chaindailyvo interface IVolumeall { volumeusd: string; - date: number; + date: string; } const supportedChains = [CHAIN.DEXALOT, CHAIN.AVAX, CHAIN.ARBITRUM, CHAIN.BASE] @@ -29,13 +29,14 @@ const fetchFromChain = (chain: CHAIN) => { return async (options: FetchOptions): Promise => { const dayTimestamp = new Date(options.startOfDay * 1000) + const dateStr = dayTimestamp.toISOString().split('T')[0] const historicalVolume: IVolumeall[] = await httpGet(endpoint) const totalVolume = historicalVolume .filter(volItem => new Date(volItem.date) <= dayTimestamp) .reduce((acc, { volumeusd }) => acc + Number(volumeusd), 0) const dailyVolume = historicalVolume - .find(dayItem => new Date(dayItem.date) === dayTimestamp)?.volumeusd + .find(dayItem => dayItem.date.split('T')[0] === dateStr)?.volumeusd return { totalVolume: `${totalVolume}`, @@ -53,7 +54,7 @@ const getStartTimestamp = (chain: CHAIN) => { } const adapter: SimpleAdapter = { - version: 2, + version: 1, adapter: supportedChains.reduce((acc, chain) => { return { ...acc,