btcpayserver/BTCPayServer/Views/Stores/AddDerivationSchemes_HardwareWalletDialogs.cshtml
Andrew Camilleri 4176f3659b
Add QR code scan/show for PSBT + Import wallet via QR (#1931)
* Add PSBT QR code scan/show

This PR introduces support to show and read PSBTs in BC-UR format via animated QR codes.  This allows you to use BTCPay with HW devices such as Cobo Vault and Blue wallet to sign transactions without ever exposing the keys outside of that device.
Spec: https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-005-ur.md
I've also bumped the QR code library we sue as it had a bug with large datasets.

* Reuse same code for all and allow wallet import via QR code scan

* remove unecessary js vendor files

* Allow export wallet from settings via QR

* formatting

* bundle

* fix wallet receive bundle
2020-10-21 14:03:11 +02:00

108 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@using NBXplorer.Models
@model DerivationSchemeViewModel
@if (Model.CanUseHotWallet)
{
ViewData.Add(nameof(Model.CanUseRPCImport), Model.CanUseRPCImport);
<partial name="AddDerivationSchemes_NBXWalletGenerate" model="@(new GenerateWalletRequest())"/>
}
<partial name="CameraScanner"/>
<form id="qr-import-form" method="post">
<input type="hidden" asp-for="WalletFileContent"/>
</form>
<div class="modal fade" id="electrumimport" tabindex="-1" role="dialog" aria-labelledby="electrumimport" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<form class="modal-content" method="post" enctype="multipart/form-data">
<div class="modal-header">
<h5 class="modal-title" id="electrumimportLabel">Import Wallet from file</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Import your air-gapped hardware wallet by exporting a file and uploading it here.</p>
<table class="table table-sm table-responsive-md">
<thead>
<tr>
<th>Wallet</th>
<th>Instructions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cobo Vault</td>
<td><kbd>Settings Watch-Only Wallet BTCPay Export Wallet</kbd></td>
</tr>
<tr>
<td>ColdCard</td>
<td>
<kbd>Advanced MicroSD Card Electrum Wallet</kbd> or
<kbd>Advanced MicroSD Card Wasabi Wallet</kbd>
</td>
</tr>
<tr>
<td>Electrum</td>
<td><kbd>File Save backup</kbd></td>
</tr>
<tr>
<td>Wasabi</td>
<td><kbd>Tools Wallet Manager Open Wallets Folder</kbd></td>
</tr>
</tbody>
</table>
<div class="form-group">
<label asp-for="WalletFile"></label>
<input type="file" class="form-control-file" asp-for="WalletFile" required>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
<template id="btcpayservervault_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="exampleModalLabel">Import from BTCPayServer Vault</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>You may import from BTCPayServer Vault.</p>
<div class="form-group">
<div id="vaultPlaceholder"></div>
</div>
<div id="vault-xpub" style="display:none;">
<div class="form-group">
<label for="addressType">Address type</label>
<select name="addressType" class="form-control">
<option value="segwit">Segwit (Recommended, cheapest transaction fee)</option>
<option value="segwitWrapped">Segwit wrapped (less cheap but compatible with old wallets)</option>
<option value="legacy">Legacy (Not recommended)</option>
</select>
</div>
<div class="form-group">
<label for="accountNumber">Account</label>
<select name="accountNumber" class="form-control">
@for (int i = 0; i < 20; i++)
{
<option value="@i">@i</option>
}
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary vault-retry" style="display:none;" type="button">Retry</button>
<button id="vault-confirm" class="btn btn-primary" style="display:none;"></button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
</form>
</div>
</template>