ADD support MONK, LTCt, DOGEt
authorPanagiotis David <panagiotis@coinomi.com>
Thu, 6 Jun 2019 18:45:57 +0000 (21:45 +0300)
committerPanagiotis David <onnateldome@gmail.com>
Mon, 10 Jun 2019 07:53:30 +0000 (10:53 +0300)
src/js/bitcoinjs-extensions.js
src/js/index.js
tests/spec/tests.js

index 16e938578b7634631b1b9535e07687042b6b6dbf..f7e708bf327691ef45240a4f2e401efadfaba659 100644 (file)
@@ -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,
+};
index 88b1e097fe5aa90c03e2ac5c3b18b93f2930bcab..7e654346d6c9d1608420ce556676a7994c3c24d7 100644 (file)
                         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();
                 setHdCoin(3);
             },
         },
+        {
+            name: "DOGEt - Dogecoin Testnet",
+            onSelect: function() {
+                network = bitcoinjs.bitcoin.networks.dogecointestnet;
+                setHdCoin(1);
+            },
+        },
         {
             name: "DXN - DEXON",
             onSelect: function() {
                 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() {
                 setHdCoin(121);
             },
         },
+        {
+            name: "MONK - Monkey Project",
+`           onSelect: function() {
+                network = bitcoinjs.bitcoin.networks.monkey;
+                setHdCoin(214);
+            },
+        }
     ]
 
     var clients = [
index e3f7e1c1a6469a7b1850a6207b3bf7afa7cd1409..d609dcaa61776e3200ba3209266b8e39dd4669ac 100644 (file)
@@ -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) {