diff options
-rw-r--r-- | bip39-standalone.html | 34 | ||||
-rw-r--r-- | readme.md | 4 | ||||
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 20 | ||||
-rw-r--r-- | src/js/index.js | 14 | ||||
-rw-r--r-- | tests.js | 60 |
5 files changed, 131 insertions, 1 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html index a7d6ce9..961bedb 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html | |||
@@ -17926,6 +17926,26 @@ bitcoin.networks.peercoin = { | |||
17926 | wif: 0xb7, | 17926 | wif: 0xb7, |
17927 | }; | 17927 | }; |
17928 | 17928 | ||
17929 | bitcoin.networks.slimcoin = { | ||
17930 | bip32: { | ||
17931 | public: 0xef6adf10, | ||
17932 | private: 0xef69ea80 | ||
17933 | }, | ||
17934 | pubKeyHash: 0x3f, | ||
17935 | scriptHash: 0x7d, | ||
17936 | wif: 0x46, | ||
17937 | }; | ||
17938 | |||
17939 | bitcoin.networks.slimcointn = { | ||
17940 | bip32: { | ||
17941 | public: 0x043587CF, | ||
17942 | private: 0x04358394 | ||
17943 | }, | ||
17944 | pubKeyHash: 0x6f, | ||
17945 | scriptHash: 0xc4, | ||
17946 | wif: 0x57, | ||
17947 | }; | ||
17948 | |||
17929 | </script> | 17949 | </script> |
17930 | <script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | 17950 | <script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethUtil = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
17931 | (function (global){ | 17951 | (function (global){ |
@@ -42840,6 +42860,20 @@ window.Entropy = new (function() { | |||
42840 | }, | 42860 | }, |
42841 | }, | 42861 | }, |
42842 | { | 42862 | { |
42863 | name: "Slimcoin", | ||
42864 | onSelect: function() { | ||
42865 | network = bitcoin.networks.slimcoin; | ||
42866 | DOM.bip44coin.val(63); | ||
42867 | }, | ||
42868 | }, | ||
42869 | { | ||
42870 | name: "Slimcoin Testnet", | ||
42871 | onSelect: function() { | ||
42872 | network = bitcoin.networks.slimcointn; | ||
42873 | DOM.bip44coin.val(111); | ||
42874 | }, | ||
42875 | }, | ||
42876 | { | ||
42843 | name: "Viacoin", | 42877 | name: "Viacoin", |
42844 | onSelect: function() { | 42878 | onSelect: function() { |
42845 | network = bitcoin.networks.viacoin; | 42879 | network = bitcoin.networks.viacoin; |
@@ -4,7 +4,9 @@ A tool for converting BIP39 mnemonic phrases to addresses and private keys. | |||
4 | 4 | ||
5 | ## Online Version | 5 | ## Online Version |
6 | 6 | ||
7 | https://iancoleman.github.io/bip39/ | 7 | Upstream demo: https://iancoleman.github.io/bip39/ |
8 | |||
9 | Slimcoin: TBD | ||
8 | 10 | ||
9 | ## Standalone offline version | 11 | ## Standalone offline version |
10 | 12 | ||
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) { |