mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-29 04:15:23 +00:00
c0cd668c64
* Layed out components for custom nodes. * Outline of custom nodes. Still missing various features and error handling. * Persist custom nodes to local storage. * Make custom nodes removable. * Add latest block functions, call it when switching nodes. * Initialize correct node, move node utils into utils file. * Fix names * Send headers along with rpc requests. * Remove custom network options for now. * PR feedback. * One last log. * Fix tests. * Headers in batch too. * Switch to node when you add it. * Reduce hackery. * Clean up linter and tsc. * Fix latest block hex conversion. * Unit tests. * Fix missing property. * Fix Modal title typing.
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import {
|
|
NetworkConfig,
|
|
NetworkContract,
|
|
NETWORKS,
|
|
NodeConfig,
|
|
CustomNodeConfig
|
|
} from 'config/data';
|
|
import { INode } from 'libs/nodes/INode';
|
|
import { AppState } from 'reducers';
|
|
|
|
export function getNode(state: AppState): string {
|
|
return state.config.nodeSelection;
|
|
}
|
|
|
|
export function getNodeConfig(state: AppState): NodeConfig {
|
|
return state.config.node;
|
|
}
|
|
|
|
export function getNodeLib(state: AppState): INode {
|
|
return getNodeConfig(state).lib;
|
|
}
|
|
|
|
export function getNetworkConfig(state: AppState): NetworkConfig {
|
|
return NETWORKS[getNodeConfig(state).network];
|
|
}
|
|
|
|
export function getNetworkContracts(state: AppState): NetworkContract[] | null {
|
|
return getNetworkConfig(state).contracts;
|
|
}
|
|
|
|
export function getGasPriceGwei(state: AppState): number {
|
|
return state.config.gasPriceGwei;
|
|
}
|
|
|
|
export function getLanguageSelection(state: AppState): string {
|
|
return state.config.languageSelection;
|
|
}
|
|
|
|
export function getCustomNodeConfigs(state: AppState): CustomNodeConfig[] {
|
|
return state.config.customNodes;
|
|
}
|