MyCrypto/common/selectors/config.js

34 lines
963 B
JavaScript
Raw Normal View History

2017-07-04 01:25:01 +00:00
// @flow
import type { State } from 'reducers';
import { BaseNode } from 'libs/nodes';
import { NODES, NETWORKS } from 'config/data';
import type { NodeConfig, NetworkConfig, NetworkContract } from 'config/data';
export function getNode(state: State): string {
return state.config.nodeSelection;
}
2017-07-04 01:25:01 +00:00
export function getNodeConfig(state: State): NodeConfig {
return NODES[state.config.nodeSelection];
}
2017-07-04 01:25:01 +00:00
export function getNodeLib(state: State): BaseNode {
2017-07-04 03:21:19 +00:00
return NODES[state.config.nodeSelection].lib;
2017-07-04 01:25:01 +00:00
}
export function getNetworkConfig(state: State): NetworkConfig {
return NETWORKS[NODES[state.config.nodeSelection].network];
}
export function getNetworkContracts(state: State): ?Array<NetworkContract> {
return getNetworkConfig(state).contracts;
}
export function getGasPriceGwei(state: State): number {
return state.config.gasPriceGwei;
}
export function getLanguageSelection(state: State): string {
return state.config.languageSelection;
}