mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Implement BTCPayServer vault derivation scheme import
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
function initLedger(){
|
||||
|
||||
function initLedger() {
|
||||
var ledgerDetected = false;
|
||||
|
||||
var loc = window.location, new_uri;
|
||||
@@ -90,12 +89,57 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
var ledgerInit = false;
|
||||
$(".check-for-ledger").on("click", function(){
|
||||
if(!ledgerInit){
|
||||
$(".check-for-ledger").on("click", function () {
|
||||
if (!ledgerInit) {
|
||||
|
||||
initLedger();
|
||||
}
|
||||
ledgerInit = true;
|
||||
});
|
||||
|
||||
|
||||
function show(id, category) {
|
||||
$("." + category).css("display", "none");
|
||||
$("#" + id).css("display", "block");
|
||||
}
|
||||
|
||||
var websocketPath = $("#WebsocketPath").text();
|
||||
var loc = window.location, ws_uri;
|
||||
if (loc.protocol === "https:") {
|
||||
ws_uri = "wss:";
|
||||
} else {
|
||||
ws_uri = "ws:";
|
||||
}
|
||||
ws_uri += "//" + loc.host;
|
||||
ws_uri += websocketPath;
|
||||
|
||||
function displayXPubs(xpubs) {
|
||||
$("#vault-dropdown").css("display", "block");
|
||||
$("#vault-dropdown .dropdown-item").click(function () {
|
||||
var id = $(this).attr('id').replace("vault-", "");
|
||||
var xpub = xpubs[id];
|
||||
$("#DerivationScheme").val(xpub.strategy);
|
||||
$("#RootFingerprint").val(xpubs.fingerprint);
|
||||
$("#AccountKey").val(xpub.accountKey);
|
||||
$("#Source").val("Vault");
|
||||
$("#DerivationSchemeFormat").val("BTCPay");
|
||||
$("#KeyPath").val(xpub.keyPath);
|
||||
$(".modal").modal('hide');
|
||||
$(".hw-fields").show();
|
||||
});
|
||||
}
|
||||
|
||||
var vaultInit = false;
|
||||
$(".check-for-vault").on("click", async function () {
|
||||
if (vaultInit)
|
||||
return;
|
||||
vaultInit = true;
|
||||
|
||||
var html = $("#VaultConnection").html();
|
||||
$("#vaultPlaceholder").html(html);
|
||||
|
||||
var vaultUI = new vaultui.VaultBridgeUI(ws_uri);
|
||||
if (await vaultUI.askForXPubs()) {
|
||||
displayXPubs(vaultUI.xpubs);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user