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

View File

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

View File

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

View File

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

View File

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