fix(types): make nut08Change expressible and NUT-10 tags optional - #958
Merged
Conversation
Aligns the v4 public types with v5 so future backports apply more cleanly, without removing anything from this line. - nut08Change moves onto MeltProofsConfig so it can be passed through the public melt helpers, not just prepareMelt. It already worked at runtime, since the helpers forward their config. PrepareMeltConfig stays as a deprecated alias - NUT10Option.tags and RawNUT10Option.t are optional per NUT-10 and NUT-18. Every read site already guarded for it, and decoding a spec-valid request that omits tags produced an object that violated its own declared type
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v4-dev #958 +/- ##
=========================================
Coverage ? 95.48%
=========================================
Files ? 49
Lines ? 5162
Branches ? 1290
=========================================
Hits ? 4929
Misses ? 100
Partials ? 133
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
robwoodgate
added a commit
that referenced
this pull request
Aug 12, 2026
Mostly hardening fixes, a couple of minor breaking changes to note: Experimental — SigAll (#951): 1. SigAllDigests reshaped: { legacy, current } → { v0 }. 2. SigAllSigningPackage.digests removed — digests are recomputed from package contents. 3. deserializePackage(input, options?) → deserializePackage(input); the validateDigest option is gone, validation is now implicit. Stable, type-level (#958): 4. NUT10Option.tags required → optional. 5. RawNUT10Option.t required → optional. Both only affect TypeScript consumers who read the field, who now see | undefined. Constructing gets easier, and it matches NUT-10 and NUT-18, which both call tags optional. Stable, behavioural (#932): 6. New bolt11 quote-amount check that throws, at four call sites including the read paths checkMintQuoteBolt11 and checkMintQuoteBatchBolt11. Only affects non-compliant mints that return ln invoices that do not match the quote amounts, so should not break in practice. Thanks to Project Loupe for suggesting some of the hardening fixes in this release
52 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two public type corrections carried back from the v5 line (#955), shaped so that nothing is removed from this stable major. The point is partly the fixes themselves and partly keeping the two lines' type shapes aligned so future backports apply cleanly.
Changes
nut08Changemoves ontoMeltProofsConfig.meltProofs,meltProofsBolt11,meltProofsBolt12andmeltProofsOnchainall takeMeltProofsConfigand forward it wholesale toprepareMelt, which took the widerPrepareMeltConfig. So the option already worked at runtime through every helper but could not be expressed in TypeScript.PrepareMeltConfigremains, as a deprecated alias ofMeltProofsConfig, so no import breaks.NUT10Option.tagsandRawNUT10Option.tare optional. NUT-10 markstagsoptional and NUT-18 describestas "optional NUT-10 payment tags". The implementation already agreed:utils/tlv.tsdeclares its internalNut10SpendingCondition.tagsoptional and deliberately returnsundefinedwhen absent, and every read site guards with?? []or a length check. Decoding a spec-valid request that omits tags therefore produced an object that violated its own declared type.Reviewer Notes
PrepareMeltConfigcollapsing to an alias.nut10.tagsnow seestring[][] | undefinedand need a guard. That is the truth they were already exposed to at runtime, andPaymentRequestTransport.tagson this line is already optional, so it also removes an internal inconsistency.PrepareMeltConfigis removed outright rather than aliased, which the v5 migration guide now records.src/type checks clean, node suite passes 62 files and 2077 tests, lint and format clean,api:updaterun and committed.