mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-03 23:46:00 +00:00
Network select populated automatically by js
This commit is contained in:
+1
-4
@@ -78,10 +78,7 @@
|
|||||||
<label for="network-phrase" class="col-sm-2 control-label">Coin</label>
|
<label for="network-phrase" class="col-sm-2 control-label">Coin</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select id="network-phrase" class="network form-control">
|
<select id="network-phrase" class="network form-control">
|
||||||
<option value="bitcoin">Bitcoin</option>
|
<!-- populated by javascript -->
|
||||||
<option value="bitcoin-testnet">Bitcoin Testnet</option>
|
|
||||||
<option value="litecoin">Litecoin</option>
|
|
||||||
<option value="dogecoin">Dogecoin</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+18
-12
@@ -63,18 +63,14 @@
|
|||||||
disableForms();
|
disableForms();
|
||||||
hidePending();
|
hidePending();
|
||||||
hideValidationError();
|
hideValidationError();
|
||||||
|
populateNetworkSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
|
||||||
function networkChanged(e) {
|
function networkChanged(e) {
|
||||||
var network = e.target.value;
|
var network = e.target.value;
|
||||||
if (network in networks) {
|
networks[network].onSelect();
|
||||||
networks[network].onSelect();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
setBip44DerivationPath();
|
setBip44DerivationPath();
|
||||||
delayedPhraseChanged();
|
delayedPhraseChanged();
|
||||||
}
|
}
|
||||||
@@ -389,8 +385,18 @@
|
|||||||
.hide();
|
.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
var networks = {
|
function populateNetworkSelect() {
|
||||||
"bitcoin": {
|
for (var i=0; i<networks.length; i++) {
|
||||||
|
var network = networks[i];
|
||||||
|
var option = $("<option>");
|
||||||
|
option.attr("value", i);
|
||||||
|
option.text(network.name);
|
||||||
|
DOM.phraseNetwork.append(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var networks = [
|
||||||
|
{
|
||||||
name: "Bitcoin",
|
name: "Bitcoin",
|
||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
network = Bitcoin.networks.bitcoin;
|
network = Bitcoin.networks.bitcoin;
|
||||||
@@ -398,7 +404,7 @@
|
|||||||
DOM.myceliumPath.val("m/44'/0'/0'/0");
|
DOM.myceliumPath.val("m/44'/0'/0'/0");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"bitcoin-testnet": {
|
{
|
||||||
name: "Bitcoin Testnet",
|
name: "Bitcoin Testnet",
|
||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
network = Bitcoin.networks.testnet;
|
network = Bitcoin.networks.testnet;
|
||||||
@@ -406,21 +412,21 @@
|
|||||||
DOM.myceliumPath.val("m/44'/1'/0'/0");
|
DOM.myceliumPath.val("m/44'/1'/0'/0");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"litecoin": {
|
{
|
||||||
name: "Litecoin",
|
name: "Litecoin",
|
||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
network = Bitcoin.networks.litecoin;
|
network = Bitcoin.networks.litecoin;
|
||||||
DOM.bip44coin.val(2);
|
DOM.bip44coin.val(2);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"dogecoin": {
|
{
|
||||||
name: "Dogecoin",
|
name: "Dogecoin",
|
||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
network = Bitcoin.networks.dogecoin;
|
network = Bitcoin.networks.dogecoin;
|
||||||
DOM.bip44coin.val(3);
|
DOM.bip44coin.val(3);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
]
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user