Accommodate for 0 sources verifying swap token (#10521)

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent 616b71271a
commit 8013e85c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/_locales/en/messages.json
  2. 16
      ui/app/pages/swaps/build-quote/build-quote.js

@ -1908,6 +1908,9 @@
"message": "Always confirm the token address on $1.",
"description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover."
},
"swapTokenVerificationNoSource": {
"message": "This token has not been verified."
},
"swapTokenVerificationOnlyOneSource": {
"message": "Only verified on 1 source."
},

@ -113,7 +113,7 @@ export default function BuildQuote({
const toTokenIsNotEth =
selectedToToken?.address &&
selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address;
const occurances = Number(selectedToToken?.occurances || 0);
const {
address: fromTokenAddress,
symbol: fromTokenSymbol,
@ -376,12 +376,14 @@ export default function BuildQuote({
/>
</div>
{toTokenIsNotEth &&
(selectedToToken.occurances === 1 ? (
(occurances < 2 ? (
<ActionableMessage
message={
<div className="build-quote__token-verification-warning-message">
<div className="build-quote__bold">
{t('swapTokenVerificationOnlyOneSource')}
{occurances === 1
? t('swapTokenVerificationOnlyOneSource')
: t('swapTokenVerificationNoSource')}
</div>
<div>
{t('verifyThisTokenOn', [
@ -416,9 +418,7 @@ export default function BuildQuote({
className="build-quote__bold"
key="token-verification-bold-text"
>
{t('swapTokenVerificationSources', [
selectedToToken.occurances,
])}
{t('swapTokenVerificationSources', [occurances])}
</span>
{t('swapTokenVerificationMessage', [
<a
@ -465,9 +465,7 @@ export default function BuildQuote({
!selectedToToken?.address ||
Number(maxSlippage) === 0 ||
Number(maxSlippage) > MAX_ALLOWED_SLIPPAGE ||
(toTokenIsNotEth &&
selectedToToken.occurances === 1 &&
!verificationClicked)
(toTokenIsNotEth && occurances < 2 && !verificationClicked)
}
hideCancel
showTermsOfService

Loading…
Cancel
Save