aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2019-12-02 10:24:37 +1100
committerIan Coleman <ian@iancoleman.io>2019-12-02 10:24:37 +1100
commit55367b989e026899c4afb8cf0fbb5dc0f60d6786 (patch)
treea8ef72243ddba6e7a1ff014c726ce72c6de84b25 /src
parent732613e44cb0847886a560fea4fdc73d83075d6b (diff)
downloadBIP39-55367b989e026899c4afb8cf0fbb5dc0f60d6786.tar.gz
BIP39-55367b989e026899c4afb8cf0fbb5dc0f60d6786.tar.zst
BIP39-55367b989e026899c4afb8cf0fbb5dc0f60d6786.zip
Partially revert Pull 371 BIP44 Default Change
Diffstat (limited to 'src')
-rw-r--r--src/index.html5
-rw-r--r--src/js/index.js38
2 files changed, 7 insertions, 36 deletions
diff --git a/src/index.html b/src/index.html
index 10e4a95..cc257ed 100644
--- a/src/index.html
+++ b/src/index.html
@@ -282,10 +282,7 @@
282 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change" target="_blank">External / Internal</a> 282 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change" target="_blank">External / Internal</a>
283 </label> 283 </label>
284 <div class="col-sm-10"> 284 <div class="col-sm-10">
285 <div class="input-group"> 285 <input id="change-bip44" type="text" class="change form-control" value="0">
286 <input id="change-bip44" type="text" class="change form-control" value="0">
287 <a class="default-bip44-change-value btn btn-primary input-group-addon" role="button">Default</a>
288 </div>
289 </div> 286 </div>
290 </div> 287 </div>
291 <div class="form-group"> 288 <div class="form-group">
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() {