nutshell icon indicating copy to clipboard operation
nutshell copied to clipboard

[FEAT] Amountless Melt Requests

Open cloudsupper opened this issue 10 months ago • 6 comments

Main Objective

Adds support for amountless payment requests (e.g. bolt11 amountless invoices) and signals support in the info endpoint (mint features)

https://github.com/cashubtc/nuts/pull/173

Enabled for:

  • [x] CLN
  • [x] LND
  • [x] Fake
  • [ ] Blink
  • [ ] LNbits
  • [ ] Strike

Also Added

PaymentQuoteKind:

  • REGULAR for regular quotes
  • AMOUNTLESS for quotes where the amount is specified in the amountless option
  • PARTIAL for quotes where we pay only the partial amount specified in the mpp option

m07_add_payment_quote_kind migration adds the kind column to melt_quotes in the DB. Defaults to REGULAR for all already present records.

cloudsupper avatar Feb 25 '25 00:02 cloudsupper

Codecov Report

Attention: Patch coverage is 27.17949% with 142 lines in your changes missing coverage. Please review.

Project coverage is 52.50%. Comparing base (3e32dc4) to head (5e4aac8). Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
cashu/lightning/clnrest.py 7.89% 35 Missing :warning:
cashu/lightning/lnd_grpc/lnd_grpc.py 8.57% 32 Missing :warning:
cashu/lightning/lndrest.py 8.57% 32 Missing :warning:
cashu/lightning/fake.py 15.00% 17 Missing :warning:
cashu/core/mint_info.py 18.18% 9 Missing :warning:
cashu/wallet/wallet.py 25.00% 6 Missing :warning:
cashu/wallet/v1_api.py 25.00% 3 Missing :warning:
cashu/core/errors.py 81.81% 2 Missing :warning:
cashu/mint/ledger.py 50.00% 2 Missing :warning:
cashu/core/models.py 90.00% 1 Missing :warning:
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
- Coverage   55.36%   52.50%   -2.86%     
==========================================
  Files          84       84              
  Lines        9479     9652     +173     
==========================================
- Hits         5248     5068     -180     
- Misses       4231     4584     +353     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Feb 25 '25 02:02 codecov[bot]

There is a problem here: when paying, backends cannot distinguish whether the amount on the quote is a partial amount or the full amount for a amountless invoice.

cloudsupper avatar Mar 05 '25 14:03 cloudsupper

It seems like the tests with fakewallet have nuts = {} empty nuts dict (?)

EDIT: problem was the deprecated API CI workflow

cloudsupper avatar Mar 07 '25 15:03 cloudsupper

Getting back to this very nice PR.

I think it could benefit from a few more test cases:

  • error if an amountless invoice is trying to be paid without providing an amount (should maybe be a mint test, not wallet?)
  • and the opposite, error when a normal invoice is being paid but with an amount provided in the request
  • tests for the wallet cli for paying amountless invoices

callebtc avatar Apr 25 '25 11:04 callebtc

Getting back to this very nice PR.

I think it could benefit from a few more test cases:

* error if an amountless invoice is trying to be paid without providing an amount (should maybe be a mint test, not wallet?)

* and the opposite, error when a normal invoice is being paid but with an amount provided in the request

* tests for the wallet cli for paying amountless invoices

Yea actually it's testing the Mint, not the wallet. I should probably move that particular test somewhere else.

cloudsupper avatar Apr 30 '25 16:04 cloudsupper

and the opposite, error when a normal invoice is being paid but with an amount provided in the request

We have MPP quotes remember? A client can specify the amount in the request even if the invoice specifies one.

cloudsupper avatar May 02 '25 09:05 cloudsupper