2018-03-20 11:59:43 +09:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using BTCPayServer.Payments.Lightning.Charge;
|
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Payments.Lightning
|
|
|
|
|
{
|
|
|
|
|
public class LightningInvoice
|
|
|
|
|
{
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string Status { get; set; }
|
|
|
|
|
public string BOLT11 { get; set; }
|
|
|
|
|
public DateTimeOffset? PaidAt
|
|
|
|
|
{
|
|
|
|
|
get; set;
|
|
|
|
|
}
|
|
|
|
|
public LightMoney Amount { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LightningNodeInformation
|
|
|
|
|
{
|
2018-03-22 12:02:38 +09:00
|
|
|
|
public string NodeId { get; set; }
|
2018-03-20 11:59:43 +09:00
|
|
|
|
public string Address { get; internal set; }
|
|
|
|
|
public int P2PPort { get; internal set; }
|
|
|
|
|
public int BlockHeight { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public interface ILightningInvoiceClient
|
|
|
|
|
{
|
|
|
|
|
Task<LightningInvoice> GetInvoice(string invoiceId, CancellationToken cancellation = default(CancellationToken));
|
2018-04-07 02:43:35 +09:00
|
|
|
|
Task<LightningInvoice> CreateInvoice(LightMoney amount, string description, TimeSpan expiry, CancellationToken cancellation = default(CancellationToken));
|
2018-03-20 11:59:43 +09:00
|
|
|
|
Task<ILightningListenInvoiceSession> Listen(CancellationToken cancellation = default(CancellationToken));
|
|
|
|
|
Task<LightningNodeInformation> GetInfo(CancellationToken cancellation = default(CancellationToken));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface ILightningListenInvoiceSession : IDisposable
|
|
|
|
|
{
|
2018-03-21 00:31:19 +09:00
|
|
|
|
Task<LightningInvoice> WaitInvoice(CancellationToken cancellation);
|
2018-03-20 11:59:43 +09:00
|
|
|
|
}
|
|
|
|
|
}
|