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