예제 #1
0
        public async Task <LightningInvoice> CreateInvoice(LightMoney amount, TimeSpan?expiry = null, CancellationToken cancellation = default(CancellationToken))
        {
            var id      = InvoiceIdEncoder.EncodeData(RandomUtils.GetBytes(20));
            var invoice = await SendCommandAsync <CLightningInvoice>("invoice", new object[] { amount.MilliSatoshi, id, "" }, cancellation : cancellation);

            invoice.Label        = id;
            invoice.MilliSatoshi = amount;
            invoice.Status       = "unpaid";
            return(ToLightningInvoice(invoice));
        }
예제 #2
0
 public async Task <JObject> GetRouteAsync(string peerId, LightMoney msatoshi, double riskFactor)
 {
     try
     {
         return(await SendCommandAsync <JObject>("getroute", new object[] { peerId, msatoshi.MilliSatoshi, riskFactor }));
     }
     catch (LightningRPCException ex) when(ex.Message == "Could not find a route")
     {
         return(null);
     }
 }
예제 #3
0
 Task <LightningInvoice> ILightningInvoiceClient.CreateInvoice(LightMoney amount, TimeSpan expiry, CancellationToken cancellation)
 {
     return(CreateInvoice(amount, expiry, cancellation));
 }