From 00c808fd7fb6e25729a4b0e769c7ee4b8f135608 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Fri, 14 Apr 2017 01:25:01 -0500 Subject: [PATCH] create config reducer and move config component default state into reducer --- common/reducers/config.js | 152 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 common/reducers/config.js diff --git a/common/reducers/config.js b/common/reducers/config.js new file mode 100644 index 00000000..debe4353 --- /dev/null +++ b/common/reducers/config.js @@ -0,0 +1,152 @@ +import { + CONFIG_LANGUAGE_CHANGE, + CONFIG_LANGUAGE_DROPDOWN_TOGGLE, + CONFIG_NODE_CHANGE, + CONFIG_NODE_DROPDOWN_TOGGLE +} from 'actions/config' + + +const initialState = { + languageSelection: 0, + languageToggle: false, + nodeSelection: 0, + nodeToggle: false +} + +export function config(state = initialState, action) { + switch (action.type) { + case CONFIG_LANGUAGE_CHANGE: { + return { + ...state, + languageSelection: action.index, + languageToggle: false + } + } + case CONFIG_LANGUAGE_DROPDOWN_TOGGLE: { + return { + ...state, + languageToggle: !state.languageToggle + } + } + case CONFIG_NODE_CHANGE: { + return { + ...state, + nodeSelection: action.index, + nodeToggle: false + } + } + case CONFIG_NODE_DROPDOWN_TOGGLE: { + return { + ...state, + nodeToggle: !state.languageToggle + } + } + default: + return state + } +} + +export const languages = [ + { + 'sign': 'en', + 'name': 'English' + }, + { + 'sign': 'de', + 'name': 'Deutsch' + }, + { + 'sign': 'el', + 'name': 'Ελληνικά' + }, + // { + // "sign": 'el', + // "name": 'Ελληνικά' + // }, + // { + // "sign": 'el', + // "name": 'Ελληνικά' + // }, + // { + // "sign": 'el', + // "name": 'Ελληνικά' + // }, + // { + // "sign": 'el', + // "name": 'Ελληνικά' + // }, + // { + // "sign": 'el', + // "name": 'Ελληνικά' + // }, + +]; + + +export const nodeList = [ + { + 'name': 'ETH', + 'blockExplorerTX': 'https://etherscan.io/tx/[[txHash]]', + 'blockExplorerAddr': 'https://etherscan.io/address/[[address]]', + // 'type': nodes.nodeTypes.ETH, + 'eip155': true, + 'chainId': 1, + // 'tokenList': require('./tokens/ethTokens.json'), + // 'abiList': require('./abiDefinitions/ethAbi.json'), + 'estimateGas': true, + 'service': 'MyEtherWallet', + // 'lib': new nodes.customNode('https://api.myetherapi.com/eth', '') + }, + { + 'name': 'ETH', + 'blockExplorerTX': 'https://etherscan.io/tx/[[txHash]]', + 'blockExplorerAddr': 'https://etherscan.io/address/[[address]]', + // 'type': nodes.nodeTypes.ETH, + 'eip155': true, + 'chainId': 1, + // 'tokenList': require('./tokens/ethTokens.json'), + // 'abiList': require('./abiDefinitions/ethAbi.json'), + 'estimateGas': false, + 'service': 'Etherscan.io', + // 'lib': require('./nodeHelpers/etherscan') + }, + { + 'name': 'Ropsten', + // 'type': nodes.nodeTypes.Ropsten, + 'blockExplorerTX': 'https://ropsten.etherscan.io/tx/[[txHash]]', + 'blockExplorerAddr': 'https://ropsten.etherscan.io/address/[[address]]', + 'eip155': true, + 'chainId': 3, + // 'tokenList': require('./tokens/ropstenTokens.json'), + // 'abiList': require('./abiDefinitions/ropstenAbi.json'), + 'estimateGas': false, + 'service': 'MyEtherWallet', + // 'lib': new nodes.customNode('https://api.myetherapi.com/rop', '') + }, + { + 'name': 'Kovan', + // 'type': nodes.nodeTypes.Kovan, + 'blockExplorerTX': 'https://kovan.etherscan.io/tx/[[txHash]]', + 'blockExplorerAddr': 'https://kovan.etherscan.io/address/[[address]]', + 'eip155': true, + 'chainId': 42, + // 'tokenList': require('./tokens/kovanTokens.json'), + // 'abiList': require('./abiDefinitions/kovanAbi.json'), + 'estimateGas': false, + 'service': 'Etherscan.io', + // 'lib': require('./nodeHelpers/etherscanKov') + }, + { + 'name': 'ETC', + 'blockExplorerTX': 'https://gastracker.io/tx/[[txHash]]', + 'blockExplorerAddr': 'https://gastracker.io/addr/[[address]]', + // 'type': nodes.nodeTypes.ETC, + 'eip155': true, + 'chainId': 61, + // 'tokenList': require('./tokens/etcTokens.json'), + // 'abiList': require('./abiDefinitions/etcAbi.json'), + 'estimateGas': false, + 'service': 'Epool.io', + // 'lib': new nodes.customNode('https://mewapi.epool.io', '') + } +]