Skip to content

Commit

Permalink
Revert "support eth_chainId"
Browse files Browse the repository at this point in the history
  • Loading branch information
tmashuang authored Nov 3, 2018
1 parent 65b3d6b commit 5a72442
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions app/scripts/controllers/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,10 @@ module.exports = class NetworkController extends EventEmitter {
}
var { type } = this.providerStore.getState()
const ethQuery = new EthQuery(this._provider)
// first attempt to perform lookup via eth_chainId
ethQuery.sendAsync({ method: 'eth_chainId' }, (err, chainIdHex) => {
if (err) {
// if eth_chainId is not supported, fallback to net_verion
ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
if (err) return this.setNetworkState('loading')
log.info(`net_version returned ${network}`)
this.setNetworkState(network, type)
})
return
}
const chainId = Number.parseInt(chainIdHex, 16)
log.info(`net_version returned ${chainId}`)
this.setNetworkState(chainId, type)
ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
if (err) return this.setNetworkState('loading')
log.info('web3.getNetwork returned ' + network)
this.setNetworkState(network, type)
})
}

Expand Down

0 comments on commit 5a72442

Please sign in to comment.