@breeztech/breez-sdk-spark 0.13.8-debug → 0.13.10-dev

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.
@@ -1,34 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Creates a default PostgreSQL storage configuration with sensible defaults.
5
- *
6
- * Default values (from pg.Pool):
7
- * - `maxPoolSize`: 10
8
- * - `createTimeoutSecs`: 0 (no timeout)
9
- * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
10
- */
11
- export function defaultPostgresStorageConfig(connection_string: string): PostgresStorageConfig;
12
- export function defaultConfig(network: Network): Config;
13
- export function connect(request: ConnectRequest): Promise<BreezSdk>;
14
- export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
15
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
16
- /**
17
- * Creates a default external signer from a mnemonic phrase.
18
- *
19
- * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
20
- */
21
- export function getSparkStatus(): Promise<SparkStatus>;
22
- export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
23
- /**
24
- * Entry point invoked by JavaScript in a worker.
25
- */
26
- export function task_worker_entry_point(ptr: number): void;
27
3
  /**
28
4
  * The `ReadableStreamType` enum.
29
5
  *
30
6
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
31
7
  */
8
+
32
9
  type ReadableStreamType = "bytes";
33
10
 
34
11
  /** Serialized tree node. Key fields used by store implementations: id, status, value. */
@@ -54,18 +31,18 @@ interface LeavesReservation {
54
31
  }
55
32
 
56
33
  type TargetAmounts =
57
- | { type: 'amountAndFee'; amountSats: number; feeSats: number | null }
58
- | { type: 'exactDenominations'; denominations: number[] };
34
+ | { type: 'amountAndFee'; amountSats: number; feeSats: number | null }
35
+ | { type: 'exactDenominations'; denominations: number[] };
59
36
 
60
37
  type ReserveResult =
61
- | { type: 'success'; reservation: LeavesReservation }
62
- | { type: 'insufficientFunds' }
63
- | { type: 'waitForPending'; needed: number; available: number; pending: number };
38
+ | { type: 'success'; reservation: LeavesReservation }
39
+ | { type: 'insufficientFunds' }
40
+ | { type: 'waitForPending'; needed: number; available: number; pending: number };
64
41
 
65
42
  export interface TreeStore {
66
43
  addLeaves: (leaves: TreeNode[]) => Promise<void>;
67
44
  getLeaves: () => Promise<Leaves>;
68
- getAvailableBalance: () => Promise<bigint | number>;
45
+ getAvailableBalance: () => Promise<bigint>;
69
46
  setLeaves: (leaves: TreeNode[], missingLeaves: TreeNode[], refreshStartedAtMs: number) => Promise<void>;
70
47
  cancelReservation: (id: string, leavesToKeep: TreeNode[]) => Promise<void>;
71
48
  finalizeReservation: (id: string, newLeaves: TreeNode[] | null) => Promise<void>;
@@ -74,28 +51,6 @@ export interface TreeStore {
74
51
  updateReservation: (reservationId: string, reservedLeaves: TreeNode[], changeLeaves: TreeNode[]) => Promise<LeavesReservation>;
75
52
  }
76
53
 
77
- /**
78
- * Configuration for PostgreSQL storage connection pool.
79
- */
80
- export interface PostgresStorageConfig {
81
- /**
82
- * PostgreSQL connection string (URI format).
83
- */
84
- connectionString: string;
85
- /**
86
- * Maximum number of connections in the pool.
87
- */
88
- maxPoolSize: number;
89
- /**
90
- * Timeout in seconds for establishing a new connection (0 = no timeout).
91
- */
92
- createTimeoutSecs: number;
93
- /**
94
- * Timeout in seconds before recycling an idle connection.
95
- */
96
- recycleTimeoutSecs: number;
97
- }
98
-
99
54
 
100
55
  interface WasmTokenMetadata {
101
56
  identifier: string;
@@ -142,13 +97,18 @@ interface WasmTokenOutputsReservation {
142
97
  tokenOutputs: WasmTokenOutputs;
143
98
  }
144
99
 
100
+ interface WasmTokenBalance {
101
+ metadata: WasmTokenMetadata;
102
+ balance: string;
103
+ }
104
+
145
105
  type WasmGetTokenOutputsFilter =
146
- | { type: 'identifier'; identifier: string }
147
- | { type: 'issuerPublicKey'; issuerPublicKey: string };
106
+ | { type: 'identifier'; identifier: string }
107
+ | { type: 'issuerPublicKey'; issuerPublicKey: string };
148
108
 
149
109
  type WasmReservationTarget =
150
- | { type: 'minTotalValue'; value: string }
151
- | { type: 'maxOutputCount'; value: number };
110
+ | { type: 'minTotalValue'; value: string }
111
+ | { type: 'maxOutputCount'; value: number };
152
112
 
153
113
  export interface TokenStore {
154
114
  setTokensOutputs: (tokenOutputs: WasmTokenOutputs[], refreshStartedAtMs: number) => Promise<void>;
@@ -157,39 +117,157 @@ export interface TokenStore {
157
117
  getTokenOutputs: (filter: WasmGetTokenOutputsFilter) => Promise<WasmTokenOutputsPerStatus>;
158
118
  insertTokenOutputs: (tokenOutputs: WasmTokenOutputs) => Promise<void>;
159
119
  reserveTokenOutputs: (
160
- tokenIdentifier: string,
161
- target: WasmReservationTarget,
162
- purpose: string,
163
- preferredOutputs: WasmTokenOutputWithPrevOut[] | null,
164
- selectionStrategy: string | null
120
+ tokenIdentifier: string,
121
+ target: WasmReservationTarget,
122
+ purpose: string,
123
+ preferredOutputs: WasmTokenOutputWithPrevOut[] | null,
124
+ selectionStrategy: string | null
165
125
  ) => Promise<WasmTokenOutputsReservation>;
166
126
  cancelReservation: (id: string) => Promise<void>;
167
127
  finalizeReservation: (id: string) => Promise<void>;
168
128
  now: () => Promise<number>;
169
129
  }
170
130
 
171
- export interface EventListener {
172
- onEvent: (e: SdkEvent) => void;
131
+ /**
132
+ * A wallet derived from a passkey.
133
+ */
134
+ export interface Wallet {
135
+ /**
136
+ * The derived seed.
137
+ */
138
+ seed: Seed;
139
+ /**
140
+ * The label used for derivation.
141
+ */
142
+ label: string;
173
143
  }
174
144
 
175
- export interface Logger {
176
- log: (l: LogEntry) => void;
145
+ /**
146
+ * Configuration for PostgreSQL storage connection pool.
147
+ */
148
+ export interface PostgresStorageConfig {
149
+ /**
150
+ * PostgreSQL connection string (URI format).
151
+ */
152
+ connectionString: string;
153
+ /**
154
+ * Maximum number of connections in the pool.
155
+ */
156
+ maxPoolSize: number;
157
+ /**
158
+ * Timeout in seconds for establishing a new connection (0 = no timeout).
159
+ */
160
+ createTimeoutSecs: number;
161
+ /**
162
+ * Timeout in seconds before recycling an idle connection.
163
+ */
164
+ recycleTimeoutSecs: number;
177
165
  }
178
166
 
179
- export interface RestClient {
180
- getRequest(url: string, headers?: Record<string, string>): Promise<RestResponse>;
181
- postRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
182
- deleteRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
167
+ /**
168
+ * Interface for passkey PRF (Pseudo-Random Function) operations.
169
+ *
170
+ * Implement this interface to provide passkey PRF functionality for seedless wallet restore.
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * class BrowserPasskeyPrfProvider implements PasskeyPrfProvider {
175
+ * async derivePrfSeed(salt: string): Promise<Uint8Array> {
176
+ * const credential = await navigator.credentials.get({
177
+ * publicKey: {
178
+ * challenge: new Uint8Array(32),
179
+ * rpId: window.location.hostname,
180
+ * allowCredentials: [], // or specific credential IDs
181
+ * extensions: {
182
+ * prf: { eval: { first: new TextEncoder().encode(salt) } }
183
+ * }
184
+ * }
185
+ * });
186
+ * const results = credential.getClientExtensionResults();
187
+ * return new Uint8Array(results.prf.results.first);
188
+ * }
189
+ *
190
+ * async isPrfAvailable(): Promise<boolean> {
191
+ * return window.PublicKeyCredential?.isUserVerifyingPlatformAuthenticatorAvailable?.() ?? false;
192
+ * }
193
+ * }
194
+ * ```
195
+ */
196
+ export interface PasskeyPrfProvider {
197
+ /**
198
+ * Derive a 32-byte seed from passkey PRF with the given salt.
199
+ *
200
+ * The platform authenticates the user via passkey and evaluates the PRF extension.
201
+ * The salt is used as input to the PRF to derive a deterministic output.
202
+ *
203
+ * @param salt - The salt string to use for PRF evaluation
204
+ * @returns A Promise resolving to the 32-byte PRF output
205
+ * @throws If authentication fails or PRF is not supported
206
+ */
207
+ derivePrfSeed(salt: string): Promise<Uint8Array>;
208
+
209
+ /**
210
+ * Check if a PRF-capable passkey is available on this device.
211
+ *
212
+ * This allows applications to gracefully degrade if passkey PRF is not supported.
213
+ *
214
+ * @returns A Promise resolving to true if PRF-capable passkey is available
215
+ */
216
+ isPrfAvailable(): Promise<boolean>;
183
217
  }
184
218
 
185
- export interface RestResponse {
186
- status: number;
187
- body: string;
219
+ /**
220
+ * Nostr relay configuration for passkey label operations.
221
+ *
222
+ * Used by `Passkey.listLabels` and `Passkey.storeLabel`.
223
+ */
224
+ export interface NostrRelayConfig {
225
+ /**
226
+ * Optional Breez API key for authenticated access to the Breez relay.
227
+ * When provided, the Breez relay is added and NIP-42 authentication is enabled.
228
+ */
229
+ breezApiKey?: string;
230
+ /**
231
+ * Connection timeout in seconds. Defaults to 30 when `None`.
232
+ */
233
+ timeoutSecs?: number;
188
234
  }
189
235
 
190
- export interface FiatService {
191
- fetchFiatCurrencies(): Promise<FiatCurrency[]>;
192
- fetchFiatRates(): Promise<Rate[]>;
236
+ export interface AddContactRequest {
237
+ name: string;
238
+ paymentIdentifier: string;
239
+ }
240
+
241
+ export interface AesSuccessActionData {
242
+ description: string;
243
+ ciphertext: string;
244
+ iv: string;
245
+ }
246
+
247
+ export interface AesSuccessActionDataDecrypted {
248
+ description: string;
249
+ plaintext: string;
250
+ }
251
+
252
+ export interface Bip21Details {
253
+ amountSat?: number;
254
+ assetId?: string;
255
+ uri: string;
256
+ extras: Bip21Extra[];
257
+ label?: string;
258
+ message?: string;
259
+ paymentMethods: InputType[];
260
+ }
261
+
262
+ export interface Bip21Extra {
263
+ key: string;
264
+ value: string;
265
+ }
266
+
267
+ export interface BitcoinAddressDetails {
268
+ address: string;
269
+ network: BitcoinNetwork;
270
+ source: PaymentRequestSource;
193
271
  }
194
272
 
195
273
  export interface BitcoinChainService {
@@ -200,209 +278,109 @@ export interface BitcoinChainService {
200
278
  recommendedFees(): Promise<RecommendedFees>;
201
279
  }
202
280
 
203
- export interface TxStatus {
204
- confirmed: boolean;
205
- blockHeight?: number;
206
- blockTime?: number;
281
+ export interface Bolt11Invoice {
282
+ bolt11: string;
283
+ source: PaymentRequestSource;
207
284
  }
208
285
 
209
- export type ChainApiType = "esplora" | "mempoolSpace";
286
+ export interface Bolt11InvoiceDetails {
287
+ amountMsat?: number;
288
+ description?: string;
289
+ descriptionHash?: string;
290
+ expiry: number;
291
+ invoice: Bolt11Invoice;
292
+ minFinalCltvExpiryDelta: number;
293
+ network: BitcoinNetwork;
294
+ payeePubkey: string;
295
+ paymentHash: string;
296
+ paymentSecret: string;
297
+ routingHints: Bolt11RouteHint[];
298
+ timestamp: number;
299
+ }
210
300
 
211
- export interface RecommendedFees {
212
- fastestFee: number;
213
- halfHourFee: number;
214
- hourFee: number;
215
- economyFee: number;
216
- minimumFee: number;
301
+ export interface Bolt11RouteHint {
302
+ hops: Bolt11RouteHintHop[];
217
303
  }
218
304
 
219
- export interface Utxo {
220
- txid: string;
221
- vout: number;
222
- value: number;
223
- status: TxStatus;
305
+ export interface Bolt11RouteHintHop {
306
+ srcNodeId: string;
307
+ shortChannelId: string;
308
+ feesBaseMsat: number;
309
+ feesProportionalMillionths: number;
310
+ cltvExpiryDelta: number;
311
+ htlcMinimumMsat?: number;
312
+ htlcMaximumMsat?: number;
224
313
  }
225
314
 
226
- export interface PaymentObserver {
227
- beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
315
+ export interface Bolt12Invoice {
316
+ invoice: string;
317
+ source: PaymentRequestSource;
228
318
  }
229
319
 
230
- export interface CurrencyInfo {
231
- name: string;
232
- fractionSize: number;
233
- spacing?: number;
234
- symbol?: Symbol;
235
- uniqSymbol?: Symbol;
236
- localizedName: LocalizedName[];
237
- localeOverrides: LocaleOverrides[];
320
+ export interface Bolt12InvoiceDetails {
321
+ amountMsat: number;
322
+ invoice: Bolt12Invoice;
238
323
  }
239
324
 
240
- export interface SignMessageRequest {
241
- message: string;
242
- compact: boolean;
243
- }
244
-
245
- export interface GetPaymentRequest {
246
- paymentId: string;
247
- }
248
-
249
- export interface PaymentMetadata {
250
- parentPaymentId?: string;
251
- lnurlPayInfo?: LnurlPayInfo;
252
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
253
- lnurlDescription?: string;
254
- conversionInfo?: ConversionInfo;
255
- conversionStatus?: ConversionStatus;
256
- }
257
-
258
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
259
-
260
- export interface AesSuccessActionDataDecrypted {
261
- description: string;
262
- plaintext: string;
263
- }
264
-
265
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
325
+ export interface Bolt12InvoiceRequestDetails {}
266
326
 
267
- export interface ConversionDetails {
268
- status: ConversionStatus;
269
- from?: ConversionStep;
270
- to?: ConversionStep;
327
+ export interface Bolt12Offer {
328
+ offer: string;
329
+ source: PaymentRequestSource;
271
330
  }
272
331
 
273
- export interface OutgoingChange {
274
- change: RecordChange;
275
- parent?: Record;
332
+ export interface Bolt12OfferBlindedPath {
333
+ blindedHops: string[];
276
334
  }
277
335
 
278
- export interface KeySetConfig {
279
- keySetType: KeySetType;
280
- useAddressIndex: boolean;
281
- accountNumber?: number;
336
+ export interface Bolt12OfferDetails {
337
+ absoluteExpiry?: number;
338
+ chains: string[];
339
+ description?: string;
340
+ issuer?: string;
341
+ minAmount?: Amount;
342
+ offer: Bolt12Offer;
343
+ paths: Bolt12OfferBlindedPath[];
344
+ signingPubkey?: string;
282
345
  }
283
346
 
284
- export interface LnurlInfo {
285
- url: string;
286
- bech32: string;
347
+ export interface BurnIssuerTokenRequest {
348
+ amount: bigint;
287
349
  }
288
350
 
289
- export interface RegisterWebhookRequest {
351
+ export interface BuyBitcoinResponse {
290
352
  url: string;
291
- secret: string;
292
- eventTypes: WebhookEventType[];
293
- }
294
-
295
- export interface PrepareLnurlPayResponse {
296
- amountSats: number;
297
- comment?: string;
298
- payRequest: LnurlPayRequestDetails;
299
- feeSats: number;
300
- invoiceDetails: Bolt11InvoiceDetails;
301
- successAction?: SuccessAction;
302
- conversionEstimate?: ConversionEstimate;
303
- feePolicy: FeePolicy;
304
- }
305
-
306
- export interface LightningAddressDetails {
307
- address: string;
308
- payRequest: LnurlPayRequestDetails;
309
- }
310
-
311
- export interface Payment {
312
- id: string;
313
- paymentType: PaymentType;
314
- status: PaymentStatus;
315
- amount: bigint;
316
- fees: bigint;
317
- timestamp: number;
318
- method: PaymentMethod;
319
- details?: PaymentDetails;
320
- conversionDetails?: ConversionDetails;
321
353
  }
322
354
 
323
- export interface RefundDepositRequest {
324
- txid: string;
325
- vout: number;
326
- destinationAddress: string;
327
- fee: Fee;
355
+ export interface CheckLightningAddressRequest {
356
+ username: string;
328
357
  }
329
358
 
330
- export interface SignMessageResponse {
359
+ export interface CheckMessageRequest {
360
+ message: string;
331
361
  pubkey: string;
332
362
  signature: string;
333
363
  }
334
364
 
335
- export interface ListPaymentsRequest {
336
- typeFilter?: PaymentType[];
337
- statusFilter?: PaymentStatus[];
338
- assetFilter?: AssetFilter;
339
- paymentDetailsFilter?: PaymentDetailsFilter[];
340
- fromTimestamp?: number;
341
- toTimestamp?: number;
342
- offset?: number;
343
- limit?: number;
344
- sortAscending?: boolean;
345
- }
346
-
347
- export interface Bolt11Invoice {
348
- bolt11: string;
349
- source: PaymentRequestSource;
350
- }
351
-
352
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
353
-
354
- export interface LightningAddressInfo {
355
- description: string;
356
- lightningAddress: string;
357
- lnurl: LnurlInfo;
358
- username: string;
359
- }
360
-
361
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
362
-
363
- export interface Bolt11RouteHint {
364
- hops: Bolt11RouteHintHop[];
365
- }
366
-
367
- export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
368
-
369
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
370
-
371
- export interface SendOnchainFeeQuote {
372
- id: string;
373
- expiresAt: number;
374
- speedFast: SendOnchainSpeedFeeQuote;
375
- speedMedium: SendOnchainSpeedFeeQuote;
376
- speedSlow: SendOnchainSpeedFeeQuote;
377
- }
378
-
379
- export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeeded" | "refunded";
380
-
381
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
382
-
383
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
384
-
385
- export interface Bip21Extra {
386
- key: string;
387
- value: string;
365
+ export interface CheckMessageResponse {
366
+ isValid: boolean;
388
367
  }
389
368
 
390
- export interface Credentials {
391
- username: string;
392
- password: string;
369
+ export interface ClaimDepositRequest {
370
+ txid: string;
371
+ vout: number;
372
+ maxFee?: MaxFee;
393
373
  }
394
374
 
395
- export interface FiatCurrency {
396
- id: string;
397
- info: CurrencyInfo;
375
+ export interface ClaimDepositResponse {
376
+ payment: Payment;
398
377
  }
399
378
 
400
- export interface LocalizedName {
401
- locale: string;
402
- name: string;
379
+ export interface ClaimHtlcPaymentRequest {
380
+ preimage: string;
403
381
  }
404
382
 
405
- export interface SendPaymentResponse {
383
+ export interface ClaimHtlcPaymentResponse {
406
384
  payment: Payment;
407
385
  }
408
386
 
@@ -430,319 +408,311 @@ export interface Config {
430
408
  sparkConfig?: SparkConfig;
431
409
  }
432
410
 
433
- export interface Bolt12OfferBlindedPath {
434
- blindedHops: string[];
411
+ export interface ConnectRequest {
412
+ config: Config;
413
+ seed: Seed;
414
+ storageDir: string;
435
415
  }
436
416
 
437
- export interface ListContactsRequest {
438
- offset?: number;
439
- limit?: number;
417
+ export interface Contact {
418
+ id: string;
419
+ name: string;
420
+ paymentIdentifier: string;
421
+ createdAt: number;
422
+ updatedAt: number;
440
423
  }
441
424
 
442
- export interface ReceivePaymentRequest {
443
- paymentMethod: ReceivePaymentMethod;
425
+ export interface ConversionDetails {
426
+ status: ConversionStatus;
427
+ from?: ConversionStep;
428
+ to?: ConversionStep;
444
429
  }
445
430
 
446
- export interface AesSuccessActionData {
447
- description: string;
448
- ciphertext: string;
449
- iv: string;
431
+ export interface ConversionEstimate {
432
+ options: ConversionOptions;
433
+ amountIn: bigint;
434
+ amountOut: bigint;
435
+ fee: bigint;
436
+ amountAdjustment?: AmountAdjustmentReason;
450
437
  }
451
438
 
452
- export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails);
453
-
454
- export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; redirectUrl?: string } | { type: "cashApp"; amountSats: number };
455
-
456
- export interface SetLnurlMetadataItem {
457
- paymentHash: string;
458
- senderComment?: string;
459
- nostrZapRequest?: string;
460
- nostrZapReceipt?: string;
439
+ export interface ConversionInfo {
440
+ poolId: string;
441
+ conversionId: string;
442
+ status: ConversionStatus;
443
+ fee?: string;
444
+ purpose?: ConversionPurpose;
445
+ amountAdjustment?: AmountAdjustmentReason;
461
446
  }
462
447
 
463
- export interface Rate {
464
- coin: string;
465
- value: number;
448
+ export interface ConversionOptions {
449
+ conversionType: ConversionType;
450
+ maxSlippageBps?: number;
451
+ completionTimeoutSecs?: number;
466
452
  }
467
453
 
468
- export interface GetTokensMetadataResponse {
469
- tokensMetadata: TokenMetadata[];
454
+ export interface ConversionStep {
455
+ paymentId: string;
456
+ amount: bigint;
457
+ fee: bigint;
458
+ method: PaymentMethod;
459
+ tokenMetadata?: TokenMetadata;
460
+ amountAdjustment?: AmountAdjustmentReason;
470
461
  }
471
462
 
472
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
473
-
474
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
475
-
476
- export interface GetInfoRequest {
477
- ensureSynced?: boolean;
463
+ export interface CreateIssuerTokenRequest {
464
+ name: string;
465
+ ticker: string;
466
+ decimals: number;
467
+ isFreezable: boolean;
468
+ maxSupply: bigint;
478
469
  }
479
470
 
480
- export interface UpdateContactRequest {
481
- id: string;
482
- name: string;
483
- paymentIdentifier: string;
471
+ export interface Credentials {
472
+ username: string;
473
+ password: string;
484
474
  }
485
475
 
486
- export interface TokenBalance {
487
- balance: bigint;
488
- tokenMetadata: TokenMetadata;
476
+ export interface CurrencyInfo {
477
+ name: string;
478
+ fractionSize: number;
479
+ spacing?: number;
480
+ symbol?: Symbol;
481
+ uniqSymbol?: Symbol;
482
+ localizedName: LocalizedName[];
483
+ localeOverrides: LocaleOverrides[];
489
484
  }
490
485
 
491
- export interface ReceivePaymentResponse {
492
- paymentRequest: string;
493
- fee: bigint;
486
+ export interface DepositInfo {
487
+ txid: string;
488
+ vout: number;
489
+ amountSats: number;
490
+ isMature: boolean;
491
+ refundTx?: string;
492
+ refundTxId?: string;
493
+ claimError?: DepositClaimError;
494
494
  }
495
495
 
496
- export interface LnurlPayInfo {
497
- lnAddress?: string;
498
- comment?: string;
499
- domain?: string;
500
- metadata?: string;
501
- processedSuccessAction?: SuccessActionProcessed;
502
- rawSuccessAction?: SuccessAction;
496
+ export interface EcdsaSignatureBytes {
497
+ bytes: number[];
503
498
  }
504
499
 
505
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
506
-
507
- export interface ClaimHtlcPaymentRequest {
508
- preimage: string;
500
+ export interface EventListener {
501
+ onEvent: (e: SdkEvent) => void;
509
502
  }
510
503
 
511
- export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
504
+ export interface ExternalAggregateFrostRequest {
505
+ message: number[];
506
+ statechainSignatures: IdentifierSignaturePair[];
507
+ statechainPublicKeys: IdentifierPublicKeyPair[];
508
+ verifyingKey: number[];
509
+ statechainCommitments: IdentifierCommitmentPair[];
510
+ selfCommitment: ExternalSigningCommitments;
511
+ publicKey: number[];
512
+ selfSignature: ExternalFrostSignatureShare;
513
+ adaptorPublicKey?: number[];
514
+ }
512
515
 
513
- export interface UrlSuccessActionData {
514
- description: string;
515
- url: string;
516
- matchesCallbackDomain: boolean;
516
+ export interface ExternalEncryptedSecret {
517
+ ciphertext: number[];
517
518
  }
518
519
 
519
- export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
520
+ export interface ExternalFrostCommitments {
521
+ hidingCommitment: number[];
522
+ bindingCommitment: number[];
523
+ noncesCiphertext: number[];
524
+ }
520
525
 
521
- export interface BitcoinAddressDetails {
522
- address: string;
523
- network: BitcoinNetwork;
524
- source: PaymentRequestSource;
526
+ export interface ExternalFrostSignature {
527
+ bytes: number[];
525
528
  }
526
529
 
527
- export interface FetchConversionLimitsResponse {
528
- minFromAmount?: bigint;
529
- minToAmount?: bigint;
530
+ export interface ExternalFrostSignatureShare {
531
+ bytes: number[];
530
532
  }
531
533
 
532
- export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
534
+ export interface ExternalIdentifier {
535
+ bytes: number[];
536
+ }
533
537
 
534
- export interface UnregisterWebhookRequest {
535
- webhookId: string;
538
+ export interface ExternalInputParser {
539
+ providerId: string;
540
+ inputRegex: string;
541
+ parserUrl: string;
536
542
  }
537
543
 
538
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
544
+ export interface ExternalScalar {
545
+ bytes: number[];
546
+ }
539
547
 
540
- export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
548
+ export interface ExternalSecretShare {
549
+ threshold: number;
550
+ index: ExternalScalar;
551
+ share: ExternalScalar;
552
+ }
541
553
 
542
- export interface UnversionedRecordChange {
543
- id: RecordId;
544
- schemaVersion: string;
545
- updatedFields: Map<string, string>;
554
+ export interface ExternalSignFrostRequest {
555
+ message: number[];
556
+ publicKey: number[];
557
+ secret: ExternalSecretSource;
558
+ verifyingKey: number[];
559
+ selfNonceCommitment: ExternalFrostCommitments;
560
+ statechainCommitments: IdentifierCommitmentPair[];
561
+ adaptorPublicKey?: number[];
546
562
  }
547
563
 
548
- export interface AddContactRequest {
549
- name: string;
550
- paymentIdentifier: string;
564
+ export interface ExternalSigner {
565
+ identityPublicKey(): PublicKeyBytes;
566
+ derivePublicKey(path: string): Promise<PublicKeyBytes>;
567
+ signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
568
+ signEcdsaRecoverable(message: MessageBytes, path: string): Promise<RecoverableEcdsaSignatureBytes>;
569
+ encryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
570
+ decryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
571
+ signHashSchnorr(hash: Uint8Array, path: string): Promise<SchnorrSignatureBytes>;
572
+ generateRandomSigningCommitment(): Promise<ExternalFrostCommitments>;
573
+ getPublicKeyForNode(id: ExternalTreeNodeId): Promise<PublicKeyBytes>;
574
+ generateRandomSecret(): Promise<ExternalEncryptedSecret>;
575
+ staticDepositSecretEncrypted(index: number): Promise<ExternalSecretSource>;
576
+ staticDepositSecret(index: number): Promise<SecretBytes>;
577
+ staticDepositSigningKey(index: number): Promise<PublicKeyBytes>;
578
+ subtractSecrets(signingKey: ExternalSecretSource, newSigningKey: ExternalSecretSource): Promise<ExternalSecretSource>;
579
+ splitSecretWithProofs(secret: ExternalSecretToSplit, threshold: number, numShares: number): Promise<ExternalVerifiableSecretShare[]>;
580
+ encryptPrivateKeyForReceiver(privateKey: ExternalEncryptedSecret, receiverPublicKey: PublicKeyBytes): Promise<Uint8Array>;
581
+ publicKeyFromSecret(privateKey: ExternalSecretSource): Promise<PublicKeyBytes>;
582
+ signFrost(request: ExternalSignFrostRequest): Promise<ExternalFrostSignatureShare>;
583
+ aggregateFrost(request: ExternalAggregateFrostRequest): Promise<ExternalFrostSignature>;
584
+ hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
551
585
  }
552
586
 
553
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
587
+ export interface ExternalSigningCommitments {
588
+ hiding: number[];
589
+ binding: number[];
590
+ }
554
591
 
555
- export interface Bolt11RouteHintHop {
556
- srcNodeId: string;
557
- shortChannelId: string;
558
- feesBaseMsat: number;
559
- feesProportionalMillionths: number;
560
- cltvExpiryDelta: number;
561
- htlcMinimumMsat?: number;
562
- htlcMaximumMsat?: number;
592
+ export interface ExternalTreeNodeId {
593
+ id: string;
563
594
  }
564
595
 
565
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
596
+ export interface ExternalVerifiableSecretShare {
597
+ secretShare: ExternalSecretShare;
598
+ proofs: number[][];
599
+ }
566
600
 
567
- export interface ClaimHtlcPaymentResponse {
568
- payment: Payment;
601
+ export interface FetchConversionLimitsRequest {
602
+ conversionType: ConversionType;
603
+ tokenIdentifier?: string;
569
604
  }
570
605
 
571
- export interface SparkStatus {
572
- status: ServiceStatus;
573
- lastUpdated: number;
606
+ export interface FetchConversionLimitsResponse {
607
+ minFromAmount?: bigint;
608
+ minToAmount?: bigint;
574
609
  }
575
610
 
576
- export interface ConnectRequest {
577
- config: Config;
578
- seed: Seed;
579
- storageDir: string;
611
+ export interface FiatCurrency {
612
+ id: string;
613
+ info: CurrencyInfo;
580
614
  }
581
615
 
582
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
616
+ export interface FiatService {
617
+ fetchFiatCurrencies(): Promise<FiatCurrency[]>;
618
+ fetchFiatRates(): Promise<Rate[]>;
619
+ }
583
620
 
584
- export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
621
+ export interface FreezeIssuerTokenRequest {
622
+ address: string;
623
+ }
585
624
 
586
- export interface LogEntry {
587
- line: string;
588
- level: string;
625
+ export interface FreezeIssuerTokenResponse {
626
+ impactedOutputIds: string[];
627
+ impactedTokenAmount: bigint;
589
628
  }
590
629
 
591
- export interface UserSettings {
592
- sparkPrivateModeEnabled: boolean;
593
- stableBalanceActiveLabel?: string;
630
+ export interface GetInfoRequest {
631
+ ensureSynced?: boolean;
594
632
  }
595
633
 
596
- export interface StableBalanceToken {
597
- label: string;
598
- tokenIdentifier: string;
634
+ export interface GetInfoResponse {
635
+ identityPubkey: string;
636
+ balanceSats: number;
637
+ tokenBalances: Map<string, TokenBalance>;
599
638
  }
600
639
 
601
- export interface OptimizationProgress {
602
- isRunning: boolean;
603
- currentRound: number;
604
- totalRounds: number;
640
+ export interface GetPaymentRequest {
641
+ paymentId: string;
605
642
  }
606
643
 
607
- export interface ListUnclaimedDepositsResponse {
608
- deposits: DepositInfo[];
644
+ export interface GetPaymentResponse {
645
+ payment: Payment;
609
646
  }
610
647
 
611
- export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "optimization"; optimizationEvent: OptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] };
648
+ export interface GetTokensMetadataRequest {
649
+ tokenIdentifiers: string[];
650
+ }
612
651
 
613
- export interface StableBalanceConfig {
614
- tokens: StableBalanceToken[];
615
- defaultActiveLabel?: string;
616
- thresholdSats?: number;
617
- maxSlippageBps?: number;
652
+ export interface GetTokensMetadataResponse {
653
+ tokensMetadata: TokenMetadata[];
618
654
  }
619
655
 
620
- export interface SilentPaymentAddressDetails {
621
- address: string;
622
- network: BitcoinNetwork;
623
- source: PaymentRequestSource;
656
+ export interface HashedMessageBytes {
657
+ bytes: number[];
624
658
  }
625
659
 
626
- export interface LnurlAuthRequestDetails {
627
- k1: string;
628
- action?: string;
629
- domain: string;
630
- url: string;
660
+ export interface IdentifierCommitmentPair {
661
+ identifier: ExternalIdentifier;
662
+ commitment: ExternalSigningCommitments;
631
663
  }
632
664
 
633
- export interface LnurlReceiveMetadata {
634
- nostrZapRequest?: string;
635
- nostrZapReceipt?: string;
636
- senderComment?: string;
665
+ export interface IdentifierPublicKeyPair {
666
+ identifier: ExternalIdentifier;
667
+ publicKey: number[];
637
668
  }
638
669
 
639
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
670
+ export interface IdentifierSignaturePair {
671
+ identifier: ExternalIdentifier;
672
+ signature: ExternalFrostSignatureShare;
673
+ }
640
674
 
641
- export interface ConversionInfo {
642
- poolId: string;
643
- conversionId: string;
644
- status: ConversionStatus;
645
- fee?: string;
646
- purpose?: ConversionPurpose;
647
- amountAdjustment?: AmountAdjustmentReason;
675
+ export interface IncomingChange {
676
+ newState: Record;
677
+ oldState?: Record;
648
678
  }
649
679
 
650
- export interface LnurlPayRequest {
651
- prepareResponse: PrepareLnurlPayResponse;
652
- idempotencyKey?: string;
680
+ export interface KeySetConfig {
681
+ keySetType: KeySetType;
682
+ useAddressIndex: boolean;
683
+ accountNumber?: number;
653
684
  }
654
685
 
655
- export interface Bolt11InvoiceDetails {
656
- amountMsat?: number;
657
- description?: string;
658
- descriptionHash?: string;
659
- expiry: number;
660
- invoice: Bolt11Invoice;
661
- minFinalCltvExpiryDelta: number;
662
- network: BitcoinNetwork;
663
- payeePubkey: string;
664
- paymentHash: string;
665
- paymentSecret: string;
666
- routingHints: Bolt11RouteHint[];
667
- timestamp: number;
686
+ export interface LightningAddressDetails {
687
+ address: string;
688
+ payRequest: LnurlPayRequestDetails;
668
689
  }
669
690
 
670
- export interface RefundDepositResponse {
671
- txId: string;
672
- txHex: string;
691
+ export interface LightningAddressInfo {
692
+ description: string;
693
+ lightningAddress: string;
694
+ lnurl: LnurlInfo;
695
+ username: string;
673
696
  }
674
697
 
675
- export interface Bolt12InvoiceDetails {
676
- amountMsat: number;
677
- invoice: Bolt12Invoice;
698
+ export interface ListContactsRequest {
699
+ offset?: number;
700
+ limit?: number;
678
701
  }
679
702
 
680
703
  export interface ListFiatCurrenciesResponse {
681
704
  currencies: FiatCurrency[];
682
705
  }
683
706
 
684
- export interface SparkInvoicePaymentDetails {
685
- description?: string;
686
- invoice: string;
687
- }
688
-
689
- export type PaymentType = "send" | "receive";
690
-
691
- export interface LnurlWithdrawInfo {
692
- withdrawUrl: string;
693
- }
694
-
695
- export interface FetchConversionLimitsRequest {
696
- conversionType: ConversionType;
697
- tokenIdentifier?: string;
698
- }
699
-
700
- export interface IncomingChange {
701
- newState: Record;
702
- oldState?: Record;
703
- }
704
-
705
- export interface LnurlPayRequestDetails {
706
- callback: string;
707
- minSendable: number;
708
- maxSendable: number;
709
- metadataStr: string;
710
- commentAllowed: number;
711
- domain: string;
712
- url: string;
713
- address?: string;
714
- allowsNostr?: boolean;
715
- nostrPubkey?: string;
716
- }
717
-
718
- export interface UpdateUserSettingsRequest {
719
- sparkPrivateModeEnabled?: boolean;
720
- stableBalanceActiveLabel?: StableBalanceActiveLabel;
721
- }
722
-
723
- export interface MessageSuccessActionData {
724
- message: string;
725
- }
726
-
727
- export interface ConversionStep {
728
- paymentId: string;
729
- amount: bigint;
730
- fee: bigint;
731
- method: PaymentMethod;
732
- tokenMetadata?: TokenMetadata;
733
- amountAdjustment?: AmountAdjustmentReason;
734
- }
735
-
736
- export interface SendOnchainSpeedFeeQuote {
737
- userFeeSat: number;
738
- l1BroadcastFeeSat: number;
707
+ export interface ListFiatRatesResponse {
708
+ rates: Rate[];
739
709
  }
740
710
 
741
- export interface StorageListPaymentsRequest {
711
+ export interface ListPaymentsRequest {
742
712
  typeFilter?: PaymentType[];
743
713
  statusFilter?: PaymentStatus[];
744
714
  assetFilter?: AssetFilter;
745
- paymentDetailsFilter?: StoragePaymentDetailsFilter[];
715
+ paymentDetailsFilter?: PaymentDetailsFilter[];
746
716
  fromTimestamp?: number;
747
717
  toTimestamp?: number;
748
718
  offset?: number;
@@ -750,74 +720,78 @@ export interface StorageListPaymentsRequest {
750
720
  sortAscending?: boolean;
751
721
  }
752
722
 
753
- export interface SparkHtlcDetails {
754
- paymentHash: string;
755
- preimage?: string;
756
- expiryTime: number;
757
- status: SparkHtlcStatus;
723
+ export interface ListPaymentsResponse {
724
+ payments: Payment[];
758
725
  }
759
726
 
760
- export interface Contact {
761
- id: string;
762
- name: string;
763
- paymentIdentifier: string;
764
- createdAt: number;
765
- updatedAt: number;
766
- }
727
+ export interface ListUnclaimedDepositsRequest {}
767
728
 
768
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
729
+ export interface ListUnclaimedDepositsResponse {
730
+ deposits: DepositInfo[];
731
+ }
769
732
 
770
- export interface BuyBitcoinResponse {
733
+ export interface LnurlAuthRequestDetails {
734
+ k1: string;
735
+ action?: string;
736
+ domain: string;
771
737
  url: string;
772
738
  }
773
739
 
774
- export interface SparkSigningOperator {
775
- id: number;
776
- identifier: string;
777
- address: string;
778
- identityPublicKey: string;
740
+ export interface LnurlErrorDetails {
741
+ reason: string;
779
742
  }
780
743
 
781
- export interface Bolt12OfferDetails {
782
- absoluteExpiry?: number;
783
- chains: string[];
784
- description?: string;
785
- issuer?: string;
786
- minAmount?: Amount;
787
- offer: Bolt12Offer;
788
- paths: Bolt12OfferBlindedPath[];
789
- signingPubkey?: string;
744
+ export interface LnurlInfo {
745
+ url: string;
746
+ bech32: string;
790
747
  }
791
748
 
792
- export interface GetInfoResponse {
793
- identityPubkey: string;
794
- balanceSats: number;
795
- tokenBalances: Map<string, TokenBalance>;
749
+ export interface LnurlPayInfo {
750
+ lnAddress?: string;
751
+ comment?: string;
752
+ domain?: string;
753
+ metadata?: string;
754
+ processedSuccessAction?: SuccessActionProcessed;
755
+ rawSuccessAction?: SuccessAction;
796
756
  }
797
757
 
798
- export interface SparkAddressDetails {
799
- address: string;
800
- identityPublicKey: string;
801
- network: BitcoinNetwork;
802
- source: PaymentRequestSource;
758
+ export interface LnurlPayRequest {
759
+ prepareResponse: PrepareLnurlPayResponse;
760
+ idempotencyKey?: string;
803
761
  }
804
762
 
805
- export interface LnurlWithdrawResponse {
806
- paymentRequest: string;
807
- payment?: Payment;
763
+ export interface LnurlPayRequestDetails {
764
+ callback: string;
765
+ minSendable: number;
766
+ maxSendable: number;
767
+ metadataStr: string;
768
+ commentAllowed: number;
769
+ domain: string;
770
+ url: string;
771
+ address?: string;
772
+ allowsNostr?: boolean;
773
+ nostrPubkey?: string;
808
774
  }
809
775
 
810
- export interface GetPaymentResponse {
776
+ export interface LnurlPayResponse {
811
777
  payment: Payment;
778
+ successAction?: SuccessActionProcessed;
812
779
  }
813
780
 
814
- export type FeePolicy = "feesExcluded" | "feesIncluded";
781
+ export interface LnurlReceiveMetadata {
782
+ nostrZapRequest?: string;
783
+ nostrZapReceipt?: string;
784
+ senderComment?: string;
785
+ }
815
786
 
816
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
787
+ export interface LnurlWithdrawInfo {
788
+ withdrawUrl: string;
789
+ }
817
790
 
818
- export interface Bolt12Offer {
819
- offer: string;
820
- source: PaymentRequestSource;
791
+ export interface LnurlWithdrawRequest {
792
+ amountSats: number;
793
+ withdrawRequest: LnurlWithdrawRequestDetails;
794
+ completionTimeoutSecs?: number;
821
795
  }
822
796
 
823
797
  export interface LnurlWithdrawRequestDetails {
@@ -828,137 +802,87 @@ export interface LnurlWithdrawRequestDetails {
828
802
  maxWithdrawable: number;
829
803
  }
830
804
 
831
- export interface PaymentRequestSource {
832
- bip21Uri?: string;
833
- bip353Address?: string;
805
+ export interface LnurlWithdrawResponse {
806
+ paymentRequest: string;
807
+ payment?: Payment;
834
808
  }
835
809
 
836
- export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
837
-
838
- export interface OptimizationConfig {
839
- autoEnabled: boolean;
840
- multiplicity: number;
810
+ export interface LocaleOverrides {
811
+ locale: string;
812
+ spacing?: number;
813
+ symbol: Symbol;
841
814
  }
842
815
 
843
- export interface ClaimDepositRequest {
844
- txid: string;
845
- vout: number;
846
- maxFee?: MaxFee;
816
+ export interface LocalizedName {
817
+ locale: string;
818
+ name: string;
847
819
  }
848
820
 
849
- export interface CheckMessageResponse {
850
- isValid: boolean;
821
+ export interface LogEntry {
822
+ line: string;
823
+ level: string;
851
824
  }
852
825
 
853
- export interface ListUnclaimedDepositsRequest {}
854
-
855
- export interface ClaimDepositResponse {
856
- payment: Payment;
826
+ export interface Logger {
827
+ log: (l: LogEntry) => void;
857
828
  }
858
829
 
859
- export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
860
-
861
- export interface LnurlErrorDetails {
862
- reason: string;
830
+ export interface MessageBytes {
831
+ bytes: number[];
863
832
  }
864
833
 
865
- export interface SparkSspConfig {
866
- baseUrl: string;
867
- identityPublicKey: string;
868
- schemaEndpoint?: string;
834
+ export interface MessageSuccessActionData {
835
+ message: string;
869
836
  }
870
837
 
871
- export type Network = "mainnet" | "regtest";
872
-
873
- export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
874
-
875
- export interface Symbol {
876
- grapheme?: string;
877
- template?: string;
878
- rtl?: boolean;
879
- position?: number;
838
+ export interface MintIssuerTokenRequest {
839
+ amount: bigint;
880
840
  }
881
841
 
882
- export interface CheckMessageRequest {
883
- message: string;
884
- pubkey: string;
885
- signature: string;
842
+ export interface OptimizationConfig {
843
+ autoEnabled: boolean;
844
+ multiplicity: number;
886
845
  }
887
846
 
888
- export interface RecordId {
889
- type: string;
890
- dataId: string;
847
+ export interface OptimizationProgress {
848
+ isRunning: boolean;
849
+ currentRound: number;
850
+ totalRounds: number;
891
851
  }
892
852
 
893
- export interface PrepareSendPaymentResponse {
894
- paymentMethod: SendPaymentMethod;
895
- amount: bigint;
896
- tokenIdentifier?: string;
897
- conversionEstimate?: ConversionEstimate;
898
- feePolicy: FeePolicy;
899
- }
900
-
901
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
902
-
903
- export interface CheckLightningAddressRequest {
904
- username: string;
905
- }
906
-
907
- export interface Bolt12Invoice {
908
- invoice: string;
909
- source: PaymentRequestSource;
910
- }
911
-
912
- export interface Bip21Details {
913
- amountSat?: number;
914
- assetId?: string;
915
- uri: string;
916
- extras: Bip21Extra[];
917
- label?: string;
918
- message?: string;
919
- paymentMethods: InputType[];
920
- }
921
-
922
- export interface LocaleOverrides {
923
- locale: string;
924
- spacing?: number;
925
- symbol: Symbol;
926
- }
927
-
928
- export interface DepositInfo {
929
- txid: string;
930
- vout: number;
931
- amountSats: number;
932
- isMature: boolean;
933
- refundTx?: string;
934
- refundTxId?: string;
935
- claimError?: DepositClaimError;
853
+ export interface OutgoingChange {
854
+ change: RecordChange;
855
+ parent?: Record;
936
856
  }
937
857
 
938
- export interface SendPaymentRequest {
939
- prepareResponse: PrepareSendPaymentResponse;
940
- options?: SendPaymentOptions;
941
- idempotencyKey?: string;
858
+ export interface Payment {
859
+ id: string;
860
+ paymentType: PaymentType;
861
+ status: PaymentStatus;
862
+ amount: bigint;
863
+ fees: bigint;
864
+ timestamp: number;
865
+ method: PaymentMethod;
866
+ details?: PaymentDetails;
867
+ conversionDetails?: ConversionDetails;
942
868
  }
943
869
 
944
- export interface Webhook {
945
- id: string;
946
- url: string;
947
- eventTypes: WebhookEventType[];
870
+ export interface PaymentMetadata {
871
+ parentPaymentId?: string;
872
+ lnurlPayInfo?: LnurlPayInfo;
873
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
874
+ lnurlDescription?: string;
875
+ conversionInfo?: ConversionInfo;
876
+ conversionStatus?: ConversionStatus;
948
877
  }
949
878
 
950
- export interface ListFiatRatesResponse {
951
- rates: Rate[];
879
+ export interface PaymentObserver {
880
+ beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
952
881
  }
953
882
 
954
- export interface TokenMetadata {
955
- identifier: string;
956
- issuerPublicKey: string;
957
- name: string;
958
- ticker: string;
959
- decimals: number;
960
- maxSupply: string;
961
- isFreezable: boolean;
883
+ export interface PaymentRequestSource {
884
+ bip21Uri?: string;
885
+ bip353Address?: string;
962
886
  }
963
887
 
964
888
  export interface PrepareLnurlPayRequest {
@@ -971,7 +895,32 @@ export interface PrepareLnurlPayRequest {
971
895
  feePolicy?: FeePolicy;
972
896
  }
973
897
 
974
- export interface SyncWalletRequest {}
898
+ export interface PrepareLnurlPayResponse {
899
+ amountSats: number;
900
+ comment?: string;
901
+ payRequest: LnurlPayRequestDetails;
902
+ feeSats: number;
903
+ invoiceDetails: Bolt11InvoiceDetails;
904
+ successAction?: SuccessAction;
905
+ conversionEstimate?: ConversionEstimate;
906
+ feePolicy: FeePolicy;
907
+ }
908
+
909
+ export interface PrepareSendPaymentRequest {
910
+ paymentRequest: string;
911
+ amount?: bigint;
912
+ tokenIdentifier?: string;
913
+ conversionOptions?: ConversionOptions;
914
+ feePolicy?: FeePolicy;
915
+ }
916
+
917
+ export interface PrepareSendPaymentResponse {
918
+ paymentMethod: SendPaymentMethod;
919
+ amount: bigint;
920
+ tokenIdentifier?: string;
921
+ conversionEstimate?: ConversionEstimate;
922
+ feePolicy: FeePolicy;
923
+ }
975
924
 
976
925
  export interface ProvisionalPayment {
977
926
  paymentId: string;
@@ -979,7 +928,38 @@ export interface ProvisionalPayment {
979
928
  details: ProvisionalPaymentDetails;
980
929
  }
981
930
 
982
- export interface SyncWalletResponse {}
931
+ export interface PublicKeyBytes {
932
+ bytes: number[];
933
+ }
934
+
935
+ export interface Rate {
936
+ coin: string;
937
+ value: number;
938
+ }
939
+
940
+ export interface ReceivePaymentRequest {
941
+ paymentMethod: ReceivePaymentMethod;
942
+ }
943
+
944
+ export interface ReceivePaymentResponse {
945
+ paymentRequest: string;
946
+ fee: bigint;
947
+ }
948
+
949
+ export interface RecommendedFees {
950
+ fastestFee: number;
951
+ halfHourFee: number;
952
+ hourFee: number;
953
+ economyFee: number;
954
+ minimumFee: number;
955
+ }
956
+
957
+ export interface Record {
958
+ id: RecordId;
959
+ revision: number;
960
+ schemaVersion: string;
961
+ data: Map<string, string>;
962
+ }
983
963
 
984
964
  export interface RecordChange {
985
965
  id: RecordId;
@@ -988,359 +968,179 @@ export interface RecordChange {
988
968
  localRevision: number;
989
969
  }
990
970
 
991
- export interface RegisterLightningAddressRequest {
992
- username: string;
993
- description?: string;
994
- }
995
-
996
- export type TokenTransactionType = "transfer" | "mint" | "burn";
997
-
998
- export interface SparkConfig {
999
- coordinatorIdentifier: string;
1000
- threshold: number;
1001
- signingOperators: SparkSigningOperator[];
1002
- sspConfig: SparkSspConfig;
1003
- expectedWithdrawBondSats: number;
1004
- expectedWithdrawRelativeBlockLocktime: number;
971
+ export interface RecordId {
972
+ type: string;
973
+ dataId: string;
1005
974
  }
1006
975
 
1007
- export interface LnurlPayResponse {
1008
- payment: Payment;
1009
- successAction?: SuccessActionProcessed;
976
+ export interface RecoverableEcdsaSignatureBytes {
977
+ bytes: number[];
1010
978
  }
1011
979
 
1012
- export interface PrepareSendPaymentRequest {
1013
- paymentRequest: string;
1014
- amount?: bigint;
1015
- tokenIdentifier?: string;
1016
- conversionOptions?: ConversionOptions;
1017
- feePolicy?: FeePolicy;
980
+ export interface RefundDepositRequest {
981
+ txid: string;
982
+ vout: number;
983
+ destinationAddress: string;
984
+ fee: Fee;
1018
985
  }
1019
986
 
1020
- export interface SparkHtlcOptions {
1021
- paymentHash: string;
1022
- expiryDurationSecs: number;
987
+ export interface RefundDepositResponse {
988
+ txId: string;
989
+ txHex: string;
1023
990
  }
1024
991
 
1025
- export interface SparkInvoiceDetails {
1026
- invoice: string;
1027
- identityPublicKey: string;
1028
- network: BitcoinNetwork;
1029
- amount?: string;
1030
- tokenIdentifier?: string;
1031
- expiryTime?: number;
992
+ export interface RegisterLightningAddressRequest {
993
+ username: string;
1032
994
  description?: string;
1033
- senderPublicKey?: string;
1034
995
  }
1035
996
 
1036
- export interface ExternalInputParser {
1037
- providerId: string;
1038
- inputRegex: string;
1039
- parserUrl: string;
997
+ export interface RegisterWebhookRequest {
998
+ url: string;
999
+ secret: string;
1000
+ eventTypes: WebhookEventType[];
1040
1001
  }
1041
1002
 
1042
- export interface ConversionOptions {
1043
- conversionType: ConversionType;
1044
- maxSlippageBps?: number;
1045
- completionTimeoutSecs?: number;
1003
+ export interface RegisterWebhookResponse {
1004
+ webhookId: string;
1046
1005
  }
1047
1006
 
1048
- export interface LnurlWithdrawRequest {
1049
- amountSats: number;
1050
- withdrawRequest: LnurlWithdrawRequestDetails;
1051
- completionTimeoutSecs?: number;
1007
+ export interface RestClient {
1008
+ getRequest(url: string, headers?: Record<string, string>): Promise<RestResponse>;
1009
+ postRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
1010
+ deleteRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
1052
1011
  }
1053
1012
 
1054
- export interface Bolt12InvoiceRequestDetails {}
1013
+ export interface RestResponse {
1014
+ status: number;
1015
+ body: string;
1016
+ }
1055
1017
 
1056
- export type AmountAdjustmentReason = "flooredToMinLimit" | "increasedToAvoidDust";
1018
+ export interface SchnorrSignatureBytes {
1019
+ bytes: number[];
1020
+ }
1057
1021
 
1058
- export interface ConversionEstimate {
1059
- options: ConversionOptions;
1060
- amountIn: bigint;
1061
- amountOut: bigint;
1062
- fee: bigint;
1063
- amountAdjustment?: AmountAdjustmentReason;
1022
+ export interface SecretBytes {
1023
+ bytes: number[];
1064
1024
  }
1065
1025
 
1066
- export interface Record {
1067
- id: RecordId;
1068
- revision: number;
1069
- schemaVersion: string;
1070
- data: Map<string, string>;
1026
+ export interface SendOnchainFeeQuote {
1027
+ id: string;
1028
+ expiresAt: number;
1029
+ speedFast: SendOnchainSpeedFeeQuote;
1030
+ speedMedium: SendOnchainSpeedFeeQuote;
1031
+ speedSlow: SendOnchainSpeedFeeQuote;
1071
1032
  }
1072
1033
 
1073
- export interface GetTokensMetadataRequest {
1074
- tokenIdentifiers: string[];
1034
+ export interface SendOnchainSpeedFeeQuote {
1035
+ userFeeSat: number;
1036
+ l1BroadcastFeeSat: number;
1075
1037
  }
1076
1038
 
1077
- export interface ListPaymentsResponse {
1078
- payments: Payment[];
1039
+ export interface SendPaymentRequest {
1040
+ prepareResponse: PrepareSendPaymentResponse;
1041
+ options?: SendPaymentOptions;
1042
+ idempotencyKey?: string;
1079
1043
  }
1080
1044
 
1081
- export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
1082
-
1083
- export type PaymentStatus = "completed" | "pending" | "failed";
1084
-
1085
- export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string };
1086
-
1087
- export interface RegisterWebhookResponse {
1088
- webhookId: string;
1089
- }
1090
-
1091
- /**
1092
- * Interface for passkey PRF (Pseudo-Random Function) operations.
1093
- *
1094
- * Implement this interface to provide passkey PRF functionality for seedless wallet restore.
1095
- *
1096
- * @example
1097
- * ```typescript
1098
- * class BrowserPasskeyPrfProvider implements PasskeyPrfProvider {
1099
- * async derivePrfSeed(salt: string): Promise<Uint8Array> {
1100
- * const credential = await navigator.credentials.get({
1101
- * publicKey: {
1102
- * challenge: new Uint8Array(32),
1103
- * rpId: window.location.hostname,
1104
- * allowCredentials: [], // or specific credential IDs
1105
- * extensions: {
1106
- * prf: { eval: { first: new TextEncoder().encode(salt) } }
1107
- * }
1108
- * }
1109
- * });
1110
- * const results = credential.getClientExtensionResults();
1111
- * return new Uint8Array(results.prf.results.first);
1112
- * }
1113
- *
1114
- * async isPrfAvailable(): Promise<boolean> {
1115
- * return window.PublicKeyCredential?.isUserVerifyingPlatformAuthenticatorAvailable?.() ?? false;
1116
- * }
1117
- * }
1118
- * ```
1119
- */
1120
- export interface PasskeyPrfProvider {
1121
- /**
1122
- * Derive a 32-byte seed from passkey PRF with the given salt.
1123
- *
1124
- * The platform authenticates the user via passkey and evaluates the PRF extension.
1125
- * The salt is used as input to the PRF to derive a deterministic output.
1126
- *
1127
- * @param salt - The salt string to use for PRF evaluation
1128
- * @returns A Promise resolving to the 32-byte PRF output
1129
- * @throws If authentication fails or PRF is not supported
1130
- */
1131
- derivePrfSeed(salt: string): Promise<Uint8Array>;
1132
-
1133
- /**
1134
- * Check if a PRF-capable passkey is available on this device.
1135
- *
1136
- * This allows applications to gracefully degrade if passkey PRF is not supported.
1137
- *
1138
- * @returns A Promise resolving to true if PRF-capable passkey is available
1139
- */
1140
- isPrfAvailable(): Promise<boolean>;
1045
+ export interface SendPaymentResponse {
1046
+ payment: Payment;
1141
1047
  }
1142
1048
 
1143
- export interface MintIssuerTokenRequest {
1144
- amount: bigint;
1049
+ export interface SetLnurlMetadataItem {
1050
+ paymentHash: string;
1051
+ senderComment?: string;
1052
+ nostrZapRequest?: string;
1053
+ nostrZapReceipt?: string;
1145
1054
  }
1146
1055
 
1147
- export interface UnfreezeIssuerTokenResponse {
1148
- impactedOutputIds: string[];
1149
- impactedTokenAmount: bigint;
1056
+ export interface SignMessageRequest {
1057
+ message: string;
1058
+ compact: boolean;
1150
1059
  }
1151
1060
 
1152
- export interface CreateIssuerTokenRequest {
1153
- name: string;
1154
- ticker: string;
1155
- decimals: number;
1156
- isFreezable: boolean;
1157
- maxSupply: bigint;
1061
+ export interface SignMessageResponse {
1062
+ pubkey: string;
1063
+ signature: string;
1158
1064
  }
1159
1065
 
1160
- export interface FreezeIssuerTokenRequest {
1066
+ export interface SilentPaymentAddressDetails {
1161
1067
  address: string;
1068
+ network: BitcoinNetwork;
1069
+ source: PaymentRequestSource;
1162
1070
  }
1163
1071
 
1164
- export interface FreezeIssuerTokenResponse {
1165
- impactedOutputIds: string[];
1166
- impactedTokenAmount: bigint;
1167
- }
1168
-
1169
- export interface BurnIssuerTokenRequest {
1170
- amount: bigint;
1171
- }
1172
-
1173
- export interface UnfreezeIssuerTokenRequest {
1072
+ export interface SparkAddressDetails {
1174
1073
  address: string;
1074
+ identityPublicKey: string;
1075
+ network: BitcoinNetwork;
1076
+ source: PaymentRequestSource;
1175
1077
  }
1176
1078
 
1177
- export interface ExternalSigner {
1178
- identityPublicKey(): PublicKeyBytes;
1179
- derivePublicKey(path: string): Promise<PublicKeyBytes>;
1180
- signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
1181
- signEcdsaRecoverable(message: MessageBytes, path: string): Promise<RecoverableEcdsaSignatureBytes>;
1182
- encryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1183
- decryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1184
- signHashSchnorr(hash: Uint8Array, path: string): Promise<SchnorrSignatureBytes>;
1185
- generateRandomSigningCommitment(): Promise<ExternalFrostCommitments>;
1186
- getPublicKeyForNode(id: ExternalTreeNodeId): Promise<PublicKeyBytes>;
1187
- generateRandomSecret(): Promise<ExternalEncryptedSecret>;
1188
- staticDepositSecretEncrypted(index: number): Promise<ExternalSecretSource>;
1189
- staticDepositSecret(index: number): Promise<SecretBytes>;
1190
- staticDepositSigningKey(index: number): Promise<PublicKeyBytes>;
1191
- subtractSecrets(signingKey: ExternalSecretSource, newSigningKey: ExternalSecretSource): Promise<ExternalSecretSource>;
1192
- splitSecretWithProofs(secret: ExternalSecretToSplit, threshold: number, numShares: number): Promise<ExternalVerifiableSecretShare[]>;
1193
- encryptPrivateKeyForReceiver(privateKey: ExternalEncryptedSecret, receiverPublicKey: PublicKeyBytes): Promise<Uint8Array>;
1194
- publicKeyFromSecret(privateKey: ExternalSecretSource): Promise<PublicKeyBytes>;
1195
- signFrost(request: ExternalSignFrostRequest): Promise<ExternalFrostSignatureShare>;
1196
- aggregateFrost(request: ExternalAggregateFrostRequest): Promise<ExternalFrostSignature>;
1197
- hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
1198
- }
1199
-
1200
- export interface ExternalScalar {
1201
- bytes: number[];
1202
- }
1203
-
1204
- export interface RecoverableEcdsaSignatureBytes {
1205
- bytes: number[];
1206
- }
1207
-
1208
- export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
1209
-
1210
- export interface PublicKeyBytes {
1211
- bytes: number[];
1212
- }
1213
-
1214
- export interface IdentifierCommitmentPair {
1215
- identifier: ExternalIdentifier;
1216
- commitment: ExternalSigningCommitments;
1217
- }
1218
-
1219
- export interface ExternalSigningCommitments {
1220
- hiding: number[];
1221
- binding: number[];
1222
- }
1223
-
1224
- export interface ExternalTreeNodeId {
1225
- id: string;
1226
- }
1227
-
1228
- export interface IdentifierSignaturePair {
1229
- identifier: ExternalIdentifier;
1230
- signature: ExternalFrostSignatureShare;
1231
- }
1232
-
1233
- export interface ExternalEncryptedSecret {
1234
- ciphertext: number[];
1235
- }
1236
-
1237
- export interface MessageBytes {
1238
- bytes: number[];
1239
- }
1240
-
1241
- export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1242
-
1243
- export interface ExternalFrostSignature {
1244
- bytes: number[];
1245
- }
1246
-
1247
- export interface EcdsaSignatureBytes {
1248
- bytes: number[];
1249
- }
1250
-
1251
- export interface ExternalAggregateFrostRequest {
1252
- message: number[];
1253
- statechainSignatures: IdentifierSignaturePair[];
1254
- statechainPublicKeys: IdentifierPublicKeyPair[];
1255
- verifyingKey: number[];
1256
- statechainCommitments: IdentifierCommitmentPair[];
1257
- selfCommitment: ExternalSigningCommitments;
1258
- publicKey: number[];
1259
- selfSignature: ExternalFrostSignatureShare;
1260
- adaptorPublicKey?: number[];
1261
- }
1262
-
1263
- export interface ExternalSignFrostRequest {
1264
- message: number[];
1265
- publicKey: number[];
1266
- secret: ExternalSecretSource;
1267
- verifyingKey: number[];
1268
- selfNonceCommitment: ExternalFrostCommitments;
1269
- statechainCommitments: IdentifierCommitmentPair[];
1270
- adaptorPublicKey?: number[];
1271
- }
1272
-
1273
- export interface ExternalFrostCommitments {
1274
- hidingCommitment: number[];
1275
- bindingCommitment: number[];
1276
- noncesCiphertext: number[];
1277
- }
1278
-
1279
- export interface ExternalVerifiableSecretShare {
1280
- secretShare: ExternalSecretShare;
1281
- proofs: number[][];
1079
+ export interface SparkConfig {
1080
+ coordinatorIdentifier: string;
1081
+ threshold: number;
1082
+ signingOperators: SparkSigningOperator[];
1083
+ sspConfig: SparkSspConfig;
1084
+ expectedWithdrawBondSats: number;
1085
+ expectedWithdrawRelativeBlockLocktime: number;
1282
1086
  }
1283
1087
 
1284
- export interface ExternalIdentifier {
1285
- bytes: number[];
1088
+ export interface SparkHtlcDetails {
1089
+ paymentHash: string;
1090
+ preimage?: string;
1091
+ expiryTime: number;
1092
+ status: SparkHtlcStatus;
1286
1093
  }
1287
1094
 
1288
- export interface HashedMessageBytes {
1289
- bytes: number[];
1095
+ export interface SparkHtlcOptions {
1096
+ paymentHash: string;
1097
+ expiryDurationSecs: number;
1290
1098
  }
1291
1099
 
1292
- export interface ExternalSecretShare {
1293
- threshold: number;
1294
- index: ExternalScalar;
1295
- share: ExternalScalar;
1100
+ export interface SparkInvoiceDetails {
1101
+ invoice: string;
1102
+ identityPublicKey: string;
1103
+ network: BitcoinNetwork;
1104
+ amount?: string;
1105
+ tokenIdentifier?: string;
1106
+ expiryTime?: number;
1107
+ description?: string;
1108
+ senderPublicKey?: string;
1296
1109
  }
1297
1110
 
1298
- export interface SecretBytes {
1299
- bytes: number[];
1111
+ export interface SparkInvoicePaymentDetails {
1112
+ description?: string;
1113
+ invoice: string;
1300
1114
  }
1301
1115
 
1302
- export interface ExternalFrostSignatureShare {
1303
- bytes: number[];
1116
+ export interface SparkSigningOperator {
1117
+ id: number;
1118
+ identifier: string;
1119
+ address: string;
1120
+ identityPublicKey: string;
1304
1121
  }
1305
1122
 
1306
- export interface IdentifierPublicKeyPair {
1307
- identifier: ExternalIdentifier;
1308
- publicKey: number[];
1123
+ export interface SparkSspConfig {
1124
+ baseUrl: string;
1125
+ identityPublicKey: string;
1126
+ schemaEndpoint?: string;
1309
1127
  }
1310
1128
 
1311
- export interface SchnorrSignatureBytes {
1312
- bytes: number[];
1129
+ export interface SparkStatus {
1130
+ status: ServiceStatus;
1131
+ lastUpdated: number;
1313
1132
  }
1314
1133
 
1315
- /**
1316
- * A wallet derived from a passkey.
1317
- */
1318
- export interface Wallet {
1319
- /**
1320
- * The derived seed.
1321
- */
1322
- seed: Seed;
1323
- /**
1324
- * The label used for derivation.
1325
- */
1326
- label: string;
1134
+ export interface StableBalanceConfig {
1135
+ tokens: StableBalanceToken[];
1136
+ defaultActiveLabel?: string;
1137
+ thresholdSats?: number;
1138
+ maxSlippageBps?: number;
1327
1139
  }
1328
1140
 
1329
- /**
1330
- * Nostr relay configuration for passkey label operations.
1331
- *
1332
- * Used by `Passkey.listLabels` and `Passkey.storeLabel`.
1333
- */
1334
- export interface NostrRelayConfig {
1335
- /**
1336
- * Optional Breez API key for authenticated access to the Breez relay.
1337
- * When provided, the Breez relay is added and NIP-42 authentication is enabled.
1338
- */
1339
- breezApiKey?: string;
1340
- /**
1341
- * Connection timeout in seconds. Defaults to 30 when `None`.
1342
- */
1343
- timeoutSecs?: number;
1141
+ export interface StableBalanceToken {
1142
+ label: string;
1143
+ tokenIdentifier: string;
1344
1144
  }
1345
1145
 
1346
1146
  export interface Storage {
@@ -1373,104 +1173,297 @@ export interface Storage {
1373
1173
  syncUpdateRecordFromIncoming: (record: Record) => Promise<void>;
1374
1174
  }
1375
1175
 
1176
+ export interface StorageListPaymentsRequest {
1177
+ typeFilter?: PaymentType[];
1178
+ statusFilter?: PaymentStatus[];
1179
+ assetFilter?: AssetFilter;
1180
+ paymentDetailsFilter?: StoragePaymentDetailsFilter[];
1181
+ fromTimestamp?: number;
1182
+ toTimestamp?: number;
1183
+ offset?: number;
1184
+ limit?: number;
1185
+ sortAscending?: boolean;
1186
+ }
1187
+
1188
+ export interface Symbol {
1189
+ grapheme?: string;
1190
+ template?: string;
1191
+ rtl?: boolean;
1192
+ position?: number;
1193
+ }
1194
+
1195
+ export interface SyncWalletRequest {}
1196
+
1197
+ export interface SyncWalletResponse {}
1198
+
1199
+ export interface TokenBalance {
1200
+ balance: bigint;
1201
+ tokenMetadata: TokenMetadata;
1202
+ }
1203
+
1204
+ export interface TokenMetadata {
1205
+ identifier: string;
1206
+ issuerPublicKey: string;
1207
+ name: string;
1208
+ ticker: string;
1209
+ decimals: number;
1210
+ maxSupply: string;
1211
+ isFreezable: boolean;
1212
+ }
1213
+
1214
+ export interface TxStatus {
1215
+ confirmed: boolean;
1216
+ blockHeight?: number;
1217
+ blockTime?: number;
1218
+ }
1219
+
1220
+ export interface UnfreezeIssuerTokenRequest {
1221
+ address: string;
1222
+ }
1223
+
1224
+ export interface UnfreezeIssuerTokenResponse {
1225
+ impactedOutputIds: string[];
1226
+ impactedTokenAmount: bigint;
1227
+ }
1228
+
1229
+ export interface UnregisterWebhookRequest {
1230
+ webhookId: string;
1231
+ }
1232
+
1233
+ export interface UnversionedRecordChange {
1234
+ id: RecordId;
1235
+ schemaVersion: string;
1236
+ updatedFields: Map<string, string>;
1237
+ }
1238
+
1239
+ export interface UpdateContactRequest {
1240
+ id: string;
1241
+ name: string;
1242
+ paymentIdentifier: string;
1243
+ }
1244
+
1245
+ export interface UpdateUserSettingsRequest {
1246
+ sparkPrivateModeEnabled?: boolean;
1247
+ stableBalanceActiveLabel?: StableBalanceActiveLabel;
1248
+ }
1249
+
1250
+ export interface UrlSuccessActionData {
1251
+ description: string;
1252
+ url: string;
1253
+ matchesCallbackDomain: boolean;
1254
+ }
1255
+
1256
+ export interface UserSettings {
1257
+ sparkPrivateModeEnabled: boolean;
1258
+ stableBalanceActiveLabel?: string;
1259
+ }
1260
+
1261
+ export interface Utxo {
1262
+ txid: string;
1263
+ vout: number;
1264
+ value: number;
1265
+ status: TxStatus;
1266
+ }
1267
+
1268
+ export interface Webhook {
1269
+ id: string;
1270
+ url: string;
1271
+ eventTypes: WebhookEventType[];
1272
+ }
1273
+
1274
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
1275
+
1276
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
1277
+
1278
+ export type AmountAdjustmentReason = "flooredToMinLimit" | "increasedToAvoidDust";
1279
+
1280
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
1281
+
1282
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
1283
+
1284
+ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; redirectUrl?: string } | { type: "cashApp"; amountSats: number };
1285
+
1286
+ export type ChainApiType = "esplora" | "mempoolSpace";
1287
+
1288
+ export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
1289
+
1290
+ export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeeded" | "refunded";
1291
+
1292
+ export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
1293
+
1294
+ export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
1295
+
1296
+ export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1297
+
1298
+ export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
1299
+
1300
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
1301
+
1302
+ export type FeePolicy = "feesExcluded" | "feesIncluded";
1303
+
1304
+ export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails);
1305
+
1306
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
1307
+
1308
+ export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
1309
+
1310
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
1311
+
1312
+ export type Network = "mainnet" | "regtest";
1313
+
1314
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
1315
+
1316
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
1317
+
1318
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
1319
+
1320
+ export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
1321
+
1322
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
1323
+
1324
+ export type PaymentStatus = "completed" | "pending" | "failed";
1325
+
1326
+ export type PaymentType = "send" | "receive";
1327
+
1328
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
1329
+
1330
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
1331
+
1332
+ export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "optimization"; optimizationEvent: OptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] };
1333
+
1334
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
1335
+
1336
+ export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string };
1337
+
1338
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
1339
+
1340
+ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
1341
+
1342
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
1343
+
1344
+ export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
1345
+
1346
+ export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
1347
+
1348
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
1349
+
1350
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
1351
+
1352
+ export type TokenTransactionType = "transfer" | "mint" | "burn";
1353
+
1354
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
1355
+
1356
+ export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
1357
+
1358
+
1376
1359
  export class BreezSdk {
1377
- private constructor();
1378
- free(): void;
1379
- disconnect(): Promise<void>;
1380
- lnurlAuth(request_data: LnurlAuthRequestDetails): Promise<LnurlCallbackStatus>;
1381
- addContact(request: AddContactRequest): Promise<Contact>;
1382
- buyBitcoin(request: BuyBitcoinRequest): Promise<BuyBitcoinResponse>;
1383
- getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
1384
- syncWallet(request: SyncWalletRequest): Promise<SyncWalletResponse>;
1385
- sendPayment(request: SendPaymentRequest): Promise<SendPaymentResponse>;
1386
- signMessage(request: SignMessageRequest): Promise<SignMessageResponse>;
1387
- checkMessage(request: CheckMessageRequest): Promise<CheckMessageResponse>;
1388
- claimDeposit(request: ClaimDepositRequest): Promise<ClaimDepositResponse>;
1389
- listContacts(request: ListContactsRequest): Promise<Contact[]>;
1390
- listPayments(request: ListPaymentsRequest): Promise<ListPaymentsResponse>;
1391
- listWebhooks(): Promise<Webhook[]>;
1392
- deleteContact(id: string): Promise<void>;
1393
- lnurlWithdraw(request: LnurlWithdrawRequest): Promise<LnurlWithdrawResponse>;
1394
- refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
1395
- updateContact(request: UpdateContactRequest): Promise<Contact>;
1396
- listFiatRates(): Promise<ListFiatRatesResponse>;
1397
- receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
1398
- getTokenIssuer(): TokenIssuer;
1399
- recommendedFees(): Promise<RecommendedFees>;
1400
- registerWebhook(request: RegisterWebhookRequest): Promise<RegisterWebhookResponse>;
1401
- getUserSettings(): Promise<UserSettings>;
1402
- prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
1403
- addEventListener(listener: EventListener): Promise<string>;
1404
- claimHtlcPayment(request: ClaimHtlcPaymentRequest): Promise<ClaimHtlcPaymentResponse>;
1405
- unregisterWebhook(request: UnregisterWebhookRequest): Promise<void>;
1406
- getTokensMetadata(request: GetTokensMetadataRequest): Promise<GetTokensMetadataResponse>;
1407
- listFiatCurrencies(): Promise<ListFiatCurrenciesResponse>;
1408
- prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
1409
- updateUserSettings(request: UpdateUserSettingsRequest): Promise<void>;
1410
- getLightningAddress(): Promise<LightningAddressInfo | undefined>;
1411
- removeEventListener(id: string): Promise<boolean>;
1412
- fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
1413
- listUnclaimedDeposits(request: ListUnclaimedDepositsRequest): Promise<ListUnclaimedDepositsResponse>;
1414
- startLeafOptimization(): Promise<void>;
1415
- cancelLeafOptimization(): Promise<void>;
1416
- deleteLightningAddress(): Promise<void>;
1417
- registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
1418
- getLeafOptimizationProgress(): OptimizationProgress;
1419
- checkLightningAddressAvailable(request: CheckLightningAddressRequest): Promise<boolean>;
1420
- parse(input: string): Promise<InputType>;
1421
- getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
1422
- lnurlPay(request: LnurlPayRequest): Promise<LnurlPayResponse>;
1360
+ private constructor();
1361
+ free(): void;
1362
+ [Symbol.dispose](): void;
1363
+ addContact(request: AddContactRequest): Promise<Contact>;
1364
+ addEventListener(listener: EventListener): Promise<string>;
1365
+ buyBitcoin(request: BuyBitcoinRequest): Promise<BuyBitcoinResponse>;
1366
+ cancelLeafOptimization(): Promise<void>;
1367
+ checkLightningAddressAvailable(request: CheckLightningAddressRequest): Promise<boolean>;
1368
+ checkMessage(request: CheckMessageRequest): Promise<CheckMessageResponse>;
1369
+ claimDeposit(request: ClaimDepositRequest): Promise<ClaimDepositResponse>;
1370
+ claimHtlcPayment(request: ClaimHtlcPaymentRequest): Promise<ClaimHtlcPaymentResponse>;
1371
+ deleteContact(id: string): Promise<void>;
1372
+ deleteLightningAddress(): Promise<void>;
1373
+ disconnect(): Promise<void>;
1374
+ fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
1375
+ getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
1376
+ getLeafOptimizationProgress(): OptimizationProgress;
1377
+ getLightningAddress(): Promise<LightningAddressInfo | undefined>;
1378
+ getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
1379
+ getTokenIssuer(): TokenIssuer;
1380
+ getTokensMetadata(request: GetTokensMetadataRequest): Promise<GetTokensMetadataResponse>;
1381
+ getUserSettings(): Promise<UserSettings>;
1382
+ listContacts(request: ListContactsRequest): Promise<Contact[]>;
1383
+ listFiatCurrencies(): Promise<ListFiatCurrenciesResponse>;
1384
+ listFiatRates(): Promise<ListFiatRatesResponse>;
1385
+ listPayments(request: ListPaymentsRequest): Promise<ListPaymentsResponse>;
1386
+ listUnclaimedDeposits(request: ListUnclaimedDepositsRequest): Promise<ListUnclaimedDepositsResponse>;
1387
+ listWebhooks(): Promise<Webhook[]>;
1388
+ lnurlAuth(request_data: LnurlAuthRequestDetails): Promise<LnurlCallbackStatus>;
1389
+ lnurlPay(request: LnurlPayRequest): Promise<LnurlPayResponse>;
1390
+ lnurlWithdraw(request: LnurlWithdrawRequest): Promise<LnurlWithdrawResponse>;
1391
+ parse(input: string): Promise<InputType>;
1392
+ prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
1393
+ prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
1394
+ receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
1395
+ recommendedFees(): Promise<RecommendedFees>;
1396
+ refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
1397
+ registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
1398
+ registerWebhook(request: RegisterWebhookRequest): Promise<RegisterWebhookResponse>;
1399
+ removeEventListener(id: string): Promise<boolean>;
1400
+ sendPayment(request: SendPaymentRequest): Promise<SendPaymentResponse>;
1401
+ signMessage(request: SignMessageRequest): Promise<SignMessageResponse>;
1402
+ startLeafOptimization(): Promise<void>;
1403
+ syncWallet(request: SyncWalletRequest): Promise<SyncWalletResponse>;
1404
+ unregisterWebhook(request: UnregisterWebhookRequest): Promise<void>;
1405
+ updateContact(request: UpdateContactRequest): Promise<Contact>;
1406
+ updateUserSettings(request: UpdateUserSettingsRequest): Promise<void>;
1423
1407
  }
1408
+
1424
1409
  /**
1425
1410
  * A default signer implementation that wraps the core SDK's ExternalSigner.
1426
1411
  * This is returned by `defaultExternalSigner` and can be passed to `connectWithSigner`.
1427
1412
  */
1428
1413
  export class DefaultSigner {
1429
- private constructor();
1430
- free(): void;
1431
- signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
1432
- signFrost(request: ExternalSignFrostRequest): Promise<ExternalFrostSignatureShare>;
1433
- hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
1434
- decryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1435
- encryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1436
- aggregateFrost(request: ExternalAggregateFrostRequest): Promise<ExternalFrostSignature>;
1437
- subtractSecrets(signing_key: ExternalSecretSource, new_signing_key: ExternalSecretSource): Promise<ExternalSecretSource>;
1438
- derivePublicKey(path: string): Promise<PublicKeyBytes>;
1439
- signHashSchnorr(hash: Uint8Array, path: string): Promise<SchnorrSignatureBytes>;
1440
- identityPublicKey(): PublicKeyBytes;
1441
- staticDepositSecret(index: number): Promise<SecretBytes>;
1442
- generateRandomSecret(): Promise<ExternalEncryptedSecret>;
1443
- publicKeyFromSecret(private_key: ExternalSecretSource): Promise<PublicKeyBytes>;
1444
- signEcdsaRecoverable(message: MessageBytes, path: string): Promise<RecoverableEcdsaSignatureBytes>;
1445
- getPublicKeyForNode(id: ExternalTreeNodeId): Promise<PublicKeyBytes>;
1446
- splitSecretWithProofs(secret: ExternalSecretToSplit, threshold: number, num_shares: number): Promise<ExternalVerifiableSecretShare[]>;
1447
- staticDepositSigningKey(index: number): Promise<PublicKeyBytes>;
1448
- encryptPrivateKeyForReceiver(private_key: ExternalEncryptedSecret, receiver_public_key: PublicKeyBytes): Promise<Uint8Array>;
1449
- staticDepositSecretEncrypted(index: number): Promise<ExternalSecretSource>;
1450
- generateRandomSigningCommitment(): Promise<ExternalFrostCommitments>;
1414
+ private constructor();
1415
+ free(): void;
1416
+ [Symbol.dispose](): void;
1417
+ aggregateFrost(request: ExternalAggregateFrostRequest): Promise<ExternalFrostSignature>;
1418
+ decryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1419
+ derivePublicKey(path: string): Promise<PublicKeyBytes>;
1420
+ encryptEcies(message: Uint8Array, path: string): Promise<Uint8Array>;
1421
+ encryptPrivateKeyForReceiver(private_key: ExternalEncryptedSecret, receiver_public_key: PublicKeyBytes): Promise<Uint8Array>;
1422
+ generateRandomSecret(): Promise<ExternalEncryptedSecret>;
1423
+ generateRandomSigningCommitment(): Promise<ExternalFrostCommitments>;
1424
+ getPublicKeyForNode(id: ExternalTreeNodeId): Promise<PublicKeyBytes>;
1425
+ hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
1426
+ identityPublicKey(): PublicKeyBytes;
1427
+ publicKeyFromSecret(private_key: ExternalSecretSource): Promise<PublicKeyBytes>;
1428
+ signEcdsa(message: MessageBytes, path: string): Promise<EcdsaSignatureBytes>;
1429
+ signEcdsaRecoverable(message: MessageBytes, path: string): Promise<RecoverableEcdsaSignatureBytes>;
1430
+ signFrost(request: ExternalSignFrostRequest): Promise<ExternalFrostSignatureShare>;
1431
+ signHashSchnorr(hash: Uint8Array, path: string): Promise<SchnorrSignatureBytes>;
1432
+ splitSecretWithProofs(secret: ExternalSecretToSplit, threshold: number, num_shares: number): Promise<ExternalVerifiableSecretShare[]>;
1433
+ staticDepositSecret(index: number): Promise<SecretBytes>;
1434
+ staticDepositSecretEncrypted(index: number): Promise<ExternalSecretSource>;
1435
+ staticDepositSigningKey(index: number): Promise<PublicKeyBytes>;
1436
+ subtractSecrets(signing_key: ExternalSecretSource, new_signing_key: ExternalSecretSource): Promise<ExternalSecretSource>;
1451
1437
  }
1438
+
1452
1439
  export class IntoUnderlyingByteSource {
1453
- private constructor();
1454
- free(): void;
1455
- pull(controller: ReadableByteStreamController): Promise<any>;
1456
- start(controller: ReadableByteStreamController): void;
1457
- cancel(): void;
1458
- readonly autoAllocateChunkSize: number;
1459
- readonly type: ReadableStreamType;
1440
+ private constructor();
1441
+ free(): void;
1442
+ [Symbol.dispose](): void;
1443
+ cancel(): void;
1444
+ pull(controller: ReadableByteStreamController): Promise<any>;
1445
+ start(controller: ReadableByteStreamController): void;
1446
+ readonly autoAllocateChunkSize: number;
1447
+ readonly type: ReadableStreamType;
1460
1448
  }
1449
+
1461
1450
  export class IntoUnderlyingSink {
1462
- private constructor();
1463
- free(): void;
1464
- abort(reason: any): Promise<any>;
1465
- close(): Promise<any>;
1466
- write(chunk: any): Promise<any>;
1451
+ private constructor();
1452
+ free(): void;
1453
+ [Symbol.dispose](): void;
1454
+ abort(reason: any): Promise<any>;
1455
+ close(): Promise<any>;
1456
+ write(chunk: any): Promise<any>;
1467
1457
  }
1458
+
1468
1459
  export class IntoUnderlyingSource {
1469
- private constructor();
1470
- free(): void;
1471
- pull(controller: ReadableStreamDefaultController): Promise<any>;
1472
- cancel(): void;
1460
+ private constructor();
1461
+ free(): void;
1462
+ [Symbol.dispose](): void;
1463
+ cancel(): void;
1464
+ pull(controller: ReadableStreamDefaultController): Promise<any>;
1473
1465
  }
1466
+
1474
1467
  /**
1475
1468
  * Passkey-based wallet operations using WebAuthn PRF extension.
1476
1469
  *
@@ -1478,64 +1471,101 @@ export class IntoUnderlyingSource {
1478
1471
  * wallet derivation and label management via Nostr relays.
1479
1472
  */
1480
1473
  export class Passkey {
1481
- free(): void;
1482
- /**
1483
- * Derive a wallet for a given label.
1484
- *
1485
- * Uses the passkey PRF to derive a `Wallet` containing the seed and resolved label.
1486
- *
1487
- * @param label - Optional label string (defaults to "Default")
1488
- */
1489
- getWallet(label?: string | null): Promise<Wallet>;
1490
- /**
1491
- * List all labels published to Nostr for this passkey's identity.
1492
- *
1493
- * Requires 1 PRF call (for Nostr identity derivation).
1494
- */
1495
- listLabels(): Promise<string[]>;
1496
- /**
1497
- * Publish a label to Nostr relays for this passkey's identity.
1498
- *
1499
- * Idempotent: if the label already exists, it is not published again.
1500
- * Requires 1 PRF call.
1501
- */
1502
- storeLabel(label: string): Promise<void>;
1503
- /**
1504
- * Check if passkey PRF is available on this device.
1505
- */
1506
- isAvailable(): Promise<boolean>;
1507
- /**
1508
- * Create a new `Passkey` instance.
1509
- *
1510
- * @param prfProvider - Platform implementation of passkey PRF operations
1511
- * @param relayConfig - Optional configuration for Nostr relay connections
1512
- */
1513
- constructor(prf_provider: PasskeyPrfProvider, relay_config?: NostrRelayConfig | null);
1474
+ free(): void;
1475
+ [Symbol.dispose](): void;
1476
+ /**
1477
+ * Derive a wallet for a given label.
1478
+ *
1479
+ * Uses the passkey PRF to derive a `Wallet` containing the seed and resolved label.
1480
+ *
1481
+ * @param label - Optional label string (defaults to "Default")
1482
+ */
1483
+ getWallet(label?: string | null): Promise<Wallet>;
1484
+ /**
1485
+ * Check if passkey PRF is available on this device.
1486
+ */
1487
+ isAvailable(): Promise<boolean>;
1488
+ /**
1489
+ * List all labels published to Nostr for this passkey's identity.
1490
+ *
1491
+ * Requires 1 PRF call (for Nostr identity derivation).
1492
+ */
1493
+ listLabels(): Promise<string[]>;
1494
+ /**
1495
+ * Create a new `Passkey` instance.
1496
+ *
1497
+ * @param prfProvider - Platform implementation of passkey PRF operations
1498
+ * @param relayConfig - Optional configuration for Nostr relay connections
1499
+ */
1500
+ constructor(prf_provider: PasskeyPrfProvider, relay_config?: NostrRelayConfig | null);
1501
+ /**
1502
+ * Publish a label to Nostr relays for this passkey's identity.
1503
+ *
1504
+ * Idempotent: if the label already exists, it is not published again.
1505
+ * Requires 1 PRF call.
1506
+ */
1507
+ storeLabel(label: string): Promise<void>;
1514
1508
  }
1509
+
1515
1510
  export class SdkBuilder {
1516
- private constructor();
1517
- free(): void;
1518
- withKeySet(config: KeySetConfig): SdkBuilder;
1519
- withStorage(storage: Storage): SdkBuilder;
1520
- static newWithSigner(config: Config, signer: ExternalSigner): SdkBuilder;
1521
- withFiatService(fiat_service: FiatService): SdkBuilder;
1522
- withLnurlClient(lnurl_client: RestClient): SdkBuilder;
1523
- withChainService(chain_service: BitcoinChainService): SdkBuilder;
1524
- withDefaultStorage(storage_dir: string): Promise<SdkBuilder>;
1525
- withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
1526
- withPostgresBackend(config: PostgresStorageConfig): SdkBuilder;
1527
- withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
1528
- static new(config: Config, seed: Seed): SdkBuilder;
1529
- build(): Promise<BreezSdk>;
1511
+ private constructor();
1512
+ free(): void;
1513
+ [Symbol.dispose](): void;
1514
+ build(): Promise<BreezSdk>;
1515
+ static new(config: Config, seed: Seed): SdkBuilder;
1516
+ static newWithSigner(config: Config, signer: ExternalSigner): SdkBuilder;
1517
+ withChainService(chain_service: BitcoinChainService): SdkBuilder;
1518
+ withDefaultStorage(storage_dir: string): Promise<SdkBuilder>;
1519
+ withFiatService(fiat_service: FiatService): SdkBuilder;
1520
+ withKeySet(config: KeySetConfig): SdkBuilder;
1521
+ withLnurlClient(lnurl_client: RestClient): SdkBuilder;
1522
+ withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
1523
+ withPostgresBackend(config: PostgresStorageConfig): SdkBuilder;
1524
+ withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
1525
+ withStorage(storage: Storage): SdkBuilder;
1530
1526
  }
1527
+
1531
1528
  export class TokenIssuer {
1532
- private constructor();
1533
- free(): void;
1534
- burnIssuerToken(request: BurnIssuerTokenRequest): Promise<Payment>;
1535
- mintIssuerToken(request: MintIssuerTokenRequest): Promise<Payment>;
1536
- createIssuerToken(request: CreateIssuerTokenRequest): Promise<TokenMetadata>;
1537
- freezeIssuerToken(request: FreezeIssuerTokenRequest): Promise<FreezeIssuerTokenResponse>;
1538
- unfreezeIssuerToken(request: UnfreezeIssuerTokenRequest): Promise<UnfreezeIssuerTokenResponse>;
1539
- getIssuerTokenBalance(): Promise<TokenBalance>;
1540
- getIssuerTokenMetadata(): Promise<TokenMetadata>;
1529
+ private constructor();
1530
+ free(): void;
1531
+ [Symbol.dispose](): void;
1532
+ burnIssuerToken(request: BurnIssuerTokenRequest): Promise<Payment>;
1533
+ createIssuerToken(request: CreateIssuerTokenRequest): Promise<TokenMetadata>;
1534
+ freezeIssuerToken(request: FreezeIssuerTokenRequest): Promise<FreezeIssuerTokenResponse>;
1535
+ getIssuerTokenBalance(): Promise<TokenBalance>;
1536
+ getIssuerTokenMetadata(): Promise<TokenMetadata>;
1537
+ mintIssuerToken(request: MintIssuerTokenRequest): Promise<Payment>;
1538
+ unfreezeIssuerToken(request: UnfreezeIssuerTokenRequest): Promise<UnfreezeIssuerTokenResponse>;
1541
1539
  }
1540
+
1541
+ export function connect(request: ConnectRequest): Promise<BreezSdk>;
1542
+
1543
+ export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
1544
+
1545
+ export function defaultConfig(network: Network): Config;
1546
+
1547
+ export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
1548
+
1549
+ /**
1550
+ * Creates a default PostgreSQL storage configuration with sensible defaults.
1551
+ *
1552
+ * Default values (from pg.Pool):
1553
+ * - `maxPoolSize`: 10
1554
+ * - `createTimeoutSecs`: 0 (no timeout)
1555
+ * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
1556
+ */
1557
+ export function defaultPostgresStorageConfig(connection_string: string): PostgresStorageConfig;
1558
+
1559
+ /**
1560
+ * Creates a default external signer from a mnemonic phrase.
1561
+ *
1562
+ * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
1563
+ */
1564
+ export function getSparkStatus(): Promise<SparkStatus>;
1565
+
1566
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
1567
+
1568
+ /**
1569
+ * Entry point invoked by JavaScript in a worker.
1570
+ */
1571
+ export function task_worker_entry_point(ptr: number): void;