diff options
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 13 | ||||
-rw-r--r-- | src/js/index.js | 9 | ||||
-rw-r--r-- | src/js/segwit-parameters.js | 52 | ||||
-rw-r--r-- | tests/spec/tests.js | 7 |
4 files changed, 81 insertions, 0 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index 4536783..0d58bb9 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js | |||
@@ -1738,3 +1738,16 @@ bitcoinjs.bitcoin.networks.elastos = { | |||
1738 | scriptHash: 0xc4, // TODO set this correctly, same as BTC for now | 1738 | scriptHash: 0xc4, // TODO set this correctly, same as BTC for now |
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 | |||
1742 | // https://github.com/bitcoinjs/bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js | ||
1743 | bitcoinjs.bitcoin.networks.regtest = { | ||
1744 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
1745 | bech32: 'bcrt', | ||
1746 | bip32: { | ||
1747 | public: 0x043587cf, | ||
1748 | private: 0x04358394, | ||
1749 | }, | ||
1750 | pubKeyHash: 0x6f, | ||
1751 | scriptHash: 0xc4, | ||
1752 | wif: 0xef, | ||
1753 | }; | ||
diff --git a/src/js/index.js b/src/js/index.js index c9e7b44..d169ed2 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -2100,6 +2100,15 @@ | |||
2100 | }, | 2100 | }, |
2101 | }, | 2101 | }, |
2102 | { | 2102 | { |
2103 | name: "BTC - Bitcoin RegTest", | ||
2104 | onSelect: function() { | ||
2105 | network = bitcoinjs.bitcoin.networks.regtest; | ||
2106 | // Using hd coin value 1 based on bip44_coin_type | ||
2107 | // https://github.com/chaintope/bitcoinrb/blob/f1014406f6b8f9b4edcecedc18df70c80df06f11/lib/bitcoin/chainparams/regtest.yml | ||
2108 | setHdCoin(1); | ||
2109 | }, | ||
2110 | }, | ||
2111 | { | ||
2103 | name: "BTC - Bitcoin Testnet", | 2112 | name: "BTC - Bitcoin Testnet", |
2104 | onSelect: function() { | 2113 | onSelect: function() { |
2105 | network = bitcoinjs.bitcoin.networks.testnet; | 2114 | network = bitcoinjs.bitcoin.networks.testnet; |
diff --git a/src/js/segwit-parameters.js b/src/js/segwit-parameters.js index 83d49da..9641d71 100644 --- a/src/js/segwit-parameters.js +++ b/src/js/segwit-parameters.js | |||
@@ -28,6 +28,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wpkh = { | |||
28 | wif: 0xef | 28 | wif: 0xef |
29 | }; | 29 | }; |
30 | 30 | ||
31 | bitcoinjs.bitcoin.networks.regtest.p2wpkh = { | ||
32 | baseNetwork: "regtest", | ||
33 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
34 | bech32: 'bcrt', | ||
35 | bip32: { | ||
36 | public: 0x045f1cf6, | ||
37 | private: 0x045f18bc | ||
38 | }, | ||
39 | pubKeyHash: 0x6f, | ||
40 | scriptHash: 0xc4, | ||
41 | wif: 0xef | ||
42 | }; | ||
43 | |||
31 | // p2wpkh in p2sh | 44 | // p2wpkh in p2sh |
32 | 45 | ||
33 | bitcoinjs.bitcoin.networks.bitcoin.p2wpkhInP2sh = { | 46 | bitcoinjs.bitcoin.networks.bitcoin.p2wpkhInP2sh = { |
@@ -56,6 +69,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wpkhInP2sh = { | |||
56 | wif: 0xef | 69 | wif: 0xef |
57 | }; | 70 | }; |
58 | 71 | ||
72 | bitcoinjs.bitcoin.networks.regtest.p2wpkhInP2sh = { | ||
73 | baseNetwork: "regtest", | ||
74 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
75 | bech32: 'bcrt', | ||
76 | bip32: { | ||
77 | public: 0x044a5262, | ||
78 | private: 0x044a4e28 | ||
79 | }, | ||
80 | pubKeyHash: 0x6f, | ||
81 | scriptHash: 0xc4, | ||
82 | wif: 0xef | ||
83 | }; | ||
84 | |||
59 | // p2wsh | 85 | // p2wsh |
60 | 86 | ||
61 | bitcoinjs.bitcoin.networks.bitcoin.p2wsh = { | 87 | bitcoinjs.bitcoin.networks.bitcoin.p2wsh = { |
@@ -84,6 +110,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wsh = { | |||
84 | wif: 0xef | 110 | wif: 0xef |
85 | }; | 111 | }; |
86 | 112 | ||
113 | bitcoinjs.bitcoin.networks.regtest.p2wsh = { | ||
114 | baseNetwork: "regtest", | ||
115 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
116 | bech32: 'bcrt', | ||
117 | bip32: { | ||
118 | public: 0x02575483, | ||
119 | private: 0x02575048 | ||
120 | }, | ||
121 | pubKeyHash: 0x6f, | ||
122 | scriptHash: 0xc4, | ||
123 | wif: 0xef | ||
124 | }; | ||
125 | |||
87 | // p2wsh in p2sh | 126 | // p2wsh in p2sh |
88 | 127 | ||
89 | bitcoinjs.bitcoin.networks.bitcoin.p2wshInP2sh = { | 128 | bitcoinjs.bitcoin.networks.bitcoin.p2wshInP2sh = { |
@@ -112,6 +151,19 @@ bitcoinjs.bitcoin.networks.testnet.p2wshInP2sh = { | |||
112 | wif: 0xef | 151 | wif: 0xef |
113 | }; | 152 | }; |
114 | 153 | ||
154 | bitcoinjs.bitcoin.networks.regtest.p2wshInP2sh = { | ||
155 | baseNetwork: "regtest", | ||
156 | messagePrefix: '\x18Bitcoin Signed Message:\n', | ||
157 | bech32: 'bcrt', | ||
158 | bip32: { | ||
159 | public: 0x024289ef, | ||
160 | private: 0x024285b5 | ||
161 | }, | ||
162 | pubKeyHash: 0x6f, | ||
163 | scriptHash: 0xc4, | ||
164 | wif: 0xef | ||
165 | }; | ||
166 | |||
115 | bitcoinjs.bitcoin.networks.litecoin.p2wpkh = { | 167 | bitcoinjs.bitcoin.networks.litecoin.p2wpkh = { |
116 | baseNetwork: "litecoin", | 168 | baseNetwork: "litecoin", |
117 | messagePrefix: '\x19Litecoin Signed Message:\n', | 169 | messagePrefix: '\x19Litecoin Signed Message:\n', |
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index fefb8b7..260ff2c 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -412,6 +412,13 @@ it('Allows selection of bitcoin testnet', function(done) { | |||
412 | }; | 412 | }; |
413 | testNetwork(done, params); | 413 | testNetwork(done, params); |
414 | }); | 414 | }); |
415 | it('Allows selection of bitcoin regtest', function(done) { | ||
416 | var params = { | ||
417 | selectText: "BTC - Bitcoin RegTest", | ||
418 | firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi", | ||
419 | }; | ||
420 | testNetwork(done, params); | ||
421 | }); | ||
415 | it('Allows selection of litecoin', function(done) { | 422 | it('Allows selection of litecoin', function(done) { |
416 | var params = { | 423 | var params = { |
417 | selectText: "LTC - Litecoin", | 424 | selectText: "LTC - Litecoin", |