From e2149ed883e76c8d9e4f4f73492fc444920a5913 Mon Sep 17 00:00:00 2001 From: FlowX Dev Date: Tue, 4 Jul 2023 17:34:35 +0700 Subject: [PATCH] Hotfix: Update total volumes --- dexs/flowx-finance/index.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dexs/flowx-finance/index.ts b/dexs/flowx-finance/index.ts index ff2e4ef0dc..b6bbf260b6 100644 --- a/dexs/flowx-finance/index.ts +++ b/dexs/flowx-finance/index.ts @@ -14,6 +14,9 @@ const getDailyVolume = () => { volume7D totalLiquidityInUSD } + exchangeTotalVolume { + totalVolume + } } `; }; @@ -21,6 +24,7 @@ const getDailyVolume = () => { const graphQLClient = new GraphQLClient( "https://api.flowx.finance/flowx-be/graphql" ); + const getGQLClient = () => { return graphQLClient; }; @@ -29,19 +33,23 @@ export interface IExchangeStats { fee24H: string; totalLiquidity: string; totalLiquidityInUSD: string; - transaction24H: number; + transaction24H: string; volume24H: string; volume7D: string; } +export interface IExchangeTotalVolume { + totalVolume: string; +} + const fetch = async (timestamp: number) => { const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000)); - const historicalVolume: IExchangeStats = ( - await getGQLClient().request(getDailyVolume()) - ).exchangeStats; + const statsRes = await getGQLClient().request(getDailyVolume()); + const historicalVolume: IExchangeStats = statsRes.exchangeStats; + const cumulativeVolume: IExchangeTotalVolume = statsRes.exchangeTotalVolume; return { - totalVolume: historicalVolume.totalLiquidityInUSD - ? historicalVolume.totalLiquidityInUSD + totalVolume: cumulativeVolume.totalVolume + ? cumulativeVolume.totalVolume : undefined, dailyVolume: historicalVolume.volume24H ? `${historicalVolume.volume24H}`