add method field to quote responses, closes #378 - #387
Merged
Conversation
robwoodgate
approved these changes
Jun 10, 2026
robwoodgate
added a commit
to robwoodgate/cashu-ts
that referenced
this pull request
Jun 12, 2026
Implements cashubtc/nuts#387: every mint and melt quote response carries a method field. The wallet always knows the method from the request endpoint, so normalization populates it when the mint omits it (no mint ships the field yet) and throws when a reported method disagrees with the endpoint. Once mints implement it, NUT-17 generic mint_quote/melt_quote notifications become routable by method.
This was referenced Jun 12, 2026
Closed
Collaborator
|
Implemented in cashubtc/cashu-ts#698 - wallet backfills method from the endpoint for mints that don't send it yet. |
robwoodgate
added a commit
to robwoodgate/cashu-ts
that referenced
this pull request
Jun 12, 2026
Implements cashubtc/nuts#387: every mint and melt quote response carries a method field. The wallet always knows the method from the request endpoint, so normalization populates it when the mint omits it (no mint ships the field yet) and throws when a reported method disagrees with the endpoint. Once mints implement it, NUT-17 generic mint_quote/melt_quote notifications become routable by method.
robwoodgate
added a commit
to robwoodgate/cashu-ts
that referenced
this pull request
Jun 12, 2026
Implements cashubtc/nuts#387: every mint and melt quote response carries a method field. The wallet always knows the method from the request endpoint, so normalization populates it when the mint omits it (no mint ships the field yet) and throws when a reported method disagrees with the endpoint. Once mints implement it, NUT-17 generic mint_quote/melt_quote notifications become routable by method.
robwoodgate
added a commit
to robwoodgate/nuts
that referenced
this pull request
Jun 15, 2026
Consolidates review feedback on the generic payment method PR. Scoped to the delta NOT covered by cashubtc#377 (accounting fields) or cashubtc#387 (method), so those can merge independently: - common mint quote request: optional amount, description, pubkey - common melt quote request: optional amount - common mint quote response: expiry, optional pubkey - common melt quote response: request, optional fee_reserve - custom mint quotes MUST carry the accounting fields - custom melt quotes MUST use the standard UNPAID/PENDING/PAID states
Member
|
implemented in cashubtc/nutshell#1055 |
This was referenced Jun 18, 2026
Merged
3 tasks
robwoodgate
added a commit
to cashubtc/cashu-ts
that referenced
this pull request
Jul 3, 2026
Implements cashubtc/nuts#387: every mint and melt quote response carries a method field. The wallet always knows the method from the request endpoint, so normalization populates it when the mint omits it (no mint ships the field yet) and throws when a reported method disagrees with the endpoint. Once mints implement it, NUT-17 generic mint_quote/melt_quote notifications become routable by method.
thesimplekid
approved these changes
Jul 4, 2026
robwoodgate
added a commit
to cashubtc/cashu-ts
that referenced
this pull request
Jul 8, 2026
…cts (#698) Matures the NUT-04/05 base payloads so wallets can handle generic and custom payment methods, implementing: - **cashubtc/nuts#377** — mint quote accounting: `amount_paid`, `amount_issued` and `updated_at` become base mint quote response fields for every payment method; `state` is deprecated (but always populated for bolt11). - **cashubtc/nuts#382** — custom payment methods: base request/response structs widened per the shapes suggested in review, generic quote responses get base normalization + validation, and new `MintQuoteGenericResponse` / `MeltQuoteGenericResponse` passthrough types are the defaults on the generic quote methods so custom-method fields are reachable without casting. - **cashubtc/nuts#387** — every quote response carries a `method` field: populated from the request endpoint when the mint omits it (no mint ships it yet), throwing when a reported method disagrees with the endpoint. Once mints implement it, NUT-17 generic `mint_quote`/`melt_quote` notifications become routable by method. Follows up on #672 (nuts#374 `method_name`), which already merged. ## Design notes - **Required-but-derived accounting.** For mints that predate quote accounting, `amount_paid`/`amount_issued` are derived from the legacy single-use `state` + `amount` (UNPAID → 0/0, PAID → amount/0, ISSUED → amount/amount); conversely a missing bolt11 `state` is derived from the accounting fields. Underivable responses throw, matching the existing melt-side strictness. `updated_at` is `number | null` (null when the mint does not report it — it cannot be derived). - **Base shapes per the nuts#382 review suggestions.** Mint quote request base gains optional `amount`/`description`; `expiry` moves into the mint quote response base (normalized to `null` when unset); melt quote request base gains optional `amount`; melt quote response base gains required `request` and optional `fee_reserve` (bolt methods keep it required, onchain keeps `fee_options`). - **Mintable amount enforced for all methods.** `validateMintQuoteAvailableAmount` loses its bolt12/onchain gate: mintable = `amount_paid − amount_issued` is checked whenever the quote object carries accounting fields. Stored quotes without them (pre-accounting) skip the check, as before. - Method-id validation (`^[a-z0-9_-]+$`) and the generic `/v1/{mint,melt}/quote/{method}` plumbing already existed and are unchanged. ## Breaking changes - `MintQuoteBaseResponse` requires `amount_paid`, `amount_issued`, `updated_at`, `expiry`; `MeltQuoteBaseResponse` requires `request`. Type-breaking for code constructing quote literals; runtime consumers are unaffected because normalization guarantees the fields. - Non-conformant quote responses that previously passed through unvalidated (mint quotes missing `quote`/`request`/`unit` or underivable accounting; melt quotes missing `request`) now throw `Invalid response from mint`.
3 tasks
callebtc
pushed a commit
that referenced
this pull request
Jul 21, 2026
* Add generic payment method support * feat(nut04/05): widen common quote structs for custom payment methods Consolidates review feedback on the generic payment method PR. Scoped to the delta NOT covered by #377 (accounting fields) or #387 (method), so those can merge independently: - common mint quote request: optional amount, description, pubkey - common melt quote request: optional amount - common mint quote response: expiry, optional pubkey - common melt quote response: request, optional fee_reserve - custom mint quotes MUST carry the accounting fields - custom melt quotes MUST use the standard UNPAID/PENDING/PAID states * fix: prettier * Update 04.md * fix references to nut17/19 * remove sections --------- Co-authored-by: Rob Woodgate <robwoodgate@mac.com> Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
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.
Implementations
add a
methodfield to all quote responses.closes #378