Comparing version 4.0.10 to 4.1.0
{ | ||
"name": "ethrpc", | ||
"version": "4.0.10", | ||
"version": "4.1.0", | ||
"description": "Ethereum JSON RPC", | ||
@@ -5,0 +5,0 @@ "author": "The Augur Developers <team@augur.net>", |
@@ -23,2 +23,3 @@ # ethrpc | ||
ipcAddresses: [], // optional, default empty array | ||
networkID: 3, // optional, used to verify connection to the intended network (blockchain) | ||
connectionTimeout: 3000, // optional, default 3000 | ||
@@ -25,0 +26,0 @@ errorHandler: function (err) { /* out-of-band error */ }, // optional, used for errors that can't be correlated back to a request |
@@ -64,2 +64,8 @@ "use strict"; | ||
if (networkID instanceof Error || networkID.error) return initialConnectCallback(networkID); | ||
// If configuration.networkID is provided, verify that we're actually on that network | ||
if (configuration.networkID && parseInt(networkID, 10) !== parseInt(configuration.networkID, 10)) { | ||
return initialConnectCallback(networkID); | ||
} | ||
dispatch({ type: "SET_NETWORK_ID", networkID: networkID }); | ||
@@ -66,0 +72,0 @@ createBlockAndLogStreamer({ |
@@ -14,2 +14,3 @@ "use strict"; | ||
ipcAddresses: [], | ||
networkID: null, | ||
connectionTimeout: 3000, | ||
@@ -16,0 +17,0 @@ pollingIntervalMilliseconds: 30000, |
@@ -98,3 +98,6 @@ "use strict"; | ||
web3Transport = new Web3Transport(messageHandler, function (error) { | ||
resultAggregator.web3Transports[0] = (error !== null) ? null : web3Transport; | ||
// only use web3 transport if we're on mainnet (1) or public testnet (3) | ||
var networkID = parseInt(configuration.networkID, 10); | ||
var isMainnetOrPublicTestnet = !isNaN(networkID) && (networkID === 1 || networkID === 3); | ||
resultAggregator.web3Transports[0] = (error !== null || !isMainnetOrPublicTestnet) ? null : web3Transport; | ||
checkIfComplete(this, resultAggregator, callback); | ||
@@ -101,0 +104,0 @@ }.bind(this)); |
178897
4039
166