Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testnet toggler now follows network state #152

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
decryptWallet,
getNewAddress,
getDerivationPath,
LegacyMasterKey,

Check warning on line 13 in scripts/global.js

View workflow job for this annotation

GitHub Actions / ESLint

scripts/global.js#L13

'LegacyMasterKey' is defined but never used (@typescript-eslint/no-unused-vars)
} from './wallet.js';
import { getNetwork, HistoricalTxType } from './network.js';
import {
Expand Down Expand Up @@ -292,6 +292,7 @@
domDisplaySettingsBtn: document.getElementById('settingsDisplayBtn'),
domVersion: document.getElementById('version'),
domFlipdown: document.getElementById('flipdown'),
domTesnetToggler: document.getElementById('tesnetToggler'),
JSKitty marked this conversation as resolved.
Show resolved Hide resolved
};
await i18nStart();
await loadImages();
Expand Down
13 changes: 12 additions & 1 deletion scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,11 @@ async function setAnalytics(level, fSilent = false) {
}

export function toggleTestnet() {
if (fWalletLoaded)
if (fWalletLoaded) {
// Revert testnet toggle
doms.domTesnetToggler.checked = !doms.domTesnetToggler.checked;
return createAlert('warning', ALERTS.UNABLE_SWITCH_TESTNET, [], 3250);
}

// Update current chain config
cChainParams.current = cChainParams.current.isTestnet
Expand All @@ -403,6 +406,14 @@ export function toggleTestnet() {
doms.domGuiBalanceStakingTicker.innerText = cChainParams.current.TICKER;
doms.domPrefixNetwork.innerText =
cChainParams.current.PUBKEY_PREFIX.join(' or ');

// Update testnet toggle in settings
if (cChainParams.current.isTestnet) {
doms.domTesnetToggler.checked = true;
} else {
doms.domTesnetToggler.checked = false;
}
JSKitty marked this conversation as resolved.
Show resolved Hide resolved

fillExplorerSelect();
fillNodeSelect();
getBalance(true);
Expand Down