mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-23 00:54:44 +00:00
Add client select
This commit is contained in:
@@ -253,6 +253,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="client-phrase" class="col-sm-2 control-label" data-translate>Client</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select id="client-phrase" class="client form-control">
|
||||||
|
<!-- populated by javascript -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="root-key" class="col-sm-2 control-label" data-translate>BIP32 Root Key</label>
|
<label for="root-key" class="col-sm-2 control-label" data-translate>BIP32 Root Key</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
var DOM = {};
|
var DOM = {};
|
||||||
DOM.network = $(".network");
|
DOM.network = $(".network");
|
||||||
|
DOM.client = $(".client");
|
||||||
DOM.phraseNetwork = $("#network-phrase");
|
DOM.phraseNetwork = $("#network-phrase");
|
||||||
|
DOM.phraseClient = $("#client-phrase");
|
||||||
DOM.useEntropy = $(".use-entropy");
|
DOM.useEntropy = $(".use-entropy");
|
||||||
DOM.entropyContainer = $(".entropy-container");
|
DOM.entropyContainer = $(".entropy-container");
|
||||||
DOM.entropy = $(".entropy");
|
DOM.entropy = $(".entropy");
|
||||||
@@ -77,6 +79,7 @@
|
|||||||
function init() {
|
function init() {
|
||||||
// Events
|
// Events
|
||||||
DOM.network.on("change", networkChanged);
|
DOM.network.on("change", networkChanged);
|
||||||
|
DOM.client.on("change", clientChanged);
|
||||||
DOM.useEntropy.on("change", setEntropyVisibility);
|
DOM.useEntropy.on("change", setEntropyVisibility);
|
||||||
DOM.entropy.on("input", delayedEntropyChanged);
|
DOM.entropy.on("input", delayedEntropyChanged);
|
||||||
DOM.entropyMnemonicLength.on("change", entropyChanged);
|
DOM.entropyMnemonicLength.on("change", entropyChanged);
|
||||||
@@ -102,6 +105,7 @@
|
|||||||
hidePending();
|
hidePending();
|
||||||
hideValidationError();
|
hideValidationError();
|
||||||
populateNetworkSelect();
|
populateNetworkSelect();
|
||||||
|
populateClientSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
@@ -116,6 +120,17 @@
|
|||||||
rootKeyChanged();
|
rootKeyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clientChanged(e) {
|
||||||
|
var clientIndex = e.target.value;
|
||||||
|
clients[clientIndex].onSelect();
|
||||||
|
if (seed != null) {
|
||||||
|
phraseChanged();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rootKeyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setEntropyVisibility() {
|
function setEntropyVisibility() {
|
||||||
if (isUsingOwnEntropy()) {
|
if (isUsingOwnEntropy()) {
|
||||||
@@ -701,6 +716,16 @@
|
|||||||
DOM.phraseNetwork.append(option);
|
DOM.phraseNetwork.append(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.phraseClient.append(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getLanguage() {
|
function getLanguage() {
|
||||||
var defaultLanguage = "english";
|
var defaultLanguage = "english";
|
||||||
@@ -1124,6 +1149,30 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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();
|
init();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user