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

Begin consolidating network enums (#8914)

This commit is contained in:
Erik Marks 2020-07-03 11:10:58 -07:00 committed by GitHub
parent f97f95cc86
commit 69fb521c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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