mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
Make sure fingerprint/hdpath are passed down to AddDerivationScheme.
Close ledger popup on account selection. Add additional info after pairing
This commit is contained in:
parent
5571413a78
commit
429170520e
5 changed files with 54 additions and 40 deletions
|
@ -341,6 +341,7 @@ namespace BTCPayServer.Controllers
|
|||
}
|
||||
}
|
||||
vm.Confirmation = true;
|
||||
ModelState.Remove(nameof(vm.Config)); // Remove the cached value
|
||||
return View(vm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace BTCPayServer.Models.StoreViewModels
|
|||
public IFormFile ColdcardPublicFile{ get; set; }
|
||||
public string Config { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string DerivationSchemeFormat { get; set; }
|
||||
public string AccountKey { get; set; }
|
||||
public BTCPayNetwork Network { get; set; }
|
||||
}
|
||||
|
|
|
@ -4,9 +4,16 @@
|
|||
ViewData.SetActivePageAndTitle(StoreNavPages.Index, $"{Model.CryptoCode} Derivation scheme");
|
||||
}
|
||||
|
||||
@section HeadScripts {
|
||||
<style type="text/css">
|
||||
.hw-fields {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<partial name="_StatusMessage" for="StatusMessage" />
|
||||
<h4>@ViewData["Title"]</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
|
@ -14,21 +21,23 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<partial name="AddDerivationSchemes_HardwareWalletDialogs" model="@Model"/>
|
||||
|
||||
@if (!Model.Confirmation)
|
||||
{
|
||||
<partial name="AddDerivationSchemes_HardwareWalletDialogs" model="@Model" />
|
||||
}
|
||||
<form method="post">
|
||||
|
||||
<input id="Config" asp-for="Config" type="hidden" />
|
||||
|
||||
@if (!Model.Confirmation)
|
||||
{
|
||||
<input id="CryptoCurrency" asp-for="CryptoCode" type="hidden" />
|
||||
<input id="DerivationSchemeFormat" asp-for="DerivationSchemeFormat" type="hidden" />
|
||||
<input id="AccountKey" asp-for="AccountKey" type="hidden" />
|
||||
<div class="form-group">
|
||||
<h5>Derivation Scheme</h5>
|
||||
<span>The DerivationScheme represents the destination of the funds received by your invoice. It is generated by your wallet software. Please, verify that you are generating the right addresses by clicking on 'Check ExtPubKey'</span>
|
||||
</div>
|
||||
<input id="CryptoCurrency" asp-for="CryptoCode" type="hidden" />
|
||||
<input id="KeyPath" asp-for="KeyPath" type="hidden" />
|
||||
<input id="Source" asp-for="Source" type="hidden" />
|
||||
<input id="RootFingerprint" asp-for="RootFingerprint" type="hidden" />
|
||||
<input id="AccountKey" asp-for="AccountKey" type="hidden" />
|
||||
<input id="Config" asp-for="Config" type="hidden" />
|
||||
<div class="form-group">
|
||||
<label asp-for="DerivationScheme"></label>
|
||||
<input asp-for="DerivationScheme" class="form-control store-derivation-scheme" />
|
||||
|
@ -36,15 +45,15 @@
|
|||
|
||||
<div class="dropdown mt-2 text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-link dropdown-toggle" type="button" id="hardwarewlletimportdropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Import from hardware device
|
||||
</button>
|
||||
<button class="btn btn-link dropdown-toggle" type="button" id="hardwarewlletimportdropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Import from hardware device
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="hardwarewlletimportdropdown">
|
||||
<button class="dropdown-item" type="button" data-toggle="modal" data-target="#coldcardimport">Coldcard</button>
|
||||
<button class="dropdown-item check-for-ledger" data-toggle="modal" data-target="#ledgerimport" type="button">Ledger</button>
|
||||
<button class="dropdown-item check-for-ledger" data-toggle="modal" data-target="#ledgerimport" type="button">Ledger Wallet</button>
|
||||
@* <button class="dropdown-item check-for-trezor" type="button" data-toggle="modal" data-target="#trezorimport">Trezor</button> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -84,6 +93,22 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="form-group hw-fields">
|
||||
<h5>Additional pairing information</h5>
|
||||
</div>
|
||||
<div class="form-group hw-fields">
|
||||
<label asp-for="Source"></label>
|
||||
<input asp-for="Source" class="form-control" readonly />
|
||||
</div>
|
||||
<div class="form-group hw-fields">
|
||||
<label asp-for="RootFingerprint"></label>
|
||||
<input asp-for="RootFingerprint" class="form-control" readonly />
|
||||
</div>
|
||||
<div class="form-group hw-fields">
|
||||
<label asp-for="KeyPath"></label>
|
||||
<input asp-for="KeyPath" class="form-control" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Enabled"></label>
|
||||
<input asp-for="Enabled" type="checkbox" class="form-check" />
|
||||
|
@ -96,14 +121,9 @@
|
|||
<h5>Confirm the addresses (@Model.CryptoCode)</h5>
|
||||
<span>Please check that your @Model.CryptoCode wallet is generating the same addresses as below.</span>
|
||||
</div>
|
||||
<input type="hidden" asp-for="Confirmation" />
|
||||
<input id="KeyPath" asp-for="KeyPath" type="hidden" />
|
||||
<input id="Source" asp-for="Source" type="hidden" />
|
||||
<input id="RootFingerprint" asp-for="RootFingerprint" type="hidden" />
|
||||
<input id="AccountKey" asp-for="AccountKey" type="hidden" />
|
||||
<input asp-for="Confirmation" type="hidden" />
|
||||
<input type="hidden" asp-for="DerivationScheme" />
|
||||
<input type="hidden" asp-for="Enabled" />
|
||||
<input id="Config" asp-for="Config" type="hidden" />
|
||||
<div class="form-group">
|
||||
<table class="table table-sm table-responsive-md">
|
||||
<thead>
|
||||
|
@ -138,15 +158,13 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@await Html.PartialAsync("_ValidationScriptsPartial")
|
||||
<script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/StoreAddDerivationScheme.js" type="text/javascript" defer="defer"></script>
|
||||
|
||||
<script src="~/vendor/trezor/trezor.js-umd.min.js" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-client.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-add-derivation-scheme.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/ledgerwebsocket.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/StoreAddDerivationScheme.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/vendor/trezor/trezor.js-umd.min.js" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-client.js" type="text/javascript" defer="defer"></script>
|
||||
<script src="~/js/trezor/trezor-add-derivation-scheme.js" type="text/javascript" defer="defer"></script>
|
||||
<script>
|
||||
window.coinName = "@Model.Network.DisplayName.ToLowerInvariant()";
|
||||
</script>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
Checking if a ledger wallet is connected...
|
||||
</div>
|
||||
<div id="ledger-validate" style="display: none;">
|
||||
Please validate access on your screen...
|
||||
Retrieving, wallet information... you may need to confirm access on your screen.
|
||||
</div>
|
||||
<p id="no-ledger-info" style="display: none;">
|
||||
No ledger wallet detected. If you own one, use chrome, open the app, and refresh this page.
|
||||
|
@ -93,13 +93,6 @@
|
|||
<p id="trezor-success" style="display: none;">
|
||||
<span class="fa fa-check-circle" style="color: green;"></span> <span class="hw-label">Trezor wallet detected! Name: <kbd id="trezor-devicename"></kbd></span>
|
||||
</p>
|
||||
<input id="KeyPath" asp-for="KeyPath" type="hidden"/>
|
||||
<input id="RootFingerprint" asp-for="RootFingerprint" type="hidden"/>
|
||||
<input id="AccountKey" asp-for="AccountKey" type="hidden"/>
|
||||
|
||||
<input id="Source" asp-for="Source" type="hidden" value="Trezor"/>
|
||||
<input type="hidden" asp-for="DerivationScheme"/>
|
||||
<input type="hidden" asp-for="Enabled"/>
|
||||
|
||||
<div class="form-group display-when-trezor-connected" style="display: none">
|
||||
|
||||
|
@ -127,7 +120,7 @@
|
|||
<option
|
||||
data-derivation-suffix="-[p2sh]"
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.SegwitP2SH).Derive(i, true)"
|
||||
>Account @i (<span>@Model.Network.GetRootKeyPath(DerivationType.SegwitP2SH).Derive(i, true)</span>)</option>
|
||||
>Account @i (@Model.Network.GetRootKeyPath(DerivationType.SegwitP2SH).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -140,7 +133,7 @@
|
|||
{
|
||||
<option
|
||||
data-derivation-suffix=""
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true)" href="#">Account @i (<span>@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true)</span>)</option>
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true)" href="#">Account @i (@Model.Network.GetRootKeyPath(DerivationType.Segwit).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -154,7 +147,7 @@
|
|||
{
|
||||
<option
|
||||
data-derivation-suffix="-[legacy]"
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true)">Account @i (<span>@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true)</span>)</option>
|
||||
data-trezorkeypath="@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true)">Account @i (@Model.Network.GetRootKeyPath(DerivationType.Legacy).Derive(i, true))</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -48,13 +48,14 @@
|
|||
return;
|
||||
|
||||
showFeedback("ledger-info");
|
||||
|
||||
$("#DerivationScheme").val(result.derivationScheme);
|
||||
$("#RootFingerprint").val(result.rootFingerprint);
|
||||
$("#AccountKey").val(result.extPubKey);
|
||||
$("#Source").val(result.source);
|
||||
$("#DerivationSchemeFormat").val("BTCPay");
|
||||
$("#KeyPath").val(keypath);
|
||||
$(".modal").modal('hide');
|
||||
$(".hw-fields").show();
|
||||
})
|
||||
.catch(function (reason) { Write('check', 'error', reason); });
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue