mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
start connecting LN to btcpay
This commit is contained in:
parent
ec38da3c45
commit
dc18f97d88
5 changed files with 43 additions and 1 deletions
|
@ -1,8 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BTCPayServer.Lightning;
|
||||
|
||||
namespace BTCPayApp.CommonServer;
|
||||
|
||||
public partial class LightningPayment
|
||||
{
|
||||
public string PaymentHash { get; set; }
|
||||
public string? PaymentId { get; set; }
|
||||
public string? Preimage { get; set; }
|
||||
public string? Secret { get; set; }
|
||||
public bool Inbound { get; set; }
|
||||
public DateTimeOffset Timestamp { get; set; }
|
||||
public long Value { get; set; }
|
||||
public LightningPaymentStatus Status { get; set; }
|
||||
}
|
||||
|
||||
public class AppUserInfo
|
||||
{
|
||||
public string? UserId { get; set; }
|
||||
|
|
|
@ -6,4 +6,8 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BTCPayServer.Client\BTCPayServer.Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client.Models;
|
||||
|
||||
namespace BTCPayApp.CommonServer;
|
||||
|
||||
|
||||
|
||||
//methods available on the hub in the client
|
||||
public interface IBTCPayAppHubClient
|
||||
{
|
||||
Task NotifyNetwork(string network);
|
||||
Task TransactionDetected(string identifier, string txId);
|
||||
Task NewBlock(string block);
|
||||
|
||||
Task<LightningPayment> CreateInvoice(CreateLightningInvoiceRequest createLightningInvoiceRequest);
|
||||
}
|
||||
//methods available on the hub in the server
|
||||
public interface IBTCPayAppHubServer
|
||||
|
@ -27,6 +32,9 @@ public interface IBTCPayAppHubServer
|
|||
Task TrackScripts(string identifier, string[] scripts);
|
||||
Task<string> UpdatePsbt(string[] identifiers, string psbt);
|
||||
Task<CoinResponse[]> GetUTXOs(string[] identifiers);
|
||||
|
||||
|
||||
Task SendPaymentUpdate(string identifier, LightningPayment lightningPayment);
|
||||
}
|
||||
|
||||
public class CoinResponse
|
||||
|
|
|
@ -260,6 +260,11 @@ var resultPsbt = PSBT.Parse(psbt, explorerClient.Network.NBitcoinNetwork);
|
|||
return result.ToArray();
|
||||
}
|
||||
|
||||
public async Task SendPaymentUpdate(string identifier, LightningPayment lightningPayment)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public async Task MasterNodePong(string group, bool active)
|
||||
{
|
||||
|
@ -273,6 +278,7 @@ var resultPsbt = PSBT.Parse(psbt, explorerClient.Network.NBitcoinNetwork);
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<AppHandshakeResponse> Handshake(AppHandshake request)
|
||||
{
|
||||
|
|
|
@ -3,10 +3,12 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayApp.CommonServer;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Controllers;
|
||||
using BTCPayServer.Lightning;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using NBitcoin;
|
||||
using LightningPayment = BTCPayServer.Lightning.LightningPayment;
|
||||
|
||||
namespace BTCPayServer.App;
|
||||
|
||||
|
@ -114,9 +116,18 @@ public class BTCPayAppLightningClient:ILightningClient
|
|||
|
||||
public async Task<LightningInvoice> CreateInvoice(CreateInvoiceParams createInvoiceRequest, CancellationToken cancellation = new CancellationToken())
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var lp = await HubClient.CreateInvoice(new CreateLightningInvoiceRequest(createInvoiceRequest.Amount, createInvoiceRequest.Description, createInvoiceRequest.Expiry)
|
||||
{
|
||||
DescriptionHashOnly = createInvoiceRequest.DescriptionHashOnly,
|
||||
PrivateRouteHints = createInvoiceRequest.PrivateRouteHints,
|
||||
|
||||
});
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public async Task<ILightningInvoiceListener> Listen(CancellationToken cancellation = new CancellationToken())
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
Loading…
Add table
Reference in a new issue