#nullable enable using BTCPayServer.Abstractions.Contracts; using BTCPayServer.Abstractions.Models; using BTCPayServer.Abstractions.Services; using BTCPayServer.Configuration; using BTCPayServer.Lightning; using BTCPayServer.Payments; using BTCPayServer.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using NBitcoin; using System; namespace BTCPayServer.Plugins.BreezSpark { public class BreezSparkPlugin : BaseBTCPayServerPlugin { public override IBTCPayServerPlugin.PluginDependency[] Dependencies { get; } = { new() { Identifier = nameof(BTCPayServer), Condition = ">=2.2.0" } }; public override void Execute(IServiceCollection applicationBuilder) { applicationBuilder.AddSingleton(); applicationBuilder.AddSingleton(provider => provider.GetRequiredService()); applicationBuilder.AddSingleton(); applicationBuilder.AddSingleton(provider => provider.GetRequiredService()); // Register the BreezSpark payment method handler applicationBuilder.AddSingleton(provider => { var breezService = provider.GetRequiredService(); var networkProvider = provider.GetRequiredService(); var lightningClientFactory = provider.GetRequiredService(); var lightningNetworkOptions = provider.GetRequiredService>(); return new BreezSparkPaymentMethodHandler( breezService, networkProvider.GetNetwork("BTC"), lightningClientFactory, lightningNetworkOptions); }); // Add UI extensions for lightning setup tab (like Boltz does) applicationBuilder.AddSingleton(new UIExtension("BreezSpark/LNPaymentMethodSetupTab", "ln-payment-method-setup-tab")); applicationBuilder.AddSingleton(new UIExtension("BreezSpark/LNPaymentMethodSetupTabhead", "ln-payment-method-setup-tabhead")); // Surface BreezSpark navigation inside the store integrations nav, matching the plugin template pattern. applicationBuilder.AddUIExtension("store-integrations-nav", "BreezSpark/BreezSparkNav"); base.Execute(applicationBuilder); } } }