-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathEclairClientSample.cs
More file actions
29 lines (24 loc) · 966 Bytes
/
EclairClientSample.cs
File metadata and controls
29 lines (24 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Threading.Tasks;
using LightningPay.Clients.Eclair;
namespace LightningPay.Samples.Console
{
class EclairClientSample : SampleBase
{
public async override Task Execute()
{
using (var eclairClient = EclairClient.New("http://localhost:4570/", "eclairpassword"))
{
var invoice = await eclairClient.CreateInvoice(Money.FromSatoshis(100),
"My First invoice");
System.Console.WriteLine($"Create a new invoice with id {invoice.Id}");
System.Console.WriteLine($"Payment request : {invoice.BOLT11}");
System.Console.WriteLine($"Invoice Uri : {invoice.Uri}");
while (!await eclairClient.CheckPayment(invoice.Id))
{
System.Console.WriteLine("Waiting for invoice payment....");
await Task.Delay(5000);
}
}
}
}
}