1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Compare the networkId against the correct enum in eth and token overview components (#9485)

This commit is contained in:
Dan J Miller 2020-10-06 17:34:53 -02:30 committed by GitHub
parent dd3c2cc3ec
commit 94810ce9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import SendIcon from '../../ui/icon/overview-send-icon.component'
import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps'
import { ETH_SWAPS_TOKEN_OBJECT } from '../../../helpers/constants/swaps'
import IconButton from '../../ui/icon-button'
import { MAINNET_NETWORK_ID } from '../../../../../app/scripts/controllers/network/enums'
import WalletOverview from './wallet-overview'
const EthOverview = ({ className }) => {
@ -112,10 +113,10 @@ const EthOverview = ({ className }) => {
{swapsEnabled ? (
<IconButton
className="eth-overview__button"
disabled={networkId !== '1'}
disabled={networkId !== MAINNET_NETWORK_ID}
Icon={SwapIcon}
onClick={() => {
if (networkId === '1') {
if (networkId === MAINNET_NETWORK_ID) {
enteredSwapsEvent()
dispatch(setSwapsFromToken({
...ETH_SWAPS_TOKEN_OBJECT,

View File

@ -14,6 +14,7 @@ import { useTokenFiatAmount } from '../../../hooks/useTokenFiatAmount'
import { updateSendToken } from '../../../store/actions'
import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps'
import { getAssetImages, getCurrentKeyring, getCurrentNetworkId } from '../../../selectors/selectors'
import { MAINNET_NETWORK_ID } from '../../../../../app/scripts/controllers/network/enums'
import SwapIcon from '../../ui/icon/swap-icon.component'
import SendIcon from '../../ui/icon/overview-send-icon.component'
@ -81,10 +82,10 @@ const TokenOverview = ({ className, token }) => {
{swapsEnabled ? (
<IconButton
className="token-overview__button"
disabled={networkId !== '1'}
disabled={networkId !== MAINNET_NETWORK_ID}
Icon={SwapIcon}
onClick={() => {
if (networkId === '1') {
if (networkId === MAINNET_NETWORK_ID) {
enteredSwapsEvent()
dispatch(setSwapsFromToken({ ...token, iconUrl: assetImages[token.address] }))
if (usingHardwareWallet) {