feat(core): Updates to nut18 and nut26 payment request#1059
Conversation
Codecov Report❌ Patch coverage is
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. |
|
@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? |
Yes please |
|
The nut has been updated: |
|
I think there are new changes to the spec @KvngMikey |
…quest that carries fields
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.
11612fe to
91195fd
Compare
implements cashubtc/nuts#381 to keep Nutshell up to date !