Skip to content

Commit 79da4fb

Browse files
committed
fix estimate ui price
1 parent b621b83 commit 79da4fb

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/EstimateSummary.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export const EstimateSummary = () => {
2121
const swapForm = useSwap()
2222
const {openModal} = useModal()
2323

24+
const tokenInInfo = swapForm.tokenInfos.get(swapForm.tokenInInput.tokenId ?? undefinedToken)
25+
const tokenOutInfo = swapForm.tokenInfos.get(swapForm.tokenOutInput.tokenId ?? undefinedToken)
26+
27+
const tokenInTicker = tokenInInfo?.ticker ?? tokenInInfo?.name ?? '-'
28+
const tokenOutTicker = tokenOutInfo?.ticker ?? tokenOutInfo?.name ?? '-'
29+
2430
const protocol = swapForm.estimate?.splits[0]?.protocol
2531

2632
const expand = () =>
@@ -68,7 +74,7 @@ export const EstimateSummary = () => {
6874
<Row
6975
label={strings.price}
7076
description={swapForm.orderType === 'limit' ? strings.limitPriceInfo : strings.marketPriceInfo}
71-
value={`${swapForm.estimate?.netPrice} ${wallet.portfolioPrimaryTokenInfo.ticker}`}
77+
value={`1 ${tokenInTicker} = ${swapForm.estimate?.netPrice} ${tokenOutTicker}`}
7278
/>
7379

7480
<Row
@@ -80,9 +86,7 @@ export const EstimateSummary = () => {
8086
<Row
8187
label={strings.swapMinReceivedTitle}
8288
description={strings.swapMinReceived}
83-
value={`${swapForm.estimate?.totalOutput} ${
84-
swapForm.tokenInfos.get(swapForm.tokenOutInput.tokenId ?? undefinedToken)?.ticker
85-
}`}
89+
value={`${swapForm.estimate?.totalOutput} ${tokenOutTicker}`}
8690
/>
8791

8892
<Row

apps/wallet-mobile/src/features/Swap/useCases/CreateOrder/LimitInput.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export const LimitInput = () => {
1515
const {isDark} = useTheme()
1616

1717
const swapForm = useSwap()
18-
const sellTokenInfo = swapForm.tokenInfos.get(swapForm.tokenInInput.tokenId ?? undefinedToken)
19-
const buyTokenInfo = swapForm.tokenInfos.get(swapForm.tokenOutInput.tokenId ?? undefinedToken)
18+
const tokenInInfo = swapForm.tokenInfos.get(swapForm.tokenInInput.tokenId ?? undefinedToken)
19+
const tokenOutInfo = swapForm.tokenInfos.get(swapForm.tokenOutInput.tokenId ?? undefinedToken)
2020
const disabled = swapForm.orderType === 'market'
2121

22-
const tokenToSellName = sellTokenInfo?.ticker ?? sellTokenInfo?.name ?? '-'
23-
const tokenToBuyName = buyTokenInfo?.ticker ?? buyTokenInfo?.name ?? '-'
24-
const pair = `${tokenToBuyName}/${tokenToSellName}`
22+
const tokenInTicker = tokenInInfo?.ticker ?? tokenInInfo?.name ?? '-'
23+
const tokenOutTicker = tokenOutInfo?.ticker ?? tokenOutInfo?.name ?? '-'
24+
const pair = `${tokenOutTicker}/${tokenInTicker}`
2525

2626
return (
2727
<>

0 commit comments

Comments
 (0)