From 1e1f7e4bc81274352b30b89590f2090cd5ee38ec Mon Sep 17 00:00:00 2001 From: AzizbekFayziyev Date: Thu, 14 Aug 2025 21:53:09 +0500 Subject: [PATCH] change: zano price decimals to 4 --- src/components/default/PairsTable/PairsTable.tsx | 4 ++-- src/components/dex/TradingHeader/index.tsx | 11 ++++++----- src/hook/useTradeInit.ts | 4 +--- src/pages/dex/pairs/PairsCard/PairsCard.tsx | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/default/PairsTable/PairsTable.tsx b/src/components/default/PairsTable/PairsTable.tsx index 0891919..94611b7 100644 --- a/src/components/default/PairsTable/PairsTable.tsx +++ b/src/components/default/PairsTable/PairsTable.tsx @@ -106,7 +106,7 @@ function PairsTable({ data }: IProps) { cell: ({ row }) => (
- {roundTo(notationToString(row.original.price), 2)} + {roundTo(notationToString(row.original.price), 4)}
{row.original.priceUSD}
@@ -149,7 +149,7 @@ function PairsTable({ data }: IProps) { cell: ({ row }) => (
- {roundTo(notationToString(row.original?.volume ?? 0), 2)} + {roundTo(notationToString(row.original?.volume ?? 0), 4)}
{row.original.volumeUSD}
diff --git a/src/components/dex/TradingHeader/index.tsx b/src/components/dex/TradingHeader/index.tsx index 9658c1b..1e48e06 100644 --- a/src/components/dex/TradingHeader/index.tsx +++ b/src/components/dex/TradingHeader/index.tsx @@ -36,23 +36,23 @@ const TradingHeader = ({ { Img: ClockIcon, title: '24h change', - value: `${roundTo(notationToString(pairStats?.rate || 0), 8)} ${secondCurrencyName}`, + value: `${roundTo(notationToString(pairStats?.rate || 0), 4)} ${secondCurrencyName}`, coefficient: coefficientOutput, }, { Img: UpIcon, title: '24h high', - value: `${roundTo(notationToString(pairStats?.high || 0), 8)} ${secondCurrencyName}`, + value: `${roundTo(notationToString(pairStats?.high || 0), 4)} ${secondCurrencyName}`, }, { Img: DownIcon, title: '24h low', - value: `${roundTo(notationToString(pairStats?.low || 0), 8)} ${secondCurrencyName}`, + value: `${roundTo(notationToString(pairStats?.low || 0), 4)} ${secondCurrencyName}`, }, { Img: VolumeIcon, title: '24h volume', - value: `${roundTo(notationToString(pairStats?.volume || 0), 8)} ${secondCurrencyName}`, + value: `${roundTo(notationToString(pairStats?.volume || 0), 4)} ${secondCurrencyName}`, }, ]; @@ -77,7 +77,8 @@ const TradingHeader = ({

- {notationToString(pairStats?.rate || 0)} {secondCurrencyName} + {roundTo(notationToString(pairStats?.rate || 0), 4)}{' '} + {secondCurrencyName}

{pairRateUsd &&

~ ${pairRateUsd}

}
diff --git a/src/hook/useTradeInit.ts b/src/hook/useTradeInit.ts index 4b5dc9b..f3e2732 100644 --- a/src/hook/useTradeInit.ts +++ b/src/hook/useTradeInit.ts @@ -35,9 +35,7 @@ const useTradeInit = ({ pairData, pairStats }: useTradeInitParams) => { const pairRateUsd = pairStats?.rate !== undefined && secondAssetUsdPrice !== undefined - ? new Decimal(pairStats.rate) - .mul(secondAssetUsdPrice) - .toFixed(pairStats.rate < 0.1 ? 6 : 2) + ? new Decimal(pairStats.rate).mul(secondAssetUsdPrice).toFixed(2) : undefined; const buyForm = useOrderForm({ diff --git a/src/pages/dex/pairs/PairsCard/PairsCard.tsx b/src/pages/dex/pairs/PairsCard/PairsCard.tsx index c0b5c2d..9e92456 100644 --- a/src/pages/dex/pairs/PairsCard/PairsCard.tsx +++ b/src/pages/dex/pairs/PairsCard/PairsCard.tsx @@ -22,7 +22,7 @@ export default function PairsCard({ pair }: IProps) { const secondAssetUsdPrice = state.assetsRates.get(secondCurrency.asset_id || '') ?? 0; - const price = Number(roundTo(notationToString(pair.rate ?? 0), 2)); + const price = Number(roundTo(notationToString(pair.rate ?? 0), 4)); const currentPriceUSD = secondAssetUsdPrice ? price : 0; const priceUSD = currentPriceUSD ? String(`$${(secondAssetUsdPrice * price).toFixed(2)}`) @@ -34,7 +34,7 @@ export default function PairsCard({ pair }: IProps) { ? -99.99 : parseFloat(coefficient?.toFixed(2) || '0'); - const volume = Number(roundTo(notationToString(pair.volume ?? 0), 2)); + const volume = Number(roundTo(notationToString(pair.volume ?? 0), 4)); const currentVolumeUSD = secondAssetUsdPrice ? volume : 0; const volumeUSD = currentVolumeUSD ? String(`$${(secondAssetUsdPrice * volume).toFixed(2)}`)