mirror of
https://github.com/zhigang1992/xverse-web-extension.git
synced 2026-04-29 05:05:45 +08:00
Merge pull request #863 from secretkeylabs/fix/eng-6119/callout-when-no-fiat-price
fix: [ENG-6119] Callout warning when no fiat price available
This commit is contained in:
@@ -18,7 +18,10 @@ const useFromTokens = (toToken?: FungibleToken) => {
|
||||
|
||||
const filteredTokens = toToken
|
||||
? sortedTokens.filter(
|
||||
(token) => token.principal !== toToken.ticker && toToken.protocol === token.protocol,
|
||||
(token) =>
|
||||
token.principal !== toToken.ticker &&
|
||||
token.principal !== toToken.principal &&
|
||||
toToken.protocol === token.protocol,
|
||||
)
|
||||
: sortedTokens;
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ export default function QuoteSummary({
|
||||
} = usePlaceUtxoOrder();
|
||||
|
||||
useEffect(() => {
|
||||
if (true) {
|
||||
if (placeOrderError || placeUtxoOrderError) {
|
||||
onError(placeOrderError ?? placeUtxoOrderError ?? '');
|
||||
}
|
||||
}, [placeOrderError, placeUtxoOrderError]);
|
||||
@@ -299,11 +299,9 @@ export default function QuoteSummary({
|
||||
.toFixed(2);
|
||||
})();
|
||||
|
||||
const showBadQuoteWarning =
|
||||
quote.slippageSupported &&
|
||||
new BigNumber(toTokenFiatValue).isLessThan(
|
||||
new BigNumber(fromTokenFiatValue).multipliedBy(BAD_QUOTE_PERCENTAGE),
|
||||
);
|
||||
const showBadQuoteWarning = new BigNumber(toTokenFiatValue).isLessThan(
|
||||
new BigNumber(fromTokenFiatValue).multipliedBy(BAD_QUOTE_PERCENTAGE),
|
||||
);
|
||||
const valueLossPercentage = new BigNumber(fromTokenFiatValue)
|
||||
.minus(new BigNumber(toTokenFiatValue))
|
||||
.dividedBy(new BigNumber(fromTokenFiatValue))
|
||||
@@ -330,9 +328,13 @@ export default function QuoteSummary({
|
||||
<CalloutContainer>
|
||||
<Callout
|
||||
titleText={t('SWAP_SCREEN.BAD_QUOTE_WARNING_TITLE')}
|
||||
bodyText={t('SWAP_SCREEN.BAD_QUOTE_WARNING_DESC', {
|
||||
percentage: valueLossPercentage,
|
||||
})}
|
||||
bodyText={
|
||||
quote.slippageSupported && BigNumber(toTokenFiatValue).isGreaterThan(0)
|
||||
? t('SWAP_SCREEN.BAD_QUOTE_WARNING_DESC', {
|
||||
percentage: valueLossPercentage,
|
||||
})
|
||||
: t('SWAP_SCREEN.UNKNOWN_QUOTE_VALUE_WARNING_DESC')
|
||||
}
|
||||
variant="warning"
|
||||
/>
|
||||
</CalloutContainer>
|
||||
|
||||
@@ -1528,7 +1528,8 @@
|
||||
"LIST_YOUR_RUNES": "List your Runes on a marketplace",
|
||||
"SLIPPAGE_WARNING": "Your transaction may be frontrun and result in an unfavorable trade",
|
||||
"BAD_QUOTE_WARNING_TITLE": "The quote you are receiving may result in significant value loss.",
|
||||
"BAD_QUOTE_WARNING_DESC": "The minimum amount you will receive will result in a loss of over {{percentage}}% of your trade’s value. This is due to low liquidity in the pool, causing discrepancies in pricing. Please review the details carefully before proceeding with the swap."
|
||||
"BAD_QUOTE_WARNING_DESC": "The minimum amount you will receive will result in a loss of over {{percentage}}% of your trade’s value. This is due to low liquidity in the pool, causing discrepancies in pricing. Please review the details carefully before proceeding with the swap.",
|
||||
"UNKNOWN_QUOTE_VALUE_WARNING_DESC": "The market value of the token you will receive is unknown. Review details carefully before proceeding with the swap."
|
||||
},
|
||||
"SWAP_CONFIRM_SCREEN": {
|
||||
"TOKEN_SWAP": "Token swap",
|
||||
|
||||
Reference in New Issue
Block a user