]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Add BCH - Bitcoin Cash network
authorIan Coleman <coleman.ian@gmail.com>
Sat, 5 Aug 2017 21:58:58 +0000 (07:58 +1000)
committerIan Coleman <coleman.ian@gmail.com>
Mon, 7 Aug 2017 08:54:12 +0000 (18:54 +1000)
src/js/index.js
tests.js

index a12e4422b2a8711b958fc6bee60238c350e27f7e..b1876cbdd11e08e9b1212754f02d355a75c88d25 100644 (file)
     }
 
     var networks = [
+        {
+            name: "BCH - Bitcoin Cash",
+            bip49available: false,
+            onSelect: function() {
+                network = bitcoinjs.bitcoin.networks.bitcoin;
+                setHdCoin(145);
+            },
+        },
         {
             name: "BTC - Bitcoin",
             bip49available: true,
index b6713b040e371803fab23cd47b5b555d7750d6db..2e2e38bc7ecd0d642f3da71da3ffb56cb7c4f094 100644 (file)
--- a/tests.js
+++ b/tests.js
@@ -872,6 +872,36 @@ page.open(url, function(status) {
 });
 },
 
+// Network can be set to bitcoin cash
+function() {
+page.open(url, function(status) {
+    // set the phrase and coin
+    var expected = "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A";
+    page.evaluate(function() {
+        $(".phrase").val("abandon abandon ability");
+        $(".phrase").trigger("input");
+        $(".network option[selected]").removeAttr("selected");
+        $(".network option").filter(function() {
+            return $(this).html() == "BCH - Bitcoin Cash";
+        }).prop("selected", true);
+        $(".network").trigger("change");
+    });
+    // check the address is generated correctly
+    waitForGenerate(function() {
+        var actual = page.evaluate(function() {
+            return $(".address:first").text();
+        });
+        if (actual != expected) {
+            console.log("Bitcoin Cash address is incorrect");
+            console.log("Expected: " + expected);
+            console.log("Actual: " + actual);
+            fail();
+        }
+        next();
+    });
+});
+},
+
 // BIP39 seed is set from phrase
 function() {
 page.open(url, function(status) {