lightning-browser-extension icon indicating copy to clipboard operation
lightning-browser-extension copied to clipboard

Use minSendable and maxSendable values from LNURLp response to cap user input

Open fanismichalakis opened this issue 3 years ago • 1 comments

Feature description

Right now, when paying using LNURL-pay (either directly of through a Lightning Address), the minSendable and maxSendable fields aren't use to their full extent. From what I can see, minSendable only seems to be used to populate the amount field on Alby. If a user tries to pay an amount that is lower than minSendable, no error will display until the payment is actually tried and rejected by the recipient, with a vague "could not fetch invoice" error.

Describe the solution

Alby should use minSendable et maxSendable fields sent by the recipient's "service" to cap user input. For example, display an error below the amount field if the amount is out of the [minSendable, maxSendable] range, and disable the "Send" button. Furthermore, the 4 prefilled amount buttons should take the min and max field into account. For example, the lowest amont could be set to minSendable, while the highest amount could be set to max(maxSendable, balance).

Additional context

If you want to try this, you can for example get a Lightning Address from lnmarkets.com and try to pay an amount that is lower than 1000 sats to it.

Are you working on this?

Yes

fanismichalakis avatar Oct 05 '22 15:10 fanismichalakis

Awesome @fanismichalakis ! Thanks for tackling this! Let us know if you get stuck or need any feedback.

escapedcat avatar Oct 06 '22 00:10 escapedcat