Skip to content

feat(core): Updates to nut18 and nut26 payment request#1059

Open
KvngMikey wants to merge 9 commits into
cashubtc:mainfrom
KvngMikey:payment_request_update
Open

feat(core): Updates to nut18 and nut26 payment request#1059
KvngMikey wants to merge 9 commits into
cashubtc:mainfrom
KvngMikey:payment_request_update

Conversation

@KvngMikey

Copy link
Copy Markdown
Collaborator

implements cashubtc/nuts#381 to keep Nutshell up to date !

Copilot AI review requested due to automatic review settings June 21, 2026 09:50
@github-project-automation github-project-automation Bot moved this to Backlog in nutshell Jun 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.19048% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.66%. Comparing base (a935eb9) to head (91195fd).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cashu/core/mint_info.py 90.00% 2 Missing ⚠️
cashu/core/nuts/nut26.py 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1059      +/-   ##
==========================================
+ Coverage   74.54%   74.66%   +0.12%     
==========================================
  Files         115      115              
  Lines       13195    13294      +99     
==========================================
+ Hits         9836     9926      +90     
- Misses       3359     3368       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@KvngMikey KvngMikey changed the title feat(core): new properties added to nut18 and nut26 payment request feat(core): Updates to nut18 and nut26 payment request Jun 21, 2026
@a1denvalu3

Copy link
Copy Markdown
Collaborator

@KvngMikey If I am not mistaken this only adds support for decoding such payment requests with the additional fields but does not add any logic to handle them or to create a payment request with them.

@KvngMikey

Copy link
Copy Markdown
Collaborator Author

@KvngMikey If I am not mistaken this only adds support for decoding such payment requests with the additional fields but does not add any logic to handle them or to create a payment request with them.

@a1denvalu3 you're right that this PR only adds encoding/decoding for the new ms / fr / sm fields and doesn't add enforcement logic.

Happy to either extend this PR with that handling + a request-creation path, or land this as the serialization layer and do the behavior in a focused follow-up. Which would you prefer?

@a1denvalu3

a1denvalu3 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Happy to either extend this PR with that handling + a request-creation path

Yes please

@robwoodgate

Copy link
Copy Markdown
Contributor

The nut has been updated: ms (mint_strict) is now flipped to mp (mint_preferred) to avoid the omitted=true antipattern.

@a1denvalu3

Copy link
Copy Markdown
Collaborator

I think there are new changes to the spec @KvngMikey

Drop `fr` and replace `sm: List[str]` with `sm: List[SupportedMethod]`
(`mn`, optional `mf`) per cashubtc/nuts#381. NUT-26 tag 0x0a is now a
repeatable supported_method sub-TLV (0x01=method, 0x02=fee u64 BE);
0x0b removed. Also fixes a mis-scoped guard error message (tag 0x01 is
id, not transport). Byte-verified against frozen spec vectors.
Add MintInfo.payment_request_method_fee (mirrors supports_mpp): reject
when the mint melts none of a request's `sm` methods, else return the
lowest matching mf, unit-filtered. Wire it into `pay`: fee applies only
when paying from a mint outside a strict/preferred list, or when no
mint list is set. Fix `request` command's --method/--fee-reserve to
match the new SupportedMethod shape (fr no longer exists).
… path

the creq pay path already selects proofs via include_fees=True, which enforces sum(proofs) - input_fee(proofs) >= amount. Add a dust-proof regression test (20x 1-sat proofs at 250 ppk) proving the payer tops up rather than underpays. No CDK oracle exists for this clause.
--method now accepts name or name:fee (e.g. bolt11:50), rejecting non-integer or negative fees. Help text states the fee only applies when the payer mint is outside a preferred mint list. Full suite green (839 passed); no fr references remain outside unrelated tor binaries.
@KvngMikey KvngMikey force-pushed the payment_request_update branch from 11612fe to 91195fd Compare July 10, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants