aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-08-02 16:12:41 +1000
committerIan Coleman <coleman.ian@gmail.com>2017-08-02 17:12:13 +1000
commit684624b522025062e0426b0c2dd77281d4108f6f (patch)
treebf12f9e52fa13af64e91d59e36d465b78e450c6f
parent33b3dd47aa237849d21736782103408fb003b1c1 (diff)
downloadBIP39-684624b522025062e0426b0c2dd77281d4108f6f.tar.gz
BIP39-684624b522025062e0426b0c2dd77281d4108f6f.tar.zst
BIP39-684624b522025062e0426b0c2dd77281d4108f6f.zip
Change BIP44 purpose and coin fields to readonly
-rw-r--r--src/index.html4
-rw-r--r--src/js/index.js2
-rw-r--r--tests.js68
3 files changed, 4 insertions, 70 deletions
diff --git a/src/index.html b/src/index.html
index 8edb0ae..6a5e644 100644
--- a/src/index.html
+++ b/src/index.html
@@ -299,7 +299,7 @@
299 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#purpose" target="_blank" data-translate>Purpose</a> 299 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#purpose" target="_blank" data-translate>Purpose</a>
300 </label> 300 </label>
301 <div class="col-sm-10"> 301 <div class="col-sm-10">
302 <input id="purpose" type="text" class="purpose form-control" value="44"> 302 <input id="purpose" type="text" class="purpose form-control" value="44" readonly>
303 </div> 303 </div>
304 </div> 304 </div>
305 <div class="form-group"> 305 <div class="form-group">
@@ -307,7 +307,7 @@
307 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#registered-coin-types" target="_blank" data-translate>Coin</a> 307 <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#registered-coin-types" target="_blank" data-translate>Coin</a>
308 </label> 308 </label>
309 <div class="col-sm-10"> 309 <div class="col-sm-10">
310 <input id="coin" type="text" class="coin form-control" value="0"> 310 <input id="coin" type="text" class="coin form-control" value="0" readonly>
311 </div> 311 </div>
312 </div> 312 </div>
313 <div class="form-group"> 313 <div class="form-group">
diff --git a/src/js/index.js b/src/js/index.js
index 9b8432a..84c773f 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -88,8 +88,6 @@
88 DOM.more.on("click", showMore); 88 DOM.more.on("click", showMore);
89 DOM.rootKey.on("input", delayedRootKeyChanged); 89 DOM.rootKey.on("input", delayedRootKeyChanged);
90 DOM.bip32path.on("input", calcForDerivationPath); 90 DOM.bip32path.on("input", calcForDerivationPath);
91 DOM.bip44purpose.on("input", calcForDerivationPath);
92 DOM.bip44coin.on("input", calcForDerivationPath);
93 DOM.bip44account.on("input", calcForDerivationPath); 91 DOM.bip44account.on("input", calcForDerivationPath);
94 DOM.bip44change.on("input", calcForDerivationPath); 92 DOM.bip44change.on("input", calcForDerivationPath);
95 DOM.tab.on("shown.bs.tab", calcForDerivationPath); 93 DOM.tab.on("shown.bs.tab", calcForDerivationPath);
diff --git a/tests.js b/tests.js
index 4f922ce..ea29043 100644
--- a/tests.js
+++ b/tests.js
@@ -1028,70 +1028,6 @@ page.open(url, function(status) {
1028}); 1028});
1029}, 1029},
1030 1030
1031// BIP44 purpose field changes address list
1032function() {
1033page.open(url, function(status) {
1034 // set the phrase
1035 var expected = "1JbDzRJ2cDT8aat2xwKd6Pb2zzavow5MhF";
1036 page.evaluate(function() {
1037 $(".phrase").val("abandon abandon ability");
1038 $(".phrase").trigger("input");
1039 });
1040 waitForGenerate(function() {
1041 // change the bip44 purpose field to 45
1042 page.evaluate(function() {
1043 $("#bip44 .purpose").val("45");
1044 $("#bip44 .purpose").trigger("input");
1045 });
1046 waitForGenerate(function() {
1047 // check the address for the new derivation path
1048 var actual = page.evaluate(function() {
1049 return $(".address:first").text();
1050 });
1051 if (actual != expected) {
1052 console.log("BIP44 purpose field generates incorrect address");
1053 console.log("Expected: " + expected);
1054 console.log("Actual: " + actual);
1055 fail();
1056 }
1057 next();
1058 });
1059 });
1060});
1061},
1062
1063// BIP44 coin field changes address list
1064function() {
1065page.open(url, function(status) {
1066 // set the phrase
1067 var expected = "1F6dB2djQYrxoyfZZmfr6D5voH8GkJTghk";
1068 page.evaluate(function() {
1069 $(".phrase").val("abandon abandon ability");
1070 $(".phrase").trigger("input");
1071 });
1072 waitForGenerate(function() {
1073 // change the bip44 purpose field to 45
1074 page.evaluate(function() {
1075 $("#bip44 .coin").val("1");
1076 $("#bip44 .coin").trigger("input");
1077 });
1078 waitForGenerate(function() {
1079 // check the address for the new derivation path
1080 var actual = page.evaluate(function() {
1081 return $(".address:first").text();
1082 });
1083 if (actual != expected) {
1084 console.log("BIP44 coin field generates incorrect address");
1085 console.log("Expected: " + expected);
1086 console.log("Actual: " + actual);
1087 fail();
1088 }
1089 next();
1090 });
1091 });
1092});
1093},
1094
1095// BIP44 account field changes address list 1031// BIP44 account field changes address list
1096function() { 1032function() {
1097page.open(url, function(status) { 1033page.open(url, function(status) {
@@ -3392,7 +3328,7 @@ page.open(url, function(status) {
3392 // check the BIP44 account extended private key 3328 // check the BIP44 account extended private key
3393 waitForGenerate(function() { 3329 waitForGenerate(function() {
3394 var actual = page.evaluate(function() { 3330 var actual = page.evaluate(function() {
3395 return $(".account-xprv").val(); 3331 return $("#bip44 .account-xprv").val();
3396 }); 3332 });
3397 if (actual != expected) { 3333 if (actual != expected) {
3398 console.log("BIP44 account extended private key is incorrect"); 3334 console.log("BIP44 account extended private key is incorrect");
@@ -3418,7 +3354,7 @@ page.open(url, function(status) {
3418 // check the BIP44 account extended public key 3354 // check the BIP44 account extended public key
3419 waitForGenerate(function() { 3355 waitForGenerate(function() {
3420 var actual = page.evaluate(function() { 3356 var actual = page.evaluate(function() {
3421 return $(".account-xpub").val(); 3357 return $("#bip44 .account-xpub").val();
3422 }); 3358 });
3423 if (actual != expected) { 3359 if (actual != expected) {
3424 console.log("BIP44 account extended public key is incorrect"); 3360 console.log("BIP44 account extended public key is incorrect");