+ DOM.useP2wpkhNestedInP2sh.prop("disabled", true);
+ DOM.useP2wpkhNestedInP2sh.prop("checked", false);
+ }
+
+ function useBitpayAddresses() {
+ return !(DOM.useBitpayAddresses.prop("checked"));
+ }
+
+ function setBitcoinCashNetworkValues() {
+ if (useBitpayAddresses()) {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ }
+ else {
+ network = bitcoinjs.bitcoin.networks.bitcoinCashBitbpay;
+ }
+ }
+
+ function adjustNetworkForBip49() {
+ // If bip49 is selected the xpub/xprv prefixes need to be adjusted
+ // to avoid accidentally importing BIP49 xpub to BIP44 watch only
+ // wallet.
+ // See https://github.com/iancoleman/bip39/issues/125
+ if (P2wpkhNestedInP2shSelected()) {
+ if (network == bitcoinjs.bitcoin.networks.bitcoin) {
+ network = bitcoinjs.bitcoin.networks.bitcoinBip49;
+ }
+ else if (network == bitcoinjs.bitcoin.networks.testnet) {
+ network = bitcoinjs.bitcoin.networks.testnetBip49;
+ }
+ else if (network == bitcoinjs.bitcoin.networks.litecoin) {
+ network = bitcoinjs.bitcoin.networks.litecoinBip49;
+ }
+ }
+ else {
+ if (network == bitcoinjs.bitcoin.networks.bitcoinBip49) {
+ network = bitcoinjs.bitcoin.networks.bitcoin;
+ }
+ else if (network == bitcoinjs.bitcoin.networks.testnetBip49) {
+ network = bitcoinjs.bitcoin.networks.testnet;
+ }
+ else if (network == bitcoinjs.bitcoin.networks.litecoinBip49) {
+ network = bitcoinjs.bitcoin.networks.litecoin;
+ }
+ }