Skip to content

Commit

Permalink
Release v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Coleman committed Sep 1, 2017
1 parent 8831146 commit 0a8d06d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 39 deletions.
91 changes: 53 additions & 38 deletions bip39-standalone.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -412,6 +412,13 @@ <h2>Derivation Path</h2>
<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">
Expand Down Expand Up @@ -46190,6 +46197,7 @@ <h3 data-translate>Libraries</h3>
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");
Expand Down Expand Up @@ -46226,6 +46234,7 @@ <h3 data-translate>Libraries</h3>
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);
Expand All @@ -46248,11 +46257,11 @@ <h3 data-translate>Libraries</h3>
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();
Expand Down Expand Up @@ -46384,7 +46393,6 @@ <h3 data-translate>Libraries</h3>
function rootKeyChanged() {
showPending();
hideValidationError();
// Validate the root key TODO
var rootKeyBase58 = DOM.rootKey.val();
var errorText = validateRootKey(rootKeyBase58);
if (errorText) {
Expand Down Expand Up @@ -46577,7 +46585,7 @@ <h3 data-translate>Libraries</h3>

function validateRootKey(rootKeyBase58) {
try {
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58);
bitcoinjs.bitcoin.HDNode.fromBase58(rootKeyBase58, network);
}
catch (e) {
return "Invalid root key";
Expand Down Expand Up @@ -46755,8 +46763,8 @@ <h3 data-translate>Libraries</h3>
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();
Expand Down Expand Up @@ -46801,8 +46809,8 @@ <h3 data-translate>Libraries</h3>
address = convertRippleAdrr(address);
}
// BIP49 addresses are different
if (isBip49) {
if (!bip49available) {
if (isP2wpkhNestedInP2sh) {
if (!p2wpkhNestedInP2shAvailable) {
return;
}
var keyhash = bitcoinjs.bitcoin.crypto.hash160(key.getPublicKeyBuffer());
Expand Down Expand Up @@ -47282,8 +47290,12 @@ <h3 data-translate>Libraries</h3>
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() {
Expand All @@ -47295,108 +47307,111 @@ <h3 data-translate>Libraries</h3>
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);
},
},
{
name: "BTC - Bitcoin",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(0);
},
},
{
name: "BTC - Bitcoin Testnet",
bip49available: true,
p2wpkhNestedInP2shAvailable: true,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.testnet;
setHdCoin(1);
},
},
{
name: "CLAM - Clams",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.clam;
setHdCoin(23);
},
},
{
name: "CRW - Crown",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.crown;
setHdCoin(72);
},
},
{
name: "DASH - Dash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dash;
setHdCoin(5);
},
},
{
name: "DASH - Dash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dashtn;
setHdCoin(1);
},
},
{
name: "DOGE - Dogecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.dogecoin;
setHdCoin(3);
},
},
{
name: "ETH - Ethereum",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(60);
},
},
{
name: "GAME - GameCredits",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.game;
setHdCoin(101);
},
},
{
name: "JBS - Jumbucks",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.jumbucks;
setHdCoin(26);
},
},
{
name: "LTC - Litecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.litecoin;
setHdCoin(2);
Expand All @@ -47405,7 +47420,7 @@ <h3 data-translate>Libraries</h3>
},
{
name: "MAZA - Maza",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.maza;
setHdCoin(13);
Expand All @@ -47414,95 +47429,95 @@ <h3 data-translate>Libraries</h3>

{
name: "NMC - Namecoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.namecoin;
setHdCoin(7);
},
},
{
name: "PIVX - PIVX",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivx;
setHdCoin(119);
},
},
{
name: "PIVX - PIVX Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.pivxtestnet;
setHdCoin(1);
},
},
{
name: "PPC - Peercoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.peercoin;
setHdCoin(6);
},
},
{
name: "SDC - ShadowCash",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadow;
setHdCoin(35);
},
},
{
name: "SDC - ShadowCash Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.shadowtn;
setHdCoin(1);
},
},
{
name: "SLM - Slimcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcoin;
setHdCoin(63);
},
},
{
name: "SLM - Slimcoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.slimcointn;
setHdCoin(111);
},
},
{
name: "VIA - Viacoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacoin;
setHdCoin(14);
},
},
{
name: "VIA - Viacoin Testnet",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.viacointestnet;
setHdCoin(1);
},
},
{
name: "XMY - Myriadcoin",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.myriadcoin;
setHdCoin(90);
},
},
{
name: "XRP - Ripple",
bip49available: false,
p2wpkhNestedInP2shAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(144);
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 0a8d06d

Please sign in to comment.