Add token verification message to swaps build quote screen (#9891)

* Add token verification message to swaps build quote screen

* Adds description for locale

* Use <a> tag for etherscan link

* Remove unnecessary span

* Update ui/app/pages/swaps/build-quote/build-quote.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
feature/default_network_editable
Dan J Miller 4 years ago committed by GitHub
parent 31a3541105
commit e4de763116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      app/_locales/en/messages.json
  2. 22
      ui/app/pages/swaps/build-quote/build-quote.js
  3. 21
      ui/app/pages/swaps/build-quote/index.scss

@ -629,6 +629,9 @@
"ethereumPublicAddress": { "ethereumPublicAddress": {
"message": "Ethereum Public Address" "message": "Ethereum Public Address"
}, },
"etherscan": {
"message": "Etherscan"
},
"etherscanView": { "etherscanView": {
"message": "View account on Etherscan" "message": "View account on Etherscan"
}, },
@ -1848,6 +1851,9 @@
"swapUsingBestQuote": { "swapUsingBestQuote": {
"message": "Using the best quote" "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": { "swapViewToken": {
"message": "View $1" "message": "View $1"
}, },
@ -2079,6 +2085,10 @@
"userName": { "userName": {
"message": "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": { "viewAccount": {
"message": "View Account" "message": "View Account"
}, },

@ -13,6 +13,7 @@ import DropdownInputPair from '../dropdown-input-pair'
import DropdownSearchList from '../dropdown-search-list' import DropdownSearchList from '../dropdown-search-list'
import SlippageButtons from '../slippage-buttons' import SlippageButtons from '../slippage-buttons'
import { getTokens } from '../../../ducks/metamask/metamask' import { getTokens } from '../../../ducks/metamask/metamask'
import InfoTooltip from '../../../components/ui/info-tooltip'
import { import {
fetchQuotesAndSetQuoteState, fetchQuotesAndSetQuoteState,
@ -366,6 +367,27 @@ export default function BuildQuote({
defaultToAll defaultToAll
/> />
</div> </div>
{selectedToToken?.address &&
selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address && (
<div className="build-quote__token-message">
{t('verifyThisTokenOn', [
<a
className="build-quote__token-etherscan-link"
key="build-quote-etherscan-link"
href={`https://etherscan.io/token/${selectedToToken.address}`}
target="_blank"
rel="noopener noreferrer"
>
{t('etherscan')}
</a>,
])}
<InfoTooltip
position="top"
contentText={t('swapVerifyTokenExplanation')}
containerClassName="build-quote__token-tooltip-container"
/>
</div>
)}
<div className="build-quote__slippage-buttons-container"> <div className="build-quote__slippage-buttons-container">
<SlippageButtons <SlippageButtons
onSelect={(newSlippage) => { onSelect={(newSlippage) => {

@ -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 */ /* Prevents the swaps "Swap to" field from overflowing */
.dropdown-input-pair__to .dropdown-search-list { .dropdown-input-pair__to .dropdown-search-list {
width: 100%; width: 100%;

Loading…
Cancel
Save