Compare commits

...

5 Commits
0.2.4 ... 0.2.5

Author SHA1 Message Date
Ian Coleman
0a8d06d03e Release v0.2.5 2017-09-01 12:35:42 +10:00
Ian Coleman
88311463c7 Allow P2WPKH nested in P2SH addresses on BIP32 tab 2017-09-01 12:28:27 +10:00
Ian Coleman
cd7c8327b1 Validate root key correctly for alternate networks 2017-09-01 12:27:03 +10:00
Ian Coleman
0cda44d5f6 Rename bip49 to p2wpkhNestedInP2sh where suitable 2017-09-01 12:25:45 +10:00
Ian Coleman
7258b102c1 Add confirmation steps to the release process 2017-08-28 10:03:21 +10:00
6 changed files with 153 additions and 76 deletions

View File

@@ -118,7 +118,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.2.4</p>
<p class="version">v0.2.5</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -412,6 +412,13 @@
<span data-translate>Use hardened addresses</span>
</label>
</div>
<div class="form-group">
<div class="col-sm-2"></div>
<label class="col-sm-10">
<input class="p2wpkh-nested-in-p2sh" type="checkbox">
<span data-translate>Use SegWit addresses (ie P2WPKH Nested In P2SH)</span>
</label>
</div>
<div class="form-group">
<label for="core-path" class="col-sm-2 control-label" data-translate>Bitcoin Core</label>
<div class="col-sm-10">
@@ -46190,6 +46197,7 @@ window.Entropy = new (function() {
DOM.bip49change = $("#bip49 .change");
DOM.generatedStrength = $(".generate-container .strength");
DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh");
DOM.addresses = $(".addresses");
DOM.rowsToAdd = $(".rows-to-add");
DOM.more = $(".more");
@@ -46226,6 +46234,7 @@ window.Entropy = new (function() {
DOM.bip49change.on("input", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
DOM.addressToggle.on("click", toggleAddresses);
DOM.publicKeyToggle.on("click", togglePublicKeys);
@@ -46248,11 +46257,11 @@ window.Entropy = new (function() {
var networkIndex = e.target.value;
var network = networks[networkIndex];
network.onSelect();
if (network.bip49available) {
showBip49();
if (network.p2wpkhNestedInP2shAvailable) {
showP2wpkhNestedInP2shAvailable();
}
else {
hideBip49();
showP2wpkhNestedInP2shUnavailable();
}
if (seed != null) {
phraseChanged();
@@ -46384,7 +46393,6 @@ window.Entropy = new (function() {
function rootKeyChanged() {
showPending();
hideValidationError();
// Validate the root key TODO
var rootKeyBase58 = DOM.rootKey.val();
var errorText = validateRootKey(rootKeyBase58);
if (errorText) {
@@ -46577,7 +46585,7 @@ window.Entropy = new (function() {
function validateRootKey(rootKeyBase58) {
try {
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58);
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58, network);
}
catch (e) {
return "Invalid root key";
@@ -46755,8 +46763,8 @@ window.Entropy = new (function() {
var self = this;
this.shouldGenerate = true;
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
var isBip49 = bip49TabSelected();
var bip49available = networkHasBip49();
var isP2wpkhNestedInP2sh = bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
var p2wpkhNestedInP2shAvailable = networkHasBip49();
function init() {
calculateValues();
@@ -46801,8 +46809,8 @@ window.Entropy = new (function() {
address = convertRippleAdrr(address);
}
// BIP49 addresses are different
if (isBip49) {
if (!bip49available) {
if (isP2wpkhNestedInP2sh) {
if (!p2wpkhNestedInP2shAvailable) {
return;
}
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
@@ -47282,8 +47290,12 @@ window.Entropy = new (function() {
return DOM.bip32tab.hasClass("active");
}
function useP2wpkhNestedInP2sh() {
return DOM.useP2wpkhNestedInP2sh.prop("checked");
}
function networkHasBip49() {
return networks[DOM.network.val()].bip49available;
return networks[DOM.network.val()].p2wpkhNestedInP2shAvailable;
}
function bip49TabSelected() {
@@ -47295,20 +47307,23 @@ window.Entropy = new (function() {
DOM.bip49coin.val(coinValue);
}
function showBip49() {
function showP2wpkhNestedInP2shAvailable() {
DOM.bip49unavailable.addClass("hidden");
DOM.bip49available.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", false);
}
function hideBip49() {
function showP2wpkhNestedInP2shUnavailable() {
DOM.bip49available.addClass("hidden");
DOM.bip49unavailable.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", true);
DOM.useP2wpkhNestedInP2sh.prop("checked", false);
}
var networks = [
{
name: "BCH - Bitcoin Cash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(145);
@@ -47316,7 +47331,7 @@ window.Entropy = new (function() {
},
{
name: "BTC - Bitcoin",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(0);
@@ -47324,7 +47339,7 @@ window.Entropy = new (function() {
},
{
name: "BTC - Bitcoin Testnet",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.testnet;
setHdCoin(1);
@@ -47332,7 +47347,7 @@ window.Entropy = new (function() {
},
{
name: "CLAM - Clams",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.clam;
setHdCoin(23);
@@ -47340,7 +47355,7 @@ window.Entropy = new (function() {
},
{
name: "CRW - Crown",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.crown;
setHdCoin(72);
@@ -47348,7 +47363,7 @@ window.Entropy = new (function() {
},
{
name: "DASH - Dash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dash;
setHdCoin(5);
@@ -47356,7 +47371,7 @@ window.Entropy = new (function() {
},
{
name: "DASH - Dash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dashtn;
setHdCoin(1);
@@ -47364,7 +47379,7 @@ window.Entropy = new (function() {
},
{
name: "DOGE - Dogecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dogecoin;
setHdCoin(3);
@@ -47372,7 +47387,7 @@ window.Entropy = new (function() {
},
{
name: "ETH - Ethereum",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(60);
@@ -47380,7 +47395,7 @@ window.Entropy = new (function() {
},
{
name: "GAME - GameCredits",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.game;
setHdCoin(101);
@@ -47388,7 +47403,7 @@ window.Entropy = new (function() {
},
{
name: "JBS - Jumbucks",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.jumbucks;
setHdCoin(26);
@@ -47396,7 +47411,7 @@ window.Entropy = new (function() {
},
{
name: "LTC - Litecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
@@ -47405,7 +47420,7 @@ window.Entropy = new (function() {
},
{
name: "MAZA - Maza",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.maza;
setHdCoin(13);
@@ -47414,7 +47429,7 @@ window.Entropy = new (function() {
{
name: "NMC - Namecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.namecoin;
setHdCoin(7);
@@ -47422,7 +47437,7 @@ window.Entropy = new (function() {
},
{
name: "PIVX - PIVX",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivx;
setHdCoin(119);
@@ -47430,7 +47445,7 @@ window.Entropy = new (function() {
},
{
name: "PIVX - PIVX Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivxtestnet;
setHdCoin(1);
@@ -47438,7 +47453,7 @@ window.Entropy = new (function() {
},
{
name: "PPC - Peercoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.peercoin;
setHdCoin(6);
@@ -47446,7 +47461,7 @@ window.Entropy = new (function() {
},
{
name: "SDC - ShadowCash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadow;
setHdCoin(35);
@@ -47454,7 +47469,7 @@ window.Entropy = new (function() {
},
{
name: "SDC - ShadowCash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadowtn;
setHdCoin(1);
@@ -47462,7 +47477,7 @@ window.Entropy = new (function() {
},
{
name: "SLM - Slimcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcoin;
setHdCoin(63);
@@ -47470,7 +47485,7 @@ window.Entropy = new (function() {
},
{
name: "SLM - Slimcoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcointn;
setHdCoin(111);
@@ -47478,7 +47493,7 @@ window.Entropy = new (function() {
},
{
name: "VIA - Viacoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacoin;
setHdCoin(14);
@@ -47486,7 +47501,7 @@ window.Entropy = new (function() {
},
{
name: "VIA - Viacoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacointestnet;
setHdCoin(1);
@@ -47494,7 +47509,7 @@ window.Entropy = new (function() {
},
{
name: "XMY - Myriadcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.myriadcoin;
setHdCoin(90);
@@ -47502,7 +47517,7 @@ window.Entropy = new (function() {
},
{
name: "XRP - Ripple",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(144);

View File

@@ -1,3 +1,9 @@
# 0.2.5
* Rename variables for clarity between BIP49 and P2WPKH Nested In P2SH
* Fix bug for validation of root key when using non-bitcoin networks
* Add option to use P2WPKH Nested In P2SH addresses on BIP32 tab
# 0.2.4
* Show error when using xpub with hardened addresses

View File

@@ -17,3 +17,5 @@ created with the following steps:
1. attach the bip39-standalone.html file
1. Add a new post to twitter from @bip39tool with the version, link and hash
1. Publish to any hosted locations (eg iancoleman.github.io/bip39)
1. Download the file from the release and confirm it hashes to the expected value
1. Confirm the signature as posted to the release notes.

View File

@@ -114,7 +114,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.2.4</p>
<p class="version">v0.2.5</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -408,6 +408,13 @@
<span data-translate>Use hardened addresses</span>
</label>
</div>
<div class="form-group">
<div class="col-sm-2"></div>
<label class="col-sm-10">
<input class="p2wpkh-nested-in-p2sh" type="checkbox">
<span data-translate>Use SegWit addresses (ie P2WPKH Nested In P2SH)</span>
</label>
</div>
<div class="form-group">
<label for="core-path" class="col-sm-2 control-label" data-translate>Bitcoin Core</label>
<div class="col-sm-10">

View File

@@ -73,6 +73,7 @@
DOM.bip49change = $("#bip49 .change");
DOM.generatedStrength = $(".generate-container .strength");
DOM.hardenedAddresses = $(".hardened-addresses");
DOM.useP2wpkhNestedInP2sh = $(".p2wpkh-nested-in-p2sh");
DOM.addresses = $(".addresses");
DOM.rowsToAdd = $(".rows-to-add");
DOM.more = $(".more");
@@ -109,6 +110,7 @@
DOM.bip49change.on("input", calcForDerivationPath);
DOM.tab.on("shown.bs.tab", calcForDerivationPath);
DOM.hardenedAddresses.on("change", calcForDerivationPath);
DOM.useP2wpkhNestedInP2sh.on("change", calcForDerivationPath);
DOM.indexToggle.on("click", toggleIndexes);
DOM.addressToggle.on("click", toggleAddresses);
DOM.publicKeyToggle.on("click", togglePublicKeys);
@@ -131,11 +133,11 @@
var networkIndex = e.target.value;
var network = networks[networkIndex];
network.onSelect();
if (network.bip49available) {
showBip49();
if (network.p2wpkhNestedInP2shAvailable) {
showP2wpkhNestedInP2shAvailable();
}
else {
hideBip49();
showP2wpkhNestedInP2shUnavailable();
}
if (seed != null) {
phraseChanged();
@@ -267,7 +269,6 @@
function rootKeyChanged() {
showPending();
hideValidationError();
// Validate the root key TODO
var rootKeyBase58 = DOM.rootKey.val();
var errorText = validateRootKey(rootKeyBase58);
if (errorText) {
@@ -460,7 +461,7 @@
function validateRootKey(rootKeyBase58) {
try {
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58);
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58, network);
}
catch (e) {
return "Invalid root key";
@@ -638,8 +639,8 @@
var self = this;
this.shouldGenerate = true;
var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
var isBip49 = bip49TabSelected();
var bip49available = networkHasBip49();
var isP2wpkhNestedInP2sh = bip49TabSelected() || (bip32TabSelected() && useP2wpkhNestedInP2sh());
var p2wpkhNestedInP2shAvailable = networkHasBip49();
function init() {
calculateValues();
@@ -684,8 +685,8 @@
address = convertRippleAdrr(address);
}
// BIP49 addresses are different
if (isBip49) {
if (!bip49available) {
if (isP2wpkhNestedInP2sh) {
if (!p2wpkhNestedInP2shAvailable) {
return;
}
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
@@ -1165,8 +1166,12 @@
return DOM.bip32tab.hasClass("active");
}
function useP2wpkhNestedInP2sh() {
return DOM.useP2wpkhNestedInP2sh.prop("checked");
}
function networkHasBip49() {
return networks[DOM.network.val()].bip49available;
return networks[DOM.network.val()].p2wpkhNestedInP2shAvailable;
}
function bip49TabSelected() {
@@ -1178,20 +1183,23 @@
DOM.bip49coin.val(coinValue);
}
function showBip49() {
function showP2wpkhNestedInP2shAvailable() {
DOM.bip49unavailable.addClass("hidden");
DOM.bip49available.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", false);
}
function hideBip49() {
function showP2wpkhNestedInP2shUnavailable() {
DOM.bip49available.addClass("hidden");
DOM.bip49unavailable.removeClass("hidden");
DOM.useP2wpkhNestedInP2sh.prop("disabled", true);
DOM.useP2wpkhNestedInP2sh.prop("checked", false);
}
var networks = [
{
name: "BCH - Bitcoin Cash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(145);
@@ -1199,7 +1207,7 @@
},
{
name: "BTC - Bitcoin",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(0);
@@ -1207,7 +1215,7 @@
},
{
name: "BTC - Bitcoin Testnet",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.testnet;
setHdCoin(1);
@@ -1215,7 +1223,7 @@
},
{
name: "CLAM - Clams",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.clam;
setHdCoin(23);
@@ -1223,7 +1231,7 @@
},
{
name: "CRW - Crown",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.crown;
setHdCoin(72);
@@ -1231,7 +1239,7 @@
},
{
name: "DASH - Dash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dash;
setHdCoin(5);
@@ -1239,7 +1247,7 @@
},
{
name: "DASH - Dash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dashtn;
setHdCoin(1);
@@ -1247,7 +1255,7 @@
},
{
name: "DOGE - Dogecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dogecoin;
setHdCoin(3);
@@ -1255,7 +1263,7 @@
},
{
name: "ETH - Ethereum",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(60);
@@ -1263,7 +1271,7 @@
},
{
name: "GAME - GameCredits",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.game;
setHdCoin(101);
@@ -1271,7 +1279,7 @@
},
{
name: "JBS - Jumbucks",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.jumbucks;
setHdCoin(26);
@@ -1279,7 +1287,7 @@
},
{
name: "LTC - Litecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
@@ -1288,7 +1296,7 @@
},
{
name: "MAZA - Maza",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.maza;
setHdCoin(13);
@@ -1297,7 +1305,7 @@
{
name: "NMC - Namecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.namecoin;
setHdCoin(7);
@@ -1305,7 +1313,7 @@
},
{
name: "PIVX - PIVX",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivx;
setHdCoin(119);
@@ -1313,7 +1321,7 @@
},
{
name: "PIVX - PIVX Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivxtestnet;
setHdCoin(1);
@@ -1321,7 +1329,7 @@
},
{
name: "PPC - Peercoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.peercoin;
setHdCoin(6);
@@ -1329,7 +1337,7 @@
},
{
name: "SDC - ShadowCash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadow;
setHdCoin(35);
@@ -1337,7 +1345,7 @@
},
{
name: "SDC - ShadowCash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadowtn;
setHdCoin(1);
@@ -1345,7 +1353,7 @@
},
{
name: "SLM - Slimcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcoin;
setHdCoin(63);
@@ -1353,7 +1361,7 @@
},
{
name: "SLM - Slimcoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcointn;
setHdCoin(111);
@@ -1361,7 +1369,7 @@
},
{
name: "VIA - Viacoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacoin;
setHdCoin(14);
@@ -1369,7 +1377,7 @@
},
{
name: "VIA - Viacoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacointestnet;
setHdCoin(1);
@@ -1377,7 +1385,7 @@
},
{
name: "XMY - Myriadcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.myriadcoin;
setHdCoin(90);
@@ -1385,7 +1393,7 @@
},
{
name: "XRP - Ripple",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(144);

View File

@@ -4267,6 +4267,45 @@ page.open(url, function(status) {
});
},
// BIP32 tab can use P2WPKH Nested In P2SH
// github issue 91 part 2
// https://github.com/iancoleman/bip39/issues/91
// generate new addresses from xpub?
function() {
page.open(url, function(status) {
// set the xpub and coin and select bip32 tab with p2wpkh addresses
page.evaluate(function() {
// use p2wpkh addresses
$(".p2wpkh-nested-in-p2sh").prop("checked", true);
// use bip32 tab
$("#bip32-tab a").click();
// use testnet
$(".network option[selected]").removeAttr("selected");
$(".network option").filter(function() {
return $(this).html() == "BTC - Bitcoin Testnet";
}).prop("selected", true);
$(".network").trigger("change");
// Set root xpub to BIP49 official test vector account 0
$(".root-key").val("tpubDD7tXK8KeQ3YY83yWq755fHY2JW8Ha8Q765tknUM5rSvjPcGWfUppDFMpQ1ScziKfW3ZNtZvAD7M3u7bSs7HofjTD3KP3YxPK7X6hwV8Rk2");
$(".root-key").trigger("input");
});
// check the address is generated correctly
waitForGenerate(function() {
var expected = "2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2";
var actual = page.evaluate(function() {
return $(".address:first").text();
});
if (actual != expected) {
console.log("BIP32 tab cannot generate P2WPKH Nested In P2SH addresses");
console.log("Expected: " + expected);
console.log("Actual: " + actual);
fail();
}
next();
});
});
},
// If you wish to add more tests, do so here...
// Here is a blank test template