Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Account = ({ peers, t, showNetworkIndicator }) => {
const iconMap = ['mainnet', 'testnet', 'devnet'];
const translations = iconMap.map(code => t(code));
let iconCode = peers.options.code;
if (iconCode === 2) {
iconCode = (peers.options.nethash === Lisk.constants.MAINNET_NETHASH)
? networks.mainnet.code : iconCode;
iconCode = (peers.options.nethash === Lisk.constants.TESTNET_NETHASH)
? networks.testnet.code : iconCode;
}
const status = (peers.status && peers.status.online)
?
: ;
const shouldShowNetworkIndicator = (peers.liskAPIClient
&& (showNetworkIndicator || peers.options.code !== networks.mainnet.code));
return (shouldShowNetworkIndicator
? (
<section>
<div>
<span id="accountStatus">
{status}</span></div></section>
const Network = ({ network, t, token }) => {
const networksList = {
Mainnet: t('Mainnet'),
Testnet: t('Testnet'),
'Custom Node': t('Devnet'),
};
let activeNetwork = network.name;
if (network.name === networks.customNode.name && token !== 'BTC') {
activeNetwork = network.networks[token].nethash === Lisk.constants.MAINNET_NETHASH
? networks.mainnet.name
: network.name;
activeNetwork = network.networks[token].nethash === Lisk.constants.TESTNET_NETHASH
? networks.testnet.name
: network.name;
}
if (network.name === networks.customNode.name && token === 'BTC') {
activeNetwork = token === 'BTC' ? networks.testnet.name : network.name;
}
const statusColor = network.status.online ? styles.online : styles.offline;
return (
<section>
<span></span></section>
export const getNetworkNameBasedOnNethash = (network, token = 'LSK') => {
let activeNetwork = network.name;
if (network.name === networks.customNode.name && token !== 'BTC') {
activeNetwork = network.networks[token].nethash === Lisk.constants.MAINNET_NETHASH
? networks.mainnet.name
: network.name;
activeNetwork = network.networks[token].nethash === Lisk.constants.TESTNET_NETHASH
? networks.testnet.name
: network.name;
}
if (network.name === networks.customNode.name && token === 'BTC') {
activeNetwork = token === 'BTC' ? networks.testnet.name : network.name;
}
return activeNetwork;
};
const Network = ({ network, t, token }) => {
const networksList = {
Mainnet: t('Mainnet'),
Testnet: t('Testnet'),
'Custom Node': t('Devnet'),
};
let activeNetwork = network.name;
if (network.name === networks.customNode.name && token !== 'BTC') {
activeNetwork = network.networks[token].nethash === Lisk.constants.MAINNET_NETHASH
? networks.mainnet.name
: network.name;
activeNetwork = network.networks[token].nethash === Lisk.constants.TESTNET_NETHASH
? networks.testnet.name
: network.name;
}
if (network.name === networks.customNode.name && token === 'BTC') {
activeNetwork = token === 'BTC' ? networks.testnet.name : network.name;
}
const statusColor = network.status.online ? styles.online : styles.offline;
return (
<section>
<span>
<p>
<span>{t('Connected to:')}</span>
<span>{(networksList[activeNetwork] || '').toLowerCase()}</span></p></span></section>
export const getNetworkNameBasedOnNethash = (network, token = 'LSK') => {
let activeNetwork = network.name;
if (network.name === networks.customNode.name && token !== 'BTC') {
activeNetwork = network.networks[token].nethash === Lisk.constants.MAINNET_NETHASH
? networks.mainnet.name
: network.name;
activeNetwork = network.networks[token].nethash === Lisk.constants.TESTNET_NETHASH
? networks.testnet.name
: network.name;
}
if (network.name === networks.customNode.name && token === 'BTC') {
activeNetwork = token === 'BTC' ? networks.testnet.name : network.name;
}
return activeNetwork;
};
const Account = ({ peers, t, showNetworkIndicator }) => {
const iconMap = ['mainnet', 'testnet', 'devnet'];
const translations = iconMap.map(code => t(code));
let iconCode = peers.options.code;
if (iconCode === 2) {
iconCode = (peers.options.nethash === Lisk.constants.MAINNET_NETHASH)
? networks.mainnet.code : iconCode;
iconCode = (peers.options.nethash === Lisk.constants.TESTNET_NETHASH)
? networks.testnet.code : iconCode;
}
const status = (peers.status && peers.status.online)
?
: ;
const shouldShowNetworkIndicator = (peers.liskAPIClient
&& (showNetworkIndicator || peers.options.code !== networks.mainnet.code));
return (shouldShowNetworkIndicator
? (
<section>
<div></div></section>