diff options
author | iancoleman <1281387+iancoleman@users.noreply.github.com> | 2020-04-27 10:41:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-27 10:41:27 +1000 |
commit | 904e39748cb64ed7630c8f8eead7b841693e16df (patch) | |
tree | 13023d40fd8e05057715930c037ffeadcacc6a75 | |
parent | 54600393af3293dc9e0f222b24ebd07b63824330 (diff) | |
parent | 4958ea8009e3c950a680bded814994428630b645 (diff) | |
download | BIP39-904e39748cb64ed7630c8f8eead7b841693e16df.tar.gz BIP39-904e39748cb64ed7630c8f8eead7b841693e16df.tar.zst BIP39-904e39748cb64ed7630c8f8eead7b841693e16df.zip |
Merge pull request #415 from jangchongchan20/master
Add Sugarchain support
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 11 | ||||
-rw-r--r-- | src/js/index.js | 7 | ||||
-rw-r--r-- | src/js/segwit-parameters.js | 26 | ||||
-rw-r--r-- | tests/spec/tests.js | 10 |
4 files changed, 54 insertions, 0 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index 17475b1..7446bd7 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js | |||
@@ -1739,6 +1739,17 @@ libs.bitcoin.networks.elastos = { | |||
1739 | wif: 0xef // TODO set this correctly, same as BTC for now | 1739 | wif: 0xef // TODO set this correctly, same as BTC for now |
1740 | }; | 1740 | }; |
1741 | 1741 | ||
1742 | libs.bitcoin.networks.sugarchain = { | ||
1743 | messagePrefix: '\x18Sugarchain Signed Message:\n', | ||
1744 | bip32: { | ||
1745 | public: 0x0488B21E, | ||
1746 | private: 0x0488ADE4, | ||
1747 | }, | ||
1748 | pubKeyHash: 0x3f, | ||
1749 | scriptHash: 0x7d, | ||
1750 | wif: 0x80 | ||
1751 | }; | ||
1752 | |||
1742 | // https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js | 1753 | // https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js |
1743 | libs.bitcoin.networks.regtest = { | 1754 | libs.bitcoin.networks.regtest = { |
1744 | messagePrefix: '\x18Bitcoin Signed Message:\n', | 1755 | messagePrefix: '\x18Bitcoin Signed Message:\n', |
diff --git a/src/js/index.js b/src/js/index.js index c2d34a7..841a27f 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -3092,6 +3092,13 @@ | |||
3092 | }, | 3092 | }, |
3093 | }, | 3093 | }, |
3094 | { | 3094 | { |
3095 | name: "SUGAR - Sugarchain", | ||
3096 | onSelect: function() { | ||
3097 | network = libs.bitcoin.networks.sugarchain; | ||
3098 | setHdCoin(408); | ||
3099 | }, | ||
3100 | }, | ||
3101 | { | ||
3095 | name: "SWTC - Jingtum", | 3102 | name: "SWTC - Jingtum", |
3096 | onSelect: function() { | 3103 | onSelect: function() { |
3097 | network = libs.bitcoin.networks.bitcoin; | 3104 | network = libs.bitcoin.networks.bitcoin; |
diff --git a/src/js/segwit-parameters.js b/src/js/segwit-parameters.js index d5ea419..0c41bf7 100644 --- a/src/js/segwit-parameters.js +++ b/src/js/segwit-parameters.js | |||
@@ -683,4 +683,30 @@ libs.bitcoin.networks.deeponion.p2wpkhInP2sh = { | |||
683 | wif: 0x9f | 683 | wif: 0x9f |
684 | }; | 684 | }; |
685 | 685 | ||
686 | libs.bitcoin.networks.sugarchain.p2wpkh = { | ||
687 | baseNetwork: "sugarchain", | ||
688 | messagePrefix: '\x1DSugarchain Signed Message:\n', | ||
689 | bech32: 'sugar', | ||
690 | bip32: { | ||
691 | public: 0x04b24746, | ||
692 | private: 0x04b2430c | ||
693 | }, | ||
694 | pubKeyHash: 0x3f, | ||
695 | scriptHash: 0x7d, | ||
696 | wif: 0x80 | ||
697 | }; | ||
698 | |||
699 | libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = { | ||
700 | baseNetwork: "sugarchain", | ||
701 | messagePrefix: '\x1DSugarchain Signed Message:\n', | ||
702 | bech32: 'sugar', | ||
703 | bip32: { | ||
704 | public: 0x049d7cb2, | ||
705 | private: 0x049d7878 | ||
706 | }, | ||
707 | pubKeyHash: 0x3f, | ||
708 | scriptHash: 0x7d, | ||
709 | wif: 0x80 | ||
710 | }; | ||
711 | |||
686 | })(); | 712 | })(); |
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 31fa043..d9a1843 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -1675,6 +1675,16 @@ it('Allows selection of Stratis Test', function(done) { | |||
1675 | }; | 1675 | }; |
1676 | testNetwork(done, params); | 1676 | testNetwork(done, params); |
1677 | }); | 1677 | }); |
1678 | it('Allows selection of Sugarchain', function(done) { | ||
1679 | var params = { | ||
1680 | selectText: "SUGAR - Sugarchain", | ||
1681 | phrase: "abandon abandon ability", | ||
1682 | firstAddress: "SYnd31fYr39VgKju87Vz1sYBmEeHg5cudk", | ||
1683 | firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25", | ||
1684 | firstPrivKey: "L2G3axGdZv5EV8osAsBPMese74i4dTHaGvxDh7DsRF5Ky6hKkPDY", | ||
1685 | }; | ||
1686 | testNetwork(done, params); | ||
1687 | }); | ||
1678 | it('Allows selection of Syscoin', function(done) { | 1688 | it('Allows selection of Syscoin', function(done) { |
1679 | var params = { | 1689 | var params = { |
1680 | selectText: "SYS - Syscoin", | 1690 | selectText: "SYS - Syscoin", |