btcpayserver/BTCPayServer/Views/Stores/ImportWallet/ConfirmAddresses.cshtml
d11n ed7031981b
Bootstrap v5 migration (#2490)
* Swap bootstrap asset files

* Update themes and color definitions

* Move general bootstrap customizations

* Theme updates

Theme updates

* Remove BuildBundlerMinifier

This lead to an error, because BuildBundlerMinifier and BundlerMinifier.Core seem to conflict here. Details: https://stackoverflow.com/a/61119586

* Rewplace btn-block class with w-100

* Update badge classes

* Remove old font family head variable

* Update margin classes

* Cleanups

* Update float classes

* Update text classes

* Update padding classes

* Update border classes

* UPdate dropdown classes

* Update select classes

* Update neutral custom props

* Update bootstrap and customizations

* Update ChromeDriver; disable smooth scroll

https://github.com/SeleniumHQ/selenium/issues/8295

* Improve alert messages

* Improve bootstrap customizations

* Disable reduced motion

See also 7358282f

* Update Bootstrap data attributes

* Update file inputs

* Update input groups

* Replace deprecated jumbotron class

* Update variables; re-add negative margin util classes

* Update cards

* Update form labels

* Debug alerts

* Fix aria-labelledby associations

* Dropdown-related test fixes

* Fix CanUseWebhooks test

* Test fixes

* Nav updates

* Fix nav usage in wallet send and payouts

* Update alert and modal close buttons

* Re-add backdrop properties

* Upgrade Bootstrap to v5 final

* Update screen reader classes

* Update font-weight classes

* Update monospace font classes

* Update accordians

* Update close icon usage

* Cleanup

* Update scripts and style integrations

* Update input group texts

* Update LN node setup page

* Update more form control classes

* Update inline forms

* Add js specific test

* Upgrade Vue.js

* Remove unused JS

* Upgrade Bootstrap to v5.0.1

* Try container related test updates

* Separate jQuery bundle

* Remove jQuery from LND seed backup page

* Remove unused code

* Refactor email autofill js

* Refactor camera scanner JS

* Re-add tests

* Re-add BuildBundlerMinifier

* Do not minify bundles containing Bootstrap

Details https://github.com/madskristensen/BundlerMinifier/issues/558

* Update bundles

* Cleanup JS test

* Cleanup tests involving dropdowns

* Cleanup tests involving collapses

* Cleanup locale additions in ConfigureCore

* Cleanup bundles

* Remove duplicate status message

* Cleanup formatting

* Fix missing validation scripts

* Remove unused unminified Bootstrap js files

* Fix classic theme

* Fix Casa theme

* Fix PoS validation
2021-05-19 11:39:27 +09:00

156 lines
6.2 KiB
Text

@model WalletSetupViewModel
@addTagHelper *, BundlerMinifier.TagHelpers
@{
Layout = "_LayoutWalletSetup";
ViewData.SetActivePageAndTitle(StoreNavPages.Wallet, "Confirm addresses", Context.GetStoreData().StoreName);
}
@section Navbar {
<a asp-controller="Stores" asp-action="ImportWallet" asp-route-storeId="@Model.StoreId" asp-route-cryptoCode="@Model.CryptoCode" asp-route-method="@Model.Method">
<vc:icon symbol="back" />
</a>
}
<header class="text-center">
<h1>@ViewData["Title"]</h1>
<p class="lead text-secondary mt-3">Please check that your @Model.CryptoCode wallet is generating the same addresses as below.</p>
</header>
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="All" class="text-danger"></div>
}
<template id="modal-template">
<div class="modal-dialog" role="document">
<form class="modal-content" method="post" enctype="multipart/form-data">
<div class="modal-header">
<h5 class="modal-title" id="addressVerification">Address verification</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
<vc:icon symbol="close" />
</button>
</div>
<div class="modal-body">
<p>
Confirm that you see the following address on the device:
<code id="displayed-address"></code>
</p>
<div id="vault-status"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
</div>
</form>
</div>
</template>
<div id="btcpayservervault" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="btcpayservervault" aria-hidden="true"></div>
<form method="post" asp-controller="Stores" asp-action="UpdateWallet" asp-route-storeId="@Model.StoreId" asp-route-cryptoCode="@Model.CryptoCode">
<input asp-for="Config" type="hidden"/>
<input asp-for="Confirmation" type="hidden"/>
<input asp-for="DerivationScheme" type="hidden"/>
<input asp-for="Enabled" type="hidden"/>
<div class="form-group">
<table class="table table-sm table-responsive-md">
<thead>
<tr>
<th>Key path</th>
<th>Address</th>
@if (Model.Source == "Vault")
{
<th></th>
}
</tr>
</thead>
<tbody>
@foreach (var sample in Model.AddressSamples)
{
<tr>
<td>@sample.KeyPath</td>
<td><code>@sample.Address</code></td>
@if (Model.Source == "Vault")
{
<td class="text-end">
@* Using single quotes for the data attributes on purpose *@
<a href="#" data-address='@Safe.Json(sample.Address)' data-rooted-key-path='@Safe.Json(sample.RootedKeyPath.ToString())'>Show on device</a>
</td>
}
</tr>
}
</tbody>
</table>
</div>
<div class="text-center mb-4">
<button class="btn btn-link" type="button" data-bs-toggle="collapse" data-bs-target="#wrong-addresses" aria-expanded="false" aria-controls="wrong-addresses">
Wrong addresses?
</button>
<div id="wrong-addresses" class="collapse @(ViewContext.ModelState.IsValid ? "" : "show")">
<div class="pb-1">
<label asp-for="HintAddress">Help us to find the correct settings by telling us the first address of your wallet.</label>
<div class="form-group">
<input asp-for="HintAddress" class="form-control"/>
<span asp-validation-for="HintAddress" class="text-danger"></span>
</div>
</div>
</div>
</div>
<div class="text-center">
<button name="command" type="submit" class="btn btn-primary" value="save" id="Confirm">Confirm</button>
</div>
</form>
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
<partial name="VaultElements" />
<script src="~/js/vaultbridge.js" defer asp-append-version="true"></script>
<script src="~/js/vaultbridge.ui.js" defer asp-append-version="true"></script>
<script>
window.addEventListener("load", async () => {
const wsPath = "@Url.Action("VaultBridgeConnection", "Vault", new {cryptoCode = Model.CryptoCode})";
const wsProto = location.protocol.replace(/^http/, "ws");
const statusHTML = document.getElementById("VaultConnection").innerHTML;
const modalHTML = document.getElementById("modal-template").innerHTML;
const $modal = document.getElementById("btcpayservervault");
document.querySelectorAll("[data-address]").forEach(link => {
link.addEventListener("click", async event => {
event.preventDefault();
const $link = event.currentTarget;
const address = JSON.parse($link.dataset.address);
const rootedKeyPath = JSON.parse($link.dataset.rootedKeyPath);
$modal.innerHTML = modalHTML;
const $address = document.getElementById("displayed-address");
const $status = document.getElementById("vault-status");
$status.innerHTML = statusHTML;
$address.innerText = address;
const vaultUI = new vaultui.VaultBridgeUI(`${wsProto}//${location.host}${wsPath}`);
const $$modal = $($modal)
$$modal.modal();
$$modal.on('hidden.bs.modal', () => {
vaultUI.closeBridge();
});
while (!await vaultUI.askForDevice()) {}
await vaultUI.askForDisplayAddress(rootedKeyPath);
$$modal.modal("hide");
});
});
});
</script>
}