X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fjs%2Findex.js;h=c502208d3b468737c3cc1f86d059434e5ba9de1d;hb=a362ff2f626b8dbf0302c1d55a55ccd3ee2da221;hp=fd8c16b99173bcb4a8a6a3c49793bf062dd63d4e;hpb=32ade2fbf79415f8335d96c942b5f5569829820d;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/src/js/index.js b/src/js/index.js index fd8c16b..c502208 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1238,7 +1238,7 @@ address = libs.ethUtil.addHexPrefix(checksumAddress); pubkey = libs.ethUtil.addHexPrefix(pubkey); if (hasPrivkey) { - privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer()); + privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer(32)); } } //TRX is different @@ -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) { @@ -1398,6 +1419,12 @@ privkey = FIObufferToPrivate(keyPair.d.toBuffer(32)); } + if (networks[DOM.network.val()].name == "ATOM - Cosmos Hub") { + address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer()); + pubkey = CosmosBufferToPublic(keyPair.getPublicKeyBuffer()); + privkey = keyPair.d.toBuffer().toString("base64"); + } + //Groestlcoin Addresses are different if(isGRS()) { @@ -2213,6 +2240,13 @@ setHdCoin(357); }, }, + { + name: "ATOM - Cosmos Hub", + onSelect: function() { + network = libs.bitcoin.networks.bitcoin; + setHdCoin(118); + }, + }, { name: "AUR - Auroracoin", onSelect: function() { @@ -3218,6 +3252,13 @@ setHdCoin(4); }, }, + { + name: "RITO - Ritocoin", + onSelect: function() { + network = libs.bitcoin.networks.ritocoin; + setHdCoin(19169); + }, + }, { name: "RVR - RevolutionVR", onSelect: function() { @@ -3540,6 +3581,13 @@ setHdCoin(136); }, }, + { + name: "ZBC - ZooBlockchain", + onSelect: function () { + network = libs.bitcoin.networks.zoobc; + setHdCoin(883); + }, + }, { name: "ZCL - Zclassic", onSelect: function() {