aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-21 13:20:08 +0800
committerGitHub <noreply@github.com>2018-10-21 13:20:08 +0800
commit61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e (patch)
tree57b20620dcb2e0eea38c0e1e1ccf7cfb4cb597b7 /app
parent2f6530a4948743fe156dc3519f04bd44f7c6e2ae (diff)
downloadtangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar.gz
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar.bz2
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar.lz
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar.xz
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.tar.zst
tangerine-wallet-browser-61c7bbb1c1f0c216d5f8cd0d0753c78bc635624e.zip
network - improve logging and type conversion
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/network/network.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js
index b386161da..904c20cff 100644
--- a/app/scripts/controllers/network/network.js
+++ b/app/scripts/controllers/network/network.js
@@ -86,17 +86,19 @@ module.exports = class NetworkController extends EventEmitter {
return log.warn('NetworkController - lookupNetwork aborted due to missing provider')
}
const ethQuery = new EthQuery(this._provider)
- ethQuery.sendAsync({ method: 'eth_chainId' }, (err, 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('web3.getNetwork returned net_version = ' + network)
+ log.info(`net_version returned ${network}`)
this.setNetworkState(network)
})
return
}
- log.info('web3.getNetwork returned chainId = ' + parseInt(chainId))
- this.setNetworkState(parseInt(chainId))
+ const chainId = Number.parseInt(chainIdHex, 16)
+ log.info(`net_version returned ${chainId}`)
+ this.setNetworkState(chainId)
})
}