Repository navigation
feat: melt lnurlcash notes with @lnurlcash/kit 0.20.2, keeping older mints and note shapes - #17
Merged
Merged
Conversation
…mints and note shapes lnurlcash-kit is retired. Its successor, @lnurlcash/kit, carries LUD-25 as revised for unified taproot notes: a bearer note is named by its cp1 on the wire and a certificate travels as c=cs1<amount>. The kit's own lookup now asks after a bearer note only by cp1 (?p=), which a mint from before that revision does not read. The melt therefore asks the mint about a note by its spend (?k1=), through the kit's guarded fetch: every mint generation answers that, and a current one checks the spend in full. The melt itself still sends the 64-hex preimage as k1, the short form both generations accept. Any certificate on the note URL - the old sig as hex or fixed-HRP cs1, or the current c - is dropped from the lookup, so a note held in any of those shapes melts the same way. Tests grade both mint generations: moneyer 0.17.0 (current LUD-25) and moneyer 0.3.1 as moneyer-legacy (reads only k1), through the full 402 path and by melting each note shape directly. The unused per-call timeoutMs option goes: the kit sets its own timeout, and its transport is process-wide.
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.
What
Moves the lnurlcash melt off the retired
lnurlcash-kit(^0.2.1) onto@lnurlcash/kit0.20.2, exact pin. That kit carries LUD-25 as revised for unified taproot notes: a bearer note is named by itscp1on the wire, and a certificate travels asc=cs1<amount>.Backwards compatibility
The kit's
fetchNoteInfonow looks a bearer note up only by itscp1(?p=cp1…), and its raw-k1fallback is gone. Mints from before the revision read onlyk1on that lookup, so using it as-is would leave satgate unable to melt notes from them.src/lnurlcash-melt.tstherefore asks the mint about a note by its spend (GET <note>?k1=<preimage>), using the kit's guardedlnurlFetchandclassifyNoteError:?k1=. A current mint also checks the spend in full.k1, a short form that both generations accept. No…Shortvariant applies here: a melt names no output, and the only short lookup (fetchNoteInfoByHashShort) sendsp=, whichk1-only mints don't read.sigas hex,sigas fixed-HRPcs1, or the currentc=cs1<amount>) along withamount. A melt needs no certificate and the mint states the value itself, so a note in any of these shapes melts the same way.callbackis required, so a mint with no signing key of its own still works.The unused per-call
timeoutMsoption is removed (no caller passed it). The kit applies its own timeout, and its transport is process-wide, so satgate configures nothing on it. Otherwise it would also override toll-booth's settings once toll-booth uses the same kit.ReceivedNotefrom@forgesworn/toll-boothis used unchanged. Tested against toll-booth 6.2.0 (the lockfile) and 6.2.6 (what^6.2.0resolves to today).Tests
src/lnurlcash.test.tscovers two mint generations. Neither involves live sats: both use the fake Lightning backend.@forgesworn/moneyer0.17.0 (exact): current LUD-25.moneyer-legacy=npm:@forgesworn/moneyer@0.3.1: an older mint that reads onlyk1.For each generation:
c=cs1<amount>, barek1,k1withamount,sigas hex, andsigas fixed-HRPcs1. Each test asserts that the mint paid the operator's invoice and that the note is gonepaid: falsewith an error and does not claim successOne further test shows that the kit's own
fetchNoteInfofails against the legacy mint while satgate's lookup succeeds. I checked that the tests catch the problem: swapping the kit's lookup back in makes the three legacy-mint melt paths fail.typecheck, test (401), build and
check:publish-dependenciespass on Node 22 and 24.Also
chore:an in-range lockfile refresh (npm audit fix, no--force) that clears three advisories already present on main (proxy-addr, ip-address, source-map-js). Without it, CI'snpm auditstep fails.Version
I did not bump the version or edit CHANGELOG.md by hand. auto-release bumps from
package.json, so a hand-written 1.18.0 plus thisfeat:commit would release as 1.19.0. When this PR is squash-merged under itsfeat:title, auto-release produces 1.18.0 with the Features line.