@breeztech/breez-sdk-spark 0.13.1 → 0.13.2-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.
@@ -9,17 +9,17 @@
9
9
  * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
10
10
  */
11
11
  export function defaultPostgresStorageConfig(connection_string: string): PostgresStorageConfig;
12
- export function defaultConfig(network: Network): Config;
13
- export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
14
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
15
- export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
16
12
  /**
17
13
  * Creates a default external signer from a mnemonic phrase.
18
14
  *
19
15
  * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
20
16
  */
21
17
  export function getSparkStatus(): Promise<SparkStatus>;
18
+ export function defaultConfig(network: Network): Config;
19
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
22
20
  export function connect(request: ConnectRequest): Promise<BreezSdk>;
21
+ export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
22
+ export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
23
23
  /**
24
24
  * Entry point invoked by JavaScript in a worker.
25
25
  */
@@ -198,14 +198,14 @@ export interface BitcoinChainService {
198
198
  recommendedFees(): Promise<RecommendedFees>;
199
199
  }
200
200
 
201
- export type ChainApiType = "esplora" | "mempoolSpace";
202
-
203
201
  export interface TxStatus {
204
202
  confirmed: boolean;
205
203
  blockHeight?: number;
206
204
  blockTime?: number;
207
205
  }
208
206
 
207
+ export type ChainApiType = "esplora" | "mempoolSpace";
208
+
209
209
  export interface Utxo {
210
210
  txid: string;
211
211
  vout: number;
@@ -225,19 +225,51 @@ export interface PaymentObserver {
225
225
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
226
226
  }
227
227
 
228
- export interface Bip21Details {
229
- amountSat?: number;
230
- assetId?: string;
231
- uri: string;
232
- extras: Bip21Extra[];
233
- label?: string;
234
- message?: string;
235
- paymentMethods: InputType[];
228
+ export interface ListFiatCurrenciesResponse {
229
+ currencies: FiatCurrency[];
236
230
  }
237
231
 
238
- export interface Bolt12InvoiceDetails {
239
- amountMsat: number;
240
- invoice: Bolt12Invoice;
232
+ export interface FiatCurrency {
233
+ id: string;
234
+ info: CurrencyInfo;
235
+ }
236
+
237
+ export interface PaymentMetadata {
238
+ parentPaymentId?: string;
239
+ lnurlPayInfo?: LnurlPayInfo;
240
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
241
+ lnurlDescription?: string;
242
+ conversionInfo?: ConversionInfo;
243
+ conversionStatus?: ConversionStatus;
244
+ }
245
+
246
+ export interface LnurlWithdrawRequest {
247
+ amountSats: number;
248
+ withdrawRequest: LnurlWithdrawRequestDetails;
249
+ completionTimeoutSecs?: number;
250
+ }
251
+
252
+ export interface Symbol {
253
+ grapheme?: string;
254
+ template?: string;
255
+ rtl?: boolean;
256
+ position?: number;
257
+ }
258
+
259
+ export interface PrepareLnurlPayResponse {
260
+ amountSats: number;
261
+ comment?: string;
262
+ payRequest: LnurlPayRequestDetails;
263
+ feeSats: number;
264
+ invoiceDetails: Bolt11InvoiceDetails;
265
+ successAction?: SuccessAction;
266
+ conversionEstimate?: ConversionEstimate;
267
+ feePolicy: FeePolicy;
268
+ }
269
+
270
+ export interface FetchConversionLimitsResponse {
271
+ minFromAmount?: bigint;
272
+ minToAmount?: bigint;
241
273
  }
242
274
 
243
275
  export interface KeySetConfig {
@@ -246,138 +278,124 @@ export interface KeySetConfig {
246
278
  accountNumber?: number;
247
279
  }
248
280
 
249
- export interface SignMessageRequest {
250
- message: string;
251
- compact: boolean;
281
+ export interface LightningAddressInfo {
282
+ description: string;
283
+ lightningAddress: string;
284
+ lnurl: LnurlInfo;
285
+ username: string;
252
286
  }
253
287
 
254
- 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 };
255
-
256
- export interface ConversionStep {
257
- paymentId: string;
258
- amount: bigint;
259
- fee: bigint;
260
- method: PaymentMethod;
261
- tokenMetadata?: TokenMetadata;
262
- amountAdjustment?: AmountAdjustmentReason;
288
+ export interface LnurlPayInfo {
289
+ lnAddress?: string;
290
+ comment?: string;
291
+ domain?: string;
292
+ metadata?: string;
293
+ processedSuccessAction?: SuccessActionProcessed;
294
+ rawSuccessAction?: SuccessAction;
263
295
  }
264
296
 
265
- export interface SyncWalletResponse {}
266
-
267
- 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 };
297
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
268
298
 
269
- export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
299
+ export interface Bolt12InvoiceRequestDetails {}
270
300
 
271
- export interface GetPaymentRequest {
272
- paymentId: string;
301
+ export interface RegisterLightningAddressRequest {
302
+ username: string;
303
+ description?: string;
273
304
  }
274
305
 
275
- export interface LnurlWithdrawInfo {
276
- withdrawUrl: string;
306
+ export interface BuyBitcoinResponse {
307
+ url: string;
277
308
  }
278
309
 
279
- export interface ConversionOptions {
280
- conversionType: ConversionType;
281
- maxSlippageBps?: number;
282
- completionTimeoutSecs?: number;
310
+ export interface GetPaymentRequest {
311
+ paymentId: string;
283
312
  }
284
313
 
285
- export interface ListPaymentsRequest {
286
- typeFilter?: PaymentType[];
287
- statusFilter?: PaymentStatus[];
288
- assetFilter?: AssetFilter;
289
- paymentDetailsFilter?: PaymentDetailsFilter[];
290
- fromTimestamp?: number;
291
- toTimestamp?: number;
292
- offset?: number;
293
- limit?: number;
294
- sortAscending?: boolean;
314
+ export interface SparkStatus {
315
+ status: ServiceStatus;
316
+ lastUpdated: number;
295
317
  }
296
318
 
297
- export interface SignMessageResponse {
298
- pubkey: string;
299
- signature: string;
319
+ export interface ClaimHtlcPaymentRequest {
320
+ preimage: string;
300
321
  }
301
322
 
302
- export interface ListUnclaimedDepositsRequest {}
303
-
304
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
305
-
306
- export interface LocalizedName {
307
- locale: string;
308
- name: string;
323
+ export interface AesSuccessActionData {
324
+ description: string;
325
+ ciphertext: string;
326
+ iv: string;
309
327
  }
310
328
 
311
- export interface LnurlPayRequest {
312
- prepareResponse: PrepareLnurlPayResponse;
313
- idempotencyKey?: string;
314
- }
329
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
315
330
 
316
- export interface LnurlReceiveMetadata {
317
- nostrZapRequest?: string;
318
- nostrZapReceipt?: string;
319
- senderComment?: string;
331
+ export interface SparkInvoiceDetails {
332
+ invoice: string;
333
+ identityPublicKey: string;
334
+ network: BitcoinNetwork;
335
+ amount?: string;
336
+ tokenIdentifier?: string;
337
+ expiryTime?: number;
338
+ description?: string;
339
+ senderPublicKey?: string;
320
340
  }
321
341
 
322
- export interface TokenMetadata {
323
- identifier: string;
324
- issuerPublicKey: string;
342
+ export interface AddContactRequest {
325
343
  name: string;
326
- ticker: string;
327
- decimals: number;
328
- maxSupply: string;
329
- isFreezable: boolean;
344
+ paymentIdentifier: string;
330
345
  }
331
346
 
332
- export interface GetTokensMetadataRequest {
333
- tokenIdentifiers: string[];
334
- }
347
+ export type TokenTransactionType = "transfer" | "mint" | "burn";
335
348
 
336
- export interface LnurlWithdrawRequest {
337
- amountSats: number;
338
- withdrawRequest: LnurlWithdrawRequestDetails;
339
- completionTimeoutSecs?: number;
349
+ export interface Bip21Details {
350
+ amountSat?: number;
351
+ assetId?: string;
352
+ uri: string;
353
+ extras: Bip21Extra[];
354
+ label?: string;
355
+ message?: string;
356
+ paymentMethods: InputType[];
340
357
  }
341
358
 
342
- export interface Bolt12OfferBlindedPath {
343
- blindedHops: string[];
359
+ export interface LogEntry {
360
+ line: string;
361
+ level: string;
344
362
  }
345
363
 
346
364
  export interface MessageSuccessActionData {
347
365
  message: string;
348
366
  }
349
367
 
350
- export interface ListUnclaimedDepositsResponse {
351
- deposits: DepositInfo[];
352
- }
353
-
354
368
  export interface UpdateUserSettingsRequest {
355
369
  sparkPrivateModeEnabled?: boolean;
356
370
  stableBalanceActiveLabel?: StableBalanceActiveLabel;
357
371
  }
358
372
 
359
- export interface ExternalInputParser {
360
- providerId: string;
361
- inputRegex: string;
362
- parserUrl: string;
363
- }
373
+ export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
364
374
 
365
- export interface SparkInvoicePaymentDetails {
366
- description?: string;
367
- invoice: string;
368
- }
375
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
369
376
 
370
- export interface RecordId {
371
- type: string;
372
- dataId: string;
377
+ export interface SyncWalletRequest {}
378
+
379
+ export interface DepositInfo {
380
+ txid: string;
381
+ vout: number;
382
+ amountSats: number;
383
+ isMature: boolean;
384
+ refundTx?: string;
385
+ refundTxId?: string;
386
+ claimError?: DepositClaimError;
373
387
  }
374
388
 
375
- export interface PrepareSendPaymentResponse {
376
- paymentMethod: SendPaymentMethod;
377
- amount: bigint;
378
- tokenIdentifier?: string;
379
- conversionEstimate?: ConversionEstimate;
380
- feePolicy: FeePolicy;
389
+ export interface ListPaymentsRequest {
390
+ typeFilter?: PaymentType[];
391
+ statusFilter?: PaymentStatus[];
392
+ assetFilter?: AssetFilter;
393
+ paymentDetailsFilter?: PaymentDetailsFilter[];
394
+ fromTimestamp?: number;
395
+ toTimestamp?: number;
396
+ offset?: number;
397
+ limit?: number;
398
+ sortAscending?: boolean;
381
399
  }
382
400
 
383
401
  export interface CurrencyInfo {
@@ -390,106 +408,117 @@ export interface CurrencyInfo {
390
408
  localeOverrides: LocaleOverrides[];
391
409
  }
392
410
 
393
- export interface Rate {
394
- coin: string;
395
- value: number;
411
+ export interface UnregisterWebhookRequest {
412
+ webhookId: string;
396
413
  }
397
414
 
398
- export interface SparkConfig {
399
- coordinatorIdentifier: string;
400
- threshold: number;
401
- signingOperators: SparkSigningOperator[];
402
- sspConfig: SparkSspConfig;
403
- expectedWithdrawBondSats: number;
404
- expectedWithdrawRelativeBlockLocktime: number;
405
- }
415
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
406
416
 
407
- export interface Webhook {
408
- id: string;
409
- url: string;
410
- eventTypes: WebhookEventType[];
417
+ export interface SparkSigningOperator {
418
+ id: number;
419
+ identifier: string;
420
+ address: string;
421
+ identityPublicKey: string;
411
422
  }
412
423
 
413
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
414
-
415
- export interface LnurlWithdrawResponse {
416
- paymentRequest: string;
417
- payment?: Payment;
424
+ export interface ConversionStep {
425
+ paymentId: string;
426
+ amount: bigint;
427
+ fee: bigint;
428
+ method: PaymentMethod;
429
+ tokenMetadata?: TokenMetadata;
430
+ amountAdjustment?: AmountAdjustmentReason;
418
431
  }
419
432
 
420
- export interface LnurlErrorDetails {
421
- reason: string;
422
- }
433
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
423
434
 
424
- export interface GetPaymentResponse {
425
- payment: Payment;
426
- }
435
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
427
436
 
428
- export interface LnurlPayResponse {
429
- payment: Payment;
430
- successAction?: SuccessActionProcessed;
431
- }
437
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
432
438
 
433
- export interface SparkHtlcDetails {
434
- paymentHash: string;
435
- preimage?: string;
436
- expiryTime: number;
437
- status: SparkHtlcStatus;
439
+ export interface GetTokensMetadataRequest {
440
+ tokenIdentifiers: string[];
438
441
  }
439
442
 
440
- export interface SendPaymentRequest {
441
- prepareResponse: PrepareSendPaymentResponse;
442
- options?: SendPaymentOptions;
443
- idempotencyKey?: string;
443
+ export interface LightningAddressDetails {
444
+ address: string;
445
+ payRequest: LnurlPayRequestDetails;
444
446
  }
445
447
 
446
- export interface ConnectRequest {
447
- config: Config;
448
- seed: Seed;
449
- storageDir: string;
448
+ export interface ListContactsRequest {
449
+ offset?: number;
450
+ limit?: number;
450
451
  }
451
452
 
452
- export interface ClaimHtlcPaymentRequest {
453
- preimage: string;
454
- }
453
+ export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
455
454
 
456
- export interface SendPaymentResponse {
457
- payment: Payment;
455
+ export interface CheckMessageRequest {
456
+ message: string;
457
+ pubkey: string;
458
+ signature: string;
458
459
  }
459
460
 
460
- export interface SendOnchainSpeedFeeQuote {
461
- userFeeSat: number;
462
- l1BroadcastFeeSat: number;
463
- }
461
+ export interface ListUnclaimedDepositsRequest {}
464
462
 
465
- export interface ProvisionalPayment {
466
- paymentId: string;
467
- amount: bigint;
468
- details: ProvisionalPaymentDetails;
463
+ export interface Bolt11Invoice {
464
+ bolt11: string;
465
+ source: PaymentRequestSource;
469
466
  }
470
467
 
471
- export interface RefundDepositRequest {
472
- txid: string;
473
- vout: number;
474
- destinationAddress: string;
475
- fee: Fee;
468
+ export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeeded" | "refunded";
469
+
470
+ export interface TokenBalance {
471
+ balance: bigint;
472
+ tokenMetadata: TokenMetadata;
476
473
  }
477
474
 
478
- export interface UpdateContactRequest {
479
- id: string;
475
+ export interface TokenMetadata {
476
+ identifier: string;
477
+ issuerPublicKey: string;
480
478
  name: string;
481
- paymentIdentifier: string;
479
+ ticker: string;
480
+ decimals: number;
481
+ maxSupply: string;
482
+ isFreezable: boolean;
482
483
  }
483
484
 
484
- export interface ClaimDepositRequest {
485
- txid: string;
486
- vout: number;
487
- maxFee?: MaxFee;
485
+ export interface Bolt12Offer {
486
+ offer: string;
487
+ source: PaymentRequestSource;
488
488
  }
489
489
 
490
- export interface OutgoingChange {
491
- change: RecordChange;
492
- parent?: Record;
490
+ export interface Config {
491
+ apiKey?: string;
492
+ network: Network;
493
+ syncIntervalSecs: number;
494
+ maxDepositClaimFee?: MaxFee;
495
+ lnurlDomain?: string;
496
+ preferSparkOverLightning: boolean;
497
+ externalInputParsers?: ExternalInputParser[];
498
+ useDefaultExternalInputParsers: boolean;
499
+ realTimeSyncServerUrl?: string;
500
+ privateEnabledDefault: boolean;
501
+ optimizationConfig: OptimizationConfig;
502
+ stableBalanceConfig?: StableBalanceConfig;
503
+ /**
504
+ * Maximum number of concurrent transfer claims.
505
+ *
506
+ * Controls how many pending Spark transfers can be claimed in parallel.
507
+ * Default is 4. Increase for server environments with high incoming
508
+ * payment volume to improve throughput.
509
+ */
510
+ maxConcurrentClaims: number;
511
+ sparkConfig?: SparkConfig;
512
+ }
513
+
514
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
515
+
516
+ export type AmountAdjustmentReason = "flooredToMinLimit" | "increasedToAvoidDust";
517
+
518
+ export interface ProvisionalPayment {
519
+ paymentId: string;
520
+ amount: bigint;
521
+ details: ProvisionalPaymentDetails;
493
522
  }
494
523
 
495
524
  export interface FetchConversionLimitsRequest {
@@ -497,178 +526,156 @@ export interface FetchConversionLimitsRequest {
497
526
  tokenIdentifier?: string;
498
527
  }
499
528
 
500
- export interface LightningAddressDetails {
501
- address: string;
502
- payRequest: LnurlPayRequestDetails;
529
+ export interface SignMessageResponse {
530
+ pubkey: string;
531
+ signature: string;
503
532
  }
504
533
 
505
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
506
-
507
- export interface Symbol {
508
- grapheme?: string;
509
- template?: string;
510
- rtl?: boolean;
511
- position?: number;
534
+ export interface StableBalanceConfig {
535
+ tokens: StableBalanceToken[];
536
+ defaultActiveLabel?: string;
537
+ thresholdSats?: number;
538
+ maxSlippageBps?: number;
512
539
  }
513
540
 
514
- export interface ClaimHtlcPaymentResponse {
515
- payment: Payment;
541
+ export interface ConversionEstimate {
542
+ options: ConversionOptions;
543
+ amountIn: bigint;
544
+ amountOut: bigint;
545
+ fee: bigint;
546
+ amountAdjustment?: AmountAdjustmentReason;
516
547
  }
517
548
 
518
- export interface UrlSuccessActionData {
519
- description: string;
520
- url: string;
521
- matchesCallbackDomain: boolean;
549
+ export interface LnurlErrorDetails {
550
+ reason: string;
522
551
  }
523
552
 
524
- 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);
525
-
526
- 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[] };
527
-
528
- export interface RegisterWebhookRequest {
529
- url: string;
530
- secret: string;
531
- eventTypes: WebhookEventType[];
553
+ export interface GetPaymentResponse {
554
+ payment: Payment;
532
555
  }
533
556
 
534
- export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
535
-
536
- export interface PaymentRequestSource {
537
- bip21Uri?: string;
538
- bip353Address?: string;
557
+ export interface LnurlPayRequestDetails {
558
+ callback: string;
559
+ minSendable: number;
560
+ maxSendable: number;
561
+ metadataStr: string;
562
+ commentAllowed: number;
563
+ domain: string;
564
+ url: string;
565
+ address?: string;
566
+ allowsNostr?: boolean;
567
+ nostrPubkey?: string;
539
568
  }
540
569
 
541
- export interface SparkInvoiceDetails {
542
- invoice: string;
543
- identityPublicKey: string;
570
+ export interface BitcoinAddressDetails {
571
+ address: string;
544
572
  network: BitcoinNetwork;
545
- amount?: string;
546
- tokenIdentifier?: string;
547
- expiryTime?: number;
548
- description?: string;
549
- senderPublicKey?: string;
573
+ source: PaymentRequestSource;
550
574
  }
551
575
 
552
- export interface ConversionInfo {
553
- poolId: string;
554
- conversionId: string;
555
- status: ConversionStatus;
556
- fee?: string;
557
- purpose?: ConversionPurpose;
558
- amountAdjustment?: AmountAdjustmentReason;
576
+ export interface SparkInvoicePaymentDetails {
577
+ description?: string;
578
+ invoice: string;
559
579
  }
560
580
 
561
- export interface RefundDepositResponse {
562
- txId: string;
563
- txHex: string;
581
+ export interface IncomingChange {
582
+ newState: Record;
583
+ oldState?: Record;
564
584
  }
565
585
 
566
- export interface LnurlInfo {
567
- url: string;
568
- bech32: string;
586
+ export interface CheckMessageResponse {
587
+ isValid: boolean;
569
588
  }
570
589
 
571
- export interface PaymentMetadata {
572
- parentPaymentId?: string;
573
- lnurlPayInfo?: LnurlPayInfo;
574
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
575
- lnurlDescription?: string;
576
- conversionInfo?: ConversionInfo;
577
- conversionStatus?: ConversionStatus;
590
+ export interface Payment {
591
+ id: string;
592
+ paymentType: PaymentType;
593
+ status: PaymentStatus;
594
+ amount: bigint;
595
+ fees: bigint;
596
+ timestamp: number;
597
+ method: PaymentMethod;
598
+ details?: PaymentDetails;
599
+ conversionDetails?: ConversionDetails;
578
600
  }
579
601
 
580
- export interface ConversionEstimate {
581
- options: ConversionOptions;
582
- amountIn: bigint;
583
- amountOut: bigint;
584
- fee: bigint;
585
- amountAdjustment?: AmountAdjustmentReason;
602
+ export interface LnurlAuthRequestDetails {
603
+ k1: string;
604
+ action?: string;
605
+ domain: string;
606
+ url: string;
586
607
  }
587
608
 
588
- export interface OptimizationConfig {
589
- autoEnabled: boolean;
590
- multiplicity: number;
609
+ export interface LnurlReceiveMetadata {
610
+ nostrZapRequest?: string;
611
+ nostrZapReceipt?: string;
612
+ senderComment?: string;
591
613
  }
592
614
 
593
- export interface SyncWalletRequest {}
594
-
595
- export interface AddContactRequest {
596
- name: string;
597
- paymentIdentifier: string;
598
- }
615
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
599
616
 
600
- export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
617
+ export interface Webhook {
618
+ id: string;
619
+ url: string;
620
+ eventTypes: WebhookEventType[];
621
+ }
601
622
 
602
- export type FeePolicy = "feesExcluded" | "feesIncluded";
623
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
603
624
 
604
- export interface CheckMessageRequest {
605
- message: string;
606
- pubkey: string;
607
- signature: string;
625
+ export interface ListPaymentsResponse {
626
+ payments: Payment[];
608
627
  }
609
628
 
610
- export interface Credentials {
611
- username: string;
612
- password: string;
629
+ export interface LnurlPayRequest {
630
+ prepareResponse: PrepareLnurlPayResponse;
631
+ idempotencyKey?: string;
613
632
  }
614
633
 
615
634
  export interface ClaimDepositResponse {
616
635
  payment: Payment;
617
636
  }
618
637
 
619
- 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 };
638
+ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
620
639
 
621
- export interface UserSettings {
622
- sparkPrivateModeEnabled: boolean;
623
- stableBalanceActiveLabel?: string;
640
+ export interface Bolt11RouteHintHop {
641
+ srcNodeId: string;
642
+ shortChannelId: string;
643
+ feesBaseMsat: number;
644
+ feesProportionalMillionths: number;
645
+ cltvExpiryDelta: number;
646
+ htlcMinimumMsat?: number;
647
+ htlcMaximumMsat?: number;
624
648
  }
625
649
 
626
- export interface GetInfoRequest {
627
- ensureSynced?: boolean;
650
+ export interface LnurlInfo {
651
+ url: string;
652
+ bech32: string;
628
653
  }
629
654
 
630
- export interface LightningAddressInfo {
631
- description: string;
632
- lightningAddress: string;
633
- lnurl: LnurlInfo;
634
- username: string;
635
- }
655
+ export type PaymentType = "send" | "receive";
636
656
 
637
- export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
657
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
638
658
 
639
- export interface PrepareLnurlPayResponse {
640
- amountSats: number;
641
- comment?: string;
642
- payRequest: LnurlPayRequestDetails;
643
- feeSats: number;
644
- invoiceDetails: Bolt11InvoiceDetails;
645
- successAction?: SuccessAction;
646
- conversionEstimate?: ConversionEstimate;
647
- feePolicy: FeePolicy;
648
- }
659
+ export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
649
660
 
650
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
661
+ export interface SendOnchainFeeQuote {
662
+ id: string;
663
+ expiresAt: number;
664
+ speedFast: SendOnchainSpeedFeeQuote;
665
+ speedMedium: SendOnchainSpeedFeeQuote;
666
+ speedSlow: SendOnchainSpeedFeeQuote;
667
+ }
651
668
 
652
- export interface StableBalanceToken {
653
- label: string;
654
- tokenIdentifier: string;
669
+ export interface ListUnclaimedDepositsResponse {
670
+ deposits: DepositInfo[];
655
671
  }
656
672
 
657
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
673
+ export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
658
674
 
659
- export interface Bolt11InvoiceDetails {
660
- amountMsat?: number;
661
- description?: string;
662
- descriptionHash?: string;
663
- expiry: number;
664
- invoice: Bolt11Invoice;
665
- minFinalCltvExpiryDelta: number;
666
- network: BitcoinNetwork;
667
- payeePubkey: string;
668
- paymentHash: string;
669
- paymentSecret: string;
670
- routingHints: Bolt11RouteHint[];
671
- timestamp: number;
675
+ export interface ConversionDetails {
676
+ status: ConversionStatus;
677
+ from?: ConversionStep;
678
+ to?: ConversionStep;
672
679
  }
673
680
 
674
681
  export interface PrepareLnurlPayRequest {
@@ -681,130 +688,119 @@ export interface PrepareLnurlPayRequest {
681
688
  feePolicy?: FeePolicy;
682
689
  }
683
690
 
684
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
685
-
686
- export interface RegisterLightningAddressRequest {
687
- username: string;
688
- description?: string;
691
+ export interface UnversionedRecordChange {
692
+ id: RecordId;
693
+ schemaVersion: string;
694
+ updatedFields: Map<string, string>;
689
695
  }
690
696
 
691
- export interface UnregisterWebhookRequest {
692
- webhookId: string;
697
+ export interface SparkSspConfig {
698
+ baseUrl: string;
699
+ identityPublicKey: string;
700
+ schemaEndpoint?: string;
693
701
  }
694
702
 
695
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
703
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
696
704
 
697
- export interface SparkAddressDetails {
698
- address: string;
699
- identityPublicKey: string;
700
- network: BitcoinNetwork;
701
- source: PaymentRequestSource;
702
- }
705
+ export type PaymentStatus = "completed" | "pending" | "failed";
703
706
 
704
- export interface CheckMessageResponse {
705
- isValid: boolean;
707
+ export interface Bolt12InvoiceDetails {
708
+ amountMsat: number;
709
+ invoice: Bolt12Invoice;
706
710
  }
707
711
 
708
- export interface ConversionDetails {
709
- status: ConversionStatus;
710
- from?: ConversionStep;
711
- to?: ConversionStep;
712
+ export interface Bolt11RouteHint {
713
+ hops: Bolt11RouteHintHop[];
712
714
  }
713
715
 
714
- export interface Bolt12OfferDetails {
715
- absoluteExpiry?: number;
716
- chains: string[];
717
- description?: string;
718
- issuer?: string;
719
- minAmount?: Amount;
720
- offer: Bolt12Offer;
721
- paths: Bolt12OfferBlindedPath[];
722
- signingPubkey?: string;
716
+ export interface ReceivePaymentResponse {
717
+ paymentRequest: string;
718
+ fee: bigint;
723
719
  }
724
720
 
725
- export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
721
+ export interface SparkHtlcDetails {
722
+ paymentHash: string;
723
+ preimage?: string;
724
+ expiryTime: number;
725
+ status: SparkHtlcStatus;
726
+ }
726
727
 
727
- export interface Payment {
728
- id: string;
729
- paymentType: PaymentType;
730
- status: PaymentStatus;
731
- amount: bigint;
732
- fees: bigint;
733
- timestamp: number;
734
- method: PaymentMethod;
735
- details?: PaymentDetails;
736
- conversionDetails?: ConversionDetails;
728
+ export interface Bip21Extra {
729
+ key: string;
730
+ value: string;
737
731
  }
738
732
 
739
- export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
733
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
740
734
 
741
- export interface OptimizationProgress {
742
- isRunning: boolean;
743
- currentRound: number;
744
- totalRounds: number;
745
- }
735
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
746
736
 
747
- export interface FetchConversionLimitsResponse {
748
- minFromAmount?: bigint;
749
- minToAmount?: bigint;
737
+ export interface ExternalInputParser {
738
+ providerId: string;
739
+ inputRegex: string;
740
+ parserUrl: string;
750
741
  }
751
742
 
752
- 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 };
753
-
754
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
743
+ export interface ConversionOptions {
744
+ conversionType: ConversionType;
745
+ maxSlippageBps?: number;
746
+ completionTimeoutSecs?: number;
747
+ }
755
748
 
756
- export interface SparkSspConfig {
757
- baseUrl: string;
758
- identityPublicKey: string;
759
- schemaEndpoint?: string;
749
+ export interface LocalizedName {
750
+ locale: string;
751
+ name: string;
760
752
  }
761
753
 
762
- export interface AesSuccessActionData {
763
- description: string;
764
- ciphertext: string;
765
- iv: string;
754
+ export interface PrepareSendPaymentRequest {
755
+ paymentRequest: string;
756
+ amount?: bigint;
757
+ tokenIdentifier?: string;
758
+ conversionOptions?: ConversionOptions;
759
+ feePolicy?: FeePolicy;
766
760
  }
767
761
 
768
762
  export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; redirectUrl?: string } | { type: "cashApp"; amountSats?: number };
769
763
 
770
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
764
+ export type Network = "mainnet" | "regtest";
771
765
 
772
- export interface SparkStatus {
773
- status: ServiceStatus;
774
- lastUpdated: number;
766
+ export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
767
+
768
+ export interface GetInfoRequest {
769
+ ensureSynced?: boolean;
775
770
  }
776
771
 
777
- export type TokenTransactionType = "transfer" | "mint" | "burn";
772
+ export interface StorageListPaymentsRequest {
773
+ typeFilter?: PaymentType[];
774
+ statusFilter?: PaymentStatus[];
775
+ assetFilter?: AssetFilter;
776
+ paymentDetailsFilter?: StoragePaymentDetailsFilter[];
777
+ fromTimestamp?: number;
778
+ toTimestamp?: number;
779
+ offset?: number;
780
+ limit?: number;
781
+ sortAscending?: boolean;
782
+ }
778
783
 
779
- export interface LnurlPayRequestDetails {
780
- callback: string;
781
- minSendable: number;
782
- maxSendable: number;
783
- metadataStr: string;
784
- commentAllowed: number;
785
- domain: string;
784
+ export interface RegisterWebhookRequest {
786
785
  url: string;
787
- address?: string;
788
- allowsNostr?: boolean;
789
- nostrPubkey?: string;
786
+ secret: string;
787
+ eventTypes: WebhookEventType[];
790
788
  }
791
789
 
792
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
793
-
794
- export interface TokenBalance {
795
- balance: bigint;
796
- tokenMetadata: TokenMetadata;
797
- }
790
+ 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 };
798
791
 
799
- export interface ReceivePaymentRequest {
800
- paymentMethod: ReceivePaymentMethod;
792
+ export interface SetLnurlMetadataItem {
793
+ paymentHash: string;
794
+ senderComment?: string;
795
+ nostrZapRequest?: string;
796
+ nostrZapReceipt?: string;
801
797
  }
802
798
 
803
- export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
804
-
805
- export interface Bolt11Invoice {
806
- bolt11: string;
807
- source: PaymentRequestSource;
799
+ export interface RefundDepositRequest {
800
+ txid: string;
801
+ vout: number;
802
+ destinationAddress: string;
803
+ fee: Fee;
808
804
  }
809
805
 
810
806
  export interface LnurlWithdrawRequestDetails {
@@ -815,157 +811,174 @@ export interface LnurlWithdrawRequestDetails {
815
811
  maxWithdrawable: number;
816
812
  }
817
813
 
818
- export interface SparkSigningOperator {
819
- id: number;
820
- identifier: string;
821
- address: string;
822
- identityPublicKey: string;
814
+ export interface Contact {
815
+ id: string;
816
+ name: string;
817
+ paymentIdentifier: string;
818
+ createdAt: number;
819
+ updatedAt: number;
820
+ }
821
+
822
+ export interface OutgoingChange {
823
+ change: RecordChange;
824
+ parent?: Record;
823
825
  }
824
826
 
825
- export interface IncomingChange {
826
- newState: Record;
827
- oldState?: Record;
827
+ export interface ListFiatRatesResponse {
828
+ rates: Rate[];
828
829
  }
829
830
 
830
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
831
-
832
- export interface ReceivePaymentResponse {
833
- paymentRequest: string;
834
- fee: bigint;
831
+ export interface AesSuccessActionDataDecrypted {
832
+ description: string;
833
+ plaintext: string;
835
834
  }
836
835
 
837
- export interface BitcoinAddressDetails {
838
- address: string;
839
- network: BitcoinNetwork;
840
- source: PaymentRequestSource;
836
+ export interface RecordId {
837
+ type: string;
838
+ dataId: string;
841
839
  }
842
840
 
843
- export interface ListFiatCurrenciesResponse {
844
- currencies: FiatCurrency[];
841
+ export interface StableBalanceToken {
842
+ label: string;
843
+ tokenIdentifier: string;
845
844
  }
846
845
 
847
- export interface RecordChange {
848
- id: RecordId;
849
- schemaVersion: string;
850
- updatedFields: Map<string, string>;
851
- localRevision: number;
846
+ export interface LnurlPayResponse {
847
+ payment: Payment;
848
+ successAction?: SuccessActionProcessed;
852
849
  }
853
850
 
854
- export interface Bolt12Offer {
855
- offer: string;
856
- source: PaymentRequestSource;
851
+ export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
852
+
853
+ export interface CheckLightningAddressRequest {
854
+ username: string;
857
855
  }
858
856
 
859
- export interface UnversionedRecordChange {
860
- id: RecordId;
861
- schemaVersion: string;
862
- updatedFields: Map<string, string>;
857
+ 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);
858
+
859
+ export interface UserSettings {
860
+ sparkPrivateModeEnabled: boolean;
861
+ stableBalanceActiveLabel?: string;
863
862
  }
864
863
 
865
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
864
+ export interface UrlSuccessActionData {
865
+ description: string;
866
+ url: string;
867
+ matchesCallbackDomain: boolean;
868
+ }
866
869
 
867
- export type AmountAdjustmentReason = "flooredToMinLimit" | "increasedToAvoidDust";
870
+ export type FeePolicy = "feesExcluded" | "feesIncluded";
868
871
 
869
- export interface LnurlPayInfo {
870
- lnAddress?: string;
871
- comment?: string;
872
- domain?: string;
873
- metadata?: string;
874
- processedSuccessAction?: SuccessActionProcessed;
875
- rawSuccessAction?: SuccessAction;
872
+ export interface LocaleOverrides {
873
+ locale: string;
874
+ spacing?: number;
875
+ symbol: Symbol;
876
876
  }
877
877
 
878
- export type Network = "mainnet" | "regtest";
878
+ export interface SignMessageRequest {
879
+ message: string;
880
+ compact: boolean;
881
+ }
879
882
 
880
- export interface SendOnchainFeeQuote {
881
- id: string;
882
- expiresAt: number;
883
- speedFast: SendOnchainSpeedFeeQuote;
884
- speedMedium: SendOnchainSpeedFeeQuote;
885
- speedSlow: SendOnchainSpeedFeeQuote;
883
+ export interface SendPaymentRequest {
884
+ prepareResponse: PrepareSendPaymentResponse;
885
+ options?: SendPaymentOptions;
886
+ idempotencyKey?: string;
886
887
  }
887
888
 
888
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
889
+ export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
889
890
 
890
- export interface FiatCurrency {
891
- id: string;
892
- info: CurrencyInfo;
891
+ export interface SendOnchainSpeedFeeQuote {
892
+ userFeeSat: number;
893
+ l1BroadcastFeeSat: number;
893
894
  }
894
895
 
895
- export interface Bip21Extra {
896
- key: string;
897
- value: string;
896
+ export interface SendPaymentResponse {
897
+ payment: Payment;
898
898
  }
899
899
 
900
- export interface SilentPaymentAddressDetails {
901
- address: string;
902
- network: BitcoinNetwork;
903
- source: PaymentRequestSource;
900
+ export interface ConnectRequest {
901
+ config: Config;
902
+ seed: Seed;
903
+ storageDir: string;
904
904
  }
905
905
 
906
- export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeeded" | "refunded";
906
+ export interface RegisterWebhookResponse {
907
+ webhookId: string;
908
+ }
907
909
 
908
- export interface BuyBitcoinResponse {
909
- url: string;
910
+ export interface RefundDepositResponse {
911
+ txId: string;
912
+ txHex: string;
910
913
  }
911
914
 
912
- export interface AesSuccessActionDataDecrypted {
913
- description: string;
914
- plaintext: string;
915
+ export interface Bolt12OfferDetails {
916
+ absoluteExpiry?: number;
917
+ chains: string[];
918
+ description?: string;
919
+ issuer?: string;
920
+ minAmount?: Amount;
921
+ offer: Bolt12Offer;
922
+ paths: Bolt12OfferBlindedPath[];
923
+ signingPubkey?: string;
915
924
  }
916
925
 
917
- export interface CheckLightningAddressRequest {
918
- username: string;
926
+ export interface PaymentRequestSource {
927
+ bip21Uri?: string;
928
+ bip353Address?: string;
919
929
  }
920
930
 
921
- export interface GetTokensMetadataResponse {
922
- tokensMetadata: TokenMetadata[];
931
+ export interface LnurlWithdrawResponse {
932
+ paymentRequest: string;
933
+ payment?: Payment;
923
934
  }
924
935
 
925
- export interface ListContactsRequest {
926
- offset?: number;
927
- limit?: number;
936
+ export interface ConversionInfo {
937
+ poolId: string;
938
+ conversionId: string;
939
+ status: ConversionStatus;
940
+ fee?: string;
941
+ purpose?: ConversionPurpose;
942
+ amountAdjustment?: AmountAdjustmentReason;
928
943
  }
929
944
 
930
- export interface Bolt11RouteHintHop {
931
- srcNodeId: string;
932
- shortChannelId: string;
933
- feesBaseMsat: number;
934
- feesProportionalMillionths: number;
935
- cltvExpiryDelta: number;
936
- htlcMinimumMsat?: number;
937
- htlcMaximumMsat?: number;
945
+ export interface UpdateContactRequest {
946
+ id: string;
947
+ name: string;
948
+ paymentIdentifier: string;
938
949
  }
939
950
 
940
- export interface Bolt12InvoiceRequestDetails {}
951
+ export interface OptimizationConfig {
952
+ autoEnabled: boolean;
953
+ multiplicity: number;
954
+ }
941
955
 
942
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
956
+ export interface LnurlWithdrawInfo {
957
+ withdrawUrl: string;
958
+ }
943
959
 
944
- export interface PrepareSendPaymentRequest {
945
- paymentRequest: string;
946
- amount?: bigint;
947
- tokenIdentifier?: string;
948
- conversionOptions?: ConversionOptions;
949
- feePolicy?: FeePolicy;
960
+ export interface SparkAddressDetails {
961
+ address: string;
962
+ identityPublicKey: string;
963
+ network: BitcoinNetwork;
964
+ source: PaymentRequestSource;
950
965
  }
951
966
 
952
- export type PaymentStatus = "completed" | "pending" | "failed";
967
+ export interface Rate {
968
+ coin: string;
969
+ value: number;
970
+ }
953
971
 
954
- export interface LocaleOverrides {
955
- locale: string;
956
- spacing?: number;
957
- symbol: Symbol;
972
+ export interface ClaimHtlcPaymentResponse {
973
+ payment: Payment;
958
974
  }
959
975
 
960
- export interface RegisterWebhookResponse {
961
- webhookId: string;
976
+ export interface Bolt12OfferBlindedPath {
977
+ blindedHops: string[];
962
978
  }
963
979
 
964
- export interface LnurlAuthRequestDetails {
965
- k1: string;
966
- action?: string;
967
- domain: string;
968
- url: string;
980
+ export interface GetTokensMetadataResponse {
981
+ tokensMetadata: TokenMetadata[];
969
982
  }
970
983
 
971
984
  export interface GetInfoResponse {
@@ -974,36 +987,9 @@ export interface GetInfoResponse {
974
987
  tokenBalances: Map<string, TokenBalance>;
975
988
  }
976
989
 
977
- export interface StableBalanceConfig {
978
- tokens: StableBalanceToken[];
979
- defaultActiveLabel?: string;
980
- thresholdSats?: number;
981
- maxSlippageBps?: number;
982
- }
990
+ 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 };
983
991
 
984
- export interface Config {
985
- apiKey?: string;
986
- network: Network;
987
- syncIntervalSecs: number;
988
- maxDepositClaimFee?: MaxFee;
989
- lnurlDomain?: string;
990
- preferSparkOverLightning: boolean;
991
- externalInputParsers?: ExternalInputParser[];
992
- useDefaultExternalInputParsers: boolean;
993
- realTimeSyncServerUrl?: string;
994
- privateEnabledDefault: boolean;
995
- optimizationConfig: OptimizationConfig;
996
- stableBalanceConfig?: StableBalanceConfig;
997
- /**
998
- * Maximum number of concurrent transfer claims.
999
- *
1000
- * Controls how many pending Spark transfers can be claimed in parallel.
1001
- * Default is 4. Increase for server environments with high incoming
1002
- * payment volume to improve throughput.
1003
- */
1004
- maxConcurrentClaims: number;
1005
- sparkConfig?: SparkConfig;
1006
- }
992
+ 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[] };
1007
993
 
1008
994
  export interface Record {
1009
995
  id: RecordId;
@@ -1012,79 +998,93 @@ export interface Record {
1012
998
  data: Map<string, string>;
1013
999
  }
1014
1000
 
1015
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
1016
-
1017
- export interface Bolt11RouteHint {
1018
- hops: Bolt11RouteHintHop[];
1019
- }
1020
-
1021
- export interface DepositInfo {
1022
- txid: string;
1023
- vout: number;
1024
- amountSats: number;
1025
- isMature: boolean;
1026
- refundTx?: string;
1027
- refundTxId?: string;
1028
- claimError?: DepositClaimError;
1001
+ export interface RecordChange {
1002
+ id: RecordId;
1003
+ schemaVersion: string;
1004
+ updatedFields: Map<string, string>;
1005
+ localRevision: number;
1029
1006
  }
1030
1007
 
1031
- export interface Contact {
1032
- id: string;
1033
- name: string;
1034
- paymentIdentifier: string;
1035
- createdAt: number;
1036
- updatedAt: number;
1008
+ export interface ReceivePaymentRequest {
1009
+ paymentMethod: ReceivePaymentMethod;
1037
1010
  }
1038
1011
 
1039
- export interface SparkHtlcOptions {
1040
- paymentHash: string;
1041
- expiryDurationSecs: number;
1042
- }
1012
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
1043
1013
 
1044
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
1014
+ export interface PrepareSendPaymentResponse {
1015
+ paymentMethod: SendPaymentMethod;
1016
+ amount: bigint;
1017
+ tokenIdentifier?: string;
1018
+ conversionEstimate?: ConversionEstimate;
1019
+ feePolicy: FeePolicy;
1020
+ }
1045
1021
 
1046
- export interface LogEntry {
1047
- line: string;
1048
- level: string;
1022
+ export interface Bolt12Invoice {
1023
+ invoice: string;
1024
+ source: PaymentRequestSource;
1049
1025
  }
1050
1026
 
1051
- export interface StorageListPaymentsRequest {
1052
- typeFilter?: PaymentType[];
1053
- statusFilter?: PaymentStatus[];
1054
- assetFilter?: AssetFilter;
1055
- paymentDetailsFilter?: StoragePaymentDetailsFilter[];
1056
- fromTimestamp?: number;
1057
- toTimestamp?: number;
1058
- offset?: number;
1059
- limit?: number;
1060
- sortAscending?: boolean;
1027
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
1028
+
1029
+ export interface Credentials {
1030
+ username: string;
1031
+ password: string;
1061
1032
  }
1062
1033
 
1063
- export interface SetLnurlMetadataItem {
1034
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
1035
+
1036
+ export interface Bolt11InvoiceDetails {
1037
+ amountMsat?: number;
1038
+ description?: string;
1039
+ descriptionHash?: string;
1040
+ expiry: number;
1041
+ invoice: Bolt11Invoice;
1042
+ minFinalCltvExpiryDelta: number;
1043
+ network: BitcoinNetwork;
1044
+ payeePubkey: string;
1064
1045
  paymentHash: string;
1065
- senderComment?: string;
1066
- nostrZapRequest?: string;
1067
- nostrZapReceipt?: string;
1046
+ paymentSecret: string;
1047
+ routingHints: Bolt11RouteHint[];
1048
+ timestamp: number;
1068
1049
  }
1069
1050
 
1070
- export interface ListFiatRatesResponse {
1071
- rates: Rate[];
1051
+ export interface SilentPaymentAddressDetails {
1052
+ address: string;
1053
+ network: BitcoinNetwork;
1054
+ source: PaymentRequestSource;
1072
1055
  }
1073
1056
 
1074
- export type PaymentType = "send" | "receive";
1057
+ export interface SyncWalletResponse {}
1075
1058
 
1076
- export interface Bolt12Invoice {
1077
- invoice: string;
1078
- source: PaymentRequestSource;
1059
+ export interface ClaimDepositRequest {
1060
+ txid: string;
1061
+ vout: number;
1062
+ maxFee?: MaxFee;
1079
1063
  }
1080
1064
 
1081
- export interface ListPaymentsResponse {
1082
- payments: Payment[];
1065
+ 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 };
1066
+
1067
+ export interface OptimizationProgress {
1068
+ isRunning: boolean;
1069
+ currentRound: number;
1070
+ totalRounds: number;
1083
1071
  }
1084
1072
 
1085
- export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
1073
+ 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 };
1086
1074
 
1087
- export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
1075
+ export interface SparkConfig {
1076
+ coordinatorIdentifier: string;
1077
+ threshold: number;
1078
+ signingOperators: SparkSigningOperator[];
1079
+ sspConfig: SparkSspConfig;
1080
+ expectedWithdrawBondSats: number;
1081
+ expectedWithdrawRelativeBlockLocktime: number;
1082
+ }
1083
+
1084
+ export interface SparkHtlcOptions {
1085
+ paymentHash: string;
1086
+ expiryDurationSecs: number;
1087
+ }
1088
1088
 
1089
1089
  /**
1090
1090
  * Interface for passkey PRF (Pseudo-Random Function) operations.
@@ -1138,19 +1138,24 @@ export interface PasskeyPrfProvider {
1138
1138
  isPrfAvailable(): Promise<boolean>;
1139
1139
  }
1140
1140
 
1141
- export interface UnfreezeIssuerTokenRequest {
1142
- address: string;
1143
- }
1144
-
1145
1141
  export interface FreezeIssuerTokenResponse {
1146
1142
  impactedOutputIds: string[];
1147
1143
  impactedTokenAmount: bigint;
1148
1144
  }
1149
1145
 
1150
- export interface FreezeIssuerTokenRequest {
1146
+ export interface BurnIssuerTokenRequest {
1147
+ amount: bigint;
1148
+ }
1149
+
1150
+ export interface UnfreezeIssuerTokenRequest {
1151
1151
  address: string;
1152
1152
  }
1153
1153
 
1154
+ export interface UnfreezeIssuerTokenResponse {
1155
+ impactedOutputIds: string[];
1156
+ impactedTokenAmount: bigint;
1157
+ }
1158
+
1154
1159
  export interface CreateIssuerTokenRequest {
1155
1160
  name: string;
1156
1161
  ticker: string;
@@ -1159,16 +1164,11 @@ export interface CreateIssuerTokenRequest {
1159
1164
  maxSupply: bigint;
1160
1165
  }
1161
1166
 
1162
- export interface MintIssuerTokenRequest {
1163
- amount: bigint;
1164
- }
1165
-
1166
- export interface UnfreezeIssuerTokenResponse {
1167
- impactedOutputIds: string[];
1168
- impactedTokenAmount: bigint;
1167
+ export interface FreezeIssuerTokenRequest {
1168
+ address: string;
1169
1169
  }
1170
1170
 
1171
- export interface BurnIssuerTokenRequest {
1171
+ export interface MintIssuerTokenRequest {
1172
1172
  amount: bigint;
1173
1173
  }
1174
1174
 
@@ -1195,33 +1195,9 @@ export interface ExternalSigner {
1195
1195
  hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
1196
1196
  }
1197
1197
 
1198
- export interface ExternalSecretShare {
1199
- threshold: number;
1200
- index: ExternalScalar;
1201
- share: ExternalScalar;
1202
- }
1203
-
1204
- export interface ExternalVerifiableSecretShare {
1205
- secretShare: ExternalSecretShare;
1206
- proofs: number[][];
1207
- }
1208
-
1209
- export interface ExternalEncryptedSecret {
1210
- ciphertext: number[];
1211
- }
1212
-
1213
- export interface IdentifierSignaturePair {
1198
+ export interface IdentifierCommitmentPair {
1214
1199
  identifier: ExternalIdentifier;
1215
- signature: ExternalFrostSignatureShare;
1216
- }
1217
-
1218
- export interface ExternalSigningCommitments {
1219
- hiding: number[];
1220
- binding: number[];
1221
- }
1222
-
1223
- export interface HashedMessageBytes {
1224
- bytes: number[];
1200
+ commitment: ExternalSigningCommitments;
1225
1201
  }
1226
1202
 
1227
1203
  export interface ExternalSignFrostRequest {
@@ -1234,26 +1210,45 @@ export interface ExternalSignFrostRequest {
1234
1210
  adaptorPublicKey?: number[];
1235
1211
  }
1236
1212
 
1237
- export interface ExternalIdentifier {
1213
+ export interface EcdsaSignatureBytes {
1238
1214
  bytes: number[];
1239
1215
  }
1240
1216
 
1241
- export interface ExternalFrostSignatureShare {
1242
- bytes: number[];
1217
+ export interface ExternalEncryptedSecret {
1218
+ ciphertext: number[];
1243
1219
  }
1244
1220
 
1245
- export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
1221
+ export interface HashedMessageBytes {
1222
+ bytes: number[];
1223
+ }
1246
1224
 
1247
1225
  export interface RecoverableEcdsaSignatureBytes {
1248
1226
  bytes: number[];
1249
1227
  }
1250
1228
 
1251
- export interface EcdsaSignatureBytes {
1229
+ export interface MessageBytes {
1252
1230
  bytes: number[];
1253
1231
  }
1254
1232
 
1255
- export interface ExternalTreeNodeId {
1256
- id: string;
1233
+ export interface ExternalFrostCommitments {
1234
+ hidingCommitment: number[];
1235
+ bindingCommitment: number[];
1236
+ noncesCiphertext: number[];
1237
+ }
1238
+
1239
+ export interface SchnorrSignatureBytes {
1240
+ bytes: number[];
1241
+ }
1242
+
1243
+ export interface ExternalFrostSignature {
1244
+ bytes: number[];
1245
+ }
1246
+
1247
+ export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
1248
+
1249
+ export interface IdentifierSignaturePair {
1250
+ identifier: ExternalIdentifier;
1251
+ signature: ExternalFrostSignatureShare;
1257
1252
  }
1258
1253
 
1259
1254
  export interface ExternalAggregateFrostRequest {
@@ -1268,30 +1263,39 @@ export interface ExternalAggregateFrostRequest {
1268
1263
  adaptorPublicKey?: number[];
1269
1264
  }
1270
1265
 
1271
- export interface SchnorrSignatureBytes {
1266
+ export interface SecretBytes {
1272
1267
  bytes: number[];
1273
1268
  }
1274
1269
 
1275
- export interface ExternalFrostCommitments {
1276
- hidingCommitment: number[];
1277
- bindingCommitment: number[];
1278
- noncesCiphertext: number[];
1270
+ export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1271
+
1272
+ export interface ExternalSigningCommitments {
1273
+ hiding: number[];
1274
+ binding: number[];
1279
1275
  }
1280
1276
 
1281
- export interface SecretBytes {
1282
- bytes: number[];
1277
+ export interface ExternalVerifiableSecretShare {
1278
+ secretShare: ExternalSecretShare;
1279
+ proofs: number[][];
1283
1280
  }
1284
1281
 
1285
- export interface IdentifierCommitmentPair {
1286
- identifier: ExternalIdentifier;
1287
- commitment: ExternalSigningCommitments;
1282
+ export interface ExternalTreeNodeId {
1283
+ id: string;
1284
+ }
1285
+
1286
+ export interface ExternalScalar {
1287
+ bytes: number[];
1288
1288
  }
1289
1289
 
1290
1290
  export interface PublicKeyBytes {
1291
1291
  bytes: number[];
1292
1292
  }
1293
1293
 
1294
- export interface ExternalFrostSignature {
1294
+ export interface ExternalIdentifier {
1295
+ bytes: number[];
1296
+ }
1297
+
1298
+ export interface ExternalFrostSignatureShare {
1295
1299
  bytes: number[];
1296
1300
  }
1297
1301
 
@@ -1300,14 +1304,24 @@ export interface IdentifierPublicKeyPair {
1300
1304
  publicKey: number[];
1301
1305
  }
1302
1306
 
1303
- export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1304
-
1305
- export interface MessageBytes {
1306
- bytes: number[];
1307
+ export interface ExternalSecretShare {
1308
+ threshold: number;
1309
+ index: ExternalScalar;
1310
+ share: ExternalScalar;
1307
1311
  }
1308
1312
 
1309
- export interface ExternalScalar {
1310
- bytes: number[];
1313
+ /**
1314
+ * A wallet derived from a passkey.
1315
+ */
1316
+ export interface Wallet {
1317
+ /**
1318
+ * The derived seed.
1319
+ */
1320
+ seed: Seed;
1321
+ /**
1322
+ * The label used for derivation.
1323
+ */
1324
+ label: string;
1311
1325
  }
1312
1326
 
1313
1327
  /**
@@ -1327,20 +1341,6 @@ export interface NostrRelayConfig {
1327
1341
  timeoutSecs?: number;
1328
1342
  }
1329
1343
 
1330
- /**
1331
- * A wallet derived from a passkey.
1332
- */
1333
- export interface Wallet {
1334
- /**
1335
- * The derived seed.
1336
- */
1337
- seed: Seed;
1338
- /**
1339
- * The label used for derivation.
1340
- */
1341
- label: string;
1342
- }
1343
-
1344
1344
  export interface Storage {
1345
1345
  getCachedItem: (key: string) => Promise<string | null>;
1346
1346
  setCachedItem: (key: string, value: string) => Promise<void>;