@breeztech/breez-sdk-spark 0.9.1 → 0.11.0-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.
@@ -1,16 +1,25 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
4
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
- export function defaultConfig(network: Network): Config;
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;
6
12
  /**
7
13
  * Creates a default external signer from a mnemonic phrase.
8
14
  *
9
15
  * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
10
16
  */
11
17
  export function getSparkStatus(): Promise<SparkStatus>;
12
- export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
18
+ export function defaultConfig(network: Network): Config;
19
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
20
+ export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
13
21
  export function connect(request: ConnectRequest): Promise<BreezSdk>;
22
+ export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
14
23
  /**
15
24
  * Entry point invoked by JavaScript in a worker.
16
25
  */
@@ -21,6 +30,28 @@ export function task_worker_entry_point(ptr: number): void;
21
30
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
22
31
  */
23
32
  type ReadableStreamType = "bytes";
33
+ /**
34
+ * Configuration for PostgreSQL storage connection pool.
35
+ */
36
+ export interface PostgresStorageConfig {
37
+ /**
38
+ * PostgreSQL connection string (URI format).
39
+ */
40
+ connectionString: string;
41
+ /**
42
+ * Maximum number of connections in the pool.
43
+ */
44
+ maxPoolSize: number;
45
+ /**
46
+ * Timeout in seconds for establishing a new connection (0 = no timeout).
47
+ */
48
+ createTimeoutSecs: number;
49
+ /**
50
+ * Timeout in seconds before recycling an idle connection.
51
+ */
52
+ recycleTimeoutSecs: number;
53
+ }
54
+
24
55
  export interface EventListener {
25
56
  onEvent: (e: SdkEvent) => void;
26
57
  }
@@ -59,6 +90,8 @@ export interface TxStatus {
59
90
  blockTime?: number;
60
91
  }
61
92
 
93
+ export type ChainApiType = "esplora" | "mempoolSpace";
94
+
62
95
  export interface Utxo {
63
96
  txid: string;
64
97
  vout: number;
@@ -66,8 +99,6 @@ export interface Utxo {
66
99
  status: TxStatus;
67
100
  }
68
101
 
69
- export type ChainApiType = "esplora" | "mempoolSpace";
70
-
71
102
  export interface RecommendedFees {
72
103
  fastestFee: number;
73
104
  halfHourFee: number;
@@ -80,36 +111,53 @@ export interface PaymentObserver {
80
111
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
81
112
  }
82
113
 
83
- export interface ConversionDetails {
84
- from: ConversionStep;
85
- to: ConversionStep;
114
+ export interface BitcoinAddressDetails {
115
+ address: string;
116
+ network: BitcoinNetwork;
117
+ source: PaymentRequestSource;
86
118
  }
87
119
 
88
- export interface Bolt12InvoiceDetails {
89
- amountMsat: number;
90
- invoice: Bolt12Invoice;
120
+ export interface Contact {
121
+ id: string;
122
+ name: string;
123
+ paymentIdentifier: string;
124
+ createdAt: number;
125
+ updatedAt: number;
91
126
  }
92
127
 
93
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
128
+ export interface ListUnclaimedDepositsRequest {}
94
129
 
95
- export interface LnurlPayResponse {
96
- payment: Payment;
97
- successAction?: SuccessActionProcessed;
130
+ export interface PrepareSendPaymentRequest {
131
+ paymentRequest: string;
132
+ amount?: bigint;
133
+ tokenIdentifier?: string;
134
+ conversionOptions?: ConversionOptions;
135
+ feePolicy?: FeePolicy;
98
136
  }
99
137
 
100
- export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
101
-
102
- export interface ReceivePaymentResponse {
103
- paymentRequest: string;
104
- fee: bigint;
138
+ export interface KeySetConfig {
139
+ keySetType: KeySetType;
140
+ useAddressIndex: boolean;
141
+ accountNumber?: number;
105
142
  }
106
143
 
107
- export interface SignMessageRequest {
108
- message: string;
109
- compact: boolean;
144
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
145
+
146
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
147
+
148
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
149
+
150
+ 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);
151
+
152
+ export interface ConversionStep {
153
+ paymentId: string;
154
+ amount: bigint;
155
+ fee: bigint;
156
+ method: PaymentMethod;
157
+ tokenMetadata?: TokenMetadata;
110
158
  }
111
159
 
112
- 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 };
160
+ export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
113
161
 
114
162
  export interface Config {
115
163
  apiKey?: string;
@@ -132,60 +180,57 @@ export interface Config {
132
180
  * payment volume to improve throughput.
133
181
  */
134
182
  maxConcurrentClaims: number;
183
+ supportLnurlVerify: boolean;
135
184
  }
136
185
 
137
- export interface SparkInvoicePaymentDetails {
138
- description?: string;
139
- invoice: string;
186
+ export interface Bolt11Invoice {
187
+ bolt11: string;
188
+ source: PaymentRequestSource;
140
189
  }
141
190
 
142
- export interface SparkInvoiceDetails {
143
- invoice: string;
144
- identityPublicKey: string;
145
- network: BitcoinNetwork;
146
- amount?: string;
147
- tokenIdentifier?: string;
148
- expiryTime?: number;
149
- description?: string;
150
- senderPublicKey?: string;
151
- }
191
+ export type PaymentStatus = "completed" | "pending" | "failed";
152
192
 
153
- export interface LnurlErrorDetails {
154
- reason: string;
193
+ export type PaymentType = "send" | "receive";
194
+
195
+ export interface LnurlReceiveMetadata {
196
+ nostrZapRequest?: string;
197
+ nostrZapReceipt?: string;
198
+ senderComment?: string;
155
199
  }
156
200
 
157
- export interface RefundDepositResponse {
158
- txId: string;
159
- txHex: string;
201
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
202
+
203
+ export interface Bolt11RouteHint {
204
+ hops: Bolt11RouteHintHop[];
160
205
  }
161
206
 
162
- export interface BuyBitcoinResponse {
163
- url: string;
207
+ export interface ConversionOptions {
208
+ conversionType: ConversionType;
209
+ maxSlippageBps?: number;
210
+ completionTimeoutSecs?: number;
164
211
  }
165
212
 
166
- export interface Payment {
167
- id: string;
168
- paymentType: PaymentType;
169
- status: PaymentStatus;
170
- amount: bigint;
171
- fees: bigint;
172
- timestamp: number;
173
- method: PaymentMethod;
174
- details?: PaymentDetails;
175
- conversionDetails?: ConversionDetails;
213
+ export interface GetInfoRequest {
214
+ ensureSynced?: boolean;
176
215
  }
177
216
 
178
- export interface FetchConversionLimitsResponse {
179
- minFromAmount?: bigint;
180
- minToAmount?: bigint;
217
+ export interface Record {
218
+ id: RecordId;
219
+ revision: number;
220
+ schemaVersion: string;
221
+ data: Map<string, string>;
181
222
  }
182
223
 
183
- export interface LightningAddressDetails {
184
- address: string;
185
- payRequest: LnurlPayRequestDetails;
224
+ export interface SignMessageRequest {
225
+ message: string;
226
+ compact: boolean;
186
227
  }
187
228
 
188
- export type PaymentType = "send" | "receive";
229
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
230
+
231
+ 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 };
232
+
233
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
189
234
 
190
235
  export interface LnurlPayRequestDetails {
191
236
  callback: string;
@@ -200,80 +245,92 @@ export interface LnurlPayRequestDetails {
200
245
  nostrPubkey?: string;
201
246
  }
202
247
 
203
- export interface GetTokensMetadataResponse {
204
- tokensMetadata: TokenMetadata[];
248
+ export interface UserSettings {
249
+ sparkPrivateModeEnabled: boolean;
205
250
  }
206
251
 
207
- 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 };
208
-
209
- export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
210
-
211
- export interface ListFiatCurrenciesResponse {
212
- currencies: FiatCurrency[];
252
+ export interface RegisterLightningAddressRequest {
253
+ username: string;
254
+ description?: string;
213
255
  }
214
256
 
215
- export interface UpdateUserSettingsRequest {
216
- sparkPrivateModeEnabled?: boolean;
257
+ export interface ClaimHtlcPaymentResponse {
258
+ payment: Payment;
217
259
  }
218
260
 
219
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
261
+ export interface RefundDepositRequest {
262
+ txid: string;
263
+ vout: number;
264
+ destinationAddress: string;
265
+ fee: Fee;
266
+ }
220
267
 
221
- export interface OptimizationConfig {
222
- autoEnabled: boolean;
223
- multiplicity: number;
268
+ export interface GetInfoResponse {
269
+ identityPubkey: string;
270
+ balanceSats: number;
271
+ tokenBalances: Map<string, TokenBalance>;
224
272
  }
225
273
 
226
- export interface Record {
227
- id: RecordId;
228
- revision: number;
229
- schemaVersion: string;
230
- data: Map<string, string>;
274
+ export interface LocaleOverrides {
275
+ locale: string;
276
+ spacing?: number;
277
+ symbol: Symbol;
231
278
  }
232
279
 
233
- export interface Bolt11Invoice {
234
- bolt11: string;
235
- source: PaymentRequestSource;
280
+ export interface PrepareLnurlPayRequest {
281
+ amountSats: number;
282
+ comment?: string;
283
+ payRequest: LnurlPayRequestDetails;
284
+ validateSuccessActionUrl?: boolean;
285
+ conversionOptions?: ConversionOptions;
286
+ feePolicy?: FeePolicy;
236
287
  }
237
288
 
238
- export interface ListPaymentsResponse {
239
- payments: Payment[];
289
+ export interface LightningAddressInfo {
290
+ description: string;
291
+ lightningAddress: string;
292
+ lnurl: LnurlInfo;
293
+ username: string;
240
294
  }
241
295
 
242
- export interface LnurlWithdrawRequestDetails {
243
- callback: string;
244
- k1: string;
245
- defaultDescription: string;
246
- minWithdrawable: number;
247
- maxWithdrawable: number;
296
+ export interface GetPaymentRequest {
297
+ paymentId: string;
248
298
  }
249
299
 
250
- export interface DepositInfo {
251
- txid: string;
252
- vout: number;
253
- amountSats: number;
254
- refundTx?: string;
255
- refundTxId?: string;
256
- claimError?: DepositClaimError;
300
+ export interface Bolt11InvoiceDetails {
301
+ amountMsat?: number;
302
+ description?: string;
303
+ descriptionHash?: string;
304
+ expiry: number;
305
+ invoice: Bolt11Invoice;
306
+ minFinalCltvExpiryDelta: number;
307
+ network: BitcoinNetwork;
308
+ payeePubkey: string;
309
+ paymentHash: string;
310
+ paymentSecret: string;
311
+ routingHints: Bolt11RouteHint[];
312
+ timestamp: number;
257
313
  }
258
314
 
259
- export interface ConnectRequest {
260
- config: Config;
261
- seed: Seed;
262
- storageDir: string;
315
+ export interface TokenMetadata {
316
+ identifier: string;
317
+ issuerPublicKey: string;
318
+ name: string;
319
+ ticker: string;
320
+ decimals: number;
321
+ maxSupply: string;
322
+ isFreezable: boolean;
263
323
  }
264
324
 
265
- export interface ClaimDepositResponse {
266
- payment: Payment;
325
+ export interface LnurlWithdrawResponse {
326
+ paymentRequest: string;
327
+ payment?: Payment;
267
328
  }
268
329
 
269
- export interface LnurlWithdrawInfo {
270
- withdrawUrl: string;
271
- }
272
-
273
- export interface LnurlWithdrawRequest {
274
- amountSats: number;
275
- withdrawRequest: LnurlWithdrawRequestDetails;
276
- completionTimeoutSecs?: number;
330
+ export interface OptimizationProgress {
331
+ isRunning: boolean;
332
+ currentRound: number;
333
+ totalRounds: number;
277
334
  }
278
335
 
279
336
  export interface LogEntry {
@@ -281,37 +338,73 @@ export interface LogEntry {
281
338
  level: string;
282
339
  }
283
340
 
284
- export interface Bolt11RouteHint {
285
- hops: Bolt11RouteHintHop[];
341
+ export interface SilentPaymentAddressDetails {
342
+ address: string;
343
+ network: BitcoinNetwork;
344
+ source: PaymentRequestSource;
286
345
  }
287
346
 
288
- export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
347
+ export interface ListUnclaimedDepositsResponse {
348
+ deposits: DepositInfo[];
349
+ }
289
350
 
290
- export interface BuyBitcoinRequest {
291
- lockedAmountSat?: number;
292
- redirectUrl?: string;
351
+ export interface AesSuccessActionData {
352
+ description: string;
353
+ ciphertext: string;
354
+ iv: string;
293
355
  }
294
356
 
295
- export interface ExternalInputParser {
296
- providerId: string;
297
- inputRegex: string;
298
- parserUrl: string;
357
+ export interface SendPaymentRequest {
358
+ prepareResponse: PrepareSendPaymentResponse;
359
+ options?: SendPaymentOptions;
360
+ idempotencyKey?: string;
299
361
  }
300
362
 
301
- export interface CheckLightningAddressRequest {
302
- username: string;
363
+ export interface Bolt12InvoiceRequestDetails {}
364
+
365
+ export interface SparkHtlcOptions {
366
+ paymentHash: string;
367
+ expiryDurationSecs: number;
303
368
  }
304
369
 
305
- export interface LnurlAuthRequestDetails {
306
- k1: string;
307
- action?: string;
308
- domain: string;
309
- url: string;
370
+ export interface Payment {
371
+ id: string;
372
+ paymentType: PaymentType;
373
+ status: PaymentStatus;
374
+ amount: bigint;
375
+ fees: bigint;
376
+ timestamp: number;
377
+ method: PaymentMethod;
378
+ details?: PaymentDetails;
379
+ conversionDetails?: ConversionDetails;
310
380
  }
311
381
 
312
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
382
+ export interface SignMessageResponse {
383
+ pubkey: string;
384
+ signature: string;
385
+ }
313
386
 
314
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
387
+ 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 };
388
+
389
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
390
+
391
+ export interface StorageListPaymentsRequest {
392
+ typeFilter?: PaymentType[];
393
+ statusFilter?: PaymentStatus[];
394
+ assetFilter?: AssetFilter;
395
+ paymentDetailsFilter?: StoragePaymentDetailsFilter[];
396
+ fromTimestamp?: number;
397
+ toTimestamp?: number;
398
+ offset?: number;
399
+ limit?: number;
400
+ sortAscending?: boolean;
401
+ }
402
+
403
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
404
+
405
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
406
+
407
+ export interface SyncWalletRequest {}
315
408
 
316
409
  export interface LnurlPayInfo {
317
410
  lnAddress?: string;
@@ -322,119 +415,81 @@ export interface LnurlPayInfo {
322
415
  rawSuccessAction?: SuccessAction;
323
416
  }
324
417
 
325
- export interface LocalizedName {
326
- locale: string;
327
- name: string;
328
- }
329
-
330
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
331
-
332
- export interface Credentials {
333
- username: string;
334
- password: string;
335
- }
336
-
337
- export interface LnurlWithdrawResponse {
338
- paymentRequest: string;
339
- payment?: Payment;
418
+ export interface ConversionEstimate {
419
+ options: ConversionOptions;
420
+ amount: bigint;
421
+ fee: bigint;
340
422
  }
341
423
 
342
- export interface SendOnchainFeeQuote {
343
- id: string;
344
- expiresAt: number;
345
- speedFast: SendOnchainSpeedFeeQuote;
346
- speedMedium: SendOnchainSpeedFeeQuote;
347
- speedSlow: SendOnchainSpeedFeeQuote;
348
- }
424
+ export type FeePolicy = "feesExcluded" | "feesIncluded";
349
425
 
350
- export interface SparkAddressDetails {
351
- address: string;
352
- identityPublicKey: string;
353
- network: BitcoinNetwork;
354
- source: PaymentRequestSource;
426
+ export interface UnversionedRecordChange {
427
+ id: RecordId;
428
+ schemaVersion: string;
429
+ updatedFields: Map<string, string>;
355
430
  }
356
431
 
357
- export interface SilentPaymentAddressDetails {
358
- address: string;
359
- network: BitcoinNetwork;
360
- source: PaymentRequestSource;
361
- }
432
+ 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 };
362
433
 
363
- export interface OutgoingChange {
364
- change: RecordChange;
365
- parent?: Record;
434
+ export interface CheckMessageRequest {
435
+ message: string;
436
+ pubkey: string;
437
+ signature: string;
366
438
  }
367
439
 
368
- export interface TokenBalance {
369
- balance: bigint;
370
- tokenMetadata: TokenMetadata;
440
+ export interface DepositInfo {
441
+ txid: string;
442
+ vout: number;
443
+ amountSats: number;
444
+ refundTx?: string;
445
+ refundTxId?: string;
446
+ claimError?: DepositClaimError;
371
447
  }
372
448
 
373
- export interface LnurlPayRequest {
374
- prepareResponse: PrepareLnurlPayResponse;
375
- idempotencyKey?: string;
449
+ export interface ListFiatCurrenciesResponse {
450
+ currencies: FiatCurrency[];
376
451
  }
377
452
 
378
- export interface SetLnurlMetadataItem {
379
- paymentHash: string;
380
- senderComment?: string;
381
- nostrZapRequest?: string;
382
- nostrZapReceipt?: string;
453
+ export interface PaymentRequestSource {
454
+ bip21Uri?: string;
455
+ bip353Address?: string;
383
456
  }
384
457
 
385
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
386
-
387
- export interface KeySetConfig {
388
- keySetType: KeySetType;
389
- useAddressIndex: boolean;
390
- accountNumber?: number;
458
+ export interface ReceivePaymentRequest {
459
+ paymentMethod: ReceivePaymentMethod;
391
460
  }
392
461
 
393
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
394
-
395
- export interface GetPaymentResponse {
396
- payment: Payment;
462
+ export interface CheckMessageResponse {
463
+ isValid: boolean;
397
464
  }
398
465
 
399
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
400
-
401
- export interface SendPaymentRequest {
402
- prepareResponse: PrepareSendPaymentResponse;
403
- options?: SendPaymentOptions;
404
- idempotencyKey?: string;
405
- }
466
+ export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
406
467
 
407
- export interface PrepareLnurlPayResponse {
408
- amountSats: number;
409
- comment?: string;
410
- payRequest: LnurlPayRequestDetails;
411
- feeSats: number;
412
- invoiceDetails: Bolt11InvoiceDetails;
413
- successAction?: SuccessAction;
414
- conversionEstimate?: ConversionEstimate;
415
- feePolicy: FeePolicy;
468
+ export interface CheckLightningAddressRequest {
469
+ username: string;
416
470
  }
417
471
 
418
- export interface Bolt12OfferBlindedPath {
419
- blindedHops: string[];
472
+ export interface ListPaymentsResponse {
473
+ payments: Payment[];
420
474
  }
421
475
 
422
- export interface FetchConversionLimitsRequest {
423
- conversionType: ConversionType;
424
- tokenIdentifier?: string;
476
+ export interface RecordChange {
477
+ id: RecordId;
478
+ schemaVersion: string;
479
+ updatedFields: Map<string, string>;
480
+ localRevision: number;
425
481
  }
426
482
 
427
- export interface SendOnchainSpeedFeeQuote {
428
- userFeeSat: number;
429
- l1BroadcastFeeSat: number;
483
+ export interface BuyBitcoinResponse {
484
+ url: string;
430
485
  }
431
486
 
432
- export interface Bip21Extra {
433
- key: string;
434
- value: string;
487
+ export interface TokenBalance {
488
+ balance: bigint;
489
+ tokenMetadata: TokenMetadata;
435
490
  }
436
491
 
437
- 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 };
492
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
438
493
 
439
494
  export interface SparkHtlcDetails {
440
495
  paymentHash: string;
@@ -443,49 +498,41 @@ export interface SparkHtlcDetails {
443
498
  status: SparkHtlcStatus;
444
499
  }
445
500
 
446
- export interface Bip21Details {
447
- amountSat?: number;
448
- assetId?: string;
449
- uri: string;
450
- extras: Bip21Extra[];
451
- label?: string;
452
- message?: string;
453
- paymentMethods: InputType[];
501
+ export interface ListPaymentsRequest {
502
+ typeFilter?: PaymentType[];
503
+ statusFilter?: PaymentStatus[];
504
+ assetFilter?: AssetFilter;
505
+ paymentDetailsFilter?: PaymentDetailsFilter[];
506
+ fromTimestamp?: number;
507
+ toTimestamp?: number;
508
+ offset?: number;
509
+ limit?: number;
510
+ sortAscending?: boolean;
454
511
  }
455
512
 
456
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
457
-
458
- export interface LnurlInfo {
459
- url: string;
460
- bech32: string;
513
+ export interface LnurlWithdrawInfo {
514
+ withdrawUrl: string;
461
515
  }
462
516
 
463
- export interface LocaleOverrides {
464
- locale: string;
465
- spacing?: number;
466
- symbol: Symbol;
467
- }
517
+ export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
468
518
 
469
- export interface AesSuccessActionDataDecrypted {
470
- description: string;
471
- plaintext: string;
519
+ export interface LnurlErrorDetails {
520
+ reason: string;
472
521
  }
473
522
 
523
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
524
+
474
525
  export interface SendPaymentResponse {
475
526
  payment: Payment;
476
527
  }
477
528
 
478
- export interface Rate {
479
- coin: string;
480
- value: number;
529
+ export interface UpdateUserSettingsRequest {
530
+ sparkPrivateModeEnabled?: boolean;
481
531
  }
482
532
 
483
- export interface ClaimHtlcPaymentRequest {
484
- preimage: string;
485
- }
486
-
487
- export interface ListFiatRatesResponse {
488
- rates: Rate[];
533
+ export interface BuyBitcoinRequest {
534
+ lockedAmountSat?: number;
535
+ redirectUrl?: string;
489
536
  }
490
537
 
491
538
  export interface ProvisionalPayment {
@@ -494,193 +541,241 @@ export interface ProvisionalPayment {
494
541
  details: ProvisionalPaymentDetails;
495
542
  }
496
543
 
497
- export interface PaymentRequestSource {
498
- bip21Uri?: string;
499
- bip353Address?: string;
544
+ 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 };
545
+
546
+ export interface SparkInvoiceDetails {
547
+ invoice: string;
548
+ identityPublicKey: string;
549
+ network: BitcoinNetwork;
550
+ amount?: string;
551
+ tokenIdentifier?: string;
552
+ expiryTime?: number;
553
+ description?: string;
554
+ senderPublicKey?: string;
500
555
  }
501
556
 
502
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
557
+ export interface ClaimDepositRequest {
558
+ txid: string;
559
+ vout: number;
560
+ maxFee?: MaxFee;
561
+ }
503
562
 
504
- export interface SparkHtlcOptions {
505
- paymentHash: string;
506
- expiryDurationSecs: number;
563
+ export interface LightningAddressDetails {
564
+ address: string;
565
+ payRequest: LnurlPayRequestDetails;
507
566
  }
508
567
 
509
- export interface ReceivePaymentRequest {
510
- paymentMethod: ReceivePaymentMethod;
568
+ export interface UrlSuccessActionData {
569
+ description: string;
570
+ url: string;
571
+ matchesCallbackDomain: boolean;
511
572
  }
512
573
 
513
- export interface ConversionOptions {
514
- conversionType: ConversionType;
515
- maxSlippageBps?: number;
516
- completionTimeoutSecs?: number;
574
+ export interface FiatCurrency {
575
+ id: string;
576
+ info: CurrencyInfo;
517
577
  }
518
578
 
519
- export interface OptimizationProgress {
520
- isRunning: boolean;
521
- currentRound: number;
522
- totalRounds: number;
579
+ export interface ClaimDepositResponse {
580
+ payment: Payment;
523
581
  }
524
582
 
525
- export interface SignMessageResponse {
526
- pubkey: string;
527
- signature: string;
583
+ export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
584
+
585
+ export type TokenTransactionType = "transfer" | "mint" | "burn";
586
+
587
+ export interface SetLnurlMetadataItem {
588
+ paymentHash: string;
589
+ senderComment?: string;
590
+ nostrZapRequest?: string;
591
+ nostrZapReceipt?: string;
592
+ preimage?: string;
528
593
  }
529
594
 
530
- export interface Symbol {
531
- grapheme?: string;
532
- template?: string;
533
- rtl?: boolean;
534
- position?: number;
595
+ export interface AddContactRequest {
596
+ name: string;
597
+ paymentIdentifier: string;
535
598
  }
536
599
 
537
- export interface RefundDepositRequest {
538
- txid: string;
539
- vout: number;
540
- destinationAddress: string;
541
- fee: Fee;
600
+ export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; hasLnurlPreimage?: boolean };
601
+
602
+ export interface PaymentMetadata {
603
+ parentPaymentId?: string;
604
+ lnurlPayInfo?: LnurlPayInfo;
605
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
606
+ lnurlDescription?: string;
607
+ conversionInfo?: ConversionInfo;
542
608
  }
543
609
 
544
- export interface ListUnclaimedDepositsResponse {
545
- deposits: DepositInfo[];
610
+ export interface StableBalanceConfig {
611
+ tokenIdentifier: string;
612
+ thresholdSats?: number;
613
+ maxSlippageBps?: number;
614
+ reservedSats?: number;
546
615
  }
547
616
 
548
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
617
+ export interface FetchConversionLimitsRequest {
618
+ conversionType: ConversionType;
619
+ tokenIdentifier?: string;
620
+ }
549
621
 
550
- export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
622
+ export interface Bip21Extra {
623
+ key: string;
624
+ value: string;
625
+ }
551
626
 
552
- export type Network = "mainnet" | "regtest";
627
+ export interface Rate {
628
+ coin: string;
629
+ value: number;
630
+ }
553
631
 
554
- export type PaymentStatus = "completed" | "pending" | "failed";
632
+ export interface ConversionDetails {
633
+ from: ConversionStep;
634
+ to: ConversionStep;
635
+ }
555
636
 
556
- export interface PrepareLnurlPayRequest {
557
- amountSats: number;
558
- comment?: string;
559
- payRequest: LnurlPayRequestDetails;
560
- validateSuccessActionUrl?: boolean;
561
- conversionOptions?: ConversionOptions;
562
- feePolicy?: FeePolicy;
637
+ export interface LnurlInfo {
638
+ url: string;
639
+ bech32: string;
563
640
  }
564
641
 
565
- 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);
642
+ export interface Bolt12InvoiceDetails {
643
+ amountMsat: number;
644
+ invoice: Bolt12Invoice;
645
+ }
566
646
 
567
- export interface RecordChange {
568
- id: RecordId;
569
- schemaVersion: string;
570
- updatedFields: Map<string, string>;
571
- localRevision: number;
647
+ export interface ClaimHtlcPaymentRequest {
648
+ preimage: string;
572
649
  }
573
650
 
574
- export interface UnversionedRecordChange {
575
- id: RecordId;
576
- schemaVersion: string;
577
- updatedFields: Map<string, string>;
651
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
652
+
653
+ export interface ReceivePaymentResponse {
654
+ paymentRequest: string;
655
+ fee: bigint;
578
656
  }
579
657
 
580
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
658
+ export interface GetTokensMetadataRequest {
659
+ tokenIdentifiers: string[];
660
+ }
581
661
 
582
- export interface FiatCurrency {
583
- id: string;
584
- info: CurrencyInfo;
662
+ export interface FetchConversionLimitsResponse {
663
+ minFromAmount?: bigint;
664
+ minToAmount?: bigint;
585
665
  }
586
666
 
587
- export interface LnurlReceiveMetadata {
588
- nostrZapRequest?: string;
589
- nostrZapReceipt?: string;
590
- senderComment?: string;
667
+ export interface LnurlWithdrawRequest {
668
+ amountSats: number;
669
+ withdrawRequest: LnurlWithdrawRequestDetails;
670
+ completionTimeoutSecs?: number;
591
671
  }
592
672
 
593
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
673
+ export interface PrepareLnurlPayResponse {
674
+ amountSats: number;
675
+ comment?: string;
676
+ payRequest: LnurlPayRequestDetails;
677
+ feeSats: number;
678
+ invoiceDetails: Bolt11InvoiceDetails;
679
+ successAction?: SuccessAction;
680
+ conversionEstimate?: ConversionEstimate;
681
+ feePolicy: FeePolicy;
682
+ }
594
683
 
595
- export interface StableBalanceConfig {
596
- tokenIdentifier: string;
597
- thresholdSats?: number;
598
- maxSlippageBps?: number;
599
- reservedSats?: number;
684
+ export interface SparkInvoicePaymentDetails {
685
+ description?: string;
686
+ invoice: string;
600
687
  }
601
688
 
602
- export interface GetInfoResponse {
603
- identityPubkey: string;
604
- balanceSats: number;
605
- tokenBalances: Map<string, TokenBalance>;
689
+ export interface OutgoingChange {
690
+ change: RecordChange;
691
+ parent?: Record;
606
692
  }
607
693
 
608
- export interface ConversionInfo {
609
- poolId: string;
610
- conversionId: string;
611
- status: ConversionStatus;
612
- fee?: string;
613
- purpose?: ConversionPurpose;
694
+ export interface SyncWalletResponse {}
695
+
696
+ export interface SparkAddressDetails {
697
+ address: string;
698
+ identityPublicKey: string;
699
+ network: BitcoinNetwork;
700
+ source: PaymentRequestSource;
614
701
  }
615
702
 
616
- export interface IncomingChange {
617
- newState: Record;
618
- oldState?: Record;
703
+ export interface Bolt12Offer {
704
+ offer: string;
705
+ source: PaymentRequestSource;
619
706
  }
620
707
 
621
- export interface TokenMetadata {
622
- identifier: string;
623
- issuerPublicKey: string;
708
+ export interface CurrencyInfo {
624
709
  name: string;
625
- ticker: string;
626
- decimals: number;
627
- maxSupply: string;
628
- isFreezable: boolean;
710
+ fractionSize: number;
711
+ spacing?: number;
712
+ symbol?: Symbol;
713
+ uniqSymbol?: Symbol;
714
+ localizedName: LocalizedName[];
715
+ localeOverrides: LocaleOverrides[];
629
716
  }
630
717
 
631
- export interface UserSettings {
632
- sparkPrivateModeEnabled: boolean;
718
+ export interface Bolt12OfferDetails {
719
+ absoluteExpiry?: number;
720
+ chains: string[];
721
+ description?: string;
722
+ issuer?: string;
723
+ minAmount?: Amount;
724
+ offer: Bolt12Offer;
725
+ paths: Bolt12OfferBlindedPath[];
726
+ signingPubkey?: string;
633
727
  }
634
728
 
635
- 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 };
729
+ export interface LnurlPayRequest {
730
+ prepareResponse: PrepareLnurlPayResponse;
731
+ idempotencyKey?: string;
732
+ }
636
733
 
637
- export interface Bolt12Invoice {
638
- invoice: string;
639
- source: PaymentRequestSource;
734
+ export interface GetPaymentResponse {
735
+ payment: Payment;
640
736
  }
641
737
 
642
- export interface RegisterLightningAddressRequest {
643
- username: string;
644
- description?: string;
738
+ export interface LnurlAuthRequestDetails {
739
+ k1: string;
740
+ action?: string;
741
+ domain: string;
742
+ url: string;
645
743
  }
646
744
 
647
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
745
+ export interface Bolt12Invoice {
746
+ invoice: string;
747
+ source: PaymentRequestSource;
748
+ }
648
749
 
649
- export interface ListPaymentsRequest {
650
- typeFilter?: PaymentType[];
651
- statusFilter?: PaymentStatus[];
652
- assetFilter?: AssetFilter;
653
- paymentDetailsFilter?: PaymentDetailsFilter[];
654
- fromTimestamp?: number;
655
- toTimestamp?: number;
750
+ export interface ListContactsRequest {
656
751
  offset?: number;
657
752
  limit?: number;
658
- sortAscending?: boolean;
659
- }
660
-
661
- export interface GetTokensMetadataRequest {
662
- tokenIdentifiers: string[];
663
753
  }
664
754
 
665
- export interface GetInfoRequest {
666
- ensureSynced?: boolean;
755
+ export interface SendOnchainSpeedFeeQuote {
756
+ userFeeSat: number;
757
+ l1BroadcastFeeSat: number;
667
758
  }
668
759
 
669
- export interface MessageSuccessActionData {
670
- message: string;
760
+ export interface AesSuccessActionDataDecrypted {
761
+ description: string;
762
+ plaintext: string;
671
763
  }
672
764
 
673
- export interface SyncWalletRequest {}
765
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
674
766
 
675
- export interface ConversionStep {
676
- paymentId: string;
677
- amount: bigint;
678
- fee: bigint;
679
- method: PaymentMethod;
680
- tokenMetadata?: TokenMetadata;
767
+ export interface ConversionInfo {
768
+ poolId: string;
769
+ conversionId: string;
770
+ status: ConversionStatus;
771
+ fee?: string;
772
+ purpose?: ConversionPurpose;
681
773
  }
682
774
 
683
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
775
+ export interface Credentials {
776
+ username: string;
777
+ password: string;
778
+ }
684
779
 
685
780
  export interface PrepareSendPaymentResponse {
686
781
  paymentMethod: SendPaymentMethod;
@@ -690,167 +785,144 @@ export interface PrepareSendPaymentResponse {
690
785
  feePolicy: FeePolicy;
691
786
  }
692
787
 
693
- export interface Bolt11RouteHintHop {
694
- srcNodeId: string;
695
- shortChannelId: string;
696
- feesBaseMsat: number;
697
- feesProportionalMillionths: number;
698
- cltvExpiryDelta: number;
699
- htlcMinimumMsat?: number;
700
- htlcMaximumMsat?: number;
788
+ export interface RefundDepositResponse {
789
+ txId: string;
790
+ txHex: string;
701
791
  }
702
792
 
703
- export interface Bolt12Offer {
704
- offer: string;
705
- source: PaymentRequestSource;
706
- }
793
+ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
707
794
 
708
- export interface PrepareSendPaymentRequest {
709
- paymentRequest: string;
710
- amount?: bigint;
711
- tokenIdentifier?: string;
712
- conversionOptions?: ConversionOptions;
713
- feePolicy?: FeePolicy;
795
+ export interface RecordId {
796
+ type: string;
797
+ dataId: string;
714
798
  }
715
799
 
716
- export interface SyncWalletResponse {}
717
-
718
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
719
-
720
- export type TokenTransactionType = "transfer" | "mint" | "burn";
721
-
722
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
800
+ export interface SendOnchainFeeQuote {
801
+ id: string;
802
+ expiresAt: number;
803
+ speedFast: SendOnchainSpeedFeeQuote;
804
+ speedMedium: SendOnchainSpeedFeeQuote;
805
+ speedSlow: SendOnchainSpeedFeeQuote;
806
+ }
723
807
 
724
- export interface ConversionEstimate {
725
- options: ConversionOptions;
726
- amount: bigint;
727
- fee: bigint;
808
+ export interface Bip21Details {
809
+ amountSat?: number;
810
+ assetId?: string;
811
+ uri: string;
812
+ extras: Bip21Extra[];
813
+ label?: string;
814
+ message?: string;
815
+ paymentMethods: InputType[];
728
816
  }
729
817
 
730
- export interface GetPaymentRequest {
731
- paymentId: string;
818
+ export type Network = "mainnet" | "regtest";
819
+
820
+ export interface OptimizationConfig {
821
+ autoEnabled: boolean;
822
+ multiplicity: number;
732
823
  }
733
824
 
734
- export interface ClaimDepositRequest {
735
- txid: string;
736
- vout: number;
737
- maxFee?: MaxFee;
825
+ export interface LnurlWithdrawRequestDetails {
826
+ callback: string;
827
+ k1: string;
828
+ defaultDescription: string;
829
+ minWithdrawable: number;
830
+ maxWithdrawable: number;
738
831
  }
739
832
 
740
- export interface ListUnclaimedDepositsRequest {}
741
-
742
- export interface SparkStatus {
743
- status: ServiceStatus;
744
- lastUpdated: number;
833
+ export interface LocalizedName {
834
+ locale: string;
835
+ name: string;
745
836
  }
746
837
 
747
- export interface RecordId {
748
- type: string;
749
- dataId: string;
838
+ export interface Bolt11RouteHintHop {
839
+ srcNodeId: string;
840
+ shortChannelId: string;
841
+ feesBaseMsat: number;
842
+ feesProportionalMillionths: number;
843
+ cltvExpiryDelta: number;
844
+ htlcMinimumMsat?: number;
845
+ htlcMaximumMsat?: number;
750
846
  }
751
847
 
752
- export interface AesSuccessActionData {
753
- description: string;
754
- ciphertext: string;
755
- iv: string;
848
+ export interface MessageSuccessActionData {
849
+ message: string;
756
850
  }
757
851
 
758
- export interface BitcoinAddressDetails {
759
- address: string;
760
- network: BitcoinNetwork;
761
- source: PaymentRequestSource;
852
+ export interface Symbol {
853
+ grapheme?: string;
854
+ template?: string;
855
+ rtl?: boolean;
856
+ position?: number;
762
857
  }
763
858
 
764
859
  export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
765
860
 
766
- export interface UrlSuccessActionData {
767
- description: string;
768
- url: string;
769
- matchesCallbackDomain: boolean;
770
- }
861
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
771
862
 
772
- export interface LightningAddressInfo {
773
- description: string;
774
- lightningAddress: string;
775
- lnurl: LnurlInfo;
776
- username: string;
863
+ export interface Bolt12OfferBlindedPath {
864
+ blindedHops: string[];
777
865
  }
778
866
 
779
- export interface PaymentMetadata {
780
- parentPaymentId?: string;
781
- lnurlPayInfo?: LnurlPayInfo;
782
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
783
- lnurlDescription?: string;
784
- conversionInfo?: ConversionInfo;
867
+ export interface UpdateContactRequest {
868
+ id: string;
869
+ name: string;
870
+ paymentIdentifier: string;
785
871
  }
786
872
 
787
- export interface Bolt12InvoiceRequestDetails {}
788
-
789
- export interface CheckMessageResponse {
790
- isValid: boolean;
873
+ export interface SparkStatus {
874
+ status: ServiceStatus;
875
+ lastUpdated: number;
791
876
  }
792
877
 
793
- export interface Bolt11InvoiceDetails {
794
- amountMsat?: number;
795
- description?: string;
796
- descriptionHash?: string;
797
- expiry: number;
798
- invoice: Bolt11Invoice;
799
- minFinalCltvExpiryDelta: number;
800
- network: BitcoinNetwork;
801
- payeePubkey: string;
802
- paymentHash: string;
803
- paymentSecret: string;
804
- routingHints: Bolt11RouteHint[];
805
- timestamp: number;
878
+ export interface ExternalInputParser {
879
+ providerId: string;
880
+ inputRegex: string;
881
+ parserUrl: string;
806
882
  }
807
883
 
808
- export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
884
+ export interface ConnectRequest {
885
+ config: Config;
886
+ seed: Seed;
887
+ storageDir: string;
888
+ }
809
889
 
810
- export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
890
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
811
891
 
812
- export interface ClaimHtlcPaymentResponse {
813
- payment: Payment;
892
+ export interface IncomingChange {
893
+ newState: Record;
894
+ oldState?: Record;
814
895
  }
815
896
 
816
- export interface Bolt12OfferDetails {
817
- absoluteExpiry?: number;
818
- chains: string[];
819
- description?: string;
820
- issuer?: string;
821
- minAmount?: Amount;
822
- offer: Bolt12Offer;
823
- paths: Bolt12OfferBlindedPath[];
824
- signingPubkey?: string;
897
+ export interface ListFiatRatesResponse {
898
+ rates: Rate[];
825
899
  }
826
900
 
827
- export interface CheckMessageRequest {
828
- message: string;
829
- pubkey: string;
830
- signature: string;
901
+ export interface GetTokensMetadataResponse {
902
+ tokensMetadata: TokenMetadata[];
831
903
  }
832
904
 
833
- export interface CurrencyInfo {
834
- name: string;
835
- fractionSize: number;
836
- spacing?: number;
837
- symbol?: Symbol;
838
- uniqSymbol?: Symbol;
839
- localizedName: LocalizedName[];
840
- localeOverrides: LocaleOverrides[];
905
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
906
+
907
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
908
+
909
+ export interface LnurlPayResponse {
910
+ payment: Payment;
911
+ successAction?: SuccessActionProcessed;
841
912
  }
842
913
 
843
- export type FeePolicy = "feesExcluded" | "feesIncluded";
914
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
844
915
 
845
- export interface MintIssuerTokenRequest {
846
- amount: bigint;
916
+ export interface UnfreezeIssuerTokenResponse {
917
+ impactedOutputIds: string[];
918
+ impactedTokenAmount: bigint;
847
919
  }
848
920
 
849
- export interface UnfreezeIssuerTokenRequest {
921
+ export interface FreezeIssuerTokenRequest {
850
922
  address: string;
851
923
  }
852
924
 
853
- export interface FreezeIssuerTokenRequest {
925
+ export interface UnfreezeIssuerTokenRequest {
854
926
  address: string;
855
927
  }
856
928
 
@@ -871,9 +943,8 @@ export interface CreateIssuerTokenRequest {
871
943
  maxSupply: bigint;
872
944
  }
873
945
 
874
- export interface UnfreezeIssuerTokenResponse {
875
- impactedOutputIds: string[];
876
- impactedTokenAmount: bigint;
946
+ export interface MintIssuerTokenRequest {
947
+ amount: bigint;
877
948
  }
878
949
 
879
950
  export interface ExternalSigner {
@@ -899,60 +970,72 @@ export interface ExternalSigner {
899
970
  hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
900
971
  }
901
972
 
902
- export interface PublicKeyBytes {
973
+ export interface MessageBytes {
903
974
  bytes: number[];
904
975
  }
905
976
 
906
- export interface ExternalFrostCommitments {
907
- hidingCommitment: number[];
908
- bindingCommitment: number[];
909
- noncesCiphertext: number[];
910
- }
911
-
912
- export interface ExternalTreeNodeId {
913
- id: string;
977
+ export interface SchnorrSignatureBytes {
978
+ bytes: number[];
914
979
  }
915
980
 
916
- export interface SecretBytes {
981
+ export interface EcdsaSignatureBytes {
917
982
  bytes: number[];
918
983
  }
919
984
 
920
- export interface IdentifierCommitmentPair {
921
- identifier: ExternalIdentifier;
922
- commitment: ExternalSigningCommitments;
985
+ export interface ExternalScalar {
986
+ bytes: number[];
923
987
  }
924
988
 
925
- export interface ExternalFrostSignatureShare {
926
- bytes: number[];
989
+ export interface ExternalVerifiableSecretShare {
990
+ secretShare: ExternalSecretShare;
991
+ proofs: number[][];
927
992
  }
928
993
 
929
- export interface SchnorrSignatureBytes {
994
+ export interface PublicKeyBytes {
930
995
  bytes: number[];
931
996
  }
932
997
 
933
998
  export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
934
999
 
935
- export interface ExternalFrostSignature {
936
- bytes: number[];
1000
+ export interface ExternalFrostCommitments {
1001
+ hidingCommitment: number[];
1002
+ bindingCommitment: number[];
1003
+ noncesCiphertext: number[];
937
1004
  }
938
1005
 
939
- export interface ExternalScalar {
1006
+ export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1007
+
1008
+ export interface ExternalFrostSignatureShare {
940
1009
  bytes: number[];
941
1010
  }
942
1011
 
943
- export interface MessageBytes {
944
- bytes: number[];
1012
+ export interface ExternalEncryptedSecret {
1013
+ ciphertext: number[];
945
1014
  }
946
1015
 
947
1016
  export interface ExternalIdentifier {
948
1017
  bytes: number[];
949
1018
  }
950
1019
 
951
- export interface HashedMessageBytes {
952
- bytes: number[];
1020
+ export interface IdentifierSignaturePair {
1021
+ identifier: ExternalIdentifier;
1022
+ signature: ExternalFrostSignatureShare;
953
1023
  }
954
1024
 
955
- export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1025
+ export interface ExternalSignFrostRequest {
1026
+ message: number[];
1027
+ publicKey: number[];
1028
+ secret: ExternalSecretSource;
1029
+ verifyingKey: number[];
1030
+ selfNonceCommitment: ExternalFrostCommitments;
1031
+ statechainCommitments: IdentifierCommitmentPair[];
1032
+ adaptorPublicKey?: number[];
1033
+ }
1034
+
1035
+ export interface IdentifierCommitmentPair {
1036
+ identifier: ExternalIdentifier;
1037
+ commitment: ExternalSigningCommitments;
1038
+ }
956
1039
 
957
1040
  export interface ExternalAggregateFrostRequest {
958
1041
  message: number[];
@@ -966,37 +1049,16 @@ export interface ExternalAggregateFrostRequest {
966
1049
  adaptorPublicKey?: number[];
967
1050
  }
968
1051
 
969
- export interface ExternalVerifiableSecretShare {
970
- secretShare: ExternalSecretShare;
971
- proofs: number[][];
972
- }
973
-
974
- export interface ExternalEncryptedSecret {
975
- ciphertext: number[];
976
- }
977
-
978
- export interface IdentifierSignaturePair {
979
- identifier: ExternalIdentifier;
980
- signature: ExternalFrostSignatureShare;
981
- }
982
-
983
- export interface IdentifierPublicKeyPair {
984
- identifier: ExternalIdentifier;
985
- publicKey: number[];
1052
+ export interface SecretBytes {
1053
+ bytes: number[];
986
1054
  }
987
1055
 
988
- export interface EcdsaSignatureBytes {
1056
+ export interface ExternalFrostSignature {
989
1057
  bytes: number[];
990
1058
  }
991
1059
 
992
- export interface ExternalSignFrostRequest {
993
- message: number[];
994
- publicKey: number[];
995
- secret: ExternalSecretSource;
996
- verifyingKey: number[];
997
- selfNonceCommitment: ExternalFrostCommitments;
998
- statechainCommitments: IdentifierCommitmentPair[];
999
- adaptorPublicKey?: number[];
1060
+ export interface HashedMessageBytes {
1061
+ bytes: number[];
1000
1062
  }
1001
1063
 
1002
1064
  export interface ExternalSecretShare {
@@ -1005,20 +1067,29 @@ export interface ExternalSecretShare {
1005
1067
  share: ExternalScalar;
1006
1068
  }
1007
1069
 
1008
- export interface ExternalSigningCommitments {
1009
- hiding: number[];
1010
- binding: number[];
1070
+ export interface ExternalTreeNodeId {
1071
+ id: string;
1011
1072
  }
1012
1073
 
1013
1074
  export interface RecoverableEcdsaSignatureBytes {
1014
1075
  bytes: number[];
1015
1076
  }
1016
1077
 
1078
+ export interface IdentifierPublicKeyPair {
1079
+ identifier: ExternalIdentifier;
1080
+ publicKey: number[];
1081
+ }
1082
+
1083
+ export interface ExternalSigningCommitments {
1084
+ hiding: number[];
1085
+ binding: number[];
1086
+ }
1087
+
1017
1088
  export interface Storage {
1018
1089
  getCachedItem: (key: string) => Promise<string | null>;
1019
1090
  setCachedItem: (key: string, value: string) => Promise<void>;
1020
1091
  deleteCachedItem: (key: string) => Promise<void>;
1021
- listPayments: (request: ListPaymentsRequest) => Promise<Payment[]>;
1092
+ listPayments: (request: StorageListPaymentsRequest) => Promise<Payment[]>;
1022
1093
  insertPayment: (payment: Payment) => Promise<void>;
1023
1094
  insertPaymentMetadata: (paymentId: string, metadata: PaymentMetadata) => Promise<void>;
1024
1095
  getPaymentById: (id: string) => Promise<Payment>;
@@ -1029,6 +1100,10 @@ export interface Storage {
1029
1100
  updateDeposit: (txid: string, vout: number, payload: UpdateDepositPayload) => Promise<void>;
1030
1101
  setLnurlMetadata: (metadata: SetLnurlMetadataItem[]) => Promise<void>;
1031
1102
  getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: RelatedPayment[] }>;
1103
+ listContacts: (request: ListContactsRequest) => Promise<Contact[]>;
1104
+ getContact: (id: string) => Promise<Contact>;
1105
+ insertContact: (contact: Contact) => Promise<void>;
1106
+ deleteContact: (id: string) => Promise<void>;
1032
1107
  syncAddOutgoingChange: (record: UnversionedRecordChange) => Promise<number>;
1033
1108
  syncCompleteOutgoingSync: (record: Record) => Promise<void>;
1034
1109
  syncGetPendingOutgoingChanges: (limit: number) => Promise<OutgoingChange[]>;
@@ -1045,6 +1120,7 @@ export class BreezSdk {
1045
1120
  free(): void;
1046
1121
  disconnect(): Promise<void>;
1047
1122
  lnurlAuth(request_data: LnurlAuthRequestDetails): Promise<LnurlCallbackStatus>;
1123
+ addContact(request: AddContactRequest): Promise<Contact>;
1048
1124
  buyBitcoin(request: BuyBitcoinRequest): Promise<BuyBitcoinResponse>;
1049
1125
  getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
1050
1126
  syncWallet(request: SyncWalletRequest): Promise<SyncWalletResponse>;
@@ -1052,9 +1128,12 @@ export class BreezSdk {
1052
1128
  signMessage(request: SignMessageRequest): Promise<SignMessageResponse>;
1053
1129
  checkMessage(request: CheckMessageRequest): Promise<CheckMessageResponse>;
1054
1130
  claimDeposit(request: ClaimDepositRequest): Promise<ClaimDepositResponse>;
1131
+ listContacts(request: ListContactsRequest): Promise<Contact[]>;
1055
1132
  listPayments(request: ListPaymentsRequest): Promise<ListPaymentsResponse>;
1133
+ deleteContact(id: string): Promise<void>;
1056
1134
  lnurlWithdraw(request: LnurlWithdrawRequest): Promise<LnurlWithdrawResponse>;
1057
1135
  refundDeposit(request: RefundDepositRequest): Promise<RefundDepositResponse>;
1136
+ updateContact(request: UpdateContactRequest): Promise<Contact>;
1058
1137
  listFiatRates(): Promise<ListFiatRatesResponse>;
1059
1138
  receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
1060
1139
  getTokenIssuer(): TokenIssuer;
@@ -1142,6 +1221,7 @@ export class SdkBuilder {
1142
1221
  withChainService(chain_service: BitcoinChainService): SdkBuilder;
1143
1222
  withDefaultStorage(storage_dir: string): Promise<SdkBuilder>;
1144
1223
  withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
1224
+ withPostgresStorage(config: PostgresStorageConfig): SdkBuilder;
1145
1225
  withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
1146
1226
  static new(config: Config, seed: Seed): SdkBuilder;
1147
1227
  build(): Promise<BreezSdk>;