mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
update
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Liquid+</Product>
|
||||
<Description>Enhanced support for the liquid network.</Description>
|
||||
<Version>1.0.8</Version>
|
||||
<Version>1.1.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Plugin development properties -->
|
||||
|
||||
@@ -16,11 +16,12 @@ namespace BTCPayServer.Plugins.LiquidPlus
|
||||
{
|
||||
public override IBTCPayServerPlugin.PluginDependency[] Dependencies { get; } =
|
||||
{
|
||||
new() { Identifier = nameof(BTCPayServer), Condition = ">=1.7.4" }
|
||||
new() { Identifier = nameof(BTCPayServer), Condition = ">=1.9.0" }
|
||||
};
|
||||
public override void Execute(IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<IUIExtension>(new UIExtension("LiquidNav", "store-integrations-nav"));
|
||||
services.AddSingleton<IUIExtension>(new UIExtension("OnChainWalletSetupLiquidExtension", "onchain-wallet-setup-post-body"));
|
||||
services.AddSingleton<IUIExtension>(new UIExtension("CustomLiquidAssetsNavExtension", "server-nav"));
|
||||
services.AddSingleton<IUIExtension>(new UIExtension("StoreNavLiquidExtension", "store-nav"));
|
||||
services.AddSingleton<CustomLiquidAssetsRepository>();
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
@using System.Reflection.Metadata
|
||||
@using BTCPayServer
|
||||
@using BTCPayServer.Abstractions.TagHelpers
|
||||
@using BTCPayServer.Models.StoreViewModels
|
||||
@using NBitcoin
|
||||
@using NBitcoin.Altcoins.Elements
|
||||
@model dynamic
|
||||
|
||||
@if (Model is WalletSetupViewModel walletSetupViewModel && walletSetupViewModel.Network is ElementsBTCPayNetwork elementsBtcPayNetwork)
|
||||
{
|
||||
if (walletSetupViewModel.Method == WalletSetupMethod.GenerateOptions)
|
||||
{
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.getElementById("GenerateWatchonlyLink").parentElement.remove();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
if (!walletSetupViewModel.Confirmation && walletSetupViewModel.Method == WalletSetupMethod.ImportOptions)
|
||||
{
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll(".list-group-item:not(#ImportSeedLink)").forEach(e => e.parentElement.remove());
|
||||
});
|
||||
</script>
|
||||
}
|
||||
if (!walletSetupViewModel.Confirmation && walletSetupViewModel.Method is WalletSetupMethod.HotWallet or WalletSetupMethod.Seed)
|
||||
{
|
||||
var canUseRpcImport = ViewData["CanUseRPCImport"] is true;
|
||||
|
||||
if (!canUseRpcImport)
|
||||
{
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const warningDiv = document.createElement("div");
|
||||
warningDiv.className = 'alert alert-danger';
|
||||
warningDiv.innerHTML = 'Liquid requires the use of the RPC Import feature but you are not able to use it.';
|
||||
document.querySelector("h1").insertAdjacentElement("beforebegin", warningDiv);
|
||||
document.getElementById("Continue").disabled = true;
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
string masterBlindKey = null;
|
||||
if (walletSetupViewModel.Method == WalletSetupMethod.HotWallet)
|
||||
{
|
||||
var seed = new Mnemonic(Wordlist.English);
|
||||
var slip21 = Slip21Node.FromSeed(seed.DeriveSeed());
|
||||
var slip77 = slip21.GetSlip77Node();
|
||||
masterBlindKey = slip77.Key.ToHex();
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.getElementById("Passphrase").parentElement.style.display = "none";
|
||||
document.getElementById("passphrase_conf").parentElement.style.display = "none";
|
||||
const mnemonicElement = document.createElement("div")
|
||||
mnemonicElement.innerHTML = "<input type='hidden' name='ExistingMnemonic' value='@seed'/>"
|
||||
document.getElementById("ScriptPubKeyType").parentElement.insertAdjacentElement("afterend",mnemonicElement);
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const cbImportRpc = document.getElementById("ImportKeysToRPC");
|
||||
cbImportRpc.checked = true;
|
||||
cbImportRpc.readOnly = true;
|
||||
|
||||
const cloned = cbImportRpc.cloneNode(true);
|
||||
cloned.disabled = true;
|
||||
cloned.name = "";
|
||||
cloned.id = "";
|
||||
cbImportRpc.insertAdjacentElement("beforebegin", cloned );
|
||||
cbImportRpc.style.display = "none";
|
||||
|
||||
const cbisHotWallet = document.getElementById("SavePrivateKeys");
|
||||
if (cbisHotWallet){
|
||||
cbisHotWallet.checked = true;
|
||||
cbisHotWallet.readOnly = true;
|
||||
const cloned2 = cbisHotWallet.cloneNode(true);
|
||||
cloned2.disabled = true;
|
||||
cloned2.name = "";
|
||||
cloned2.id = "";
|
||||
cbisHotWallet.insertAdjacentElement("beforebegin", cloned2 );
|
||||
cbisHotWallet.style.display = "none";
|
||||
}
|
||||
|
||||
const slip77Allowed = @Json.Serialize(masterBlindKey != null);
|
||||
const blindedOption = `<div class='form-group mt-4' ><label class='form-label'>Liquid Confidential Address Mode</label><select id='blindingtype' class='form-select'> <option selected value='default' >Default (BTCPay Server proprietary mode)</option><option value='unblinded' >Unblinded (no confidential addresses mode)</option> ${slip77Allowed? "<option value='slip77'>SLIP77 Mode (compatible with other liquid wallets)</option>": ""}</div>`;
|
||||
document.getElementById("ImportKeysToRPC").parentElement.insertAdjacentHTML("afterend",blindedOption);
|
||||
const blindAdditionalOption = "<input type='hidden' id='blindAdditionalOption'/>";
|
||||
document.getElementById("ScriptPubKeyType").parentElement.insertAdjacentHTML("afterend", blindAdditionalOption);
|
||||
|
||||
document.getElementById("blindingtype").addEventListener("change", (evt)=>{
|
||||
if (evt.target.value == "default"){
|
||||
document.getElementById("blindAdditionalOption").value = "";
|
||||
document.getElementById("blindAdditionalOption").name = "";
|
||||
}else if (evt.target.value == "unblinded"){
|
||||
document.getElementById("blindAdditionalOption").value = "true";
|
||||
document.getElementById("blindAdditionalOption").name = "AdditionalOptions[unblinded]";
|
||||
}else if (evt.target.value == "slip77"){
|
||||
document.getElementById("blindAdditionalOption").value = "@masterBlindKey";
|
||||
document.getElementById("blindAdditionalOption").name = "AdditionalOptions[slip77]";
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@addTagHelper *, BTCPayServer.Abstractions
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
Reference in New Issue
Block a user