From: zr Date: Thu, 10 Sep 2020 09:40:56 +0000 (+0800) Subject: Add TRX coin support X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git;a=commitdiff_plain;h=b674c5710b70c9dac9f11758cac222d45575dec2 Add TRX coin support --- diff --git a/src/js/index.js b/src/js/index.js index 252eec1..2c02721 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1139,6 +1139,16 @@ privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer()); } } + //TRX is different + if (networks[DOM.network.val()].name == "TRX - Tron") { + var pubkeyBuffer = keyPair.getPublicKeyBuffer(); + var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer); + var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey); + address = libs.bitcoin.address.toBase58Check(addressBuffer, 0x41); + if (hasPrivkey) { + privkey = keyPair.d.toBuffer().toString('hex'); + } + } // RSK values are different if (networkIsRsk()) { @@ -3228,6 +3238,12 @@ setHdCoin(159); }, }, + { + name: "TRX - Tron", + onSelect: function() { + setHdCoin(195); + }, + }, { name: "TWINS - TWINS", onSelect: function() {