From 179e795b1f735ca4347667ca725694fab2c5e250 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 18 Nov 2020 21:57:29 -0330 Subject: [PATCH] Update asset page etherscan link to the address-filtered token page on Etherscan (#9909) --- ui/app/pages/asset/components/token-asset.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ui/app/pages/asset/components/token-asset.js b/ui/app/pages/asset/components/token-asset.js index 81198ee5d..9cbf083e6 100644 --- a/ui/app/pages/asset/components/token-asset.js +++ b/ui/app/pages/asset/components/token-asset.js @@ -2,14 +2,10 @@ import React from 'react' import PropTypes from 'prop-types' import { useDispatch, useSelector } from 'react-redux' import { useHistory } from 'react-router-dom' -import { createAccountLink } from '@metamask/etherscan-link' import TransactionList from '../../../components/app/transaction-list' import { TokenOverview } from '../../../components/app/wallet-overview' -import { - getCurrentNetworkId, - getSelectedIdentity, -} from '../../../selectors/selectors' +import { getSelectedIdentity } from '../../../selectors/selectors' import { DEFAULT_ROUTE } from '../../../helpers/constants/routes' import { showModal } from '../../../store/actions' @@ -18,10 +14,9 @@ import TokenOptions from './token-options' export default function TokenAsset({ token }) { const dispatch = useDispatch() - const network = useSelector(getCurrentNetworkId) - const selectedAccountName = useSelector( - (state) => getSelectedIdentity(state).name, - ) + const selectedIdentity = useSelector(getSelectedIdentity) + const selectedAccountName = selectedIdentity.name + const selectedAddress = selectedIdentity.address const history = useHistory() return ( @@ -36,7 +31,7 @@ export default function TokenAsset({ token }) { dispatch(showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token })) } onViewEtherscan={() => { - const url = createAccountLink(token.address, network) + const url = `https://etherscan.io/token/${token.address}?a=${selectedAddress}` global.platform.openTab({ url }) }} tokenSymbol={token.symbol}