MyCrypto/common/actions/config/actionCreators.ts
HenryNguyen5 01fc5f1a89 Move Nodes/Networks to Redux (#961)
* Start splitting networks into their own reducers

* Split out nodes and networks into their own reducers

* Cleanup file structure

* Make selectors for new state

* Change custom network typing

* re-type repo

* Fix up components to use selectors, work on fixing sagas

* Provide consistency in naming, fix more sagas

* Get non web3 node switching working

* Split config rehydration off into a different file for store

* Inline auth for custom nodes

* Include typing for app state

* moar selectors

* Get web3 working + cleanup sagas

* Cleanup tsc errors

* Use forof loop instead of foreach for clearing pruning custom networks

* Add reducer tests for new redux state

* Export needed variables

* Add console error

* Remove old comment

* Work on saga tests

* Get passing existing saga tests

* Fix more tests

* Remove irrlevant tests

* add console error

* Get rest of tests passing

* Fix merge errors

* Remove random text

* Fix store saving

* Fix selector lib only grabbing from static nodes

* Fix custom node removal crashing app

* Infer selected network via node

* Prune custom networks properly on node removal

* Infer network name from chainid from selecting state

* Cleanup tsc errors

* Remove MEW nodes for main and testnet
2018-02-12 14:43:07 -06:00

114 lines
2.9 KiB
TypeScript

import * as interfaces from './actionTypes';
import { TypeKeys } from './constants';
export type TToggleOffline = typeof toggleOffline;
export function toggleOffline(): interfaces.ToggleOfflineAction {
return {
type: TypeKeys.CONFIG_TOGGLE_OFFLINE
};
}
export type TToggleAutoGasLimit = typeof toggleAutoGasLimit;
export function toggleAutoGasLimit(): interfaces.ToggleAutoGasLimitAction {
return {
type: TypeKeys.CONFIG_TOGGLE_AUTO_GAS_LIMIT
};
}
export type TChangeLanguage = typeof changeLanguage;
export function changeLanguage(sign: string): interfaces.ChangeLanguageAction {
return {
type: TypeKeys.CONFIG_LANGUAGE_CHANGE,
payload: sign
};
}
export type TChangeNode = typeof changeNode;
export function changeNode(
payload: interfaces.ChangeNodeAction['payload']
): interfaces.ChangeNodeAction {
return {
type: TypeKeys.CONFIG_NODE_CHANGE,
payload
};
}
export type TPollOfflineStatus = typeof pollOfflineStatus;
export function pollOfflineStatus(): interfaces.PollOfflineStatus {
return {
type: TypeKeys.CONFIG_POLL_OFFLINE_STATUS
};
}
export type TChangeNodeIntent = typeof changeNodeIntent;
export function changeNodeIntent(payload: string): interfaces.ChangeNodeIntentAction {
return {
type: TypeKeys.CONFIG_NODE_CHANGE_INTENT,
payload
};
}
export type TAddCustomNode = typeof addCustomNode;
export function addCustomNode(
payload: interfaces.AddCustomNodeAction['payload']
): interfaces.AddCustomNodeAction {
return {
type: TypeKeys.CONFIG_ADD_CUSTOM_NODE,
payload
};
}
export type TRemoveCustomNode = typeof removeCustomNode;
export function removeCustomNode(
payload: interfaces.RemoveCustomNodeAction['payload']
): interfaces.RemoveCustomNodeAction {
return {
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NODE,
payload
};
}
export type TAddCustomNetwork = typeof addCustomNetwork;
export function addCustomNetwork(
payload: interfaces.AddCustomNetworkAction['payload']
): interfaces.AddCustomNetworkAction {
return {
type: TypeKeys.CONFIG_ADD_CUSTOM_NETWORK,
payload
};
}
export type TRemoveCustomNetwork = typeof removeCustomNetwork;
export function removeCustomNetwork(
payload: interfaces.RemoveCustomNetworkAction['payload']
): interfaces.RemoveCustomNetworkAction {
return {
type: TypeKeys.CONFIG_REMOVE_CUSTOM_NETWORK,
payload
};
}
export type TSetLatestBlock = typeof setLatestBlock;
export function setLatestBlock(payload: string): interfaces.SetLatestBlockAction {
return {
type: TypeKeys.CONFIG_SET_LATEST_BLOCK,
payload
};
}
export function web3SetNode(
payload: interfaces.Web3setNodeAction['payload']
): interfaces.Web3setNodeAction {
return {
type: TypeKeys.CONFIG_NODE_WEB3_SET,
payload
};
}
export type TWeb3UnsetNode = typeof web3UnsetNode;
export function web3UnsetNode(): interfaces.Web3UnsetNodeAction {
return {
type: TypeKeys.CONFIG_NODE_WEB3_UNSET
};
}