aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-08-06 07:58:58 +1000
committerIan Coleman <coleman.ian@gmail.com>2017-08-07 18:54:12 +1000
commitdaab55dc613a1eef22463356eba1a742cb814cb2 (patch)
tree508caa1ac338c71b9fa9b22c3e6385c036aeda85
parent7b742f87d3b17fa73e8fcdfda19bc8d08405f7cc (diff)
downloadBIP39-daab55dc613a1eef22463356eba1a742cb814cb2.tar.gz
BIP39-daab55dc613a1eef22463356eba1a742cb814cb2.tar.zst
BIP39-daab55dc613a1eef22463356eba1a742cb814cb2.zip
Add BCH - Bitcoin Cash network
-rw-r--r--src/js/index.js8
-rw-r--r--tests.js30
2 files changed, 38 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js
index a12e442..b1876cb 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1167,6 +1167,14 @@
1167 1167
1168 var networks = [ 1168 var networks = [
1169 { 1169 {
1170 name: "BCH - Bitcoin Cash",
1171 bip49available: false,
1172 onSelect: function() {
1173 network = bitcoinjs.bitcoin.networks.bitcoin;
1174 setHdCoin(145);
1175 },
1176 },
1177 {
1170 name: "BTC - Bitcoin", 1178 name: "BTC - Bitcoin",
1171 bip49available: true, 1179 bip49available: true,
1172 onSelect: function() { 1180 onSelect: function() {
diff --git a/tests.js b/tests.js
index b6713b0..2e2e38b 100644
--- a/tests.js
+++ b/tests.js
@@ -872,6 +872,36 @@ page.open(url, function(status) {
872}); 872});
873}, 873},
874 874
875// Network can be set to bitcoin cash
876function() {
877page.open(url, function(status) {
878 // set the phrase and coin
879 var expected = "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A";
880 page.evaluate(function() {
881 $(".phrase").val("abandon abandon ability");
882 $(".phrase").trigger("input");
883 $(".network option[selected]").removeAttr("selected");
884 $(".network option").filter(function() {
885 return $(this).html() == "BCH - Bitcoin Cash";
886 }).prop("selected", true);
887 $(".network").trigger("change");
888 });
889 // check the address is generated correctly
890 waitForGenerate(function() {
891 var actual = page.evaluate(function() {
892 return $(".address:first").text();
893 });
894 if (actual != expected) {
895 console.log("Bitcoin Cash address is incorrect");
896 console.log("Expected: " + expected);
897 console.log("Actual: " + actual);
898 fail();
899 }
900 next();
901 });
902});
903},
904
875// BIP39 seed is set from phrase 905// BIP39 seed is set from phrase
876function() { 906function() {
877page.open(url, function(status) { 907page.open(url, function(status) {