2020-10-05 12:17:18 +09:00
|
|
|
@model WalletSendVaultModel
|
2019-11-11 14:22:04 +09:00
|
|
|
@{
|
|
|
|
Layout = "../Shared/_NavLayout.cshtml";
|
|
|
|
ViewData["Title"] = "Manage wallet";
|
|
|
|
ViewData.SetActivePageAndTitle(WalletsNavPages.Send);
|
|
|
|
}
|
|
|
|
|
|
|
|
<h4>Sign the transaction with BTCPayServer Vault</h4>
|
2020-02-13 14:06:00 +01:00
|
|
|
@if (TempData.HasStatusMessage())
|
|
|
|
{
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-10 text-center">
|
|
|
|
<partial name="_StatusMessage" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
2019-11-11 14:22:04 +09:00
|
|
|
<div id="walletAlert" class="alert alert-danger alert-dismissible" style="display:none;" role="alert">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
<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>
|
2020-10-05 12:17:18 +09:00
|
|
|
<button class="btn btn-primary vault-retry" 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" />
|
|
|
|
@section Scripts
|
|
|
|
{
|
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>
|
2019-11-11 14:22:04 +09:00
|
|
|
<script type="text/javascript">
|
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
|
|
|
}
|
|
|
|
$(function () {
|
|
|
|
askSign();
|
2019-11-11 14:22:04 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
}
|