Merge pull request #441 from bytefly/master

Add TRX coin support
This commit is contained in:
iancoleman
2020-10-19 09:12:43 +11:00
committed by GitHub
2 changed files with 28 additions and 0 deletions

View File

@@ -1139,6 +1139,17 @@
privkey = libs.ethUtil.bufferToHex(keyPair.d.toBuffer());
}
}
//TRX is different
if (networks[DOM.network.val()].name == "TRX - Tron") {
keyPair = new libs.bitcoin.ECPair(keyPair.d, null, { network: network, compressed: false });
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()) {
@@ -3236,6 +3247,12 @@
setHdCoin(159);
},
},
{
name: "TRX - Tron",
onSelect: function() {
setHdCoin(195);
},
},
{
name: "TWINS - TWINS",
onSelect: function() {

View File

@@ -2286,6 +2286,17 @@ it('Allows selection of Binance Smart Chain', function(done) {
testNetwork(done, params);
});
it('Allows selection of TRX on Tron', function(done) {
var params = {
selectText: "TRX - Tron",
phrase: "abandon abandon ability",
firstAddress: "TA891Fu7vVz595BGQpNX2MCzr7yBcxuoC7",
firstPubKey: "0337bbb060e6166066f7f9e59e52f67bc23a6c9d0cbc815b82b6d89112444842e7",
firstPrivKey: "3a8fbd0379a815764979de86a3fcda759cb62d49e784e7b2a9a03206c90cfae2",
};
testNetwork(done, params);
});
// BIP39 seed is set from phrase
it('Sets the bip39 seed from the prhase', function(done) {
driver.findElement(By.css('.phrase'))