A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import {
|
|
|
|
MAINNET_CHAIN_ID,
|
|
|
|
ROPSTEN_CHAIN_ID,
|
|
|
|
RINKEBY_CHAIN_ID,
|
|
|
|
KOVAN_CHAIN_ID,
|
|
|
|
GOERLI_CHAIN_ID,
|
|
|
|
} from './enums'
|
|
|
|
|
|
|
|
const standardNetworkId = {
|
|
|
|
'1': MAINNET_CHAIN_ID,
|
|
|
|
'3': ROPSTEN_CHAIN_ID,
|
|
|
|
'4': RINKEBY_CHAIN_ID,
|
|
|
|
'42': KOVAN_CHAIN_ID,
|
|
|
|
'5': GOERLI_CHAIN_ID,
|
|
|
|
}
|
|
|
|
|
|
|
|
function selectChainId (metamaskState) {
|
|
|
|
const { network, provider: { chainId } } = metamaskState
|
|
|
|
return standardNetworkId[network] || `0x${parseInt(chainId, 10).toString(16)}`
|
|
|
|
}
|
|
|
|
|
|
|
|
export default selectChainId
|