]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - src/js/index.js
Add ZooBC address format
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / src / js / index.js
index 61a2dd551ee4937372ca2806b12d3b34bf86cdaa..1f4cc1fe12ab203ff39474804ac1e63c44c1463b 100644 (file)
                          address = libs.bchaddrSlp.toSlpAddress(address);
                      }
                  }
+
+                // ZooBC address format may vary
+                if (networks[DOM.network.val()].name == "ZBC - ZooBlockchain") {  
+                    
+                    var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
+                    var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
+                    var path = "m/";
+                        path += purpose + "'/";
+                        path += coin + "'/" + index + "'";
+                    var result = libs.zoobcUtil.getKeypair(path, seed);
+    
+                    let publicKey = result.pubKey.slice(1, 33);
+                    let privateKey = result.key;
+    
+                    privkey = privateKey.toString('hex');
+                    pubkey = publicKey.toString('hex');
+    
+                    indexText = path;
+                    address = libs.zoobcUtil.getZBCAddress(publicKey, 'ZBC');
+                }
+
                 // Segwit addresses are different
                 if (isSegwit) {
                     if (!segwitAvailable) {