This commit is contained in:
Kukks
2023-05-25 12:05:55 +02:00
parent 1d2811a71f
commit a06340ee19
7 changed files with 127 additions and 9 deletions

View File

@@ -97,10 +97,10 @@ Global
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Release|Any CPU.Build.0 = Release|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Release|Any CPU.Build.0 = Release|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Debug|Any CPU.ActiveCfg = Debug|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Debug|Any CPU.ActiveCfg = Altcoins-Debug|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Debug|Any CPU.Build.0 = Debug|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Debug|Any CPU.Build.0 = Altcoins-Debug|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Release|Any CPU.ActiveCfg = Release|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Release|Any CPU.ActiveCfg = Altcoins-Release|Any CPU
{DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Release|Any CPU.Build.0 = Release|Any CPU {DF85EFA4-0EF5-4A99-853F-E6F9C88E3F8C}.Altcoins-Release|Any CPU.Build.0 = Altcoins-Release|Any CPU
{2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Release|Any CPU.ActiveCfg = Release|Any CPU {2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Release|Any CPU.Build.0 = Release|Any CPU {2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Release|Any CPU.Build.0 = Release|Any CPU
{2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Altcoins-Debug|Any CPU.ActiveCfg = Altcoins-Debug|Any CPU {2C5C4DF9-BA1F-4671-9F24-B22D7C9C3D21}.Altcoins-Debug|Any CPU.ActiveCfg = Altcoins-Debug|Any CPU

View File

@@ -1,3 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UnloadedProject/UnloadedProjects/=b4e2ed08_002D4ad3_002D4648_002D8bdb_002D3107200460b9_0023BTCPayServer_002EPlugins_002ELiquidPlus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nostr/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=Nostr/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -11,7 +11,7 @@
<PropertyGroup> <PropertyGroup>
<Product>Liquid+</Product> <Product>Liquid+</Product>
<Description>Enhanced support for the liquid network.</Description> <Description>Enhanced support for the liquid network.</Description>
<Version>1.0.8</Version> <Version>1.1.0</Version>
</PropertyGroup> </PropertyGroup>
<!-- Plugin development properties --> <!-- Plugin development properties -->

View File

@@ -16,11 +16,12 @@ namespace BTCPayServer.Plugins.LiquidPlus
{ {
public override IBTCPayServerPlugin.PluginDependency[] Dependencies { get; } = 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) public override void Execute(IServiceCollection services)
{ {
services.AddSingleton<IUIExtension>(new UIExtension("LiquidNav", "store-integrations-nav")); 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("CustomLiquidAssetsNavExtension", "server-nav"));
services.AddSingleton<IUIExtension>(new UIExtension("StoreNavLiquidExtension", "store-nav")); services.AddSingleton<IUIExtension>(new UIExtension("StoreNavLiquidExtension", "store-nav"));
services.AddSingleton<CustomLiquidAssetsRepository>(); services.AddSingleton<CustomLiquidAssetsRepository>();

View File

@@ -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>
}
}
}

View File

@@ -1 +1,2 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, BTCPayServer.Abstractions
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers