diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 73f8d3f1b..94df54cd8 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2302,6 +2302,10 @@ "message": "Verified on $1 sources.", "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." }, + "swapTooManyDecimalsError": { + "message": "$1 allows up to $2 decimals", + "description": "$1 is a token symbol and $2 is the max. number of decimals allowed for the token" + }, "swapTransactionComplete": { "message": "Transaction complete" }, diff --git a/ui/pages/swaps/build-quote/build-quote.js b/ui/pages/swaps/build-quote/build-quote.js index 4985a8f6d..5b26ba4cb 100644 --- a/ui/pages/swaps/build-quote/build-quote.js +++ b/ui/pages/swaps/build-quote/build-quote.js @@ -74,6 +74,7 @@ export default function BuildQuote({ maxSlippage, selectedAccountAddress, isFeatureFlagLoaded, + tokenFromError, }) { const t = useContext(I18nContext); const dispatch = useDispatch(); @@ -367,6 +368,11 @@ export default function BuildQuote({ } } + const swapYourTokenBalance = t('swapYourTokenBalance', [ + fromTokenString || '0', + fromTokenSymbol, + ]); + return (
@@ -406,28 +412,35 @@ export default function BuildQuote({ />
- {!balanceError && + {!tokenFromError && + !balanceError && fromTokenSymbol && - t('swapYourTokenBalance', [ - fromTokenString || '0', - fromTokenSymbol, - ])} - {balanceError && fromTokenSymbol && ( + swapYourTokenBalance} + {!tokenFromError && balanceError && fromTokenSymbol && (
{t('swapsNotEnoughForTx', [fromTokenSymbol])}
- {t('swapYourTokenBalance', [ - fromTokenString || '0', - fromTokenSymbol, - ])} + {swapYourTokenBalance}
)} + {tokenFromError && ( + <> +
+ {t('swapTooManyDecimalsError', [ + fromTokenSymbol, + fromTokenDecimals, + ])} +
+
{swapYourTokenBalance}
+ + )}