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

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent 73e0fdddd0
commit 839693b685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-container.test.js
  2. 2
      ui/app/components/app/token-cell/token-cell.test.js
  3. 1
      ui/app/components/ui/currency-input/tests/currency-input.container.test.js
  4. 6
      ui/app/selectors/selectors.js
  5. 10
      ui/app/selectors/tests/custom-gas.test.js

@ -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',
}, },
}, },
}, },

@ -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',
}, },

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

@ -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) {

@ -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: {

Loading…
Cancel
Save