aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJang Chongchan <jangchongchan20@gmail.com>2020-04-28 23:32:24 +0900
committerJang Chongchan <jangchongchan20@gmail.com>2020-04-28 23:33:27 +0900
commit7594405011b91075725790ab480d5fded0b689c9 (patch)
tree576ec68fbe688ab4758f189a7009999542026248
parentd359fe64b2f43f59714815d7ec5e1c82de50afd0 (diff)
downloadBIP39-7594405011b91075725790ab480d5fded0b689c9.tar.gz
BIP39-7594405011b91075725790ab480d5fded0b689c9.tar.zst
BIP39-7594405011b91075725790ab480d5fded0b689c9.zip
Add Sugarchain testnet support
-rw-r--r--src/js/bitcoinjs-extensions.js11
-rw-r--r--src/js/index.js7
-rw-r--r--src/js/segwit-parameters.js26
-rw-r--r--tests/spec/tests.js10
4 files changed, 54 insertions, 0 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js
index e331c24..2792e13 100644
--- a/src/js/bitcoinjs-extensions.js
+++ b/src/js/bitcoinjs-extensions.js
@@ -1750,6 +1750,17 @@ libs.bitcoin.networks.sugarchain = {
1750 wif: 0x80 1750 wif: 0x80
1751}; 1751};
1752 1752
1753libs.bitcoin.networks.sugarchaintestnet = {
1754 messagePrefix: '\x18Sugarchain Signed Message:\n',
1755 bip32: {
1756 public: 0x045f1cf6,
1757 private: 0x045f18bc,
1758 },
1759 pubKeyHash: 0x42,
1760 scriptHash: 0x80,
1761 wif: 0xef
1762};
1763
1753// https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js 1764// https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js
1754libs.bitcoin.networks.regtest = { 1765libs.bitcoin.networks.regtest = {
1755 messagePrefix: '\x18Bitcoin Signed Message:\n', 1766 messagePrefix: '\x18Bitcoin Signed Message:\n',
diff --git a/src/js/index.js b/src/js/index.js
index 0471e86..f00d90b 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -3106,6 +3106,13 @@
3106 }, 3106 },
3107 }, 3107 },
3108 { 3108 {
3109 name: "TUGAR - Sugarchain Testnet",
3110 onSelect: function() {
3111 network = libs.bitcoin.networks.sugarchaintestnet;
3112 setHdCoin(408);
3113 },
3114 },
3115 {
3109 name: "SWTC - Jingtum", 3116 name: "SWTC - Jingtum",
3110 onSelect: function() { 3117 onSelect: function() {
3111 network = libs.bitcoin.networks.bitcoin; 3118 network = libs.bitcoin.networks.bitcoin;
diff --git a/src/js/segwit-parameters.js b/src/js/segwit-parameters.js
index 0c41bf7..ea6f86e 100644
--- a/src/js/segwit-parameters.js
+++ b/src/js/segwit-parameters.js
@@ -709,4 +709,30 @@ libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = {
709 wif: 0x80 709 wif: 0x80
710}; 710};
711 711
712libs.bitcoin.networks.sugarchaintestnet.p2wpkh = {
713 baseNetwork: "sugarchaintestnet",
714 messagePrefix: '\x18Sugarchain Signed Message:\n',
715 bech32: 'tugar',
716 bip32: {
717 public: 0x045f1cf6,
718 private: 0x045f18bc
719 },
720 pubKeyHash: 0x42,
721 scriptHash: 0x80,
722 wif: 0xef
723};
724
725libs.bitcoin.networks.sugarchaintestnet.p2wpkhInP2sh = {
726 baseNetwork: "sugarchaintestnet",
727 messagePrefix: '\x18Sugarchain Signed Message:\n',
728 bech32: 'tugar',
729 bip32: {
730 public: 0x044a5262,
731 private: 0x044a4e28
732 },
733 pubKeyHash: 0x42,
734 scriptHash: 0x80,
735 wif: 0xef
736};
737
712})(); 738})();
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index e7c81bc..15a52b3 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -1685,6 +1685,16 @@ it('Allows selection of Sugarchain', function(done) {
1685 }; 1685 };
1686 testNetwork(done, params); 1686 testNetwork(done, params);
1687}); 1687});
1688it('Allows selection of Sugarchain Testnet', function(done) {
1689 var params = {
1690 selectText: "TUGAR - Sugarchain Testnet",
1691 phrase: "abandon abandon ability",
1692 firstAddress: "TkoRzLZQyaY88dAACNVwUFMYekR7pv6CbY",
1693 firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25",
1694 firstPrivKey: "cSd33sGUzymVeaH8ZGzWiyNhjJ1UHuPGLy6goXgNvMjLDqioARWW",
1695 };
1696 testNetwork(done, params);
1697});
1688it('Allows selection of Syscoin', function(done) { 1698it('Allows selection of Syscoin', function(done) {
1689 var params = { 1699 var params = {
1690 selectText: "SYS - Syscoin", 1700 selectText: "SYS - Syscoin",