aboutsummaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorzr <zr@coinhub.dev>2020-09-10 17:40:56 +0800
committerzr <zr@coinhub.dev>2020-09-10 17:40:56 +0800
commitb674c5710b70c9dac9f11758cac222d45575dec2 (patch)
tree0ac413d40dc7cffb173344b1a9afe6bea1c3dd50 /src/js
parent920f7aa0785f3d2fb7b08667ea371f349eb4bced (diff)
downloadBIP39-b674c5710b70c9dac9f11758cac222d45575dec2.tar.gz
BIP39-b674c5710b70c9dac9f11758cac222d45575dec2.tar.zst
BIP39-b674c5710b70c9dac9f11758cac222d45575dec2.zip
Add TRX coin support
Diffstat (limited to 'src/js')
-rw-r--r--src/js/index.js16
1 files changed, 16 insertions, 0 deletions
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 @@
1139 privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer()); 1139 privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
1140 } 1140 }
1141 } 1141 }
1142 //TRX is different
1143 if (networks[DOM.network.val()].name == "TRX - Tron") {
1144 var pubkeyBuffer = keyPair.getPublicKeyBuffer();
1145 var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
1146 var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
1147 address = libs.bitcoin.address.toBase58Check(addressBuffer, 0x41);
1148 if (hasPrivkey) {
1149 privkey = keyPair.d.toBuffer().toString('hex');
1150 }
1151 }
1142 1152
1143 // RSK values are different 1153 // RSK values are different
1144 if (networkIsRsk()) { 1154 if (networkIsRsk()) {
@@ -3229,6 +3239,12 @@
3229 }, 3239 },
3230 }, 3240 },
3231 { 3241 {
3242 name: "TRX - Tron",
3243 onSelect: function() {
3244 setHdCoin(195);
3245 },
3246 },
3247 {
3232 name: "TWINS - TWINS", 3248 name: "TWINS - TWINS",
3233 onSelect: function() { 3249 onSelect: function() {
3234 network = libs.bitcoin.networks.twins; 3250 network = libs.bitcoin.networks.twins;