From 56530adc0419de9e26ba8bcd4a0c9181600a8665 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Sun, 19 Feb 2017 12:38:39 +1100 Subject: [PATCH] BIP32 client select compiled into standalone --- bip39-standalone.html | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/bip39-standalone.html b/bip39-standalone.html index de74d80..c42896f 100644 --- a/bip39-standalone.html +++ b/bip39-standalone.html @@ -371,6 +371,15 @@ BIP32 spec

+
+ +
+ +
+
@@ -396,6 +405,18 @@

+
+ +
+

+ Use path m/0'/0. +

+

+ For more info see + MultiBit HD +

+
+
@@ -41224,6 +41245,7 @@ window.Entropy = new (function() { var DOM = {}; DOM.network = $(".network"); + DOM.bip32Client = $("#bip32-client"); DOM.phraseNetwork = $("#network-phrase"); DOM.useEntropy = $(".use-entropy"); DOM.entropyContainer = $(".entropy-container"); @@ -41278,6 +41300,7 @@ window.Entropy = new (function() { function init() { // Events DOM.network.on("change", networkChanged); + DOM.bip32Client.on("change", bip32ClientChanged); DOM.useEntropy.on("change", setEntropyVisibility); DOM.entropy.on("input", delayedEntropyChanged); DOM.entropyMnemonicLength.on("change", entropyChanged); @@ -41303,6 +41326,7 @@ window.Entropy = new (function() { hidePending(); hideValidationError(); populateNetworkSelect(); + populateClientSelect(); } // Event handlers @@ -41318,6 +41342,23 @@ window.Entropy = new (function() { } } + function bip32ClientChanged(e) { + var clientIndex = DOM.bip32Client.val(); + if (clientIndex == "custom") { + DOM.bip32path.prop("readonly", false); + } + else { + DOM.bip32path.prop("readonly", true); + clients[clientIndex].onSelect(); + if (seed != null) { + phraseChanged(); + } + else { + rootKeyChanged(); + } + } + } + function setEntropyVisibility() { if (isUsingOwnEntropy()) { DOM.entropyContainer.removeClass("hidden"); @@ -41912,6 +41953,16 @@ window.Entropy = new (function() { } } + function populateClientSelect() { + for (var i=0; i"); + option.attr("value", i); + option.text(client.name); + DOM.bip32Client.append(option); + } + } + function getLanguage() { var defaultLanguage = "english"; // Try to get from existing phrase @@ -42342,6 +42393,30 @@ window.Entropy = new (function() { }, ] + var clients = [ + { + name: "Bitcoin Core", + onSelect: function() { + DOM.bip32path.val("m/0'/0'"); + DOM.hardenedAddresses.prop('checked', true); + }, + }, + { + name: "blockchain.info", + onSelect: function() { + DOM.bip32path.val("m/44'/0'/0'"); + DOM.hardenedAddresses.prop('checked', false); + }, + }, + { + name: "MultiBit HD", + onSelect: function() { + DOM.bip32path.val("m/0'/0"); + DOM.hardenedAddresses.prop('checked', false); + }, + } + ] + init(); })(); -- 2.41.0