Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getNeoscanAPIEndpoint(net) {
if (settings.networks[net]) {
return settings.networks[net].extra.neoscan;
}
return net;
}
function getTarget(network, endpoint) {
try {
const { protocol, host } = new URL(settings.networks[network].extra.neoscan);
return `${protocol}//${host}/${endpoint}`;
} catch (err) {
return null;
}
}
return (
<div>
Network Settings
<select value="{this.props.currentNetwork}" label="Current Network" id="network">
{map(settings.networks, this.renderNetworkOption)}
</select>
<input readonly="" value="{neoscanAddress}" label="Neoscan URL" id="neoscan">
<div>
<button>
Add Custom Network
</button>
<br></div></div>
getCurrentNetworkUrl = () => {
const currentNetworkConfig = settings.networks[this.props.currentNetwork];
return currentNetworkConfig && currentNetworkConfig.extra.neoscan;
};
}
import { settings } from '@cityofzion/neon-js';
import { keys } from 'lodash';
export const NOS_TESTNET = 'nOSNet';
export const NOS_LOCAL = 'nOSLocal';
export const PREDEFINED_NETWORKS = keys(settings.networks).concat([NOS_TESTNET, NOS_LOCAL]);
export const DEFAULT_NET = 'MainNet';