2018-02-12 20:43:07 +00:00
|
|
|
import { EtherscanNode, InfuraNode, RPCNode } from 'libs/nodes';
|
|
|
|
import { TypeKeys, NodeAction } from 'actions/config';
|
2018-04-05 20:53:36 +00:00
|
|
|
import { StaticNodesState as State } from './types';
|
2018-02-12 20:43:07 +00:00
|
|
|
|
|
|
|
export const INITIAL_STATE: State = {
|
|
|
|
eth_mycrypto: {
|
|
|
|
network: 'ETH',
|
|
|
|
isCustom: false,
|
|
|
|
lib: new RPCNode('https://api.mycryptoapi.com/eth'),
|
|
|
|
service: 'MyCrypto',
|
|
|
|
estimateGas: true
|
|
|
|
},
|
|
|
|
eth_ethscan: {
|
|
|
|
network: 'ETH',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'Etherscan.io',
|
|
|
|
lib: new EtherscanNode('https://api.etherscan.io/api'),
|
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
eth_infura: {
|
|
|
|
network: 'ETH',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'infura.io',
|
2018-02-14 23:05:43 +00:00
|
|
|
lib: new InfuraNode('https://mainnet.infura.io/mycrypto'),
|
2018-02-12 20:43:07 +00:00
|
|
|
estimateGas: false
|
|
|
|
},
|
2018-02-24 17:56:18 +00:00
|
|
|
eth_blockscale: {
|
|
|
|
network: 'ETH',
|
|
|
|
isCustom: false,
|
|
|
|
lib: new RPCNode('https://api.dev.blockscale.net/dev/parity'),
|
|
|
|
service: 'Blockscale beta',
|
|
|
|
estimateGas: true
|
|
|
|
},
|
2018-02-12 20:43:07 +00:00
|
|
|
rop_infura: {
|
|
|
|
network: 'Ropsten',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'infura.io',
|
2018-02-14 23:05:43 +00:00
|
|
|
lib: new InfuraNode('https://ropsten.infura.io/mycrypto'),
|
2018-02-12 20:43:07 +00:00
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
kov_ethscan: {
|
|
|
|
network: 'Kovan',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'Etherscan.io',
|
|
|
|
lib: new EtherscanNode('https://kovan.etherscan.io/api'),
|
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
rin_ethscan: {
|
|
|
|
network: 'Rinkeby',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'Etherscan.io',
|
|
|
|
lib: new EtherscanNode('https://rinkeby.etherscan.io/api'),
|
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
rin_infura: {
|
|
|
|
network: 'Rinkeby',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'infura.io',
|
2018-02-14 23:05:43 +00:00
|
|
|
lib: new InfuraNode('https://rinkeby.infura.io/mycrypto'),
|
2018-02-12 20:43:07 +00:00
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
etc_epool: {
|
|
|
|
network: 'ETC',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'Epool.io',
|
|
|
|
lib: new RPCNode('https://mewapi.epool.io'),
|
|
|
|
estimateGas: false
|
|
|
|
},
|
|
|
|
ubq: {
|
|
|
|
network: 'UBQ',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'ubiqscan.io',
|
|
|
|
lib: new RPCNode('https://pyrus2.ubiqscan.io'),
|
|
|
|
estimateGas: true
|
|
|
|
},
|
|
|
|
exp_tech: {
|
|
|
|
network: 'EXP',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'Expanse.tech',
|
|
|
|
lib: new RPCNode('https://node.expanse.tech/'),
|
|
|
|
estimateGas: true
|
2018-04-06 14:02:02 +00:00
|
|
|
},
|
|
|
|
poa: {
|
|
|
|
network: 'POA',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'poa.network',
|
|
|
|
lib: new RPCNode('https://core.poa.network'),
|
|
|
|
estimateGas: true
|
|
|
|
},
|
|
|
|
tomo: {
|
|
|
|
network: 'TOMO',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'tomocoin.io',
|
|
|
|
lib: new RPCNode('https://core.tomocoin.io'),
|
|
|
|
estimateGas: true
|
|
|
|
},
|
|
|
|
ella: {
|
|
|
|
network: 'ELLA',
|
|
|
|
isCustom: false,
|
|
|
|
service: 'ellaism.org',
|
|
|
|
lib: new RPCNode('https://jsonrpc.ellaism.org'),
|
|
|
|
estimateGas: true
|
2018-02-12 20:43:07 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const staticNodes = (state: State = INITIAL_STATE, action: NodeAction) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case TypeKeys.CONFIG_NODE_WEB3_SET:
|
|
|
|
return { ...state, [action.payload.id]: action.payload.config };
|
|
|
|
case TypeKeys.CONFIG_NODE_WEB3_UNSET:
|
|
|
|
const stateCopy = { ...state };
|
|
|
|
Reflect.deleteProperty(stateCopy, 'web3');
|
|
|
|
return stateCopy;
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|