aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/js/index.js17
-rw-r--r--tests/spec/tests.js11
2 files changed, 28 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js
index dc24963..114f74a 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1139,6 +1139,17 @@
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 keyPair = new libs.bitcoin.ECPair(keyPair.d, null, { network: network, compressed: false });
1145 var pubkeyBuffer = keyPair.getPublicKeyBuffer();
1146 var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
1147 var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
1148 address = libs.bitcoin.address.toBase58Check(addressBuffer, 0x41);
1149 if (hasPrivkey) {
1150 privkey = keyPair.d.toBuffer().toString('hex');
1151 }
1152 }
1142 1153
1143 // RSK values are different 1154 // RSK values are different
1144 if (networkIsRsk()) { 1155 if (networkIsRsk()) {
@@ -3237,6 +3248,12 @@
3237 }, 3248 },
3238 }, 3249 },
3239 { 3250 {
3251 name: "TRX - Tron",
3252 onSelect: function() {
3253 setHdCoin(195);
3254 },
3255 },
3256 {
3240 name: "TWINS - TWINS", 3257 name: "TWINS - TWINS",
3241 onSelect: function() { 3258 onSelect: function() {
3242 network = libs.bitcoin.networks.twins; 3259 network = libs.bitcoin.networks.twins;
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index 58318db..8b3b07b 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -2286,6 +2286,17 @@ it('Allows selection of Binance Smart Chain', function(done) {
2286 testNetwork(done, params); 2286 testNetwork(done, params);
2287}); 2287});
2288 2288
2289it('Allows selection of TRX on Tron', function(done) {
2290 var params = {
2291 selectText: "TRX - Tron",
2292 phrase: "abandon abandon ability",
2293 firstAddress: "TA891Fu7vVz595BGQpNX2MCzr7yBcxuoC7",
2294 firstPubKey: "0337bbb060e6166066f7f9e59e52f67bc23a6c9d0cbc815b82b6d89112444842e7",
2295 firstPrivKey: "3a8fbd0379a815764979de86a3fcda759cb62d49e784e7b2a9a03206c90cfae2",
2296 };
2297 testNetwork(done, params);
2298});
2299
2289// BIP39 seed is set from phrase 2300// BIP39 seed is set from phrase
2290it('Sets the bip39 seed from the prhase', function(done) { 2301it('Sets the bip39 seed from the prhase', function(done) {
2291 driver.findElement(By.css('.phrase')) 2302 driver.findElement(By.css('.phrase'))