From 6d2e202083c4166aa4be8557789a8a461df6bd5c Mon Sep 17 00:00:00 2001 From: jhonkus Date: Mon, 7 Dec 2020 20:25:25 +0800 Subject: Add ZooBC address format --- src/js/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/js/index.js b/src/js/index.js index 61a2dd5..1f4cc1f 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1348,6 +1348,27 @@ 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) { -- cgit v1.2.3