1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Use chain ID instead of network name for getIsMainnet (#10488)

This commit is contained in:
David Walsh 2021-02-23 10:27:32 -06:00 committed by GitHub
parent 73e0fdddd0
commit 839693b685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View File

@ -78,6 +78,7 @@ describe('gas-modal-page-container container', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
currentNetworkTxList: [
{
@ -200,6 +201,7 @@ describe('gas-modal-page-container container', function () {
provider: {
...baseMockState.metamask.provider,
type: 'rinkeby',
chainId: '0x4',
},
},
},
@ -225,6 +227,7 @@ describe('gas-modal-page-container container', function () {
provider: {
...baseMockState.metamask.provider,
type: 'rinkeby',
chainId: '0x4',
},
},
},
@ -246,6 +249,7 @@ describe('gas-modal-page-container container', function () {
provider: {
...baseMockState.metamask.provider,
type: 'mainnet',
chainId: '0x1',
},
},
},

View File

@ -23,7 +23,7 @@ describe('Token Cell', function () {
conversionRate: 7.0,
preferences: {},
provider: {
chainId: '1',
chainId: '0x1',
ticker: 'ETH',
type: 'mainnet',
},

View File

@ -29,6 +29,7 @@ describe('CurrencyInput container', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
},

View File

@ -2,7 +2,7 @@ import { stripHexPrefix } from 'ethereumjs-util';
import { createSelector } from 'reselect';
import { addHexPrefix } from '../../../app/scripts/lib/util';
import {
MAINNET,
MAINNET_CHAIN_ID,
TEST_CHAINS,
NETWORK_TYPE_RPC,
} from '../../../shared/constants/network';
@ -289,8 +289,8 @@ function getSuggestedTokenCount(state) {
}
export function getIsMainnet(state) {
const networkType = getNetworkIdentifier(state);
return networkType === MAINNET;
const chainId = getCurrentChainId(state);
return chainId === MAINNET_CHAIN_ID;
}
export function getIsTestnet(state) {

View File

@ -55,6 +55,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {
@ -105,6 +106,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {
@ -155,6 +157,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'rinkeby',
chainId: '0x4',
},
},
gas: {
@ -205,6 +208,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'rinkeby',
chainId: '0x4',
},
},
gas: {
@ -249,6 +253,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {
@ -310,6 +315,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {
@ -354,6 +360,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {
@ -404,6 +411,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'rinkeby',
chainId: '0x4',
},
},
gas: {
@ -454,6 +462,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'rinkeby',
chainId: '0x4',
},
},
gas: {
@ -498,6 +507,7 @@ describe('custom-gas selectors', function () {
},
provider: {
type: 'mainnet',
chainId: '0x1',
},
},
gas: {