Replace Breez SDK (Greenlight) with Breez Spark SDK (nodeless)

Major changes:
- Built C# bindings for Breez Spark SDK from source using UniFFI
- Created local NuGet package infrastructure (Breez.Sdk.Spark v0.0.1)
- Replaced Breez.Sdk package reference with Breez.Sdk.Spark
- Updated BreezLightningClient to use async Spark SDK API
- Removed Greenlight-specific code (credentials, invite codes)
- Simplified BreezSettings (no more Greenlight fields)
- Updated BreezService for async client initialization
- Cleaned up BreezController (removed certificate upload logic)

Key differences in Spark SDK:
- Nodeless architecture (no Greenlight hosting required)
- Simplified configuration (only mnemonic + API key)
- All async methods (no BlockingBreezServices)
- Different payment flow (PrepareSendPayment + SendPayment)

The plugin now works with Breez's Spark protocol which provides
a self-custodial Lightning experience without infrastructure hosting.

Note: NuGet package must be built from spark-sdk source before use.
This commit is contained in:
Claude
2025-11-13 15:00:09 +00:00
parent d27c3d5629
commit 855cd20ba6
8 changed files with 218 additions and 272 deletions

View File

@@ -92,7 +92,7 @@ public class BreezService:EventHostedServiceBase
return settings;
}
public async Task<BreezLightningClient?> Handle(string? storeId, BreezSettings? settings)
public async Task<BreezLightningClient?> Handle(string? storeId, BreezSettings? settings)
{
if (settings is null)
{
@@ -105,16 +105,24 @@ public class BreezService:EventHostedServiceBase
{
try
{
var network = Network.Main; // _btcPayNetworkProvider.BTC.NBitcoinNetwork;
var network = Network.Main;
var dir = GetWorkDir(storeId);
Directory.CreateDirectory(dir);
settings.PaymentKey ??= Guid.NewGuid().ToString();
var client = new BreezLightningClient(settings.InviteCode, settings.ApiKey, dir,
network, new Mnemonic(settings.Mnemonic), settings.PaymentKey);
var client = await BreezLightningClient.Create(
settings.ApiKey,
dir,
network,
new Mnemonic(settings.Mnemonic),
settings.PaymentKey
);
if (storeId is not null)
{
_clients.AddOrReplace(storeId, client);
}
return client;
}
catch (Exception e)