2020-10-05 12:17:18 +09:00
|
|
|
@model WalletSendVaultModel
|
2019-11-11 14:22:04 +09:00
|
|
|
@{
|
|
|
|
Layout = "../Shared/_NavLayout.cshtml";
|
2021-04-08 15:32:42 +02:00
|
|
|
ViewData.SetActivePageAndTitle(WalletsNavPages.Send, "Sign the transaction with BTCPay Server Vault", Context.GetStoreData().StoreName);
|
2019-11-11 14:22:04 +09:00
|
|
|
}
|
|
|
|
|
2021-04-08 15:32:42 +02:00
|
|
|
<h2 class="mb-4">@ViewData["PageTitle"]</h2>
|
|
|
|
|
2019-11-11 14:22:04 +09:00
|
|
|
<div id="walletAlert" class="alert alert-danger alert-dismissible" style="display:none;" role="alert">
|
2021-05-19 04:39:27 +02:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
|
|
|
<vc:icon symbol="close" />
|
|
|
|
</button>
|
2019-11-11 14:22:04 +09:00
|
|
|
<span id="alertMessage"></span>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div id="body" class="col-md-10">
|
2020-03-26 12:39:19 +01:00
|
|
|
<form id="broadcastForm" asp-action="WalletSendVault" asp-route-walletId="@this.Context.GetRouteValue("walletId")" method="post" style="display:none;">
|
2019-11-11 14:22:04 +09:00
|
|
|
<input type="hidden" id="WalletId" asp-for="WalletId" />
|
|
|
|
<input type="hidden" asp-for="WebsocketPath" />
|
2020-05-25 06:27:01 +09:00
|
|
|
<partial name="SigningContext" for="SigningContext" />
|
2019-11-11 14:22:04 +09:00
|
|
|
</form>
|
|
|
|
<div id="vaultPlaceholder"></div>
|
2021-02-11 11:48:54 +01:00
|
|
|
<button id="vault-retry" class="btn btn-primary" style="display:none;" type="button">Retry</button>
|
2019-12-04 12:52:54 +09:00
|
|
|
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
|
2019-11-11 14:22:04 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<partial name="VaultElements" />
|
2021-05-19 04:39:27 +02:00
|
|
|
|
|
|
|
@section PageFootContent
|
2019-11-11 14:22:04 +09:00
|
|
|
{
|
2020-04-18 17:56:05 +02:00
|
|
|
<script src="~/js/vaultbridge.js" type="text/javascript" defer="defer" asp-append-version="true"></script>
|
|
|
|
<script src="~/js/vaultbridge.ui.js" type="text/javascript" defer="defer" asp-append-version="true"></script>
|
2021-05-19 04:39:27 +02:00
|
|
|
<script>
|
2019-12-10 18:58:12 +09:00
|
|
|
async function askSign() {
|
2019-11-11 14:22:04 +09:00
|
|
|
var websocketPath = $("#WebsocketPath").val();
|
|
|
|
var loc = window.location, ws_uri;
|
|
|
|
if (loc.protocol === "https:") {
|
|
|
|
ws_uri = "wss:";
|
|
|
|
} else {
|
|
|
|
ws_uri = "ws:";
|
|
|
|
}
|
|
|
|
ws_uri += "//" + loc.host;
|
|
|
|
ws_uri += websocketPath;
|
|
|
|
var html = $("#VaultConnection").html();
|
|
|
|
$("#vaultPlaceholder").html(html);
|
|
|
|
var vaultUI = new vaultui.VaultBridgeUI(ws_uri);
|
2020-10-05 12:17:18 +09:00
|
|
|
|
|
|
|
while (!await vaultUI.askForDevice() || !await vaultUI.askSignPSBT({
|
2019-11-11 14:22:04 +09:00
|
|
|
walletId: $("#WalletId").val(),
|
2020-05-25 06:27:01 +09:00
|
|
|
psbt: $("#SigningContext_PSBT").val()
|
2019-12-10 18:58:12 +09:00
|
|
|
})) {
|
|
|
|
}
|
2020-10-05 12:17:18 +09:00
|
|
|
$("#SigningContext_PSBT").val(vaultUI.psbt);
|
|
|
|
$("#broadcastForm").submit();
|
2019-12-10 18:58:12 +09:00
|
|
|
}
|
2021-05-19 04:39:27 +02:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
2019-12-10 18:58:12 +09:00
|
|
|
askSign();
|
2019-11-11 14:22:04 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
}
|