From 96695c8cf3636c7125e727071638a82a3907ea2c Mon Sep 17 00:00:00 2001 From: nattadex Date: Mon, 22 Jul 2024 14:35:25 +0800 Subject: [PATCH] update view pool info --- mobile-app/app/api/token/dusdt_converter.ts | 31 +++++++++++++++++++ .../screens/Dex/DexAddLiquidity.tsx | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/mobile-app/app/api/token/dusdt_converter.ts b/mobile-app/app/api/token/dusdt_converter.ts index 9f56b56827..2ae694dd03 100644 --- a/mobile-app/app/api/token/dusdt_converter.ts +++ b/mobile-app/app/api/token/dusdt_converter.ts @@ -90,3 +90,34 @@ export function dusdt_converter_pool_pair(availablePairs: any) { }; } } + +export function dusdt_converter_pair_data(pairData: any) { + return { + ...pairData, + symbol: pairData.symbol.replace(/USDT/g, updated_dusdt_name), + displaySymbol: pairData.displaySymbol.replace(/dUSDT/g, updated_dusdt_name), + name: pairData.name.replace(/USDT/g, updated_dusdt_name), + tokenA: { + ...pairData.tokenA, + symbol: + pairData.tokenA.symbol === "dUSDT" + ? updated_dusdt_name + : pairData.tokenA.symbol, + displaySymbol: + pairData.tokenA.displaySymbol === "dUSDT" + ? updated_dusdt_name + : pairData.tokenA.displaySymbol, + }, + tokenB: { + ...pairData.tokenB, + symbol: + pairData.tokenB.symbol === "dUSDT" + ? updated_dusdt_name + : pairData.tokenB.symbol, + displaySymbol: + pairData.tokenB.displaySymbol === "dUSDT" + ? updated_dusdt_name + : pairData.tokenB.displaySymbol, + }, + }; +} diff --git a/mobile-app/app/screens/AppNavigator/screens/Dex/DexAddLiquidity.tsx b/mobile-app/app/screens/AppNavigator/screens/Dex/DexAddLiquidity.tsx index 565259053f..071fd93015 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Dex/DexAddLiquidity.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Dex/DexAddLiquidity.tsx @@ -42,6 +42,7 @@ import { useToast } from "react-native-toast-notifications"; import { useBottomSheet } from "@hooks/useBottomSheet"; import { useDisplayUtxoWarning } from "@hooks/wallet/DisplayUtxoWarning"; import { ConvertDirection } from "@screens/enum"; +import { dusdt_converter_pair_data } from "@api/token/dusdt_converter"; import { ViewPoolHeader } from "./components/ViewPoolHeader"; import { ViewPoolDetails, DataRoutes } from "./components/ViewPoolDetails"; import { LiquidityCalculationSummary } from "./components/LiquidityCalculationSummary"; @@ -196,7 +197,7 @@ export function AddLiquidityScreen(props: Props): JSX.Element { stackScreenName: "ViewPoolShare", component: ViewPoolDetails({ dataRoutes: DataRoutes.AddLiquidity, - pairData: pairData, + pairData: dusdt_converter_pair_data(pairData), pairInfo: pairInfo, }), option: BottomSheetHeader,