diff --git a/BTCPayServer.Tests/AltcoinTests/ElementsTests.cs b/BTCPayServer.Tests/AltcoinTests/ElementsTests.cs index 5e6b870af..4e730aa97 100644 --- a/BTCPayServer.Tests/AltcoinTests/ElementsTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/ElementsTests.cs @@ -63,7 +63,6 @@ namespace BTCPayServer.Tests //no tether on our regtest, lets create it and set it var tether = tester.NetworkProvider.GetNetwork("USDT"); var lbtc = tester.NetworkProvider.GetNetwork("LBTC"); - var etb = tester.NetworkProvider.GetNetwork("ETB"); var issueAssetResult = await tester.LBTCExplorerNode.SendCommandAsync("issueasset", 100000, 0); tether.AssetId = uint256.Parse(issueAssetResult.Result["asset"].ToString()); ((ElementsBTCPayNetwork)tester.PayTester.GetService().GetWallet("USDT").Network) @@ -71,15 +70,10 @@ namespace BTCPayServer.Tests Assert.Equal(tether.AssetId, tester.NetworkProvider.GetNetwork("USDT").AssetId); Assert.Equal(tether.AssetId, ((ElementsBTCPayNetwork)tester.PayTester.GetService().GetWallet("USDT").Network).AssetId); - var issueAssetResult2 = await tester.LBTCExplorerNode.SendCommandAsync("issueasset", 100000, 0); - etb.AssetId = uint256.Parse(issueAssetResult2.Result["asset"].ToString()); - ((ElementsBTCPayNetwork)tester.PayTester.GetService().GetWallet("ETB").Network) - .AssetId = etb.AssetId; user.RegisterDerivationScheme("LBTC"); user.RegisterDerivationScheme("USDT"); - user.RegisterDerivationScheme("ETB"); //test: register 2 assets on the same elements network and make sure paying an invoice on one does not affect the other in any way var invoice = await user.BitPay.CreateInvoiceAsync(new Invoice(0.1m, "BTC")); @@ -109,11 +103,7 @@ namespace BTCPayServer.Tests Assert.Equal("paid", localInvoice.Status); Assert.Single(localInvoice.CryptoInfo.Single(info => info.CryptoCode.Equals("USDT", StringComparison.InvariantCultureIgnoreCase)).Payments); }); - - //test precision based on https://github.com/ElementsProject/elements/issues/805#issuecomment-601277606 - var etbBip21 = new BitcoinUrlBuilder(invoice.CryptoInfo.Single(info => info.CryptoCode == "ETB").PaymentUrls.BIP21, etb.NBitcoinNetwork); - //precision = 2, 1ETB = 0.00000100 - Assert.Equal(100, etbBip21.Amount.Satoshi); + var lbtcBip21 = new BitcoinUrlBuilder(invoice.CryptoInfo.Single(info => info.CryptoCode == "LBTC").PaymentUrls.BIP21, lbtc.NBitcoinNetwork); //precision = 8, 0.1 = 0.1 diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index e5ab2ba8a..89ef50574 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -106,9 +106,14 @@ @if (ViewData.IsCategoryActive(typeof(WalletsNavPages), scheme.WalletId.ToString()) || ViewData.IsPageActive([WalletsNavPages.Settings], scheme.WalletId.ToString()) || ViewData.IsPageActive([StoreNavPages.OnchainSettings], categoryId)) { - + @if (!scheme.ReadonlyWallet) + { + + } + + diff --git a/BTCPayServer/Controllers/UIStoresController.Dashboard.cs b/BTCPayServer/Controllers/UIStoresController.Dashboard.cs index 5d1ece628..9de803945 100644 --- a/BTCPayServer/Controllers/UIStoresController.Dashboard.cs +++ b/BTCPayServer/Controllers/UIStoresController.Dashboard.cs @@ -146,6 +146,7 @@ public partial class UIStoresController Crypto = network.CryptoCode, PaymentMethodId = handler.PaymentMethodId, WalletSupported = network.WalletSupported, + ReadonlyWallet = network.ReadonlyWallet, Value = value, WalletId = new WalletId(store.Id, network.CryptoCode), Enabled = !excludeFilters.Match(handler.PaymentMethodId) && strategy != null, diff --git a/BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs b/BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs index 31f8a40ee..23ada5868 100644 --- a/BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs +++ b/BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs @@ -9,6 +9,7 @@ namespace BTCPayServer.Models.StoreViewModels public string Value { get; set; } public WalletId WalletId { get; set; } public bool WalletSupported { get; set; } + public bool ReadonlyWallet { get; set; } public bool Enabled { get; set; } public bool Collapsed { get; set; } } diff --git a/BTCPayServer/Payments/PaymentMethodId.cs b/BTCPayServer/Payments/PaymentMethodId.cs index 939ca2c16..a9c12cacd 100644 --- a/BTCPayServer/Payments/PaymentMethodId.cs +++ b/BTCPayServer/Payments/PaymentMethodId.cs @@ -104,7 +104,6 @@ namespace BTCPayServer.Payments "XMR", "ZEC", "LCAD", - "ETB", "LBTC", "USDt", "MONA", diff --git a/BTCPayServer/Plugins/Altcoins/AltcoinsPlugin.cs b/BTCPayServer/Plugins/Altcoins/AltcoinsPlugin.cs index 36a3b10cf..7bd9ff9f5 100644 --- a/BTCPayServer/Plugins/Altcoins/AltcoinsPlugin.cs +++ b/BTCPayServer/Plugins/Altcoins/AltcoinsPlugin.cs @@ -1,15 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; using BTCPayServer.Abstractions.Models; -using BTCPayServer.Hosting; -using BTCPayServer.Logging; -using Microsoft.AspNetCore.HttpOverrides; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using NBitcoin; -using NBitcoin.Protocol; using NBXplorer; namespace BTCPayServer.Plugins.Altcoins @@ -37,15 +28,12 @@ namespace BTCPayServer.Plugins.Altcoins { // Activating LBTC automatically activate the other liquid assets InitUSDT(services, selectedChains, liquidNBX); - InitETB(services, selectedChains, liquidNBX); InitLCAD(services, selectedChains, liquidNBX); } else { if (selectedChains.Contains("USDT")) InitUSDT(services, selectedChains, liquidNBX); - if (selectedChains.Contains("ETB")) - InitETB(services, selectedChains, liquidNBX); if (selectedChains.Contains("LCAD")) InitLCAD(services, selectedChains, liquidNBX); } diff --git a/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.Liquid.cs b/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.Liquid.cs index fd61e9132..c855eb890 100644 --- a/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.Liquid.cs +++ b/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.Liquid.cs @@ -27,7 +27,11 @@ public partial class AltcoinsPlugin CryptoImagePath = "imlegacy/liquid.png", DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(ChainName), CoinType = ChainName == ChainName.Mainnet ? new KeyPath("1776'") : new KeyPath("1'"), - SupportRBF = true + SupportRBF = true, + SupportLightning = false, + SupportPayJoin = false, + VaultSupported = false, + ReadonlyWallet = true }.SetDefaultElectrumMapping(ChainName); var blockExplorerLink = ChainName == ChainName.Mainnet ? "https://liquid.network/tx/{0}" : "https://liquid.network/testnet/tx/{0}"; diff --git a/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.LiquidAssets.cs b/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.LiquidAssets.cs index 517802b1f..4b397db96 100644 --- a/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.LiquidAssets.cs +++ b/BTCPayServer/Plugins/Altcoins/Liquid/AltcoinsPlugin.LiquidAssets.cs @@ -30,10 +30,13 @@ public partial class AltcoinsPlugin DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(ChainName), CoinType = ChainName == ChainName.Mainnet ? new KeyPath("1776'") : new KeyPath("1'"), SupportRBF = true, - SupportLightning = false + SupportLightning = false, + SupportPayJoin = false, + VaultSupported = false, + ReadonlyWallet = true }.SetDefaultElectrumMapping(ChainName); services.AddBTCPayNetwork(network) - .AddTransactionLinkProvider(PaymentTypes.CHAIN.GetPaymentMethodId(nbxplorerNetwork.CryptoCode), new DefaultTransactionLinkProvider(LiquidBlockExplorer)); + .AddTransactionLinkProvider(PaymentTypes.CHAIN.GetPaymentMethodId("USDt"), new DefaultTransactionLinkProvider(LiquidBlockExplorer)); services.AddCurrencyData(new CurrencyData() { Code = "USDt", @@ -45,35 +48,6 @@ public partial class AltcoinsPlugin selectedChains.Add("LBTC"); } - private void InitETB(IServiceCollection services, SelectedChains selectedChains, NBXplorer.NBXplorerNetwork nbxplorerNetwork) - { - var network = new ElementsBTCPayNetwork() - { - CryptoCode = "ETB", - NetworkCryptoCode = "LBTC", - ShowSyncSummary = false, - DefaultRateRules = new[] - { - - "ETB_X = ETB_BTC * BTC_X", - "ETB_BTC = bitpay(ETB_BTC)" - }, - Divisibility = 2, - AssetId = new uint256("aa775044c32a7df391902b3659f46dfe004ccb2644ce2ddc7dba31e889391caf"), - DisplayName = "Ethiopian Birr", - NBXplorerNetwork = nbxplorerNetwork, - CryptoImagePath = "imlegacy/etb.png", - DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(ChainName), - CoinType = ChainName == ChainName.Mainnet ? new KeyPath("1776'") : new KeyPath("1'"), - SupportRBF = true, - SupportLightning = false - }.SetDefaultElectrumMapping(ChainName); - - services.AddBTCPayNetwork(network) - .AddTransactionLinkProvider(PaymentTypes.CHAIN.GetPaymentMethodId(nbxplorerNetwork.CryptoCode), new DefaultTransactionLinkProvider(LiquidBlockExplorer)); - selectedChains.Add("LBTC"); - } - string LiquidBlockExplorer => ChainName == ChainName.Mainnet ? "https://liquid.network/tx/{0}" : "https://liquid.network/testnet/tx/{0}"; private void InitLCAD(IServiceCollection services, SelectedChains selectedChains, NBXplorer.NBXplorerNetwork nbxplorerNetwork) { @@ -95,11 +69,14 @@ public partial class AltcoinsPlugin CryptoImagePath = "imlegacy/lcad.png", DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(ChainName), CoinType = ChainName == ChainName.Mainnet ? new KeyPath("1776'") : new KeyPath("1'"), - SupportRBF = true, - SupportLightning = false + SupportRBF = true, + SupportLightning = false, + SupportPayJoin = false, + VaultSupported = false, + ReadonlyWallet = true }.SetDefaultElectrumMapping(ChainName); services.AddBTCPayNetwork(network) - .AddTransactionLinkProvider(PaymentTypes.CHAIN.GetPaymentMethodId(nbxplorerNetwork.CryptoCode), new DefaultTransactionLinkProvider(LiquidBlockExplorer)); + .AddTransactionLinkProvider(PaymentTypes.CHAIN.GetPaymentMethodId("LCAD"), new DefaultTransactionLinkProvider(LiquidBlockExplorer)); selectedChains.Add("LBTC"); }