mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-30 12:34:43 +00:00
Merge pull request #390 from matthewleon/bugfix/eth-xpub-derivation
Bugfix/eth xpub derivation
This commit is contained in:
+3
-3
@@ -1128,9 +1128,9 @@
|
|||||||
}
|
}
|
||||||
// Ethereum values are different
|
// Ethereum values are different
|
||||||
if (networkIsEthereum()) {
|
if (networkIsEthereum()) {
|
||||||
var privKeyBuffer = keyPair.d.toBuffer(32);
|
var pubkeyBuffer = keyPair.getPublicKeyBuffer();
|
||||||
privkey = privKeyBuffer.toString('hex');
|
var ethPubkey = libs.ethUtil.importPublic(pubkeyBuffer);
|
||||||
var addressBuffer = libs.ethUtil.privateToAddress(privKeyBuffer);
|
var addressBuffer = libs.ethUtil.publicToAddress(ethPubkey);
|
||||||
var hexAddress = addressBuffer.toString('hex');
|
var hexAddress = addressBuffer.toString('hex');
|
||||||
var checksumAddress = libs.ethUtil.toChecksumAddress(hexAddress);
|
var checksumAddress = libs.ethUtil.toChecksumAddress(hexAddress);
|
||||||
address = libs.ethUtil.addHexPrefix(checksumAddress);
|
address = libs.ethUtil.addHexPrefix(checksumAddress);
|
||||||
|
|||||||
+16
-1
@@ -595,7 +595,6 @@ it('Allows selection of ethereum', function(done) {
|
|||||||
firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
|
firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
|
||||||
};
|
};
|
||||||
testNetwork(done, params);
|
testNetwork(done, params);
|
||||||
// TODO test private key and public key
|
|
||||||
});
|
});
|
||||||
it('Allows selection of slimcoin', function(done) {
|
it('Allows selection of slimcoin', function(done) {
|
||||||
var params = {
|
var params = {
|
||||||
@@ -4341,4 +4340,20 @@ it('Generates addresses when seed is set', function(done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://github.com/iancoleman/bip39/issues/169
|
||||||
|
it('Generates ethereum addresses from a public key', function(done) {
|
||||||
|
var pubkey = "xpub68UK3hrMEp2jLPxPASgXSiqiUsQsUWZHCeuu6NqcJLt259LMeWzwDyufXLN1QmjLeLRY5he4QfArDDLbsXiw3xN3kFcYtyDy74BY73RPhhW";
|
||||||
|
driver.findElement(By.css('.root-key'))
|
||||||
|
.sendKeys(pubkey);
|
||||||
|
driver.findElement(By.css('#bip32-tab a'))
|
||||||
|
.click()
|
||||||
|
selectNetwork('ETH - Ethereum');
|
||||||
|
driver.sleep(generateDelay).then(function() {
|
||||||
|
getFirstAddress(function(address) {
|
||||||
|
expect(address).toBe("0x1Bd54748903438C7E386b4a3fCbe16237A316a98");
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user