Adding TWINS coin support
authoryurykk <yurykk@gmail.com>
Thu, 27 Jun 2019 08:56:47 +0000 (11:56 +0300)
committeryurykk <yurykk@gmail.com>
Thu, 27 Jun 2019 08:56:47 +0000 (11:56 +0300)
src/js/bitcoinjs-extensions.js
src/js/index.js
tests/spec/tests.js

index f7e708bf327691ef45240a4f2e401efadfaba659..4e05482f174980f231d0231ba10396c1f9a190ae 100644 (file)
@@ -1253,6 +1253,28 @@ bitcoinjs.bitcoin.networks.toa = {
   wif: 0xc1,
 };
 
+bitcoinjs.bitcoin.networks.twins = {
+  messagePrefix: 'unused',
+  bip32: {
+    public: 0x022d2533,
+    private: 0x0221312b
+  },
+  pubKeyHash: 0x49,
+  scriptHash: 0x53,
+  wif: 0x42
+};
+
+bitcoinjs.bitcoin.networks.twinstestnet = {
+  messagePrefix: 'unused',
+  bip32: {
+    public: 0x3a8061a0,
+    private: 0x3a805837
+  },
+  pubKeyHash: 0x4c,
+  scriptHash: 0x89,
+  wif: 0xED
+};
+
 bitcoinjs.bitcoin.networks.ultimatesecurecash = {
   messagePrefix: '\x18UltimateSecureCash Signed Message:\n',
   bip32: {
index 56f42d4d2e3766b131c709e3d8b39be04394391a..8242da47b56d2be639f4dd391922ba31b1a9a917 100644 (file)
                     pubkey = eosUtil.bufferToPublic(keyPair.getPublicKeyBuffer());
                     privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32));
                 }
-                
+
                 addAddressToList(indexText, address, pubkey, privkey);
                 if (isLast) {
                     hidePending();
                 setHdCoin(159);
             },
         },
+        {
+            name: "TWINS - TWINS",
+            onSelect: function() {
+                network = bitcoinjs.bitcoin.networks.twins;
+                setHdCoin(970);
+            },
+        },
+        {
+            name: "TWINS - TWINS Testnet",
+            onSelect: function() {
+                network = bitcoinjs.bitcoin.networks.twinstestnet;
+                setHdCoin(1);
+            },
+        },
         {
             name: "USC - Ultimatesecurecash",
             onSelect: function() {
index 90cdc7afd84a66031ab15ee33ed6112475a62d20..c92689a78c247e3e3e82c0a63321a3dba9e262b1 100644 (file)
@@ -1242,6 +1242,20 @@ it('Allows selection of Toa', function(done) {
     };
     testNetwork(done, params);
 });
+it('Allows selection of TWINS', function(done) {
+    var params = {
+        selectText: "TWINS - TWINS",
+        firstAddress: "WPpJnfLLubNmF7HLNxg8d8zH5haxn4wri8",
+    };
+    testNetwork(done, params);
+});
+it('Allows selection of TWINS testnet', function(done) {
+    var params = {
+        selectText: "TWINS - TWINS Testnet",
+        firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
+    };
+    testNetwork(done, params);
+});
 it('Allows selection of Ultimatesecurecash', function(done) {
     var params = {
         selectText: "USC - Ultimatesecurecash",