mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-18 16:32:18 +00:00
BIP32 client select compiled into standalone
This commit is contained in:
@@ -371,6 +371,15 @@
|
||||
<a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" target="_blank">BIP32 spec</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bip32-client" class="col-sm-2 control-label" data-translate>Client</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="bip32-client" class="client form-control">
|
||||
<option value="custom">Custom derivation path</option>
|
||||
<!-- populated by javascript -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bip32-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label>
|
||||
<div class="col-sm-10">
|
||||
@@ -396,6 +405,18 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="core-path" class="col-sm-2 control-label" data-translate>Multibit</label>
|
||||
<div class="col-sm-10">
|
||||
<p class="form-control no-border">
|
||||
<span data-translate-html>Use path <code>m/0'/0</code>.</span>
|
||||
</p>
|
||||
<p class="form-control no-border">
|
||||
<span data-translate>For more info see</span>
|
||||
<a href="https://multibit.org/" target="_blank">MultiBit HD</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" data-translate>Block Explorers</label>
|
||||
<div class="col-sm-10">
|
||||
@@ -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<clients.length; i++) {
|
||||
var client = clients[i];
|
||||
var option = $("<option>");
|
||||
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();
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user