mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
fixes
This commit is contained in:
parent
2da9434571
commit
80790bd9b0
2 changed files with 53 additions and 19 deletions
|
@ -327,6 +327,8 @@ namespace BTCPayServer.Controllers
|
|||
var network = _NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode);
|
||||
var client = _ExplorerProvider.GetExplorerClient(cryptoCode);
|
||||
var response = await client.GenerateWalletAsync(request);
|
||||
|
||||
var store = HttpContext.GetStoreData();
|
||||
var result = await AddDerivationScheme(storeId, new DerivationSchemeViewModel()
|
||||
{
|
||||
Confirmation = false,
|
||||
|
@ -336,11 +338,16 @@ namespace BTCPayServer.Controllers
|
|||
CryptoCode = cryptoCode,
|
||||
DerivationScheme = response.DerivationScheme.ToString(),
|
||||
Source = "NBXplorer",
|
||||
AccountKey = response.AccountHDKey.ToWif(),
|
||||
AccountKey = response.AccountHDKey.Neuter().ToWif(),
|
||||
DerivationSchemeFormat = "BTCPay",
|
||||
KeyPath = response.AccountKeyPath.KeyPath.ToString(),
|
||||
Enabled = true
|
||||
Enabled = !store.GetStoreBlob().IsExcluded(new PaymentMethodId(cryptoCode, PaymentTypes.BTCLike))
|
||||
}, cryptoCode);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Severity = StatusMessageModel.StatusSeverity.Success,
|
||||
Html = !string.IsNullOrEmpty(request.ExistingMnemonic)? "Your wallet has been imported.": $"Your wallet has been generated. Please store your seed securely! <br/><code>{response.Mnemonic}</code>"
|
||||
});
|
||||
((ViewResult)result).ViewName = nameof(AddDerivationScheme);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
@model NBXplorer.Models.GenerateWalletRequest
|
||||
<div class="modal fade" id="nbxplorergeneratewallet" tabindex="-1" role="dialog" aria-labelledby="nbxplorergeneratewallet" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form class="modal-content" form method="post" asp-action="GenerateNBXWallet" enctype="multipart/form-data">
|
||||
<form class="modal-content" form method="post" asp-action="GenerateNBXWallet" enctype="multipart/form-data">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Generate a wallet with a seed</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
|
@ -10,25 +10,52 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>You may generate a wallet with a seed and import the xpub it into BTCPay. You can optionally also tell NBX to import the keys to the node wallet to be able to spend received funds from it.</p>
|
||||
<p>You may generate a wallet with a seed and import the xpub it into BTCPay. You can optionally also tell NBX to import the keys to the node wallet to be able to view & spend received funds from it.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="ExistingMnemonic">Existing Seed</label>
|
||||
<input type="text" asp-for="ExistingMnemonic" class="form-control"/>
|
||||
<span asp-validation-for="ExistingMnemonic" class="text-danger"></span>
|
||||
<p class="text-black-50">You can choose to import an existing mnemonic seed phrase. If you leave blank, we will generate one for you.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ScriptPubKeyType">Address type</label>
|
||||
<select class="form-control" asp-for="ScriptPubKeyType">
|
||||
<option value="@ScriptPubKeyType.Segwit">Segwit (Recommended, cheapest transaction fee)</option>
|
||||
<option value="@ScriptPubKeyType.SegwitP2SH">Segwit wrapped (less cheap but compatible with old wallets)</option>
|
||||
<option value="@ScriptPubKeyType.Legacy">Legacy (Not recommended)</option>
|
||||
</select>
|
||||
<span asp-validation-for="ScriptPubKeyType" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="AccountNumber">Account</label>
|
||||
<select asp-for="AccountNumber" class="form-control">
|
||||
@for (int i = 0; i < 20; i++)
|
||||
{
|
||||
<option value="@i">@i</option>
|
||||
}
|
||||
</select>
|
||||
<span asp-validation-for="AccountNumber" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="checkbox" class="form-check-inline" asp-for="SavePrivateKeys"/>
|
||||
<label asp-for="SavePrivateKeys">Save private keys</label>
|
||||
<span asp-validation-for="SavePrivateKeys" class="text-danger"></span>
|
||||
<p class="text-black-50">If checked, each private key associated with an address generated will be stored as metadata in NBXplorer.</p>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" class="form-check-inline" asp-for="ImportKeysToRPC"/>
|
||||
<label asp-for="ImportKeysToRPC">Import keys to RPC</label>
|
||||
<span asp-validation-for="ImportKeysToRPC" class="text-danger"></span>
|
||||
<p class="text-black-50">If checked, each address generated will be imported into the node wallet so that you can view your balance through your node. When this is enabled alongside <code>Save private keys</code>, you're also able to use the node wallet to spend (this works pretty well in conjunction with apps such as FullyNoded).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
|
||||
<div id="vault-dropdown" style="display:none;" class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
Select the type of address you want
|
||||
</button>
|
||||
<div class="dropdown-menu overflow-auto" style="max-height: 200px;">
|
||||
<button type="submit" class="dropdown-item" asp-for="ScriptPubKeyType" value="@ScriptPubKeyType.Segwit">Segwit (Recommended, cheapest transaction fee)</button>
|
||||
<a class="dropdown-item" href="#" asp-for="ScriptPubKeyType" value="@ScriptPubKeyType.SegwitP2SH">Segwit wrapped (less cheap but compatible with old wallets)</a>
|
||||
<a class="dropdown-item" href="#" asp-for="ScriptPubKeyType" value="@ScriptPubKeyType.Legacy">Legacy (Not recommended)</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" >Generate</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue