Skip to content

feat: get locked mint quotes by pubkey - #782

Open
robwoodgate wants to merge 7 commits into
mainfrom
feat/mint-quote-lookup
Open

feat: get locked mint quotes by pubkey#782
robwoodgate wants to merge 7 commits into
mainfrom
feat/mint-quote-lookup

Conversation

@robwoodgate

@robwoodgate robwoodgate commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

NUT

TODO

  • isSupported() gating (once nut number assigned)
  • integration tests (once mint supports)

Summary

Implements the draft Mint Quote Lookup by Public Key NUT (wallet side): fetch all NUT-20 locked mint quotes for a set of pubkeys, proving key ownership with BIP340 Schnorr signatures over SHA256(UTF8("Cashu_MintQuoteLookup_v1" || mint_pubkey || pubkey)).

  • signMintQuoteLookup / verifyMintQuoteLookupSignature in src/crypto/NUT20.ts; verify returns false on malformed input, never throws, matching its siblings.
  • Mint.getMintQuotesByPubkey(method, { pubkeys, pubkey_signatures }): POSTs /v1/mint/quote/{method}/pubkey, requires the { "quotes": [...] } envelope, validates inputs client-side before any request.
  • Wallet.getMintQuotesByPubkey(privkey | privkey[], method = 'bolt11'): derives compressed pubkeys, signs each against the mint's NUT-06 info pubkey, delegates to the Mint method.

All new API is @experimental.

Design notes

  • Wire format is spec-strict. The CDK implementation (NUT-XX: Mint Quote Lookup by Public Key cdk#1834) currently sends pubkeys_signatures and returns a bare array; this PR follows the spec text (pubkey_signatures, {"quotes": [...]}) and will disagree with cdk until the two converge.
  • Responses can mix payment methods. CDK returns matching quotes of every method regardless of the {method} path segment, so each returned quote is normalized by its own method field, falling back to the path method when absent.
  • No isSupported() gating yet. The NUT number is unassigned, so there is no settings key to check; gating and any numbered naming follow once a number lands.
  • No integration tests yet: no released mint implements the spec wire format.

@github-project-automation github-project-automation Bot moved this to Backlog in cashu-ts Jul 13, 2026
@robwoodgate robwoodgate added the nut hold This PR is held pending the merge of a new or updated NUT label Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.29%. Comparing base (9e2e3f9) to head (5e6738a).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #782      +/-   ##
==========================================
+ Coverage   95.26%   95.29%   +0.03%     
==========================================
  Files          54       54              
  Lines        5175     5209      +34     
  Branches     1284     1291       +7     
==========================================
+ Hits         4930     4964      +34     
  Misses        105      105              
  Partials      140      140              
Flag Coverage Δ
integration 38.40% <3.03%> (-0.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nut hold This PR is held pending the merge of a new or updated NUT on hold

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant