Closed MiguelMedeiros closed 7 months ago
my 2 cents: I would have another method just to 1. send a request to the lnurlp
endpoint and see if it's valid; 2. send a request to the callback
endpoint to generate an invoice and then you have the same bolt11 invoice to use in this sendLightningInvoice
function.
@jaonoctus Thank you for your input! 👍
Is there just one method to retrieve the lnurlp endpoint, validate it, and obtain the bolt11 invoice?
Do you have any suggestions for a cool/comprehensive name for this method?
There is no method for that on phoenixd, we need to do two http-api calls.
The validation of the first call is simple as check if there is a callback
key in the response object, as well as min and max sendables in msats. We could create utils/helpers functions for that.
getLnurlp
and getPaymentRequest
or something similar, maybe?
@jaonoctus I've been thinking about creating another npm package to handle ln addresses and leave this one just for the phoenixd endpoints. So, I'm going to close this PR for now and will let you know here when I have a new npm package for this lnaddress helper.
In the
sendLightningInvoice
method, allow theinvoice
parameter to accept LN addresses and automatically get the BOLT11 invoice. Theinvoice
parameter could then accept either an LN address or a regular BOLT11 invoice.