btcpayserver/BTCPayServer/Views/Stores/ImportWallet/Hardware.cshtml

114 lines
4.7 KiB
Plaintext
Raw Normal View History

Wallet setup redesign (#2164) * Prepare existing layouts and views * Add icon view component and sprite svg * Add wallet setup basics * Add import method view basics * Use external sprite file instead of inline svg * Refactor hardware wallet setup flow * Manually enter an xpub * Prepare other views * Update views and models * Finalize wallet setup flow * Updat tests, part 1 * Update tests, part 2 * Vaul: Fix missing retry button * Add better Scan QR subtext Still tbd. * Make wallet account an advanced setting * Prevent empty xpub * Use textarea for seed input * Remove redundant error message for missing file upload * Confirm store updates after generating a new wallet * Update wording * Modify existing wallets * Fix proposed method name * Suggest using ColdCard Electrum export option only Advise the user to use the electrum export of the coldcard instead of saying either electrum or wasabi export file … the electurm one contains more info, e.g. the wasabi one doesn't include the account key path. * More concise WalletSetupMethod setting * Test fix * Update wallet removal code * Fix back navigation quirk in change wallet case * Fix behaviour on wallet enable/disable * Fix initial wallet setup * Improve modify view and messages * Test fixes * Seed import fix Uses the correct form url for confirming addresses * Quickfixes from design meeting * Add enable toggle switch on modify page * Confirm wallet removal * Update setup view * Update import view * Icon finetuning * Improve import options page * Refactor QR code scanner Allow for usage with and without modal * Update copy and instructions on import pages * Split generate options: Hot wallet and watch-only * Implement hot wallet options correctly * Minor test changes * Navbar improvements * Fix tables * Fix badge color * Routing related updates Thanks @kukks for the suggestions! * Wording updates Thanks @kukks for the suggestions! * Extend address types table for xpub import Thanks @kukks for the suggestions! * Rename controller * Unify precondition checks * Improve removal warning for hot wallets * Add tooltip on why seed import is not recommended * Add tooltip icon * Add Specter import info
2021-02-11 11:48:54 +01:00
@model WalletSetupViewModel
@addTagHelper *, BundlerMinifier.TagHelpers
@{
Layout = "_LayoutWalletSetup";
ViewData.SetActivePageAndTitle(StoreNavPages.Wallet, "Connect your hardware wallet", Context.GetStoreData().StoreName);
Wallet setup redesign (#2164) * Prepare existing layouts and views * Add icon view component and sprite svg * Add wallet setup basics * Add import method view basics * Use external sprite file instead of inline svg * Refactor hardware wallet setup flow * Manually enter an xpub * Prepare other views * Update views and models * Finalize wallet setup flow * Updat tests, part 1 * Update tests, part 2 * Vaul: Fix missing retry button * Add better Scan QR subtext Still tbd. * Make wallet account an advanced setting * Prevent empty xpub * Use textarea for seed input * Remove redundant error message for missing file upload * Confirm store updates after generating a new wallet * Update wording * Modify existing wallets * Fix proposed method name * Suggest using ColdCard Electrum export option only Advise the user to use the electrum export of the coldcard instead of saying either electrum or wasabi export file … the electurm one contains more info, e.g. the wasabi one doesn't include the account key path. * More concise WalletSetupMethod setting * Test fix * Update wallet removal code * Fix back navigation quirk in change wallet case * Fix behaviour on wallet enable/disable * Fix initial wallet setup * Improve modify view and messages * Test fixes * Seed import fix Uses the correct form url for confirming addresses * Quickfixes from design meeting * Add enable toggle switch on modify page * Confirm wallet removal * Update setup view * Update import view * Icon finetuning * Improve import options page * Refactor QR code scanner Allow for usage with and without modal * Update copy and instructions on import pages * Split generate options: Hot wallet and watch-only * Implement hot wallet options correctly * Minor test changes * Navbar improvements * Fix tables * Fix badge color * Routing related updates Thanks @kukks for the suggestions! * Wording updates Thanks @kukks for the suggestions! * Extend address types table for xpub import Thanks @kukks for the suggestions! * Rename controller * Unify precondition checks * Improve removal warning for hot wallets * Add tooltip on why seed import is not recommended * Add tooltip icon * Add Specter import info
2021-02-11 11:48:54 +01:00
}
@section Navbar {
<a asp-controller="Stores" asp-action="ImportWallet" asp-route-storeId="@Model.StoreId" asp-route-cryptoCode="@Model.CryptoCode" asp-route-method="">
<vc:icon symbol="back" />
</a>
}
<header class="text-center">
<h1>@ViewData["Title"]</h1>
<p class="lead text-secondary mt-3">In order to securely connect to your hardware wallet you must first download, install, and run the BTCPay Server Vault.</p>
</header>
@if (!ViewContext.ModelState.IsValid)
{
<div asp-validation-summary="All" class="text-danger"></div>
}
<div class="row mt-5 mb-4">
<div class="col-md-8 mx-auto">
<div id="vault-status" class="mb-4"></div>
<div id="vault-xpub" class="mt-4" style="display:none;">
<div class="form-group">
<label for="addressType">Address type</label>
<select id="addressType" name="addressType" class="form-control w-auto">
<option value="segwit">Segwit (Recommended, cheapest fee)</option>
<option value="segwitWrapped">Segwit wrapped (Compatible with old wallets)</option>
<option value="legacy">Legacy (Not recommended)</option>
</select>
</div>
<div class="form-group">
<label for="accountNumber">Account</label>
<select id="accountNumber" name="accountNumber" class="form-control w-auto">
@for (int i = 0; i < 20; i++)
{
<option value="@i">@i</option>
}
</select>
</div>
</div>
<div>
<button type="submit" id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
<button type="button" id="vault-retry" class="btn btn-secondary" style="display:none;">Retry</button>
</div>
</div>
</div>
<form method="post" id="walletInfo" style="display:none;">
<input asp-for="Config" type="hidden" />
<input asp-for="CryptoCode" type="hidden" />
<input asp-for="AccountKey" type="hidden" />
<input asp-for="Source" type="hidden" value="Vault"/>
<input asp-for="DerivationSchemeFormat" type="hidden" value="BTCPay" />
<div class="row mb-5">
<div class="col-md-8 mx-auto">
<h4 class="mb-3">Public Key Information</h4>
<div class="form-group">
<label asp-for="DerivationScheme"></label>
<textarea asp-for="DerivationScheme" class="form-control store-derivation-scheme text-monospace py-2" rows="3" readonly></textarea>
</div>
<div class="form-group">
<label asp-for="RootFingerprint"></label>
<input asp-for="RootFingerprint" class="form-control" readonly />
</div>
<div class="form-group">
<label asp-for="KeyPath"></label>
<input asp-for="KeyPath" class="form-control" readonly />
</div>
<button name="command" type="submit" class="btn btn-primary" value="save" id="Continue">Continue</button>
</div>
</div>
</form>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
<partial name="VaultElements" />
Wallet setup redesign (#2164) * Prepare existing layouts and views * Add icon view component and sprite svg * Add wallet setup basics * Add import method view basics * Use external sprite file instead of inline svg * Refactor hardware wallet setup flow * Manually enter an xpub * Prepare other views * Update views and models * Finalize wallet setup flow * Updat tests, part 1 * Update tests, part 2 * Vaul: Fix missing retry button * Add better Scan QR subtext Still tbd. * Make wallet account an advanced setting * Prevent empty xpub * Use textarea for seed input * Remove redundant error message for missing file upload * Confirm store updates after generating a new wallet * Update wording * Modify existing wallets * Fix proposed method name * Suggest using ColdCard Electrum export option only Advise the user to use the electrum export of the coldcard instead of saying either electrum or wasabi export file … the electurm one contains more info, e.g. the wasabi one doesn't include the account key path. * More concise WalletSetupMethod setting * Test fix * Update wallet removal code * Fix back navigation quirk in change wallet case * Fix behaviour on wallet enable/disable * Fix initial wallet setup * Improve modify view and messages * Test fixes * Seed import fix Uses the correct form url for confirming addresses * Quickfixes from design meeting * Add enable toggle switch on modify page * Confirm wallet removal * Update setup view * Update import view * Icon finetuning * Improve import options page * Refactor QR code scanner Allow for usage with and without modal * Update copy and instructions on import pages * Split generate options: Hot wallet and watch-only * Implement hot wallet options correctly * Minor test changes * Navbar improvements * Fix tables * Fix badge color * Routing related updates Thanks @kukks for the suggestions! * Wording updates Thanks @kukks for the suggestions! * Extend address types table for xpub import Thanks @kukks for the suggestions! * Rename controller * Unify precondition checks * Improve removal warning for hot wallets * Add tooltip on why seed import is not recommended * Add tooltip icon * Add Specter import info
2021-02-11 11:48:54 +01:00
<script src="~/js/vaultbridge.js" defer asp-append-version="true"></script>
<script src="~/js/vaultbridge.ui.js" defer asp-append-version="true"></script>
<script type="text/javascript">
window.addEventListener("load", async () => {
const wsPath = "@Url.Action("VaultBridgeConnection", "Vault", new {cryptoCode = Model.CryptoCode})";
const wsProto = location.protocol.replace(/^http/, "ws");
const vaultUI = new vaultui.VaultBridgeUI(`${wsProto}//${location.host}${wsPath}`);
document.getElementById("vault-status").innerHTML = document.getElementById("VaultConnection").innerHTML;
window.addEventListener("beforeunload", () => {
vaultUI.closeBridge();
});
while (!await vaultUI.askForDevice() || !await vaultUI.askForXPubs()) {};
const { xpub: { strategy, fingerprint, accountKey, keyPath } } = vaultUI;
document.getElementById("DerivationScheme").value = strategy;
document.getElementById("RootFingerprint").value = fingerprint;
document.getElementById("AccountKey").value = accountKey;
document.getElementById("KeyPath").value = keyPath;
document.getElementById("walletInfo").style = null;
});
</script>
}