2017-07-04 05:25:01 +04:00
|
|
|
// @flow
|
|
|
|
import type { State } from 'reducers';
|
|
|
|
import { BaseNode } from 'libs/nodes';
|
2017-07-14 01:02:39 +04:00
|
|
|
import { NODES, NETWORKS } from 'config/data';
|
2017-08-23 02:57:18 -04:00
|
|
|
import type { NodeConfig, NetworkConfig, NetworkContract } from 'config/data';
|
2017-07-27 20:31:59 -04:00
|
|
|
|
|
|
|
export function getNode(state: State): string {
|
|
|
|
return state.config.nodeSelection;
|
|
|
|
}
|
2017-07-04 05:25:01 +04:00
|
|
|
|
2017-08-23 02:57:18 -04:00
|
|
|
export function getNodeConfig(state: State): NodeConfig {
|
|
|
|
return NODES[state.config.nodeSelection];
|
|
|
|
}
|
|
|
|
|
2017-07-04 05:25:01 +04:00
|
|
|
export function getNodeLib(state: State): BaseNode {
|
2017-07-03 22:21:19 -05:00
|
|
|
return NODES[state.config.nodeSelection].lib;
|
2017-07-04 05:25:01 +04:00
|
|
|
}
|
2017-07-14 01:02:39 +04:00
|
|
|
|
|
|
|
export function getNetworkConfig(state: State): NetworkConfig {
|
|
|
|
return NETWORKS[NODES[state.config.nodeSelection].network];
|
|
|
|
}
|
2017-07-27 20:31:59 -04:00
|
|
|
|
|
|
|
export function getNetworkContracts(state: State): ?Array<NetworkContract> {
|
|
|
|
return getNetworkConfig(state).contracts;
|
|
|
|
}
|
2017-08-11 17:54:10 -04:00
|
|
|
|
|
|
|
export function getGasPriceGwei(state: State): number {
|
|
|
|
return state.config.gasPriceGwei;
|
|
|
|
}
|