mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Tidy up getAccountLink (#9223)
This commit is contained in:
parent
937616565d
commit
2aa4b6bbee
@ -6,7 +6,7 @@ import { useDispatch, useSelector } from 'react-redux'
|
||||
import { showModal } from '../../../store/actions'
|
||||
import { CONNECTED_ROUTE } from '../../../helpers/constants/routes'
|
||||
import { Menu, MenuItem } from '../../ui/menu'
|
||||
import genAccountLink from '../../../../lib/account-link'
|
||||
import getAccountLink from '../../../../lib/account-link'
|
||||
import { getCurrentKeyring, getCurrentNetwork, getRpcPrefsForCurrentProvider, getSelectedIdentity } from '../../../selectors'
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext'
|
||||
import { useMetricEvent } from '../../../hooks/useMetricEvent'
|
||||
@ -90,7 +90,7 @@ export default function AccountOptionsMenu ({ anchorElement, onClose }) {
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
viewOnEtherscanEvent()
|
||||
global.platform.openTab({ url: genAccountLink(address, network, rpcPrefs) })
|
||||
global.platform.openTab({ url: getAccountLink(address, network, rpcPrefs) })
|
||||
onClose()
|
||||
}}
|
||||
subtitle={
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import AccountModalContainer from '../account-modal-container'
|
||||
import genAccountLink from '../../../../../lib/account-link'
|
||||
import getAccountLink from '../../../../../lib/account-link'
|
||||
import QrView from '../../../ui/qr-code'
|
||||
import EditableLabel from '../../../ui/editable-label'
|
||||
import Button from '../../../ui/button'
|
||||
@ -62,7 +62,7 @@ export default class AccountDetailsModal extends Component {
|
||||
type="secondary"
|
||||
className="account-details-modal__button"
|
||||
onClick={() => {
|
||||
global.platform.openTab({ url: genAccountLink(address, network, rpcPrefs) })
|
||||
global.platform.openTab({ url: getAccountLink(address, network, rpcPrefs) })
|
||||
}}
|
||||
>
|
||||
{rpcPrefs.blockExplorerUrl
|
||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
||||
import Modal from '../../modal'
|
||||
import { addressSummary } from '../../../../helpers/utils/util'
|
||||
import Identicon from '../../../ui/identicon'
|
||||
import genAccountLink from '../../../../../lib/account-link'
|
||||
import getAccountLink from '../../../../../lib/account-link'
|
||||
|
||||
export default class ConfirmRemoveAccount extends Component {
|
||||
static propTypes = {
|
||||
@ -47,7 +47,7 @@ export default class ConfirmRemoveAccount extends Component {
|
||||
<div className="confirm-remove-account__account__link">
|
||||
<a
|
||||
className=""
|
||||
href={genAccountLink(identity.address, this.props.network)}
|
||||
href={getAccountLink(identity.address, this.props.network)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={this.context.t('etherscanView')}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, { Component } from 'react'
|
||||
import Select from 'react-select'
|
||||
import genAccountLink from '../../../../lib/account-link'
|
||||
import getAccountLink from '../../../../lib/account-link'
|
||||
import Button from '../../../components/ui/button'
|
||||
|
||||
class AccountList extends Component {
|
||||
@ -101,7 +101,7 @@ class AccountList extends Component {
|
||||
</div>
|
||||
<a
|
||||
className="hw-account-list__item__link"
|
||||
href={genAccountLink(account.address, this.props.network)}
|
||||
href={getAccountLink(account.address, this.props.network)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={this.context.t('etherscanView')}
|
||||
|
@ -4,30 +4,20 @@ export default function getAccountLink (address, network, rpcPrefs) {
|
||||
}
|
||||
|
||||
const net = parseInt(network)
|
||||
let link
|
||||
switch (net) {
|
||||
case 1: // main net
|
||||
link = `https://etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://etherscan.io/address/${address}`
|
||||
case 2: // morden test net
|
||||
link = `https://morden.etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://morden.etherscan.io/address/${address}`
|
||||
case 3: // ropsten test net
|
||||
link = `https://ropsten.etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://ropsten.etherscan.io/address/${address}`
|
||||
case 4: // rinkeby test net
|
||||
link = `https://rinkeby.etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://rinkeby.etherscan.io/address/${address}`
|
||||
case 42: // kovan test net
|
||||
link = `https://kovan.etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://kovan.etherscan.io/address/${address}`
|
||||
case 5: // goerli test net
|
||||
link = `https://goerli.etherscan.io/address/${address}`
|
||||
break
|
||||
return `https://goerli.etherscan.io/address/${address}`
|
||||
default:
|
||||
link = ''
|
||||
break
|
||||
return ''
|
||||
}
|
||||
|
||||
return link
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user