Skip to content

Commit 0491c76

Browse files
authored
Fix/display small price (#1167)
* update price display logic in UsdPrice component for better precision handling * refactor: enhance token handling and price display logic in UniversalSwap components * Refactor ChartUsdPrice component to simplify token denomination logic
1 parent b5835c1 commit 0491c76

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/pages/UniversalSwap/Component/ChartUsdPrice.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@ const ChartUsdPrice = ({
3535
const currentToToken = useSelector(selectCurrentToToken);
3636
const currentFromToken = useSelector(selectCurrentFromToken);
3737
const toTokenDenomIsStable = getTokenIsStableCoin(currentToToken);
38+
const getTokenDenom = toTokenDenomIsStable
39+
? currentFromToken
40+
? parseTokenInfoRawDenom(currentFromToken)
41+
: 'cw20:orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh:USDT'
42+
: currentToToken
43+
? parseTokenInfoRawDenom(currentToToken)
44+
: 'orai';
3845

3946
const {
4047
currentData: data,
4148
currentItem,
4249
onCrossMove: crossMove,
4350
onMouseLeave
44-
} = useChartUsdPrice(
45-
filterDay,
46-
toTokenDenomIsStable ? parseTokenInfoRawDenom(currentFromToken) : parseTokenInfoRawDenom(currentToToken),
47-
chartTokenType,
48-
onUpdateCurrentItem,
49-
onUpdatePricePercent
50-
);
51+
} = useChartUsdPrice(filterDay, getTokenDenom, chartTokenType, onUpdateCurrentItem, onUpdatePricePercent);
5152

5253
function handleResizeObserver(entries: ResizeObserverEntry[]) {
5354
window.requestAnimationFrame((): void | undefined => {

src/pages/UniversalSwap/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Swap: React.FC = () => {
4646
// get data for mobile
4747
useChartUsdPrice(
4848
FILTER_TIME_CHART.DAY,
49-
parseTokenInfoRawDenom(tokenTo),
49+
tokenTo ? parseTokenInfoRawDenom(tokenTo) : 'orai',
5050
ChartTokenType.Price,
5151
setInitPriceUsd,
5252
setInitPercentChangeUsd

0 commit comments

Comments
 (0)