Wrangle types due to webpack weirdness.
This commit is contained in:
parent
02d8f4b6a1
commit
efe55e108e
|
@ -4,12 +4,7 @@ import {
|
|||
CustomNetworkAction,
|
||||
TypeKeys
|
||||
} from 'actions/config';
|
||||
import { CustomNetworkConfig } from 'types/network';
|
||||
|
||||
// TODO: this doesn't accurately represent state, as
|
||||
export interface State {
|
||||
[customNetworkId: string]: CustomNetworkConfig;
|
||||
}
|
||||
import { CustomNetworksState as State } from './types';
|
||||
|
||||
const addCustomNetwork = (state: State, { payload }: AddCustomNetworkAction): State => ({
|
||||
...state,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { customNetworks, State as CustomNetworksState } from './customNetworks';
|
||||
import { staticNetworks, State as StaticNetworksState } from './staticNetworks';
|
||||
import { combineReducers } from 'redux';
|
||||
import { customNetworks } from './customNetworks';
|
||||
import { staticNetworks } from './staticNetworks';
|
||||
import { StaticNetworksState, CustomNetworksState } from './types';
|
||||
|
||||
interface State {
|
||||
customNetworks: CustomNetworksState;
|
||||
|
|
|
@ -16,9 +16,8 @@ import {
|
|||
UBQ_DEFAULT
|
||||
} from 'config/dpaths';
|
||||
import { ConfigAction } from 'actions/config';
|
||||
import { StaticNetworkIds, StaticNetworkConfig, BlockExplorerConfig } from 'types/network';
|
||||
|
||||
export type State = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
import { BlockExplorerConfig } from 'types/network';
|
||||
import { StaticNetworksState as State } from './types';
|
||||
|
||||
// Must be a website that follows the ethplorer convention of /tx/[hash] and
|
||||
// address/[address] to generate the correct functions.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Moving state types into their own file resolves an annoying webpack bug
|
||||
// https://github.com/angular/angular-cli/issues/2034
|
||||
import { StaticNetworkIds, StaticNetworkConfig, CustomNetworkConfig } from 'types/network';
|
||||
|
||||
export type StaticNetworksState = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
|
||||
// TODO: this doesn't accurately represent custom networks state
|
||||
export interface CustomNetworksState {
|
||||
[customNetworkId: string]: CustomNetworkConfig;
|
||||
}
|
|
@ -4,11 +4,7 @@ import {
|
|||
AddCustomNodeAction,
|
||||
RemoveCustomNodeAction
|
||||
} from 'actions/config';
|
||||
import { CustomNodeConfig } from 'types/node';
|
||||
|
||||
export interface State {
|
||||
[customNodeId: string]: CustomNodeConfig;
|
||||
}
|
||||
import { CustomNodesState as State } from './types';
|
||||
|
||||
const addCustomNode = (state: State, { payload }: AddCustomNodeAction): State => ({
|
||||
...state,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { customNodes, State as CustomNodesState } from './customNodes';
|
||||
import { staticNodes, State as StaticNodesState } from './staticNodes';
|
||||
import { selectedNode, State as SelectedNodeState } from './selectedNode';
|
||||
import { combineReducers } from 'redux';
|
||||
import { customNodes } from './customNodes';
|
||||
import { staticNodes } from './staticNodes';
|
||||
import { selectedNode } from './selectedNode';
|
||||
import { CustomNodesState, StaticNodesState, SelectedNodeState } from './types';
|
||||
|
||||
interface State {
|
||||
customNodes: CustomNodesState;
|
||||
|
|
|
@ -6,20 +6,9 @@ import {
|
|||
RemoveCustomNodeAction,
|
||||
CustomNodeAction
|
||||
} from 'actions/config';
|
||||
import { SelectedNodeState as State } from './types';
|
||||
|
||||
interface NodeLoaded {
|
||||
pending: false;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
interface NodeChangePending {
|
||||
pending: true;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
export type State = NodeLoaded | NodeChangePending;
|
||||
|
||||
export const INITIAL_STATE: NodeLoaded = {
|
||||
export const INITIAL_STATE: State = {
|
||||
nodeId: 'eth_mycrypto',
|
||||
pending: false
|
||||
};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import { EtherscanNode, InfuraNode, RPCNode } from 'libs/nodes';
|
||||
import { TypeKeys, NodeAction } from 'actions/config';
|
||||
import { NonWeb3NodeConfigs, Web3NodeConfigs } from 'types/node';
|
||||
|
||||
export type State = NonWeb3NodeConfigs & Web3NodeConfigs;
|
||||
import { StaticNodesState as State } from './types';
|
||||
|
||||
export const INITIAL_STATE: State = {
|
||||
eth_mycrypto: {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Moving state types into their own file resolves an annoying webpack bug
|
||||
// https://github.com/angular/angular-cli/issues/2034
|
||||
import { NonWeb3NodeConfigs, Web3NodeConfigs, CustomNodeConfig } from 'types/node';
|
||||
|
||||
export interface CustomNodesState {
|
||||
[customNodeId: string]: CustomNodeConfig;
|
||||
}
|
||||
|
||||
interface NodeLoaded {
|
||||
pending: false;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
interface NodeChangePending {
|
||||
pending: true;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
export type SelectedNodeState = NodeLoaded | NodeChangePending;
|
||||
|
||||
export type StaticNodesState = NonWeb3NodeConfigs & Web3NodeConfigs;
|
Loading…
Reference in New Issue