Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Update testnet detection (#4746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored and arkpar committed Mar 3, 2017
1 parent 6221c1e commit 6758f68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/src/dapps/basiccoin/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function attachInstances () {
])
.then(([registryAddress, netChain]) => {
const registry = api.newContract(abis.registry, registryAddress).instance;
isTest = ['morden', 'ropsten', 'testnet'].includes(netChain);
isTest = ['kovan', 'morden', 'ropsten', 'testnet'].includes(netChain);

console.log(`contract was found at registry=${registryAddress}`);
console.log(`running on ${netChain}, isTest=${isTest}`);
Expand Down
9 changes: 5 additions & 4 deletions js/src/dapps/registry/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export const setIsTestnet = (isTestnet) => ({ type: 'set isTestnet', isTestnet }
export const fetchIsTestnet = () => (dispatch) =>
api.net.version()
.then((netVersion) => {
dispatch(setIsTestnet(
netVersion === '2' || // morden
netVersion === '3' // ropsten
));
dispatch(setIsTestnet([
'2', // morden
'3', // ropsten
'42' // kovan
].includes(netVersion)));
})
.catch((err) => {
console.error('could not check if testnet');
Expand Down
8 changes: 5 additions & 3 deletions js/src/redux/providers/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ export default class Status {
.then(([
netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode, upgradeStatus
]) => {
const isTest =
netVersion === '2' || // morden
netVersion === '3'; // ropsten
const isTest = [
'2', // morden
'3', // ropsten
'42' // kovan
].includes(netVersion);

const longStatus = {
netPeers,
Expand Down

0 comments on commit 6758f68

Please sign in to comment.