diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/src/js/index.js b/src/js/index.js index 5b61f1d..0b34ade 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -15,7 +15,6 @@ | |||
15 | var showPrivKey = true; | 15 | var showPrivKey = true; |
16 | var showQr = false; | 16 | var showQr = false; |
17 | var litecoinUseLtub = true; | 17 | var litecoinUseLtub = true; |
18 | var isDefaultBip44ChangeValue = true; | ||
19 | 18 | ||
20 | var entropyChangeTimeoutEvent = null; | 19 | var entropyChangeTimeoutEvent = null; |
21 | var phraseChangeTimeoutEvent = null; | 20 | var phraseChangeTimeoutEvent = null; |
@@ -72,7 +71,6 @@ | |||
72 | DOM.bip44accountXprv = $("#bip44 .account-xprv"); | 71 | DOM.bip44accountXprv = $("#bip44 .account-xprv"); |
73 | DOM.bip44accountXpub = $("#bip44 .account-xpub"); | 72 | DOM.bip44accountXpub = $("#bip44 .account-xpub"); |
74 | DOM.bip44change = $("#bip44 .change"); | 73 | DOM.bip44change = $("#bip44 .change"); |
75 | DOM.defaultBip44ChangeValue = $("#bip44 .default-bip44-change-value"); | ||
76 | DOM.bip49unavailable = $("#bip49 .unavailable"); | 74 | DOM.bip49unavailable = $("#bip49 .unavailable"); |
77 | DOM.bip49available = $("#bip49 .available"); | 75 | DOM.bip49available = $("#bip49 .available"); |
78 | DOM.bip49path = $("#bip49-path"); | 76 | DOM.bip49path = $("#bip49-path"); |
@@ -138,9 +136,7 @@ | |||
138 | DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged); | 136 | DOM.litecoinUseLtub.on("change", litecoinUseLtubChanged); |
139 | DOM.bip32path.on("input", calcForDerivationPath); | 137 | DOM.bip32path.on("input", calcForDerivationPath); |
140 | DOM.bip44account.on("input", calcForDerivationPath); | 138 | DOM.bip44account.on("input", calcForDerivationPath); |
141 | DOM.bip44change.on("input", modifiedDefaultBip44ChangeValue); | ||
142 | DOM.bip44change.on("input", calcForDerivationPath); | 139 | DOM.bip44change.on("input", calcForDerivationPath); |
143 | DOM.defaultBip44ChangeValue.on("click", resetDefaultBip44ChangeValue); | ||
144 | DOM.bip49account.on("input", calcForDerivationPath); | 140 | DOM.bip49account.on("input", calcForDerivationPath); |
145 | DOM.bip49change.on("input", calcForDerivationPath); | 141 | DOM.bip49change.on("input", calcForDerivationPath); |
146 | DOM.bip84account.on("input", calcForDerivationPath); | 142 | DOM.bip84account.on("input", calcForDerivationPath); |
@@ -742,14 +738,12 @@ | |||
742 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); | 738 | var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44); |
743 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); | 739 | var coin = parseIntNoNaN(DOM.bip44coin.val(), 0); |
744 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); | 740 | var account = parseIntNoNaN(DOM.bip44account.val(), 0); |
745 | var change = parseIntNoNaN(DOM.bip44change.val(), ""); | 741 | var change = parseIntNoNaN(DOM.bip44change.val(), 0); |
746 | var path = "m"; | 742 | var path = "m/"; |
747 | path += "/" + purpose + "'"; | 743 | path += purpose + "'/"; |
748 | path += "/" + coin + "'"; | 744 | path += coin + "'/"; |
749 | path += "/" + account + "'"; | 745 | path += account + "'/"; |
750 | if (change !== "") { | 746 | path += change; |
751 | path += "/" + change; | ||
752 | } | ||
753 | DOM.bip44path.val(path); | 747 | DOM.bip44path.val(path); |
754 | var derivationPath = DOM.bip44path.val(); | 748 | var derivationPath = DOM.bip44path.val(); |
755 | console.log("Using derivation path from BIP44 tab: " + derivationPath); | 749 | console.log("Using derivation path from BIP44 tab: " + derivationPath); |
@@ -1758,30 +1752,10 @@ | |||
1758 | return DOM.bip141tab.hasClass("active"); | 1752 | return DOM.bip141tab.hasClass("active"); |
1759 | } | 1753 | } |
1760 | 1754 | ||
1761 | function setBip44ChangeValue() { | ||
1762 | if (isDefaultBip44ChangeValue) { | ||
1763 | if (networkIsEthereum()) { | ||
1764 | DOM.bip44change.val(""); | ||
1765 | } else { | ||
1766 | DOM.bip44change.val(0); | ||
1767 | } | ||
1768 | } | ||
1769 | } | ||
1770 | |||
1771 | function modifiedDefaultBip44ChangeValue() { | ||
1772 | isDefaultBip44ChangeValue = false; | ||
1773 | } | ||
1774 | |||
1775 | function resetDefaultBip44ChangeValue() { | ||
1776 | isDefaultBip44ChangeValue = true; | ||
1777 | setBip44ChangeValue(); | ||
1778 | } | ||
1779 | |||
1780 | function setHdCoin(coinValue) { | 1755 | function setHdCoin(coinValue) { |
1781 | DOM.bip44coin.val(coinValue); | 1756 | DOM.bip44coin.val(coinValue); |
1782 | DOM.bip49coin.val(coinValue); | 1757 | DOM.bip49coin.val(coinValue); |
1783 | DOM.bip84coin.val(coinValue); | 1758 | DOM.bip84coin.val(coinValue); |
1784 | setBip44ChangeValue(); | ||
1785 | } | 1759 | } |
1786 | 1760 | ||
1787 | function showSegwitAvailable() { | 1761 | function showSegwitAvailable() { |