From fc4ff5d71cb28adc4e35db676fc5886c07ad27ca Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 11 Dec 2018 13:25:38 +0100 Subject: [PATCH] add "testnet" field to config, and filter those values for "dev build" only --- public/data/appConfig.json | 2 ++ src/actions/LocalStorageActions.js | 5 ++--- src/reducers/LocalStorageReducer.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/data/appConfig.json b/public/data/appConfig.json index b484b97d..3e29f974 100644 --- a/public/data/appConfig.json +++ b/public/data/appConfig.json @@ -3,6 +3,7 @@ { "type": "ripple", "name": "Ripple Testnet", + "testnet": true, "symbol": "XRP", "shortcut": "xrp", "bip44": "m/44'/144'/a'/0/0", @@ -52,6 +53,7 @@ { "type": "ethereum", "name": "Ethereum Ropsten", + "testnet": true, "symbol": "tROP", "shortcut": "trop", "chainId": 3, diff --git a/src/actions/LocalStorageActions.js b/src/actions/LocalStorageActions.js index 16077553..b95e4ba4 100644 --- a/src/actions/LocalStorageActions.js +++ b/src/actions/LocalStorageActions.js @@ -141,10 +141,9 @@ const loadJSON = (): AsyncAction => async (dispatch: Dispatch): Promise => try { const config: Config = await httpRequest(AppConfigJSON, 'json'); - // remove ropsten testnet from config networks + // remove testnets from config networks if (!buildUtils.isDev()) { - const index = config.networks.findIndex(c => c.shortcut === 'trop'); - delete config.networks[index]; + config.networks = config.networks.filter(n => !n.testnet); } const ERC20Abi = await httpRequest(Erc20AbiJSON, 'json'); diff --git a/src/reducers/LocalStorageReducer.js b/src/reducers/LocalStorageReducer.js index cb486f99..976de717 100644 --- a/src/reducers/LocalStorageReducer.js +++ b/src/reducers/LocalStorageReducer.js @@ -8,6 +8,7 @@ import type { Action } from 'flowtype'; export type Network = { type: string; name: string; + testnet?: boolean; shortcut: string; symbol: string; bip44: string;