diff options
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 20 | ||||
-rw-r--r-- | src/js/index.js | 14 | ||||
-rw-r--r-- | tests.js | 60 |
3 files changed, 94 insertions, 0 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index ed1bb09..dd5069c 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js | |||
@@ -75,3 +75,23 @@ bitcoin.networks.peercoin = { | |||
75 | wif: 0xb7, | 75 | wif: 0xb7, |
76 | }; | 76 | }; |
77 | 77 | ||
78 | bitcoin.networks.slimcoin = { | ||
79 | bip32: { | ||
80 | public: 0xef6adf10, | ||
81 | private: 0xef69ea80 | ||
82 | }, | ||
83 | pubKeyHash: 0x3f, | ||
84 | scriptHash: 0x7d, | ||
85 | wif: 0x46, | ||
86 | }; | ||
87 | |||
88 | bitcoin.networks.slimcointn = { | ||
89 | bip32: { | ||
90 | public: 0x043587CF, | ||
91 | private: 0x04358394 | ||
92 | }, | ||
93 | pubKeyHash: 0x6f, | ||
94 | scriptHash: 0xc4, | ||
95 | wif: 0x57, | ||
96 | }; | ||
97 | |||
diff --git a/src/js/index.js b/src/js/index.js index 8f825f4..8d75637 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1163,6 +1163,20 @@ | |||
1163 | }, | 1163 | }, |
1164 | }, | 1164 | }, |
1165 | { | 1165 | { |
1166 | name: "Slimcoin", | ||
1167 | onSelect: function() { | ||
1168 | network = bitcoin.networks.slimcoin; | ||
1169 | DOM.bip44coin.val(63); | ||
1170 | }, | ||
1171 | }, | ||
1172 | { | ||
1173 | name: "Slimcoin Testnet", | ||
1174 | onSelect: function() { | ||
1175 | network = bitcoin.networks.slimcointn; | ||
1176 | DOM.bip44coin.val(111); | ||
1177 | }, | ||
1178 | }, | ||
1179 | { | ||
1166 | name: "Viacoin", | 1180 | name: "Viacoin", |
1167 | onSelect: function() { | 1181 | onSelect: function() { |
1168 | network = bitcoin.networks.viacoin; | 1182 | network = bitcoin.networks.viacoin; |
@@ -723,6 +723,66 @@ page.open(url, function(status) { | |||
723 | }); | 723 | }); |
724 | }, | 724 | }, |
725 | 725 | ||
726 | // Network can be set to Slimcoin | ||
727 | function() { | ||
728 | page.open(url, function(status) { | ||
729 | // set the phrase and coin | ||
730 | var expected = "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww"; | ||
731 | page.evaluate(function() { | ||
732 | $(".phrase").val("abandon abandon ability"); | ||
733 | $(".phrase").trigger("input"); | ||
734 | $(".network option[selected]").removeAttr("selected"); | ||
735 | $(".network option").filter(function() { | ||
736 | return $(this).html() == "Slimcoin"; | ||
737 | }).prop("selected", true); | ||
738 | $(".network").trigger("change"); | ||
739 | }); | ||
740 | // check the address is generated correctly | ||
741 | waitForGenerate(function() { | ||
742 | var actual = page.evaluate(function() { | ||
743 | return $(".address:first").text(); | ||
744 | }); | ||
745 | if (actual != expected) { | ||
746 | console.log("Slimcoin address is incorrect"); | ||
747 | console.log("Expected: " + expected); | ||
748 | console.log("Actual: " + actual); | ||
749 | fail(); | ||
750 | } | ||
751 | next(); | ||
752 | }); | ||
753 | }); | ||
754 | }, | ||
755 | |||
756 | // Network can be set to Slimcointn | ||
757 | function() { | ||
758 | page.open(url, function(status) { | ||
759 | // set the phrase and coin | ||
760 | var expected = "n3nMgWufTek5QQAr6uwMhg5xbzj8xqc4Dq"; | ||
761 | page.evaluate(function() { | ||
762 | $(".phrase").val("abandon abandon ability"); | ||
763 | $(".phrase").trigger("input"); | ||
764 | $(".network option[selected]").removeAttr("selected"); | ||
765 | $(".network option").filter(function() { | ||
766 | return $(this).html() == "Slimcoin Testnet"; | ||
767 | }).prop("selected", true); | ||
768 | $(".network").trigger("change"); | ||
769 | }); | ||
770 | // check the address is generated correctly | ||
771 | waitForGenerate(function() { | ||
772 | var actual = page.evaluate(function() { | ||
773 | return $(".address:first").text(); | ||
774 | }); | ||
775 | if (actual != expected) { | ||
776 | console.log("Slimcoin testnet address is incorrect"); | ||
777 | console.log("Expected: " + expected); | ||
778 | console.log("Actual: " + actual); | ||
779 | fail(); | ||
780 | } | ||
781 | next(); | ||
782 | }); | ||
783 | }); | ||
784 | }, | ||
785 | |||
726 | // BIP39 seed is set from phrase | 786 | // BIP39 seed is set from phrase |
727 | function() { | 787 | function() { |
728 | page.open(url, function(status) { | 788 | page.open(url, function(status) { |