mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
7af902e500
* Make chainId available in the metamask-inpage-provider * Update metamask-inpage-provider to 2.1.0 * Add e2e tests for ethereum.on events * Move chainId constants to lib/enums.js * Don't use new chainId enums in createInfuraClient * Fix app/scripts/lib/select-chain-id.js
23 lines
500 B
JavaScript
23 lines
500 B
JavaScript
const {
|
|
MAINNET_CHAIN_ID,
|
|
ROPSTEN_CHAIN_ID,
|
|
RINKEBY_CHAIN_ID,
|
|
KOVAN_CHAIN_ID,
|
|
GOERLI_CHAIN_ID,
|
|
} = require('./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: { chaindId } } = metamaskState
|
|
return standardNetworkId[network] || `0x${parseInt(chaindId, 10).toString(16)}`
|
|
}
|
|
|
|
module.exports = selectChainId
|