2017-09-25 02:06:28 +00:00
|
|
|
import {
|
|
|
|
NetworkConfig,
|
|
|
|
NetworkContract,
|
|
|
|
NodeConfig,
|
2017-12-01 16:09:51 +00:00
|
|
|
CustomNodeConfig,
|
|
|
|
CustomNetworkConfig
|
2017-09-25 02:06:28 +00:00
|
|
|
} from 'config/data';
|
|
|
|
import { INode } from 'libs/nodes/INode';
|
|
|
|
import { AppState } from 'reducers';
|
2017-12-01 16:09:51 +00:00
|
|
|
import { getNetworkConfigFromId } from 'utils/network';
|
2017-09-25 02:06:28 +00:00
|
|
|
|
|
|
|
export function getNode(state: AppState): string {
|
|
|
|
return state.config.nodeSelection;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getNodeConfig(state: AppState): NodeConfig {
|
2017-11-18 20:33:53 +00:00
|
|
|
return state.config.node;
|
2017-09-25 02:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getNodeLib(state: AppState): INode {
|
2017-11-18 20:33:53 +00:00
|
|
|
return getNodeConfig(state).lib;
|
2017-09-25 02:06:28 +00:00
|
|
|
}
|
|
|
|
|
2017-12-01 16:09:51 +00:00
|
|
|
export function getNetworkConfig(state: AppState): NetworkConfig | undefined {
|
|
|
|
return getNetworkConfigFromId(
|
|
|
|
getNodeConfig(state).network,
|
|
|
|
getCustomNetworkConfigs(state)
|
|
|
|
);
|
2017-09-25 02:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getNetworkContracts(state: AppState): NetworkContract[] | null {
|
2017-12-01 16:09:51 +00:00
|
|
|
const network = getNetworkConfig(state);
|
|
|
|
return network ? network.contracts : [];
|
2017-09-25 02:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getGasPriceGwei(state: AppState): number {
|
|
|
|
return state.config.gasPriceGwei;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getLanguageSelection(state: AppState): string {
|
|
|
|
return state.config.languageSelection;
|
|
|
|
}
|
2017-11-18 20:33:53 +00:00
|
|
|
|
|
|
|
export function getCustomNodeConfigs(state: AppState): CustomNodeConfig[] {
|
|
|
|
return state.config.customNodes;
|
|
|
|
}
|
2017-11-29 00:17:26 +00:00
|
|
|
|
2017-12-01 16:09:51 +00:00
|
|
|
export function getCustomNetworkConfigs(
|
|
|
|
state: AppState
|
|
|
|
): CustomNetworkConfig[] {
|
|
|
|
return state.config.customNetworks;
|
|
|
|
}
|
|
|
|
|
2017-11-29 00:17:26 +00:00
|
|
|
export function getOffline(state: AppState): boolean {
|
|
|
|
return state.config.offline;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getForceOffline(state: AppState): boolean {
|
|
|
|
return state.config.forceOffline;
|
|
|
|
}
|