mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-23 09:04:44 +00:00
Use ltub for litecoin by default instead of xprv
Introduced when upgrading from bitcoinjs-lib v3.3.0
This commit is contained in:
+1
-1
@@ -277,7 +277,7 @@
|
|||||||
<label for="litecoin-use-ltub" class="col-sm-2 control-label">Prefixes</label>
|
<label for="litecoin-use-ltub" class="col-sm-2 control-label">Prefixes</label>
|
||||||
<div class="col-sm-10 checkbox">
|
<div class="col-sm-10 checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="litecoin-use-ltub" class="litecoin-use-ltub">
|
<input type="checkbox" id="litecoin-use-ltub" class="litecoin-use-ltub" checked="checked">
|
||||||
Use <code>Ltpv / Ltub</code> instead of <code>xprv / xpub</code>
|
Use <code>Ltpv / Ltub</code> instead of <code>xprv / xpub</code>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -316,3 +316,14 @@ bitcoinjs.bitcoin.networks.litecoinBip49 = {
|
|||||||
scriptHash: 0x32,
|
scriptHash: 0x32,
|
||||||
wif: 0xb0
|
wif: 0xb0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bitcoinjs.bitcoin.networks.litecoinXprv = {
|
||||||
|
messagePrefix: '\x19Litecoin Signed Message:\n',
|
||||||
|
bip32: {
|
||||||
|
public: 0x0488b21e,
|
||||||
|
private: 0x0488ade4,
|
||||||
|
},
|
||||||
|
pubKeyHash: 0x30,
|
||||||
|
scriptHash: 0x32,
|
||||||
|
wif: 0xb0
|
||||||
|
};
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@
|
|||||||
var showPubKey = true;
|
var showPubKey = true;
|
||||||
var showPrivKey = true;
|
var showPrivKey = true;
|
||||||
var showQr = false;
|
var showQr = false;
|
||||||
var litecoinUseLtub = false;
|
var litecoinUseLtub = true;
|
||||||
|
|
||||||
var entropyChangeTimeoutEvent = null;
|
var entropyChangeTimeoutEvent = null;
|
||||||
var phraseChangeTimeoutEvent = null;
|
var phraseChangeTimeoutEvent = null;
|
||||||
@@ -318,10 +318,10 @@
|
|||||||
function litecoinUseLtubChanged() {
|
function litecoinUseLtubChanged() {
|
||||||
litecoinUseLtub = DOM.litecoinUseLtub.prop("checked");
|
litecoinUseLtub = DOM.litecoinUseLtub.prop("checked");
|
||||||
if (litecoinUseLtub) {
|
if (litecoinUseLtub) {
|
||||||
network = bitcoinjs.bitcoin.networks.litecoinLtub;
|
network = bitcoinjs.bitcoin.networks.litecoin;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
network = bitcoinjs.bitcoin.networks.litecoin;
|
network = bitcoinjs.bitcoin.networks.litecoinXprv;
|
||||||
}
|
}
|
||||||
phraseChanged();
|
phraseChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -2473,11 +2473,11 @@ it('Shows error for hardened addresses with xpub root key', function(done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Litecoin uses xprv by default, and can optionally be set to ltpv
|
// Litecoin uses ltub by default, and can optionally be set to xprv
|
||||||
// github issue 96
|
// github issue 96
|
||||||
// https://github.com/iancoleman/bip39/issues/96
|
// https://github.com/iancoleman/bip39/issues/96
|
||||||
// Issue with extended keys on Litecoin
|
// Issue with extended keys on Litecoin
|
||||||
it('Uses xprv by default for litecoin, but can be set to ltpv', function(done) {
|
it('Uses ltub by default for litecoin, but can be set to xprv', function(done) {
|
||||||
driver.findElement(By.css('.phrase'))
|
driver.findElement(By.css('.phrase'))
|
||||||
.sendKeys("abandon abandon ability");
|
.sendKeys("abandon abandon ability");
|
||||||
selectNetwork("LTC - Litecoin");
|
selectNetwork("LTC - Litecoin");
|
||||||
@@ -2486,17 +2486,17 @@ it('Uses xprv by default for litecoin, but can be set to ltpv', function(done) {
|
|||||||
driver.findElement(By.css('.root-key'))
|
driver.findElement(By.css('.root-key'))
|
||||||
.getAttribute("value")
|
.getAttribute("value")
|
||||||
.then(function(rootKey) {
|
.then(function(rootKey) {
|
||||||
expect(rootKey).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
|
expect(rootKey).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU");
|
||||||
// set litecoin to use ltub
|
// set litecoin to use ltub
|
||||||
driver.executeScript(function() {
|
driver.executeScript(function() {
|
||||||
$(".litecoin-use-ltub").prop("checked", true);
|
$(".litecoin-use-ltub").prop("checked", false);
|
||||||
$(".litecoin-use-ltub").trigger("change");
|
$(".litecoin-use-ltub").trigger("change");
|
||||||
});
|
});
|
||||||
driver.sleep(generateDelay).then(function() {
|
driver.sleep(generateDelay).then(function() {
|
||||||
driver.findElement(By.css('.root-key'))
|
driver.findElement(By.css('.root-key'))
|
||||||
.getAttribute("value")
|
.getAttribute("value")
|
||||||
.then(function(rootKey) {
|
.then(function(rootKey) {
|
||||||
expect(rootKey).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU");
|
expect(rootKey).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user