From 69fb521c7a1421f20d7ffce85ae2dc49051cc16e Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Fri, 3 Jul 2020 11:10:58 -0700 Subject: [PATCH] Begin consolidating network enums (#8914) --- .../controllers/network/createInfuraClient.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/scripts/controllers/network/createInfuraClient.js b/app/scripts/controllers/network/createInfuraClient.js index 9f16b1297..a03dce7e6 100644 --- a/app/scripts/controllers/network/createInfuraClient.js +++ b/app/scripts/controllers/network/createInfuraClient.js @@ -8,6 +8,7 @@ import createBlockTrackerInspectorMiddleware from 'eth-json-rpc-middleware/block import providerFromMiddleware from 'eth-json-rpc-middleware/providerFromMiddleware' import createInfuraMiddleware from 'eth-json-rpc-infura' import BlockTracker from 'eth-block-tracker' +import * as networkEnums from './enums' export default function createInfuraClient ({ network }) { const infuraMiddleware = createInfuraMiddleware({ network, maxAttempts: 5, source: 'metamask' }) @@ -32,23 +33,23 @@ function createNetworkAndChainIdMiddleware ({ network }) { switch (network) { case 'mainnet': - netId = '1' + netId = networkEnums.MAINNET_NETWORK_ID.toString() chainId = '0x01' break case 'ropsten': - netId = '3' + netId = networkEnums.ROPSTEN_NETWORK_ID.toString() chainId = '0x03' break case 'rinkeby': - netId = '4' + netId = networkEnums.RINKEBY_NETWORK_ID.toString() chainId = '0x04' break case 'kovan': - netId = '42' - chainId = '0x2a' + netId = networkEnums.KOVAN_NETWORK_ID.toString() + chainId = networkEnums.KOVAN_CHAIN_ID break case 'goerli': - netId = '5' + netId = networkEnums.GOERLI_NETWORK_ID.toString() chainId = '0x05' break default: