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)); }
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); } }
Task <LightningInvoice> ILightningInvoiceClient.CreateInvoice(LightMoney amount, TimeSpan expiry, CancellationToken cancellation) { return(CreateInvoice(amount, expiry, cancellation)); }