Ride-The-Lightning / c-lightning-REST

REST APIs for Core Lightning written with node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

``waitInvoice`` doesn't seem to work

AngeloMetal opened this issue · comments

Function waitInvoice is supposed to wait until the given invoice is paid, and on success, it returns the object (label, description, payment_hash etc.)

Once I execute it, it cannot get the invoice while I'm sure I've entered the correct label.

$ curl -X GET 'https://192.168.2.10:3001/v1/invoice/waitInvoice' --insecure -H 'macaroon:Ag[removed]l4' -H 'Content-Type: application/json' -d '{"label":"sm2"}'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /v1/invoice/waitInvoice</pre>
</body>
</html>

Am I doing something wrong? Function listInvoices does work.

@AngeloMetal

  • Please pass invoice label as route parameter. GET method does not accept JSON data (-d).
curl -k -X 'GET' 'https://localhost:3001/v1/invoice/waitInvoice/sm2' -H 'macaroon:Ag[removed]l4'
  • Also note that once executed, this terminal will wait till invoice labelled as sm2 is not paid.
  • Once the invoice is paid, the API will return object response as below:
{"label":"sm2","bolt11":"lntb120...w45s","payment_hash":"e73...c49d","msatoshi":120000,"amount_msat":"120000msat","status":"paid","pay_index":158,"msatoshi_received":120000,"amount_received_msat":"120000msat","paid_at":1664855433,"payment_preimage":"69b...81","description":"sm2 description","expires_at":1665459017}