lnurlcash-conformance 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +5 -2
- package/runner/index.d.ts +100 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ Semantic versioning. While the LUD-25 draft is unmerged, `0.x` minor bumps
|
|
|
4
4
|
may add or tighten checks that a previously-passing mint now fails; pin an
|
|
5
5
|
exact version if you gate CI on the grade.
|
|
6
6
|
|
|
7
|
+
## 0.2.1 - 2026-08-22
|
|
8
|
+
|
|
9
|
+
- The grader ships its own TypeScript declarations. The mock mint had them
|
|
10
|
+
and the runner did not, so a TypeScript consumer hand-wrote a
|
|
11
|
+
`declare module` shim, and those drift: moneyer carried one, `gradeBoundMint`
|
|
12
|
+
landed here, and the shim did not know about it. A consumer could not call
|
|
13
|
+
the newest check without editing a copy of a declaration it does not own.
|
|
14
|
+
Now `runner/index.d.ts` sits next to the code it describes and the exports
|
|
15
|
+
map points at it. No runtime change of any kind.
|
|
16
|
+
|
|
7
17
|
## 0.2.0 - 2026-08-22
|
|
8
18
|
|
|
9
19
|
- Naming the note you are buying. In LUD-25 a minted note's `k1` is the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lnurlcash-conformance",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Language-neutral conformance vectors, an adversarial mock mint, and a grader for LNURLcash (LUD-25) implementations",
|
|
5
5
|
"author": "TheCryptoDonkey",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
"llms.txt"
|
|
35
35
|
],
|
|
36
36
|
"exports": {
|
|
37
|
-
".":
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./runner/index.d.ts",
|
|
39
|
+
"default": "./runner/index.mjs"
|
|
40
|
+
},
|
|
38
41
|
"./vectors/*": "./vectors/*",
|
|
39
42
|
"./mock-mint": {
|
|
40
43
|
"types": "./mock-mint/index.d.ts",
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Types for the grader, so a TypeScript consumer gets its shape checked
|
|
2
|
+
// rather than hand-writing a `declare module` shim of its own. Hand-written
|
|
3
|
+
// to match index.mjs.
|
|
4
|
+
//
|
|
5
|
+
// This file exists because those shims drift. moneyer carried one, the
|
|
6
|
+
// grader grew gradeBoundMint, and the shim did not: the consumer could not
|
|
7
|
+
// call the newest check without editing a copy of a declaration it does not
|
|
8
|
+
// own. Shipping the declarations puts that in one place, next to the code
|
|
9
|
+
// they describe.
|
|
10
|
+
|
|
11
|
+
/** what the mint fee is, in LUD-25's own two terms */
|
|
12
|
+
export interface MintFee {
|
|
13
|
+
baseFeeMsat: number
|
|
14
|
+
feePpm: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ReportStatus = 'pass' | 'fail' | 'warn' | 'skip'
|
|
18
|
+
|
|
19
|
+
export interface ReportResult {
|
|
20
|
+
status: ReportStatus
|
|
21
|
+
name: string
|
|
22
|
+
/** what the check saw, in a sentence. Present on nearly every result */
|
|
23
|
+
detail?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Report {
|
|
27
|
+
results: ReportResult[]
|
|
28
|
+
pass(name: string, detail?: string): void
|
|
29
|
+
fail(name: string, detail?: string): void
|
|
30
|
+
warn(name: string, detail?: string): void
|
|
31
|
+
skip(name: string, detail?: string): void
|
|
32
|
+
/**
|
|
33
|
+
* Runs `fn` and records the outcome. A thrown error is a failure; an
|
|
34
|
+
* error carrying a truthy `warning` is a warning, which is how an
|
|
35
|
+
* optional extension in the wrong shape is reported without failing a
|
|
36
|
+
* mint that need not have published it at all.
|
|
37
|
+
*/
|
|
38
|
+
check(name: string, fn: () => Promise<unknown> | unknown): Promise<void>
|
|
39
|
+
/** how many results are failures */
|
|
40
|
+
readonly failed: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare const createReport: () => Report
|
|
44
|
+
|
|
45
|
+
/** an `lnurlw://` or `lnurlp://` URL as its https equivalent, per LUD-17 */
|
|
46
|
+
export declare const fromLud17: (value: string) => string
|
|
47
|
+
|
|
48
|
+
/** a lightning address or LNURL as the payRequest URL to fetch */
|
|
49
|
+
export declare const resolveMint: (input: string) => string
|
|
50
|
+
|
|
51
|
+
/** the msat a bolt11 invoice states, or null where it states none */
|
|
52
|
+
export declare const invoiceAmountMsat: (pr: string) => number | null
|
|
53
|
+
|
|
54
|
+
/** what a gross mint of `gross` msat leaves once `fee` is withheld */
|
|
55
|
+
export declare const applyMintFee: (gross: number, fee: MintFee | null) => number
|
|
56
|
+
|
|
57
|
+
/** the `Mint fees: base,ppm` line out of a payRequest's metadata array */
|
|
58
|
+
export declare const parseAdvertisedMintFee: (metadata: string) => MintFee | null
|
|
59
|
+
|
|
60
|
+
/** the read-only mint checks: payRequest, withdrawLink, fees, verify, extensions */
|
|
61
|
+
export declare const gradeMint: (payUrl: string, report: Report) => Promise<void>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Read-only. Needs a freshly minted, never-rotated note and what its mint
|
|
65
|
+
* invoice was paid at, and grades the note's value against the advertised
|
|
66
|
+
* fee.
|
|
67
|
+
*/
|
|
68
|
+
export declare const gradeMintedValue: (
|
|
69
|
+
noteUrl: string,
|
|
70
|
+
report: Report,
|
|
71
|
+
options: {paidMsat: number; mintFee?: MintFee | null}
|
|
72
|
+
) => Promise<void>
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Read-only. Needs a note minted against a hash the WALLET chose, plus the
|
|
76
|
+
* payment preimage of the invoice that funded it. Checks that the note is
|
|
77
|
+
* at the wallet's own secret and that the preimage opens nothing.
|
|
78
|
+
*
|
|
79
|
+
* `payCallback` is optional: with it, the runner also checks that the id
|
|
80
|
+
* the note occupies cannot be sold again as a mint quote.
|
|
81
|
+
*/
|
|
82
|
+
export declare const gradeBoundMint: (
|
|
83
|
+
noteUrl: string,
|
|
84
|
+
report: Report,
|
|
85
|
+
options: {preimage: string; payCallback?: string | null}
|
|
86
|
+
) => Promise<void>
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* SPENDS. Burns the note it is given and leaves the value in a fresh one.
|
|
90
|
+
*
|
|
91
|
+
* `mintFee` absent means unknown, and the conservation checks are bounded
|
|
92
|
+
* rather than exact; null means known fee-free. `previousPubkeys` are keys
|
|
93
|
+
* the mint has signed under before, so a note issued before a rotation is
|
|
94
|
+
* not graded as a bad signature.
|
|
95
|
+
*/
|
|
96
|
+
export declare const gradeNote: (
|
|
97
|
+
noteUrl: string,
|
|
98
|
+
report: Report,
|
|
99
|
+
options?: {mintFee?: MintFee | null; previousPubkeys?: string[]}
|
|
100
|
+
) => Promise<void>
|