mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-23 01:19:02 +00:00
01fc5f1a89
* 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
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import { RPCNode, Web3Node } from 'libs/nodes';
|
|
import { StaticNetworkIds } from './network';
|
|
import { StaticNodesState, CustomNodesState } from 'reducers/config/nodes';
|
|
import CustomNode from 'libs/nodes/custom';
|
|
|
|
interface CustomNodeConfig {
|
|
id: string;
|
|
isCustom: true;
|
|
name: string;
|
|
lib: CustomNode;
|
|
service: 'your custom node';
|
|
url: string;
|
|
port: number;
|
|
network: string;
|
|
auth?: {
|
|
username: string;
|
|
password: string;
|
|
};
|
|
}
|
|
|
|
interface StaticNodeConfig {
|
|
isCustom: false;
|
|
network: StaticNetworkIds;
|
|
lib: RPCNode | Web3Node;
|
|
service: string;
|
|
estimateGas?: boolean;
|
|
hidden?: boolean;
|
|
}
|
|
|
|
interface Web3NodeConfig extends StaticNodeConfig {
|
|
lib: Web3Node;
|
|
}
|
|
|
|
declare enum StaticNodeId {
|
|
ETH_MYCRYPTO = 'eth_mycrypto',
|
|
ETH_ETHSCAN = 'eth_ethscan',
|
|
ETH_INFURA = 'eth_infura',
|
|
ROP_INFURA = 'rop_infura',
|
|
KOV_ETHSCAN = 'kov_ethscan',
|
|
RIN_ETHSCAN = 'rin_ethscan',
|
|
RIN_INFURA = 'rin_infura',
|
|
ETC_EPOOL = 'etc_epool',
|
|
UBQ = 'ubq',
|
|
EXP_TECH = 'exp_tech'
|
|
}
|
|
|
|
type StaticNodeWithWeb3Id = StaticNodeId | 'web3';
|
|
|
|
type NonWeb3NodeConfigs = { [key in StaticNodeId]: StaticNodeConfig };
|
|
|
|
interface Web3NodeConfigs {
|
|
web3?: Web3NodeConfig;
|
|
}
|
|
|
|
type NodeConfig = StaticNodesState[StaticNodeId] | CustomNodesState[string];
|