@breeztech/breez-sdk-spark 0.13.9-debug → 0.13.11-dev1

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