@arkade-os/lnurl-client 0.0.0-stage → 0.7.0
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/README.md +499 -3
- package/dist/addresses-CPAzIbJ_.d.ts +514 -0
- package/dist/arkade.d.ts +333 -0
- package/dist/arkade.js +558 -0
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +60 -0
- package/dist/chunk-4ELYU6DY.js +1417 -0
- package/dist/chunk-H7W5RHP2.js +58 -0
- package/dist/hd.d.ts +16 -0
- package/dist/hd.js +389 -0
- package/dist/index.d.ts +796 -0
- package/dist/index.js +86 -0
- package/package.json +59 -6
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `fetch` implementation this client calls.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately structural rather than `typeof globalThis.fetch`: an
|
|
5
|
+
* implementation whose signature differs slightly — notably `expo/fetch`,
|
|
6
|
+
* which React Native needs for a readable `response.body` — is then
|
|
7
|
+
* assignable without an `as unknown as` cast. Only string URLs are ever
|
|
8
|
+
* passed, so any `fetch` accepting something wider satisfies this.
|
|
9
|
+
*/
|
|
10
|
+
type FetchImpl = (input: string, init?: RequestInit) => Promise<Response>;
|
|
11
|
+
|
|
12
|
+
interface PaymentOption {
|
|
13
|
+
/** Rail identifier the callback expects back as `paymentOption`. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Rail family, e.g. `lightning` or `arkade`. */
|
|
16
|
+
type: string;
|
|
17
|
+
/** The rail as a CAIP-19 asset id; `id` is still what the callback takes back. */
|
|
18
|
+
caip19Id?: string;
|
|
19
|
+
/** Whether the rail can currently be selected. */
|
|
20
|
+
available?: boolean;
|
|
21
|
+
/** Whether callback answers on this rail carry a LUD-21 `verify` URL; absent means unknown. */
|
|
22
|
+
verifiable?: boolean;
|
|
23
|
+
/** Minimum sendable amount on this rail. */
|
|
24
|
+
minSendable?: number;
|
|
25
|
+
/** Maximum sendable amount on this rail. */
|
|
26
|
+
maxSendable?: number;
|
|
27
|
+
/** CAIP-19 id of the token a token option is paid in; its CAIP-2 namespace is `type`.
|
|
28
|
+
* Read token options through `tokenOptions`, which validates them. */
|
|
29
|
+
asset?: string;
|
|
30
|
+
/** The `units[]` code a token option is quoted in. */
|
|
31
|
+
unit?: string;
|
|
32
|
+
/** The third party the payer hands funds to on this option, e.g. "FixedFloat". */
|
|
33
|
+
provider?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A unit the receiver prices in on the lightning rail (fiat or asset alongside
|
|
37
|
+
* the native `sat`/`msat`). Quoting a non-native unit is what produces the
|
|
38
|
+
* `paymentQuote` echoed on the invoice result.
|
|
39
|
+
*/
|
|
40
|
+
interface Unit {
|
|
41
|
+
/** Unit code the callback expects back as `unit`, e.g. `USD`. */
|
|
42
|
+
code: string;
|
|
43
|
+
/** Decimal places amounts in this unit are expressed with. */
|
|
44
|
+
decimals: number;
|
|
45
|
+
/** Human-readable unit name. */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** Display symbol for the unit. */
|
|
48
|
+
symbol?: string;
|
|
49
|
+
/** Asset identifier backing the unit, for asset-denominated units. */
|
|
50
|
+
assetId?: string;
|
|
51
|
+
/** Smallest quotable amount, in the unit's smallest denomination (an integer string). */
|
|
52
|
+
minAmount?: string;
|
|
53
|
+
/** Largest quotable amount, in the unit's smallest denomination (an integer string). */
|
|
54
|
+
maxAmount?: string;
|
|
55
|
+
}
|
|
56
|
+
/** An amount in one of a payRequest's `units`: `amount` is in that unit's smallest denomination. */
|
|
57
|
+
interface UnitAmount {
|
|
58
|
+
unit: string;
|
|
59
|
+
amount: number;
|
|
60
|
+
}
|
|
61
|
+
/** What a payment was asked for in a unit, as recorded with it: `amount` in the
|
|
62
|
+
* unit's smallest denomination, `decimals` to read it ("500", 2 is 5.00). */
|
|
63
|
+
interface QuotedAmount {
|
|
64
|
+
amount: string;
|
|
65
|
+
unit: string;
|
|
66
|
+
decimals: number;
|
|
67
|
+
}
|
|
68
|
+
/** An amount paired with the unit it is denominated in. */
|
|
69
|
+
interface AmountObject {
|
|
70
|
+
/** Integer string in the smallest denomination of `unit` (cents for USD, millisats for `msat`). */
|
|
71
|
+
amount: string;
|
|
72
|
+
/** Unit code from `Unit.code`. */
|
|
73
|
+
unit: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The server's quote for a unit-converted payment: what was requested, what
|
|
77
|
+
* the payer pays, what the receiver gets, and the fee breakdown in between.
|
|
78
|
+
*/
|
|
79
|
+
interface PaymentQuote {
|
|
80
|
+
/** Quote identifier, when the server issues one. */
|
|
81
|
+
id?: string;
|
|
82
|
+
/** Expiry of the quote, when the server bounds it. */
|
|
83
|
+
expiresAt?: string;
|
|
84
|
+
/** Amount the payer asked to deliver. */
|
|
85
|
+
requested: AmountObject;
|
|
86
|
+
/** Amount the payer must actually pay. */
|
|
87
|
+
payment: AmountObject;
|
|
88
|
+
/** Amount the receiver will get after conversion. */
|
|
89
|
+
receive?: AmountObject;
|
|
90
|
+
/** Named fee legs making up the difference. */
|
|
91
|
+
fees?: {
|
|
92
|
+
name?: string;
|
|
93
|
+
amount: AmountObject;
|
|
94
|
+
}[];
|
|
95
|
+
}
|
|
96
|
+
/** An LUD-06 payRequest plus the `source` (URL and surface) it was fetched from. */
|
|
97
|
+
interface PayRequest {
|
|
98
|
+
/** LUD-06 tag; `resolve` rejects anything that is not a payRequest. */
|
|
99
|
+
tag: "payRequest";
|
|
100
|
+
/** Callback URL the invoice request is built against. */
|
|
101
|
+
callback: string;
|
|
102
|
+
/** Minimum sendable amount in millisats. */
|
|
103
|
+
minSendable: number;
|
|
104
|
+
/** Maximum sendable amount in millisats. */
|
|
105
|
+
maxSendable: number;
|
|
106
|
+
/** JSON-encoded LUD-06 metadata array. */
|
|
107
|
+
metadata: string;
|
|
108
|
+
/** Maximum comment length in characters, when the receiver accepts one. */
|
|
109
|
+
commentAllowed?: number;
|
|
110
|
+
paymentOptions?: PaymentOption[];
|
|
111
|
+
units?: Unit[];
|
|
112
|
+
/** Where this payRequest came from; drives the rail guards downstream. */
|
|
113
|
+
source: {
|
|
114
|
+
url: string;
|
|
115
|
+
surface: "address" | "session";
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Options for asking the callback for an invoice or payment destination: an
|
|
120
|
+
* amount in sats, or (lightning rail only) an amount in one of the payRequest's
|
|
121
|
+
* `units`, which the receiver quotes to millisats.
|
|
122
|
+
*/
|
|
123
|
+
type RequestInvoiceOptions = {
|
|
124
|
+
/** Optional payer comment, sent when the payRequest allows one. */
|
|
125
|
+
comment?: string;
|
|
126
|
+
paymentOption?: string;
|
|
127
|
+
} & ({
|
|
128
|
+
/** Amount to pay in sats; converted to millisats on the wire. */
|
|
129
|
+
amountSat: number;
|
|
130
|
+
unit?: undefined;
|
|
131
|
+
amount?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
/** A `units[]` code, e.g. `USD`. */
|
|
134
|
+
unit: string;
|
|
135
|
+
/** In the unit's smallest denomination: `500` is $5.00 in a 2-decimal USD. */
|
|
136
|
+
amount: number;
|
|
137
|
+
amountSat?: undefined;
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* What the callback answered: either a BOLT11 invoice to pay, or a
|
|
141
|
+
* destination to pay on a non-lightning rail (e.g. an Arkade address).
|
|
142
|
+
*/
|
|
143
|
+
type InvoiceResult = Bolt11Result | DestinationResult;
|
|
144
|
+
/**
|
|
145
|
+
* A BOLT11 invoice from the callback. `verify` is optional because the server
|
|
146
|
+
* omits it when the invoice's payment hash will not decode; `pollVerify`
|
|
147
|
+
* refuses a missing one instead of polling `undefined`.
|
|
148
|
+
*/
|
|
149
|
+
interface Bolt11Result {
|
|
150
|
+
/** Discriminant for the BOLT11 shape. */
|
|
151
|
+
kind: "bolt11";
|
|
152
|
+
/** The BOLT11 invoice to pay. */
|
|
153
|
+
pr: string;
|
|
154
|
+
/** Verify URL tracking settlement; absent when the server could not decode the payment hash. */
|
|
155
|
+
verify?: string;
|
|
156
|
+
/** LUD-XX verifyBatch: endpoint that batch-styles or streams settlement for a whole tracked set. */
|
|
157
|
+
verifyBatch?: string;
|
|
158
|
+
/** Rail the invoice was issued for, echoed back when one was selected. */
|
|
159
|
+
paymentOption?: string;
|
|
160
|
+
/** Quote for a unit-converted payment, when one was requested. */
|
|
161
|
+
paymentQuote?: PaymentQuote;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A non-BOLT11 destination from the callback: pay it on the selected rail and
|
|
165
|
+
* then track settlement through `verify`, exactly like the BOLT11 shape.
|
|
166
|
+
*/
|
|
167
|
+
interface DestinationResult {
|
|
168
|
+
/** Discriminant for the destination shape. */
|
|
169
|
+
kind: "destination";
|
|
170
|
+
/** The selected rail both sides settle on. */
|
|
171
|
+
paymentOption: string;
|
|
172
|
+
/** Where to pay on that rail, e.g. an Arkade address. */
|
|
173
|
+
paymentDestination?: string;
|
|
174
|
+
/** A memo the payment must carry. A wallet that cannot attach one must not pay. */
|
|
175
|
+
paymentDestinationTag?: string;
|
|
176
|
+
/** Wallet-executable instruction carrying the amount (BIP21, EIP-681, Solana Pay); none on Tron. */
|
|
177
|
+
paymentURI?: string;
|
|
178
|
+
/** What the payer actually pays on a rail priced in a token. Its `expiresAt` is the
|
|
179
|
+
* payer's deadline: a token answer carries no top-level `expiresAt`. */
|
|
180
|
+
paymentQuote?: PaymentQuote;
|
|
181
|
+
/** Unix seconds after which the server stops attributing payments to this destination. */
|
|
182
|
+
expiresAt?: number;
|
|
183
|
+
/** The third party the payer hands funds to, e.g. "FixedFloat". */
|
|
184
|
+
provider?: string;
|
|
185
|
+
/** Verify URL tracking settlement; absent under the same conditions as the BOLT11 shape. */
|
|
186
|
+
verify?: string;
|
|
187
|
+
/** LUD-XX verifyBatch: batch/stream endpoint covering a whole tracked set. */
|
|
188
|
+
verifyBatch?: string;
|
|
189
|
+
}
|
|
190
|
+
/** The settlement state `pollVerify` resolves with, in either rail shape. */
|
|
191
|
+
type VerifyStatus = Bolt11VerifyStatus | DestinationVerifyStatus;
|
|
192
|
+
/** Settlement state of a BOLT11 payment: `preimage` is null until settled. */
|
|
193
|
+
interface Bolt11VerifyStatus {
|
|
194
|
+
/** Discriminant for the BOLT11 shape. */
|
|
195
|
+
kind: "bolt11";
|
|
196
|
+
/** Whether the invoice has settled. */
|
|
197
|
+
settled: boolean;
|
|
198
|
+
/** Payment preimage once settled, null while pending. */
|
|
199
|
+
preimage: string | null;
|
|
200
|
+
/** The invoice this status belongs to. */
|
|
201
|
+
pr: string;
|
|
202
|
+
}
|
|
203
|
+
/** Settlement state of a destination-rail payment. */
|
|
204
|
+
interface DestinationVerifyStatus {
|
|
205
|
+
/** Discriminant for the destination shape. */
|
|
206
|
+
kind: "destination";
|
|
207
|
+
/** Whether the payment has settled. */
|
|
208
|
+
settled: boolean;
|
|
209
|
+
/** The rail both sides settled on. */
|
|
210
|
+
paymentOption: string;
|
|
211
|
+
/** Where the payment landed, when the server reports it. */
|
|
212
|
+
paymentDestination?: string;
|
|
213
|
+
/** Server-assigned payment reference, when the server reports one. */
|
|
214
|
+
paymentReference?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Tuning for `pollVerify`: how often to re-poll, how long to wait overall,
|
|
218
|
+
* what to report per poll, and how to abort early.
|
|
219
|
+
*/
|
|
220
|
+
interface PollVerifyOptions {
|
|
221
|
+
/** Milliseconds between polls; defaults to 1000. */
|
|
222
|
+
intervalMs?: number;
|
|
223
|
+
/** Overall deadline in milliseconds; defaults to 120000. */
|
|
224
|
+
timeoutMs?: number;
|
|
225
|
+
/** Called with every polled snapshot, including unsettled ones. */
|
|
226
|
+
onUpdate?: (s: VerifyStatus) => void;
|
|
227
|
+
/** Abort signal for caller-driven cancellation. */
|
|
228
|
+
signal?: AbortSignal;
|
|
229
|
+
/** The payment the verify URL was issued for — the callback's answer will do.
|
|
230
|
+
* An answer about any other payment then fails instead of resolving. */
|
|
231
|
+
expect?: VerifyExpectation;
|
|
232
|
+
}
|
|
233
|
+
/** The invoice, or the rail and destination, a verify answer must be about. */
|
|
234
|
+
type VerifyExpectation = Pick<Bolt11Result, "pr"> | Pick<DestinationResult, "paymentOption" | "paymentDestination">;
|
|
235
|
+
/**
|
|
236
|
+
* One page of address payment activity: what was paid to one address, who it
|
|
237
|
+
* belongs to, and where to resume. nextSince is inclusive, so a client
|
|
238
|
+
* re-fetching from it dedupes on paymentHash/verifyId.
|
|
239
|
+
*/
|
|
240
|
+
interface PaymentPage {
|
|
241
|
+
/** Where the payments were earned: domain, full address (null when nameless), and handle. */
|
|
242
|
+
source: {
|
|
243
|
+
domain: string;
|
|
244
|
+
lightningAddress: string | null;
|
|
245
|
+
handle: string;
|
|
246
|
+
};
|
|
247
|
+
/** Activity entries, least recently changed first. */
|
|
248
|
+
payments: PaymentActivity[];
|
|
249
|
+
/** The last row's updatedAt (createdAt on older servers), or the request's since when empty. */
|
|
250
|
+
nextSince: number;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* One payment to an address. The rail decides the shape: only the lightning
|
|
254
|
+
* rail carries a real payment hash, so the arkade rail is keyed by its
|
|
255
|
+
* verify id instead of overloading the hash field.
|
|
256
|
+
*/
|
|
257
|
+
type PaymentActivity = Bolt11Activity | DestinationActivity;
|
|
258
|
+
/**
|
|
259
|
+
* A lightning-rail payment to the address. paymentHash is a real BOLT11
|
|
260
|
+
* payment hash here.
|
|
261
|
+
*/
|
|
262
|
+
interface Bolt11Activity {
|
|
263
|
+
/** Discriminant for the BOLT11 shape. */
|
|
264
|
+
kind: "bolt11";
|
|
265
|
+
/** Real BOLT11 payment hash. */
|
|
266
|
+
paymentHash: string;
|
|
267
|
+
/** The BOLT11 invoice handed to the payer. */
|
|
268
|
+
pr: string;
|
|
269
|
+
/** Payment preimage once settled, null while pending. */
|
|
270
|
+
preimage: string | null;
|
|
271
|
+
/** RFQ id when this was an offline swap, null for relay invoices. */
|
|
272
|
+
swapId: string | null;
|
|
273
|
+
/** Arkade txid of the claim that paid the covenant out to the owner — a swap
|
|
274
|
+
* settles on a preimage, so this is the only txid their wallet holds. */
|
|
275
|
+
payoutReference: string | null;
|
|
276
|
+
/** Whether the payment has settled. */
|
|
277
|
+
settled: boolean;
|
|
278
|
+
/** Agreed amount in millisats, when recorded. */
|
|
279
|
+
amountMsat: number | null;
|
|
280
|
+
/** Creation timestamp in milliseconds. */
|
|
281
|
+
createdAt: number;
|
|
282
|
+
/** Settlement timestamp in milliseconds, null while pending. */
|
|
283
|
+
settledAt: number | null;
|
|
284
|
+
/** What the payer asked to pay in a LUD-XX unit; absent when they paid in sats. */
|
|
285
|
+
quote?: QuotedAmount;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* A destination-rail (e.g. arkade/covenant) payment to the address. The
|
|
289
|
+
* server's paymentHash field holds a random verify id on this rail, so it
|
|
290
|
+
* is exposed as verifyId and there is no paymentHash here at all.
|
|
291
|
+
*/
|
|
292
|
+
interface DestinationActivity {
|
|
293
|
+
/** Discriminant for the destination shape. */
|
|
294
|
+
kind: "destination";
|
|
295
|
+
/** Opaque verify id minted by the server; NOT a payment hash. */
|
|
296
|
+
verifyId: string;
|
|
297
|
+
/** The rail both sides settled on. */
|
|
298
|
+
paymentOption: string;
|
|
299
|
+
/** Where the payment landed, when the server reports it. */
|
|
300
|
+
paymentDestination: string | null;
|
|
301
|
+
/** Attribution key for per-payment covenant addresses. */
|
|
302
|
+
covenantScript: string | null;
|
|
303
|
+
/** Arkade txid once observed, null until then. */
|
|
304
|
+
paymentReference: string | null;
|
|
305
|
+
/** Arkade txid that credited the owner's own address — the payment itself on
|
|
306
|
+
* the static rail, the sweep on a covenant one. */
|
|
307
|
+
payoutReference: string | null;
|
|
308
|
+
/** Whether the payment has settled. */
|
|
309
|
+
settled: boolean;
|
|
310
|
+
/** Agreed amount in millisats, when recorded. */
|
|
311
|
+
amountMsat: number | null;
|
|
312
|
+
/** Creation timestamp in milliseconds. */
|
|
313
|
+
createdAt: number;
|
|
314
|
+
/** Settlement timestamp in milliseconds, null while pending. */
|
|
315
|
+
settledAt: number | null;
|
|
316
|
+
/** What the payer asked to pay in a LUD-XX unit; absent when they paid in sats. */
|
|
317
|
+
quote?: QuotedAmount;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
interface HdReceiveConfig {
|
|
321
|
+
version: 1;
|
|
322
|
+
descriptor: string;
|
|
323
|
+
serverPubKey: string;
|
|
324
|
+
hrp: "ark" | "tark";
|
|
325
|
+
exitDelay: {
|
|
326
|
+
type: "seconds" | "blocks";
|
|
327
|
+
value: number;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
interface HdReceiveAllocation {
|
|
331
|
+
id: number;
|
|
332
|
+
index: number;
|
|
333
|
+
descriptor: string;
|
|
334
|
+
arkadeAddress: string;
|
|
335
|
+
claimPublicKey: string;
|
|
336
|
+
hd: HdReceiveConfig;
|
|
337
|
+
createdAt: number;
|
|
338
|
+
}
|
|
339
|
+
interface HdReceiveAllocationPage {
|
|
340
|
+
allocations: HdReceiveAllocation[];
|
|
341
|
+
nextAfter: number;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* What registering a LUD-16 lightning address needs. `token` owns the
|
|
345
|
+
* address: the server derives the session id from it and keys ownership off
|
|
346
|
+
* that id, so the same token lists and revokes what it registered.
|
|
347
|
+
*/
|
|
348
|
+
interface RegisterAddressRequest {
|
|
349
|
+
/** Token owning the address; doubles as the Bearer credential. */
|
|
350
|
+
token: string;
|
|
351
|
+
/** Desired username; server-assigned when omitted. */
|
|
352
|
+
username?: string;
|
|
353
|
+
/** Claim code binding the registration, on domains that issue one. */
|
|
354
|
+
claimCode?: string;
|
|
355
|
+
/** Receiving domain; the server default when omitted. */
|
|
356
|
+
domain?: string;
|
|
357
|
+
/** Sent as `X-API-Key` on domains that require one. */
|
|
358
|
+
apiKey?: string;
|
|
359
|
+
/** Registers a nameless receiver instead; mutually exclusive with `username`/`claimCode`. */
|
|
360
|
+
nameless?: boolean;
|
|
361
|
+
}
|
|
362
|
+
/** A freshly registered LUD-16 lightning address and how to reach it. */
|
|
363
|
+
interface RegisteredAddress {
|
|
364
|
+
/** The `user@domain` address payers use; null for a nameless receiver. */
|
|
365
|
+
lightningAddress: string | null;
|
|
366
|
+
/** The bech32 LNURL encoding of the payRequest URL. */
|
|
367
|
+
lnurl: string;
|
|
368
|
+
/** Username part of the address; null for a nameless receiver. */
|
|
369
|
+
username: string | null;
|
|
370
|
+
/** The username, or the session id while nameless; changes on upgrade. */
|
|
371
|
+
handle: string;
|
|
372
|
+
/** Domain part of the address. */
|
|
373
|
+
domain: string;
|
|
374
|
+
/** Registration status reported by the server. */
|
|
375
|
+
status: string;
|
|
376
|
+
nameless: boolean;
|
|
377
|
+
sessionLnurl: string | null;
|
|
378
|
+
}
|
|
379
|
+
/** One address owned by a token, as listed by the server; same nullability as `RegisteredAddress`. */
|
|
380
|
+
interface AddressListEntry {
|
|
381
|
+
username: string | null;
|
|
382
|
+
/** Domain part of the address. */
|
|
383
|
+
domain: string;
|
|
384
|
+
/** Registration status reported by the server. */
|
|
385
|
+
status: string;
|
|
386
|
+
/** Creation timestamp reported by the server. */
|
|
387
|
+
createdAt: number;
|
|
388
|
+
lightningAddress: string | null;
|
|
389
|
+
/** The bech32 LNURL encoding of the payRequest URL. */
|
|
390
|
+
lnurl: string;
|
|
391
|
+
handle: string;
|
|
392
|
+
nameless: boolean;
|
|
393
|
+
/** Survives a later upgrade to a name. */
|
|
394
|
+
sessionLnurl: string | null;
|
|
395
|
+
}
|
|
396
|
+
/** What a domain allows, discoverable before calling any of its routes. */
|
|
397
|
+
interface DomainCapabilities {
|
|
398
|
+
domain: string;
|
|
399
|
+
allocationModes: string[];
|
|
400
|
+
usernameRules: {
|
|
401
|
+
minLen: number;
|
|
402
|
+
maxLen: number;
|
|
403
|
+
pattern: string;
|
|
404
|
+
};
|
|
405
|
+
requireApiKey: boolean;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* What binding an Arkade identity to an address needs. `claimPublicKey` must
|
|
409
|
+
* be a compressed 33-byte key and is checked locally; the Arkade address
|
|
410
|
+
* itself is NOT validated client-side because that would need the SDK, which
|
|
411
|
+
* is deliberately not a dependency.
|
|
412
|
+
*/
|
|
413
|
+
type RegisterArkadeIdentityRequest = {
|
|
414
|
+
/** Token owning the address; sent as the Bearer credential. */
|
|
415
|
+
token: string;
|
|
416
|
+
/** Handle of the already-registered address. */
|
|
417
|
+
handle: string;
|
|
418
|
+
domain?: string;
|
|
419
|
+
} & ({
|
|
420
|
+
/** Arkade address receiving offline payments; validated server-side. */
|
|
421
|
+
arkadeAddress: string;
|
|
422
|
+
/** Compressed 33-byte public key: `02`/`03` prefix plus 64 hex chars. */
|
|
423
|
+
claimPublicKey: string;
|
|
424
|
+
/** Boarding address the onchain rail pays; omit it to leave a registered one alone. */
|
|
425
|
+
boardingAddress?: string;
|
|
426
|
+
hd?: never;
|
|
427
|
+
} | {
|
|
428
|
+
hd: HdReceiveConfig;
|
|
429
|
+
arkadeAddress?: never;
|
|
430
|
+
claimPublicKey?: never;
|
|
431
|
+
boardingAddress?: never;
|
|
432
|
+
});
|
|
433
|
+
/**
|
|
434
|
+
* Registers a LUD-16 lightning address owned by `req.token`.
|
|
435
|
+
*
|
|
436
|
+
* @param baseUrl - Server root, e.g. `https://lnurl.example.com`.
|
|
437
|
+
* @param req - Token, optional username/claimCode/domain, and optional API key.
|
|
438
|
+
* @param fetchImpl - The injected `fetch` implementation to call.
|
|
439
|
+
* @returns The registered address and how to reach it.
|
|
440
|
+
*/
|
|
441
|
+
declare function registerAddress(baseUrl: string, req: RegisterAddressRequest, fetchImpl: FetchImpl): Promise<RegisteredAddress>;
|
|
442
|
+
/**
|
|
443
|
+
* Lists the LUD-16 addresses owned by a token.
|
|
444
|
+
*
|
|
445
|
+
* @param baseUrl - Server root, e.g. `https://lnurl.example.com`.
|
|
446
|
+
* @param token - Token whose addresses to list; sent as the Bearer credential.
|
|
447
|
+
* @param fetchImpl - The injected `fetch` implementation to call.
|
|
448
|
+
* @returns The addresses owned by the token.
|
|
449
|
+
*/
|
|
450
|
+
declare function listAddresses(baseUrl: string, token: string, fetchImpl: FetchImpl): Promise<AddressListEntry[]>;
|
|
451
|
+
/** Upgrades a nameless receiver in place to a named one; everything handed out while nameless keeps working. */
|
|
452
|
+
declare function upgradeAddress(baseUrl: string, req: {
|
|
453
|
+
token: string;
|
|
454
|
+
handle: string;
|
|
455
|
+
username?: string;
|
|
456
|
+
claimCode?: string;
|
|
457
|
+
domain?: string;
|
|
458
|
+
}, fetchImpl: FetchImpl): Promise<RegisteredAddress>;
|
|
459
|
+
declare function domainCapabilities(baseUrl: string, opts: {
|
|
460
|
+
domain?: string;
|
|
461
|
+
} | undefined, fetchImpl: FetchImpl): Promise<DomainCapabilities>;
|
|
462
|
+
/**
|
|
463
|
+
* Lists the payments made to one address owned by a token, oldest first.
|
|
464
|
+
*
|
|
465
|
+
* @param baseUrl - Server root, e.g. `https://lnurl.example.com`.
|
|
466
|
+
* @param token - Token owning the address; sent as the Bearer credential.
|
|
467
|
+
* @param handle - Handle of the address whose payments to list.
|
|
468
|
+
* @param opts - Optional domain, inclusive since cursor and page limit.
|
|
469
|
+
* @param fetchImpl - The injected `fetch` implementation to call.
|
|
470
|
+
* @returns The payment page with rail-discriminated activity entries.
|
|
471
|
+
*/
|
|
472
|
+
declare function listPayments(baseUrl: string, token: string, handle: string, opts: {
|
|
473
|
+
domain?: string;
|
|
474
|
+
since?: number;
|
|
475
|
+
limit?: number;
|
|
476
|
+
} | undefined, fetchImpl: FetchImpl): Promise<PaymentPage>;
|
|
477
|
+
/**
|
|
478
|
+
* Revokes one address owned by a token.
|
|
479
|
+
*
|
|
480
|
+
* @param baseUrl - Server root, e.g. `https://lnurl.example.com`.
|
|
481
|
+
* @param token - Token owning the address; sent as the Bearer credential.
|
|
482
|
+
* @param handle - Handle of the address to revoke.
|
|
483
|
+
* @param opts - Optional domain scoping the revocation.
|
|
484
|
+
* @param fetchImpl - The injected `fetch` implementation to call.
|
|
485
|
+
* @returns A promise settling when the server revokes the address.
|
|
486
|
+
*/
|
|
487
|
+
declare function revokeAddress(baseUrl: string, token: string, handle: string, opts: {
|
|
488
|
+
domain?: string;
|
|
489
|
+
} | undefined, fetchImpl: FetchImpl): Promise<void>;
|
|
490
|
+
/**
|
|
491
|
+
* Binds an Arkade identity to a registered address for offline receive.
|
|
492
|
+
*
|
|
493
|
+
* `claimPublicKey` must be a compressed 33-byte key and is rejected locally
|
|
494
|
+
* before any network call; the Arkade address itself is NOT validated
|
|
495
|
+
* client-side because that would need the SDK, which is deliberately not a
|
|
496
|
+
* dependency, so a malformed one fails server-side instead.
|
|
497
|
+
*
|
|
498
|
+
* `boardingAddress` is unvalidated for a stronger reason — it is a Bitcoin
|
|
499
|
+
* address on the operator's network, which this package cannot know — and
|
|
500
|
+
* omitting it sends no field, read server-side as "leave the onchain rail".
|
|
501
|
+
*
|
|
502
|
+
* @param baseUrl - Server root, e.g. `https://lnurl.example.com`.
|
|
503
|
+
* @param req - Token, handle, Arkade address, claim key, optional boarding address and domain.
|
|
504
|
+
* @param fetchImpl - The injected `fetch` implementation to call.
|
|
505
|
+
* @returns A promise settling when the server records the identity.
|
|
506
|
+
*/
|
|
507
|
+
declare function registerArkadeIdentity(baseUrl: string, req: RegisterArkadeIdentityRequest, fetchImpl: FetchImpl): Promise<void>;
|
|
508
|
+
declare function listHdAllocations(baseUrl: string, token: string, handle: string, opts: {
|
|
509
|
+
domain?: string;
|
|
510
|
+
after?: number;
|
|
511
|
+
limit?: number;
|
|
512
|
+
} | undefined, fetchImpl: FetchImpl): Promise<HdReceiveAllocationPage>;
|
|
513
|
+
|
|
514
|
+
export { type AddressListEntry as A, type Bolt11Activity as B, type DomainCapabilities as D, type FetchImpl as F, type HdReceiveAllocationPage as H, type InvoiceResult as I, type PayRequest as P, type QuotedAmount as Q, type RequestInvoiceOptions as R, type UnitAmount as U, type VerifyExpectation as V, type PaymentPage as a, type HdReceiveConfig as b, type HdReceiveAllocation as c, type PollVerifyOptions as d, type VerifyStatus as e, type DestinationResult as f, type RegisterAddressRequest as g, type RegisteredAddress as h, type RegisterArkadeIdentityRequest as i, type AmountObject as j, type Bolt11Result as k, type Bolt11VerifyStatus as l, type DestinationActivity as m, type DestinationVerifyStatus as n, type PaymentActivity as o, type PaymentOption as p, type PaymentQuote as q, type Unit as r, domainCapabilities as s, listAddresses as t, listHdAllocations as u, listPayments as v, registerAddress as w, registerArkadeIdentity as x, revokeAddress as y, upgradeAddress as z };
|