From b85da0745a0bcf438c2ef19b72dd44d1b09ccd94 Mon Sep 17 00:00:00 2001 From: Panagiotis David Date: Thu, 6 Jun 2019 21:45:57 +0300 Subject: ADD support MONK, LTCt, DOGEt --- src/js/bitcoinjs-extensions.js | 37 +++++++++++++++++++++++++++++++++++-- src/js/index.js | 26 ++++++++++++++++++++++++-- tests/spec/tests.js | 23 ++++++++++++++++++++++- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index 16e9385..f7e708b 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js @@ -47,14 +47,14 @@ bitcoinjs.bitcoin.networks.crown = { var addrBytes = b58.decode(oldAddress); - var hash160 = new Uint16Array(23); + var hash160 = new Uint16Array(23); hash160[0]= 0x01; //C hash160[1]= 0x75; //R hash160[2]= 0x07; //W addrBytes.copy(hash160, 3, 1, 21); var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4); - var binaryAddr = new Uint16Array(27); + var binaryAddr = new Uint16Array(27); binaryAddr.set(hash160,0); checksum.copy(binaryAddr, 23, 0, 4); var newAddress = b58.encode(binaryAddr); @@ -172,6 +172,17 @@ bitcoinjs.bitcoin.networks.dogecoin = { wif: 0x9e }; +bitcoinjs.bitcoin.networks.dogecointestnet = { + messagePrefix: '\x19Dogecoin Signed Message:\n', + bip32: { + public: 0x043587cf, + private: 0x04358394 + }, + pubKeyHash: 0x71, + scriptHash: 0xc4, + wif: 0xf1 +}; + bitcoinjs.bitcoin.networks.denarius = { messagePrefix: '\x19Denarius Signed Message:\n', bip32: { @@ -878,6 +889,17 @@ bitcoinjs.bitcoin.networks.linx = { wif: 0xcb, }; + +bitcoinjs.bitcoin.networks.litecointestnet = { + messagePrefix: '\x18Litecoin Signed Message:\n', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0xef, +}; bitcoinjs.bitcoin.networks.litecoincash = { messagePrefix: '\x18Litecoin Signed Message:\n', bip32: { @@ -1549,3 +1571,14 @@ bitcoinjs.bitcoin.networks.deeponion = { scriptHash: 0x4E, wif: 0x9F, }; + +bitcoinjs.bitcoin.networks.monkey = { + messagePrefix: 'x18DarkNet Signed Message:\n', + bip32: { + public: 0x0488B21E, + private: 0x0488ADE4, + }, + pubKeyHash: 0x7F, + scriptHash: 0xC4, + wif: 0x3F, +}; diff --git a/src/js/index.js b/src/js/index.js index 88b1e09..7e65434 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -980,11 +980,11 @@ address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network) } } - + if ((networks[DOM.network.val()].name == "CRW - Crown")) { address = bitcoinjs.bitcoin.networks.crown.toNewAddress(address); } - + addAddressToList(indexText, address, pubkey, privkey); if (isLast) { hidePending(); @@ -1959,6 +1959,13 @@ setHdCoin(3); }, }, + { + name: "DOGEt - Dogecoin Testnet", + onSelect: function() { + network = bitcoinjs.bitcoin.networks.dogecointestnet; + setHdCoin(1); + }, + }, { name: "DXN - DEXON", onSelect: function() { @@ -2212,6 +2219,14 @@ DOM.litecoinLtubContainer.removeClass("hidden"); }, }, + { + name: "LTCt - Litecoin Testnet", + onSelect: function() { + network = bitcoinjs.bitcoin.networks.litecointestnet; + setHdCoin(1); + DOM.litecoinLtubContainer.removeClass("hidden"); + }, + }, { name: "LTZ - LitecoinZ", onSelect: function() { @@ -2756,6 +2771,13 @@ setHdCoin(121); }, }, + { + name: "MONK - Monkey Project", +` onSelect: function() { + network = bitcoinjs.bitcoin.networks.monkey; + setHdCoin(214); + }, + } ] var clients = [ diff --git a/tests/spec/tests.js b/tests/spec/tests.js index e3f7e1c..d609dca 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -408,6 +408,13 @@ it('Allows selection of litecoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of litecoin testnet', function(done) { + var params = { + selectText: "LTCt - Litecoin Testnet", + firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi", + }; + testNetwork(done, params); +}); it('Allows selection of ripple', function(done) { var params = { selectText: "XRP - Ripple", @@ -423,6 +430,13 @@ it('Allows selection of dogecoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of dogecoin testnet', function(done) { + var params = { + selectText: "DOGEt - Dogecoin testnet", + firstAddress: "niHnSJKHdwDyDxRMLBJrtNqpvHEsAFWe6B", + }; + testNetwork(done, params); +}); it('Allows selection of denarius', function(done) { var params = { selectText: "DNR - Denarius", @@ -475,7 +489,7 @@ it('Allows selection of clam', function(done) { it('Allows selection of crown', function(done) { var params = { selectText: "CRW - Crown (Legacy)", - firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5", + firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5", }; testNetwork(done, params); }); @@ -1462,6 +1476,13 @@ it('Allows selection of Ethersocial Network', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Monkey Project', function(done) { + var params = { + selectText: "MONK - Monkey Project", + firstAddress: "MnLrcnnUzKnf7TzufjRe5DLZqQJz18oYyu", + }; + testNetwork(done, params); +}); // BIP39 seed is set from phrase it('Sets the bip39 seed from the prhase', function(done) { -- cgit v1.2.3