mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 02:55:41 +00:00
5d3e461301
* Check in. * Add read only wallet and new types for that. Convert some components to require full wallet. * Fix readonly property, fix uncaught throw. * Disable address only on some tabs. * Use FullWalletOnly render callback to handle signing. * Work around uncertain wallet type. * Fix function args. * Undo bug fix that should be done in another branch. * Disable button while address is bad. * Remove log. * Convert anonymous functions to class functions.
39 lines
920 B
TypeScript
39 lines
920 B
TypeScript
import { CustomNode } from 'libs/nodes';
|
|
import { NODES, NodeConfig, CustomNodeConfig } from 'config/data';
|
|
|
|
export function makeCustomNodeId(config: CustomNodeConfig): string {
|
|
return `${config.url}:${config.port}`;
|
|
}
|
|
|
|
export function getCustomNodeConfigFromId(
|
|
id: string,
|
|
configs: CustomNodeConfig[]
|
|
): CustomNodeConfig | undefined {
|
|
return configs.find(node => makeCustomNodeId(node) === id);
|
|
}
|
|
|
|
export function getNodeConfigFromId(
|
|
id: string,
|
|
configs: CustomNodeConfig[]
|
|
): NodeConfig | undefined {
|
|
if (NODES[id]) {
|
|
return NODES[id];
|
|
}
|
|
|
|
const config = getCustomNodeConfigFromId(id, configs);
|
|
if (config) {
|
|
return makeNodeConfigFromCustomConfig(config);
|
|
}
|
|
}
|
|
|
|
export function makeNodeConfigFromCustomConfig(
|
|
config: CustomNodeConfig
|
|
): NodeConfig {
|
|
return {
|
|
network: config.network,
|
|
lib: new CustomNode(config),
|
|
service: 'your custom node',
|
|
estimateGas: true
|
|
};
|
|
}
|