2018-01-30 01:41:59 +00:00
|
|
|
import { RPCNode, Web3Node } from 'libs/nodes';
|
|
|
|
import { StaticNetworkNames } from './network';
|
|
|
|
import { StaticNodesState, CustomNodesState } from 'reducers/config/nodes';
|
2018-01-30 03:52:19 +00:00
|
|
|
import CustomNode from 'libs/nodes/custom';
|
2018-01-30 01:41:59 +00:00
|
|
|
|
|
|
|
interface CustomNodeConfig {
|
2018-01-30 03:52:19 +00:00
|
|
|
id: string;
|
|
|
|
isCustom: true;
|
2018-01-30 01:41:59 +00:00
|
|
|
name: string;
|
2018-01-30 03:52:19 +00:00
|
|
|
lib: CustomNode;
|
|
|
|
service: 'your custom node';
|
2018-01-30 01:41:59 +00:00
|
|
|
url: string;
|
|
|
|
port: number;
|
|
|
|
network: string;
|
|
|
|
auth?: {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
interface StaticNodeConfig {
|
2018-01-30 03:52:19 +00:00
|
|
|
isCustom: false;
|
2018-01-30 01:41:59 +00:00
|
|
|
network: StaticNetworkNames;
|
|
|
|
lib: RPCNode | Web3Node;
|
|
|
|
service: string;
|
|
|
|
estimateGas?: boolean;
|
|
|
|
hidden?: boolean;
|
|
|
|
}
|
|
|
|
|
2018-01-30 03:52:19 +00:00
|
|
|
interface Web3NodeConfig extends StaticNodeConfig {
|
|
|
|
lib: Web3Node;
|
|
|
|
}
|
|
|
|
|
2018-01-30 01:41:59 +00:00
|
|
|
declare enum StaticNodeName {
|
|
|
|
ETH_MEW = 'eth_mew',
|
|
|
|
ETH_MYCRYPTO = 'eth_mycrypto',
|
|
|
|
ETH_ETHSCAN = 'eth_ethscan',
|
|
|
|
ETH_INFURA = 'eth_infura',
|
|
|
|
ROP_MEW = 'rop_mew',
|
|
|
|
ROP_INFURA = 'rop_infura',
|
|
|
|
KOV_ETHSCAN = 'kov_ethscan',
|
|
|
|
RIN_ETHSCAN = 'rin_ethscan',
|
|
|
|
RIN_INFURA = 'rin_infura',
|
|
|
|
ETC_EPOOL = 'etc_epool',
|
|
|
|
UBQ = 'ubq',
|
|
|
|
EXP_TECH = 'exp_tech'
|
|
|
|
}
|
|
|
|
|
|
|
|
type NonWeb3NodeConfigs = { [key in StaticNodeName]: StaticNodeConfig };
|
|
|
|
|
|
|
|
interface Web3NodeConfig {
|
2018-01-30 03:52:19 +00:00
|
|
|
web3?: Web3NodeConfig;
|
2018-01-30 01:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type NodeConfig = StaticNodesState[StaticNodeName] | CustomNodesState[string];
|