From e4de76311616f4fb5c8fd635be2c53c96bf4c7e0 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 17 Nov 2020 17:26:02 -0330 Subject: [PATCH] Add token verification message to swaps build quote screen (#9891) * Add token verification message to swaps build quote screen * Adds description for locale * Use tag for etherscan link * Remove unnecessary span * Update ui/app/pages/swaps/build-quote/build-quote.js Co-authored-by: Mark Stacey Co-authored-by: Mark Stacey --- app/_locales/en/messages.json | 10 +++++++++ ui/app/pages/swaps/build-quote/build-quote.js | 22 +++++++++++++++++++ ui/app/pages/swaps/build-quote/index.scss | 21 ++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index bf44ebdf6..6870be1cc 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -629,6 +629,9 @@ "ethereumPublicAddress": { "message": "Ethereum Public Address" }, + "etherscan": { + "message": "Etherscan" + }, "etherscanView": { "message": "View account on Etherscan" }, @@ -1848,6 +1851,9 @@ "swapUsingBestQuote": { "message": "Using the best quote" }, + "swapVerifyTokenExplanation": { + "message": "Multiple tokens can use the same name and symbol. Check Etherscan to verify this is the token you're looking for." + }, "swapViewToken": { "message": "View $1" }, @@ -2079,6 +2085,10 @@ "userName": { "message": "Username" }, + "verifyThisTokenOn": { + "message": "Verify this token 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\"" + }, "viewAccount": { "message": "View Account" }, diff --git a/ui/app/pages/swaps/build-quote/build-quote.js b/ui/app/pages/swaps/build-quote/build-quote.js index a1bcea61f..3aabcf82e 100644 --- a/ui/app/pages/swaps/build-quote/build-quote.js +++ b/ui/app/pages/swaps/build-quote/build-quote.js @@ -13,6 +13,7 @@ import DropdownInputPair from '../dropdown-input-pair' import DropdownSearchList from '../dropdown-search-list' import SlippageButtons from '../slippage-buttons' import { getTokens } from '../../../ducks/metamask/metamask' +import InfoTooltip from '../../../components/ui/info-tooltip' import { fetchQuotesAndSetQuoteState, @@ -366,6 +367,27 @@ export default function BuildQuote({ defaultToAll /> + {selectedToToken?.address && + selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address && ( +
+ {t('verifyThisTokenOn', [ + + {t('etherscan')} + , + ])} + +
+ )}
{ diff --git a/ui/app/pages/swaps/build-quote/index.scss b/ui/app/pages/swaps/build-quote/index.scss index eace3058c..acc1f7352 100644 --- a/ui/app/pages/swaps/build-quote/index.scss +++ b/ui/app/pages/swaps/build-quote/index.scss @@ -116,6 +116,27 @@ } } + &__token-message { + @include H7; + + width: 100%; + color: $Grey-500; + margin-top: 4px; + display: flex; + align-items: center; + } + + &__token-etherscan-link { + color: $Blue-500; + cursor: pointer; + margin-right: 4px; + } + + &__token-tooltip-container { + // Needed to override the style property added by the react-tippy library + display: flex !important; + } + /* Prevents the swaps "Swap to" field from overflowing */ .dropdown-input-pair__to .dropdown-search-list { width: 100%;