mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 02:28:31 +01:00
147 lines
7.3 KiB
Plaintext
147 lines
7.3 KiB
Plaintext
@using NBitcoin
|
|
@model WalletSetupRequest
|
|
|
|
@{
|
|
var method = ViewData["Method"];
|
|
var isImport = method is WalletSetupMethod.Seed;
|
|
var isHotWallet = method is WalletSetupMethod.HotWallet;
|
|
var canUseHotWallet = ViewData["CanUseHotWallet"] is true;
|
|
var canUseRpcImport = ViewData["CanUseRPCImport"] is true;
|
|
}
|
|
|
|
@if (!User.IsInRole(Roles.ServerAdmin))
|
|
{
|
|
<div class="alert alert-warning">
|
|
You are not an admin on this server. While you are able to import or generate a wallet via seed with
|
|
your account, please understand that you are trusting the server admins not just with your
|
|
<a href="https://docs.btcpayserver.org/Deployment/ThirdPartyHosting/#privacy-concerns" target="_blank" class="alert-link" rel="noreferrer noopener">privacy</a>
|
|
but also with <a href="https://docs.btcpayserver.org/Deployment/ThirdPartyHosting/#trust-concerns" target="_blank" class="alert-link" rel="noreferrer noopener">trivial access to your funds.</a>
|
|
If you NEED to use this feature, please reconsider hosting your own BTCPay Server instance.
|
|
</div>
|
|
}
|
|
|
|
<form id="generate-wallet-form" method="post" asp-action="GenerateWallet" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-cryptoCode="@Context.GetRouteValue("cryptoCode")" asp-route-method="@method">
|
|
@if (isImport)
|
|
{
|
|
<div class="form-group">
|
|
<label asp-for="ExistingMnemonic" class="form-label">Wallet Recovery Seed</label>
|
|
<textarea asp-for="ExistingMnemonic" class="form-control font-monospace py-2" rows="2" autocomplete="off" autocorrect="off" autocapitalize="off"></textarea>
|
|
<span asp-validation-for="ExistingMnemonic" class="text-danger"></span>
|
|
</div>
|
|
}
|
|
|
|
<div class="form-group">
|
|
<label asp-for="ScriptPubKeyType" class="form-label">Address type</label>
|
|
<select class="form-select w-auto" asp-for="ScriptPubKeyType">
|
|
@if (ViewData["SupportSegwit"] is true)
|
|
{
|
|
<option value="@ScriptPubKeyType.Segwit">Segwit (Recommended)</option>
|
|
<option value="@ScriptPubKeyType.SegwitP2SH">Segwit wrapped (Compatible with old wallets)</option>
|
|
<option value="@ScriptPubKeyType.Legacy">Legacy (Not recommended)</option>
|
|
}
|
|
else
|
|
{
|
|
<option value="@ScriptPubKeyType.Legacy">Legacy</option>
|
|
}
|
|
|
|
@if (ViewData["SupportTaproot"] is true)
|
|
{
|
|
<option value="@ScriptPubKeyType.TaprootBIP86">Taproot (For advanced users)</option>
|
|
}
|
|
</select>
|
|
<span asp-validation-for="ScriptPubKeyType" class="text-danger"></span>
|
|
</div>
|
|
|
|
@if (isImport && canUseHotWallet)
|
|
{
|
|
<div class="form-group mt-5">
|
|
<label asp-for="SavePrivateKeys">Is hot wallet</label>
|
|
<input type="checkbox" asp-for="SavePrivateKeys" class="btcpay-toggle ms-2" />
|
|
<span asp-validation-for="SavePrivateKeys" class="text-danger"></span>
|
|
<p class="text-muted pt-2">
|
|
If checked, each private key associated with an address generated will be stored as metadata
|
|
and would be accessible to anyone with admin access to your server. Enable at your own risk!
|
|
</p>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<input asp-for="SavePrivateKeys" type="hidden" value="@isHotWallet" />
|
|
|
|
@if (Model.CanUsePayJoin)
|
|
{
|
|
<div class="form-group mt-4">
|
|
<label asp-for="PayJoinEnabled">Enable PayJoin</label>
|
|
<input type="checkbox" asp-for="PayJoinEnabled" class="btcpay-toggle ml-2" />
|
|
<span asp-validation-for="PayJoinEnabled" class="text-danger"></span>
|
|
<p class="text-muted pt-2">
|
|
PayJoin enhances the privacy for you and your customers.
|
|
Enabling it gives your customers the option to use PayJoin during checkout.
|
|
<a href="https://docs.btcpayserver.org/Payjoin/" target="_blank" rel="noreferrer noopener">
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
</a>
|
|
</p>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
<div class="mb-4">
|
|
<button class="btn btn-link px-0" type="button" id="AdvancedSettingsButton" data-bs-toggle="collapse" data-bs-target="#AdvancedSettings" aria-expanded="false" aria-controls="advanced-settings">
|
|
Advanced settings
|
|
</button>
|
|
<div id="AdvancedSettings" class="collapse @(string.IsNullOrEmpty(Model.Passphrase) && !Model.ImportKeysToRPC ? "" : "show")">
|
|
<div class="pt-3 pb-1">
|
|
@if (isImport) // hide account option when creating a wallet
|
|
{
|
|
<div class="form-group mb-5">
|
|
<label asp-for="AccountNumber" class="form-label">Account</label>
|
|
<input asp-for="AccountNumber" class="form-control" style="max-width:10ch" min="0" step="1">
|
|
<span asp-validation-for="AccountNumber" class="text-danger"></span>
|
|
</div>
|
|
}
|
|
<div class="form-group">
|
|
<label asp-for="Passphrase" class="form-label">Optional passphrase (BIP39)</label>
|
|
<input type="text" asp-for="Passphrase" class="form-control" autocomplete="off"/>
|
|
<span asp-validation-for="Passphrase" class="text-danger"></span>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="passphrase_conf" class="form-label">Confirm passphrase</label>
|
|
<input type="text" name="passphrase_conf" id="passphrase_conf" class="form-control"/>
|
|
<span class="text-danger field-validation-valid" id="passphrase_conf_validation"></span>
|
|
</div>
|
|
|
|
@if (canUseRpcImport)
|
|
{
|
|
<div class="form-group mt-5">
|
|
<label asp-for="ImportKeysToRPC">Import keys to RPC</label>
|
|
<input type="checkbox" asp-for="ImportKeysToRPC" class="btcpay-toggle ms-2" />
|
|
<span asp-validation-for="ImportKeysToRPC" class="text-danger"></span>
|
|
<p class="text-muted pt-2">
|
|
Each address generated will be imported into the node wallet and you can view your balance through the node.
|
|
@if (isImport || isHotWallet)
|
|
{
|
|
<span>When this is enabled for a hot wallet, you are also able to use the node wallet to spend.</span>
|
|
}
|
|
</p>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" id="Continue">Continue</button>
|
|
</form>
|
|
|
|
<script>
|
|
document.getElementById("generate-wallet-form").addEventListener("submit", event => {
|
|
const $form = event.currentTarget;
|
|
|
|
if ($form.elements["passphrase_conf"].value !== $form.elements["Passphrase"].value) {
|
|
const $validation = document.getElementById("passphrase_conf_validation");
|
|
$validation.classList.remove("field-validation-valid");
|
|
$validation.innerText = "Invalid passphrase confirmation";
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
</script>
|