@breeztech/breez-sdk-spark 0.6.4-rc3 → 0.6.5

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,7 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
4
3
  export function defaultConfig(network: Network): Config;
4
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
5
  export function connect(request: ConnectRequest): Promise<BreezSdk>;
6
6
  /**
7
7
  * Entry point invoked by JavaScript in a worker.
@@ -53,6 +53,8 @@ export interface RecommendedFees {
53
53
  minimumFee: number;
54
54
  }
55
55
 
56
+ export type ChainApiType = "esplora" | "mempoolSpace";
57
+
56
58
  export interface TxStatus {
57
59
  confirmed: boolean;
58
60
  blockHeight?: number;
@@ -66,313 +68,288 @@ export interface Utxo {
66
68
  status: TxStatus;
67
69
  }
68
70
 
69
- export type ChainApiType = "esplora" | "mempoolSpace";
70
-
71
71
  export interface PaymentObserver {
72
72
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
73
73
  }
74
74
 
75
- export type PaymentType = "send" | "receive";
76
-
77
- export interface BitcoinAddressDetails {
78
- address: string;
79
- network: BitcoinNetwork;
80
- source: PaymentRequestSource;
75
+ export interface RecordChange {
76
+ id: RecordId;
77
+ schemaVersion: string;
78
+ updatedFields: Map<string, string>;
79
+ revision: number;
81
80
  }
82
81
 
83
- export interface ReceivePaymentRequest {
84
- paymentMethod: ReceivePaymentMethod;
82
+ export interface CurrencyInfo {
83
+ name: string;
84
+ fractionSize: number;
85
+ spacing?: number;
86
+ symbol?: Symbol;
87
+ uniqSymbol?: Symbol;
88
+ localizedName: LocalizedName[];
89
+ localeOverrides: LocaleOverrides[];
85
90
  }
86
91
 
87
- export interface LnurlWithdrawResponse {
88
- paymentRequest: string;
89
- payment?: Payment;
92
+ export interface LnurlWithdrawRequestDetails {
93
+ callback: string;
94
+ k1: string;
95
+ defaultDescription: string;
96
+ minWithdrawable: number;
97
+ maxWithdrawable: number;
90
98
  }
91
99
 
92
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: bigint; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number };
93
-
94
- export interface DepositInfo {
95
- txid: string;
96
- vout: number;
97
- amountSats: number;
98
- refundTx?: string;
99
- refundTxId?: string;
100
- claimError?: DepositClaimError;
100
+ export interface UserSettings {
101
+ sparkPrivateModeEnabled: boolean;
101
102
  }
102
103
 
103
- export interface PaymentMetadata {
104
- lnurlPayInfo?: LnurlPayInfo;
105
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
106
- lnurlDescription?: string;
104
+ export interface ListFiatCurrenciesResponse {
105
+ currencies: FiatCurrency[];
107
106
  }
108
107
 
109
- export interface ExternalInputParser {
110
- providerId: string;
111
- inputRegex: string;
112
- parserUrl: string;
108
+ export interface Bolt12OfferDetails {
109
+ absoluteExpiry?: number;
110
+ chains: string[];
111
+ description?: string;
112
+ issuer?: string;
113
+ minAmount?: Amount;
114
+ offer: Bolt12Offer;
115
+ paths: Bolt12OfferBlindedPath[];
116
+ signingPubkey?: string;
113
117
  }
114
118
 
115
- export type Network = "mainnet" | "regtest";
116
-
117
- export interface SilentPaymentAddressDetails {
118
- address: string;
119
- network: BitcoinNetwork;
120
- source: PaymentRequestSource;
119
+ export interface PrepareLnurlPayRequest {
120
+ amountSats: number;
121
+ comment?: string;
122
+ payRequest: LnurlPayRequestDetails;
123
+ validateSuccessActionUrl?: boolean;
121
124
  }
122
125
 
123
- export interface GetTokensMetadataRequest {
124
- tokenIdentifiers: string[];
126
+ export interface GetTokensMetadataResponse {
127
+ tokensMetadata: TokenMetadata[];
125
128
  }
126
129
 
127
130
  export interface Bolt11RouteHint {
128
131
  hops: Bolt11RouteHintHop[];
129
132
  }
130
133
 
131
- export interface RefundDepositResponse {
132
- txId: string;
133
- txHex: string;
134
+ export interface LnurlPayInfo {
135
+ lnAddress?: string;
136
+ comment?: string;
137
+ domain?: string;
138
+ metadata?: string;
139
+ processedSuccessAction?: SuccessActionProcessed;
140
+ rawSuccessAction?: SuccessAction;
134
141
  }
135
142
 
136
- export interface SendPaymentRequest {
137
- prepareResponse: PrepareSendPaymentResponse;
138
- options?: SendPaymentOptions;
139
- idempotencyKey?: string;
143
+ export interface TokenBalance {
144
+ balance: bigint;
145
+ tokenMetadata: TokenMetadata;
140
146
  }
141
147
 
142
148
  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);
143
149
 
144
- export interface LnurlWithdrawRequest {
145
- amountSats: number;
146
- withdrawRequest: LnurlWithdrawRequestDetails;
147
- completionTimeoutSecs?: number;
150
+ export interface PaymentMetadata {
151
+ lnurlPayInfo?: LnurlPayInfo;
152
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
153
+ lnurlDescription?: string;
148
154
  }
149
155
 
150
- export interface RecordId {
151
- type: string;
152
- dataId: string;
156
+ export interface ConnectRequest {
157
+ config: Config;
158
+ seed: Seed;
159
+ storageDir: string;
153
160
  }
154
161
 
155
- export interface IncomingChange {
156
- newState: Record;
157
- oldState?: Record;
158
- }
162
+ export interface Bolt12InvoiceRequestDetails {}
159
163
 
160
- export interface SparkInvoicePaymentDetails {
161
- description?: string;
164
+ export interface Bolt12Invoice {
162
165
  invoice: string;
166
+ source: PaymentRequestSource;
163
167
  }
164
168
 
165
- export interface Bolt12Offer {
166
- offer: string;
169
+ export interface SilentPaymentAddressDetails {
170
+ address: string;
171
+ network: BitcoinNetwork;
167
172
  source: PaymentRequestSource;
168
173
  }
169
174
 
170
- export interface PaymentRequestSource {
171
- bip21Uri?: string;
172
- bip353Address?: string;
175
+ export interface LnurlWithdrawRequest {
176
+ amountSats: number;
177
+ withdrawRequest: LnurlWithdrawRequestDetails;
178
+ completionTimeoutSecs?: number;
173
179
  }
174
180
 
175
- export interface TokenBalance {
176
- balance: bigint;
177
- tokenMetadata: TokenMetadata;
181
+ export interface ListUnclaimedDepositsResponse {
182
+ deposits: DepositInfo[];
178
183
  }
179
184
 
180
- export interface SignMessageResponse {
181
- pubkey: string;
182
- signature: string;
185
+ export interface Bolt12Offer {
186
+ offer: string;
187
+ source: PaymentRequestSource;
183
188
  }
184
189
 
185
- export interface GetPaymentResponse {
190
+ export interface SparkAddressDetails {
191
+ address: string;
192
+ identityPublicKey: string;
193
+ network: BitcoinNetwork;
194
+ source: PaymentRequestSource;
195
+ }
196
+
197
+ export interface LnurlPayResponse {
186
198
  payment: Payment;
199
+ successAction?: SuccessActionProcessed;
187
200
  }
188
201
 
189
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "lightning"; description?: string; preimage?: string; invoice: string; paymentHash: string; destinationPubkey: string; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
202
+ 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 };
190
203
 
191
- export interface LocalizedName {
192
- locale: string;
193
- name: string;
204
+ export interface UpdateUserSettingsRequest {
205
+ sparkPrivateModeEnabled?: boolean;
194
206
  }
195
207
 
196
- export interface PrepareLnurlPayResponse {
197
- amountSats: number;
198
- comment?: string;
199
- payRequest: LnurlPayRequestDetails;
200
- feeSats: number;
201
- invoiceDetails: Bolt11InvoiceDetails;
202
- successAction?: SuccessAction;
208
+ export interface LnurlPayRequestDetails {
209
+ callback: string;
210
+ minSendable: number;
211
+ maxSendable: number;
212
+ metadataStr: string;
213
+ commentAllowed: number;
214
+ domain: string;
215
+ url: string;
216
+ address?: string;
217
+ allowsNostr?: boolean;
218
+ nostrPubkey?: string;
203
219
  }
204
220
 
205
- export interface CheckMessageResponse {
206
- isValid: boolean;
221
+ export interface UnversionedRecordChange {
222
+ id: RecordId;
223
+ schemaVersion: string;
224
+ updatedFields: Map<string, string>;
207
225
  }
208
226
 
209
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
210
-
211
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
212
-
213
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
227
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
214
228
 
215
- export interface Symbol {
216
- grapheme?: string;
217
- template?: string;
218
- rtl?: boolean;
219
- position?: number;
229
+ export interface SignMessageResponse {
230
+ pubkey: string;
231
+ signature: string;
220
232
  }
221
233
 
222
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
234
+ export interface CheckLightningAddressRequest {
235
+ username: string;
236
+ }
223
237
 
224
- export interface UpdateUserSettingsRequest {
225
- sparkPrivateModeEnabled?: boolean;
238
+ export interface RecordId {
239
+ type: string;
240
+ dataId: string;
226
241
  }
227
242
 
228
- export interface RegisterLightningAddressRequest {
229
- username: string;
230
- description?: string;
243
+ export interface Bolt12OfferBlindedPath {
244
+ blindedHops: string[];
231
245
  }
232
246
 
233
247
  export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
234
248
 
249
+ export interface SendPaymentRequest {
250
+ prepareResponse: PrepareSendPaymentResponse;
251
+ options?: SendPaymentOptions;
252
+ idempotencyKey?: string;
253
+ }
254
+
255
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "lightning"; description?: string; preimage?: string; invoice: string; paymentHash: string; destinationPubkey: string; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
256
+
257
+ export type Network = "mainnet" | "regtest";
258
+
235
259
  export interface LocaleOverrides {
236
260
  locale: string;
237
261
  spacing?: number;
238
262
  symbol: Symbol;
239
263
  }
240
264
 
241
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
265
+ export interface ClaimDepositResponse {
266
+ payment: Payment;
267
+ }
242
268
 
243
- export interface ListUnclaimedDepositsResponse {
244
- deposits: DepositInfo[];
269
+ export interface SparkHtlcOptions {
270
+ paymentHash: string;
271
+ expiryDurationSecs: number;
245
272
  }
246
273
 
247
- export interface LightningAddressInfo {
248
- description: string;
249
- lightningAddress: string;
250
- lnurl: string;
251
- username: string;
274
+ export interface ListPaymentsResponse {
275
+ payments: Payment[];
252
276
  }
253
277
 
254
- export interface TokenMetadata {
255
- identifier: string;
256
- issuerPublicKey: string;
257
- name: string;
258
- ticker: string;
259
- decimals: number;
260
- maxSupply: bigint;
261
- isFreezable: boolean;
278
+ export interface RefundDepositRequest {
279
+ txid: string;
280
+ vout: number;
281
+ destinationAddress: string;
282
+ fee: Fee;
262
283
  }
263
284
 
264
- export interface Config {
265
- apiKey?: string;
266
- network: Network;
267
- syncIntervalSecs: number;
268
- maxDepositClaimFee?: MaxFee;
269
- lnurlDomain?: string;
270
- preferSparkOverLightning: boolean;
271
- externalInputParsers?: ExternalInputParser[];
272
- useDefaultExternalInputParsers: boolean;
273
- realTimeSyncServerUrl?: string;
274
- privateEnabledDefault: boolean;
285
+ export interface PaymentRequestSource {
286
+ bip21Uri?: string;
287
+ bip353Address?: string;
275
288
  }
276
289
 
277
- export interface ProvisionalPayment {
278
- paymentId: string;
290
+ export interface Payment {
291
+ id: string;
292
+ paymentType: PaymentType;
293
+ status: PaymentStatus;
279
294
  amount: bigint;
280
- details: ProvisionalPaymentDetails;
295
+ fees: bigint;
296
+ timestamp: number;
297
+ method: PaymentMethod;
298
+ details?: PaymentDetails;
281
299
  }
282
300
 
283
- export interface SparkHtlcOptions {
284
- paymentHash: string;
285
- expiryDurationSecs: number;
301
+ export interface GetTokensMetadataRequest {
302
+ tokenIdentifiers: string[];
286
303
  }
287
304
 
288
- export interface SyncWalletRequest {}
289
-
290
- export interface MessageSuccessActionData {
291
- message: string;
305
+ export interface ClaimDepositRequest {
306
+ txid: string;
307
+ vout: number;
308
+ maxFee?: MaxFee;
292
309
  }
293
310
 
294
- export interface PrepareSendPaymentRequest {
295
- paymentRequest: string;
296
- amount?: bigint;
297
- tokenIdentifier?: string;
311
+ export interface LnurlReceiveMetadata {
312
+ nostrZapRequest?: string;
313
+ nostrZapReceipt?: string;
314
+ senderComment?: string;
298
315
  }
299
316
 
300
- export interface RecordChange {
301
- id: RecordId;
302
- schemaVersion: string;
303
- updatedFields: Map<string, string>;
304
- revision: number;
317
+ export interface OptimizationProgress {
318
+ isRunning: boolean;
319
+ currentRound: number;
320
+ totalRounds: number;
305
321
  }
306
322
 
307
- 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 };
308
-
309
- export interface LogEntry {
310
- line: string;
311
- level: string;
323
+ export interface LnurlWithdrawInfo {
324
+ withdrawUrl: string;
312
325
  }
313
326
 
314
- export interface ListUnclaimedDepositsRequest {}
315
-
316
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
317
-
318
- export interface GetInfoResponse {
319
- balanceSats: number;
320
- tokenBalances: Map<string, TokenBalance>;
321
- }
327
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
322
328
 
323
- export interface SendOnchainSpeedFeeQuote {
324
- userFeeSat: number;
325
- l1BroadcastFeeSat: number;
329
+ export interface ListPaymentsRequest {
330
+ typeFilter?: PaymentType[];
331
+ statusFilter?: PaymentStatus[];
332
+ assetFilter?: AssetFilter;
333
+ sparkHtlcStatusFilter?: SparkHtlcStatus[];
334
+ fromTimestamp?: number;
335
+ toTimestamp?: number;
336
+ offset?: number;
337
+ limit?: number;
338
+ sortAscending?: boolean;
326
339
  }
327
340
 
328
341
  export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: bigint; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: bigint; tokenIdentifier?: string };
329
342
 
330
- export interface SendOnchainFeeQuote {
331
- id: string;
332
- expiresAt: number;
333
- speedFast: SendOnchainSpeedFeeQuote;
334
- speedMedium: SendOnchainSpeedFeeQuote;
335
- speedSlow: SendOnchainSpeedFeeQuote;
336
- }
337
-
338
- export interface Bolt12Invoice {
339
- invoice: string;
340
- source: PaymentRequestSource;
341
- }
342
-
343
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
344
-
345
- export interface LnurlWithdrawRequestDetails {
346
- callback: string;
347
- k1: string;
348
- defaultDescription: string;
349
- minWithdrawable: number;
350
- maxWithdrawable: number;
351
- }
352
-
353
- export interface OutgoingChange {
354
- change: RecordChange;
355
- parent?: Record;
356
- }
357
-
358
- export interface Bolt12OfferBlindedPath {
359
- blindedHops: string[];
343
+ export interface GetInfoRequest {
344
+ ensureSynced?: boolean;
360
345
  }
361
346
 
362
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
363
-
364
- export interface LnurlAuthRequestDetails {
365
- k1: string;
366
- action?: string;
367
- domain: string;
368
- url: string;
369
- }
347
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
370
348
 
371
- export interface SetLnurlMetadataItem {
372
- paymentHash: string;
373
- senderComment?: string;
374
- nostrZapRequest?: string;
375
- nostrZapReceipt?: string;
349
+ export interface PrepareSendPaymentRequest {
350
+ paymentRequest: string;
351
+ amount?: bigint;
352
+ tokenIdentifier?: string;
376
353
  }
377
354
 
378
355
  export interface Record {
@@ -382,80 +359,82 @@ export interface Record {
382
359
  data: Map<string, string>;
383
360
  }
384
361
 
385
- export interface LnurlPayRequest {
386
- prepareResponse: PrepareLnurlPayResponse;
387
- idempotencyKey?: string;
362
+ export interface PrepareLnurlPayResponse {
363
+ amountSats: number;
364
+ comment?: string;
365
+ payRequest: LnurlPayRequestDetails;
366
+ feeSats: number;
367
+ invoiceDetails: Bolt11InvoiceDetails;
368
+ successAction?: SuccessAction;
388
369
  }
389
370
 
390
- export interface CheckMessageRequest {
391
- message: string;
392
- pubkey: string;
393
- signature: string;
371
+ export interface BitcoinAddressDetails {
372
+ address: string;
373
+ network: BitcoinNetwork;
374
+ source: PaymentRequestSource;
394
375
  }
395
376
 
396
- export interface LnurlPayResponse {
397
- payment: Payment;
398
- successAction?: SuccessActionProcessed;
399
- }
377
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
400
378
 
401
- export interface LnurlPayRequestDetails {
402
- callback: string;
403
- minSendable: number;
404
- maxSendable: number;
405
- metadataStr: string;
406
- commentAllowed: number;
407
- domain: string;
408
- url: string;
409
- address?: string;
410
- allowsNostr?: boolean;
411
- nostrPubkey?: string;
379
+ export interface Symbol {
380
+ grapheme?: string;
381
+ template?: string;
382
+ rtl?: boolean;
383
+ position?: number;
412
384
  }
413
385
 
414
- export interface Bolt12InvoiceDetails {
415
- amountMsat: number;
416
- invoice: Bolt12Invoice;
386
+ export interface LogEntry {
387
+ line: string;
388
+ level: string;
417
389
  }
418
390
 
419
- export interface ListPaymentsResponse {
420
- payments: Payment[];
391
+ export interface Bip21Details {
392
+ amountSat?: number;
393
+ assetId?: string;
394
+ uri: string;
395
+ extras: Bip21Extra[];
396
+ label?: string;
397
+ message?: string;
398
+ paymentMethods: InputType[];
421
399
  }
422
400
 
423
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
424
-
425
- export interface UrlSuccessActionData {
426
- description: string;
427
- url: string;
428
- matchesCallbackDomain: boolean;
401
+ export interface RegisterLightningAddressRequest {
402
+ username: string;
403
+ description?: string;
429
404
  }
430
405
 
431
- export interface PrepareLnurlPayRequest {
432
- amountSats: number;
433
- comment?: string;
434
- payRequest: LnurlPayRequestDetails;
435
- validateSuccessActionUrl?: boolean;
406
+ export interface PrepareSendPaymentResponse {
407
+ paymentMethod: SendPaymentMethod;
408
+ amount: bigint;
409
+ tokenIdentifier?: string;
436
410
  }
437
411
 
438
- export interface RefundDepositRequest {
439
- txid: string;
440
- vout: number;
441
- destinationAddress: string;
442
- fee: Fee;
412
+ export interface ProvisionalPayment {
413
+ paymentId: string;
414
+ amount: bigint;
415
+ details: ProvisionalPaymentDetails;
443
416
  }
444
417
 
445
- export interface ListFiatCurrenciesResponse {
446
- currencies: FiatCurrency[];
418
+ export interface IncomingChange {
419
+ newState: Record;
420
+ oldState?: Record;
447
421
  }
448
422
 
449
- 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 };
450
-
451
- export interface GetTokensMetadataResponse {
452
- tokensMetadata: TokenMetadata[];
423
+ export interface CheckMessageRequest {
424
+ message: string;
425
+ pubkey: string;
426
+ signature: string;
453
427
  }
454
428
 
455
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
429
+ export interface ListFiatRatesResponse {
430
+ rates: Rate[];
431
+ }
456
432
 
457
- export interface CheckLightningAddressRequest {
458
- username: string;
433
+ export interface LnurlAuthRequestDetails {
434
+ k1: string;
435
+ action?: string;
436
+ domain: string;
437
+ url: string;
459
438
  }
460
439
 
461
440
  export interface Bolt11RouteHintHop {
@@ -468,11 +447,7 @@ export interface Bolt11RouteHintHop {
468
447
  htlcMaximumMsat?: number;
469
448
  }
470
449
 
471
- export interface ListFiatRatesResponse {
472
- rates: Rate[];
473
- }
474
-
475
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
450
+ export interface SyncWalletResponse {}
476
451
 
477
452
  export interface SparkInvoiceDetails {
478
453
  invoice: string;
@@ -485,85 +460,133 @@ export interface SparkInvoiceDetails {
485
460
  senderPublicKey?: string;
486
461
  }
487
462
 
488
- export interface FiatCurrency {
489
- id: string;
490
- info: CurrencyInfo;
463
+ export interface TokenMetadata {
464
+ identifier: string;
465
+ issuerPublicKey: string;
466
+ name: string;
467
+ ticker: string;
468
+ decimals: number;
469
+ maxSupply: bigint;
470
+ isFreezable: boolean;
491
471
  }
492
472
 
493
- export interface Bolt11InvoiceDetails {
494
- amountMsat?: number;
473
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
474
+
475
+ export interface LightningAddressDetails {
476
+ address: string;
477
+ payRequest: LnurlPayRequestDetails;
478
+ }
479
+
480
+ export interface GetInfoResponse {
481
+ balanceSats: number;
482
+ tokenBalances: Map<string, TokenBalance>;
483
+ }
484
+
485
+ export interface SparkInvoicePaymentDetails {
495
486
  description?: string;
496
- descriptionHash?: string;
497
- expiry: number;
498
- invoice: Bolt11Invoice;
499
- minFinalCltvExpiryDelta: number;
500
- network: BitcoinNetwork;
501
- payeePubkey: string;
502
- paymentHash: string;
503
- paymentSecret: string;
504
- routingHints: Bolt11RouteHint[];
505
- timestamp: number;
487
+ invoice: string;
506
488
  }
507
489
 
508
- export interface LnurlWithdrawInfo {
509
- withdrawUrl: string;
490
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
491
+
492
+ export interface ClaimHtlcPaymentResponse {
493
+ payment: Payment;
510
494
  }
511
495
 
512
- export interface SparkAddressDetails {
513
- address: string;
514
- identityPublicKey: string;
515
- network: BitcoinNetwork;
496
+ export interface Config {
497
+ apiKey?: string;
498
+ network: Network;
499
+ syncIntervalSecs: number;
500
+ maxDepositClaimFee?: MaxFee;
501
+ lnurlDomain?: string;
502
+ preferSparkOverLightning: boolean;
503
+ externalInputParsers?: ExternalInputParser[];
504
+ useDefaultExternalInputParsers: boolean;
505
+ realTimeSyncServerUrl?: string;
506
+ privateEnabledDefault: boolean;
507
+ optimizationConfig: OptimizationConfig;
508
+ }
509
+
510
+ export interface LightningAddressInfo {
511
+ description: string;
512
+ lightningAddress: string;
513
+ lnurl: string;
514
+ username: string;
515
+ }
516
+
517
+ export interface AesSuccessActionData {
518
+ description: string;
519
+ ciphertext: string;
520
+ iv: string;
521
+ }
522
+
523
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
524
+
525
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
526
+
527
+ export interface Bolt11Invoice {
528
+ bolt11: string;
516
529
  source: PaymentRequestSource;
517
530
  }
518
531
 
519
- export interface Bolt12InvoiceRequestDetails {}
532
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
533
+
534
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
535
+
536
+ export interface SendOnchainSpeedFeeQuote {
537
+ userFeeSat: number;
538
+ l1BroadcastFeeSat: number;
539
+ }
540
+
541
+ export interface SendPaymentResponse {
542
+ payment: Payment;
543
+ }
544
+
545
+ export interface UrlSuccessActionData {
546
+ description: string;
547
+ url: string;
548
+ matchesCallbackDomain: boolean;
549
+ }
520
550
 
521
- export interface ListPaymentsRequest {
522
- typeFilter?: PaymentType[];
523
- statusFilter?: PaymentStatus[];
524
- assetFilter?: AssetFilter;
525
- sparkHtlcStatusFilter?: SparkHtlcStatus[];
526
- fromTimestamp?: number;
527
- toTimestamp?: number;
528
- offset?: number;
529
- limit?: number;
530
- sortAscending?: boolean;
551
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
552
+
553
+ export interface ReceivePaymentRequest {
554
+ paymentMethod: ReceivePaymentMethod;
531
555
  }
532
556
 
533
- export interface LnurlReceiveMetadata {
534
- nostrZapRequest?: string;
535
- nostrZapReceipt?: string;
536
- senderComment?: string;
557
+ export interface DepositInfo {
558
+ txid: string;
559
+ vout: number;
560
+ amountSats: number;
561
+ refundTx?: string;
562
+ refundTxId?: string;
563
+ claimError?: DepositClaimError;
537
564
  }
538
565
 
539
- export interface SignMessageRequest {
540
- message: string;
541
- compact: boolean;
566
+ export interface OutgoingChange {
567
+ change: RecordChange;
568
+ parent?: Record;
542
569
  }
543
570
 
544
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
571
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
545
572
 
546
- export interface ClaimHtlcPaymentRequest {
547
- preimage: string;
573
+ export interface Bip21Extra {
574
+ key: string;
575
+ value: string;
548
576
  }
549
577
 
550
- export type PaymentStatus = "completed" | "pending" | "failed";
578
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
551
579
 
552
- export interface ClaimHtlcPaymentResponse {
553
- payment: Payment;
580
+ export interface LocalizedName {
581
+ locale: string;
582
+ name: string;
554
583
  }
555
584
 
556
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
585
+ 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 };
557
586
 
558
- export interface Payment {
559
- id: string;
560
- paymentType: PaymentType;
561
- status: PaymentStatus;
562
- amount: bigint;
563
- fees: bigint;
564
- timestamp: number;
565
- method: PaymentMethod;
566
- details?: PaymentDetails;
587
+ export interface ReceivePaymentResponse {
588
+ paymentRequest: string;
589
+ fee: bigint;
567
590
  }
568
591
 
569
592
  export interface AesSuccessActionDataDecrypted {
@@ -571,80 +594,70 @@ export interface AesSuccessActionDataDecrypted {
571
594
  plaintext: string;
572
595
  }
573
596
 
574
- export interface LnurlPayInfo {
575
- lnAddress?: string;
576
- comment?: string;
577
- domain?: string;
578
- metadata?: string;
579
- processedSuccessAction?: SuccessActionProcessed;
580
- rawSuccessAction?: SuccessAction;
597
+ export interface ClaimHtlcPaymentRequest {
598
+ preimage: string;
581
599
  }
582
600
 
583
- export interface PrepareSendPaymentResponse {
584
- paymentMethod: SendPaymentMethod;
585
- amount: bigint;
586
- tokenIdentifier?: string;
601
+ export interface ExternalInputParser {
602
+ providerId: string;
603
+ inputRegex: string;
604
+ parserUrl: string;
587
605
  }
588
606
 
589
- export interface SparkHtlcDetails {
590
- paymentHash: string;
591
- preimage?: string;
592
- expiryTime: number;
593
- status: SparkHtlcStatus;
607
+ export interface LnurlPayRequest {
608
+ prepareResponse: PrepareLnurlPayResponse;
609
+ idempotencyKey?: string;
594
610
  }
595
611
 
596
- export interface Bip21Details {
597
- amountSat?: number;
598
- assetId?: string;
599
- uri: string;
600
- extras: Bip21Extra[];
601
- label?: string;
602
- message?: string;
603
- paymentMethods: InputType[];
612
+ export interface Credentials {
613
+ username: string;
614
+ password: string;
604
615
  }
605
616
 
606
- export interface SendPaymentResponse {
607
- payment: Payment;
617
+ export interface Bolt11InvoiceDetails {
618
+ amountMsat?: number;
619
+ description?: string;
620
+ descriptionHash?: string;
621
+ expiry: number;
622
+ invoice: Bolt11Invoice;
623
+ minFinalCltvExpiryDelta: number;
624
+ network: BitcoinNetwork;
625
+ payeePubkey: string;
626
+ paymentHash: string;
627
+ paymentSecret: string;
628
+ routingHints: Bolt11RouteHint[];
629
+ timestamp: number;
608
630
  }
609
631
 
610
- export interface LightningAddressDetails {
611
- address: string;
612
- payRequest: LnurlPayRequestDetails;
632
+ export interface MessageSuccessActionData {
633
+ message: string;
613
634
  }
614
635
 
615
- export interface UserSettings {
616
- sparkPrivateModeEnabled: boolean;
636
+ export interface SparkHtlcDetails {
637
+ paymentHash: string;
638
+ preimage?: string;
639
+ expiryTime: number;
640
+ status: SparkHtlcStatus;
617
641
  }
618
642
 
619
- export interface GetPaymentRequest {
620
- paymentId: string;
621
- }
643
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
622
644
 
623
- export interface Bolt11Invoice {
624
- bolt11: string;
625
- source: PaymentRequestSource;
626
- }
645
+ export type PaymentStatus = "completed" | "pending" | "failed";
627
646
 
628
- export interface AesSuccessActionData {
629
- description: string;
630
- ciphertext: string;
631
- iv: string;
647
+ export interface RefundDepositResponse {
648
+ txId: string;
649
+ txHex: string;
632
650
  }
633
651
 
634
- export interface Bolt12OfferDetails {
635
- absoluteExpiry?: number;
636
- chains: string[];
637
- description?: string;
638
- issuer?: string;
639
- minAmount?: Amount;
640
- offer: Bolt12Offer;
641
- paths: Bolt12OfferBlindedPath[];
642
- signingPubkey?: string;
652
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: bigint; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number };
653
+
654
+ export interface LnurlWithdrawResponse {
655
+ paymentRequest: string;
656
+ payment?: Payment;
643
657
  }
644
658
 
645
- export interface Bip21Extra {
646
- key: string;
647
- value: string;
659
+ export interface GetPaymentRequest {
660
+ paymentId: string;
648
661
  }
649
662
 
650
663
  export interface Rate {
@@ -652,61 +665,57 @@ export interface Rate {
652
665
  value: number;
653
666
  }
654
667
 
655
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
668
+ export interface ListUnclaimedDepositsRequest {}
656
669
 
657
- export interface SyncWalletResponse {}
670
+ export interface SyncWalletRequest {}
658
671
 
659
- export interface UnversionedRecordChange {
660
- id: RecordId;
661
- schemaVersion: string;
662
- updatedFields: Map<string, string>;
672
+ export interface SetLnurlMetadataItem {
673
+ paymentHash: string;
674
+ senderComment?: string;
675
+ nostrZapRequest?: string;
676
+ nostrZapReceipt?: string;
663
677
  }
664
678
 
665
- export interface ClaimDepositResponse {
666
- payment: Payment;
667
- }
679
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
668
680
 
669
- export interface ReceivePaymentResponse {
670
- paymentRequest: string;
671
- fee: bigint;
672
- }
681
+ export type PaymentType = "send" | "receive";
673
682
 
674
- export interface CurrencyInfo {
675
- name: string;
676
- fractionSize: number;
677
- spacing?: number;
678
- symbol?: Symbol;
679
- uniqSymbol?: Symbol;
680
- localizedName: LocalizedName[];
681
- localeOverrides: LocaleOverrides[];
683
+ export interface SignMessageRequest {
684
+ message: string;
685
+ compact: boolean;
682
686
  }
683
687
 
684
- export interface GetInfoRequest {
685
- ensureSynced?: boolean;
688
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
689
+
690
+ export interface SendOnchainFeeQuote {
691
+ id: string;
692
+ expiresAt: number;
693
+ speedFast: SendOnchainSpeedFeeQuote;
694
+ speedMedium: SendOnchainSpeedFeeQuote;
695
+ speedSlow: SendOnchainSpeedFeeQuote;
686
696
  }
687
697
 
688
- export interface Credentials {
689
- username: string;
690
- password: string;
698
+ export interface OptimizationConfig {
699
+ autoEnabled: boolean;
700
+ multiplicity: number;
691
701
  }
692
702
 
693
- export interface ConnectRequest {
694
- config: Config;
695
- seed: Seed;
696
- storageDir: string;
703
+ export interface CheckMessageResponse {
704
+ isValid: boolean;
697
705
  }
698
706
 
699
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
707
+ export interface GetPaymentResponse {
708
+ payment: Payment;
709
+ }
700
710
 
701
- export interface ClaimDepositRequest {
702
- txid: string;
703
- vout: number;
704
- maxFee?: MaxFee;
711
+ export interface Bolt12InvoiceDetails {
712
+ amountMsat: number;
713
+ invoice: Bolt12Invoice;
705
714
  }
706
715
 
707
- export interface FreezeIssuerTokenResponse {
708
- impactedOutputIds: string[];
709
- impactedTokenAmount: bigint;
716
+ export interface FiatCurrency {
717
+ id: string;
718
+ info: CurrencyInfo;
710
719
  }
711
720
 
712
721
  export interface UnfreezeIssuerTokenResponse {
@@ -718,26 +727,31 @@ export interface MintIssuerTokenRequest {
718
727
  amount: bigint;
719
728
  }
720
729
 
721
- export interface CreateIssuerTokenRequest {
722
- name: string;
723
- ticker: string;
724
- decimals: number;
725
- isFreezable: boolean;
726
- maxSupply: bigint;
727
- }
728
-
729
730
  export interface BurnIssuerTokenRequest {
730
731
  amount: bigint;
731
732
  }
732
733
 
733
- export interface FreezeIssuerTokenRequest {
734
+ export interface UnfreezeIssuerTokenRequest {
734
735
  address: string;
735
736
  }
736
737
 
737
- export interface UnfreezeIssuerTokenRequest {
738
+ export interface FreezeIssuerTokenRequest {
738
739
  address: string;
739
740
  }
740
741
 
742
+ export interface FreezeIssuerTokenResponse {
743
+ impactedOutputIds: string[];
744
+ impactedTokenAmount: bigint;
745
+ }
746
+
747
+ export interface CreateIssuerTokenRequest {
748
+ name: string;
749
+ ticker: string;
750
+ decimals: number;
751
+ isFreezable: boolean;
752
+ maxSupply: bigint;
753
+ }
754
+
741
755
  export interface Storage {
742
756
  getCachedItem: (key: string) => Promise<string | null>;
743
757
  setCachedItem: (key: string, value: string) => Promise<void>;
@@ -792,8 +806,11 @@ export class BreezSdk {
792
806
  getLightningAddress(): Promise<LightningAddressInfo | undefined>;
793
807
  removeEventListener(id: string): Promise<boolean>;
794
808
  listUnclaimedDeposits(request: ListUnclaimedDepositsRequest): Promise<ListUnclaimedDepositsResponse>;
809
+ startLeafOptimization(): void;
810
+ cancelLeafOptimization(): Promise<void>;
795
811
  deleteLightningAddress(): Promise<void>;
796
812
  registerLightningAddress(request: RegisterLightningAddressRequest): Promise<LightningAddressInfo>;
813
+ getLeafOptimizationProgress(): OptimizationProgress;
797
814
  checkLightningAddressAvailable(request: CheckLightningAddressRequest): Promise<boolean>;
798
815
  parse(input: string): Promise<InputType>;
799
816
  getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
@@ -855,6 +872,7 @@ export interface InitOutput {
855
872
  readonly __wbg_sdkbuilder_free: (a: number, b: number) => void;
856
873
  readonly __wbg_tokenissuer_free: (a: number, b: number) => void;
857
874
  readonly breezsdk_addEventListener: (a: number, b: any) => any;
875
+ readonly breezsdk_cancelLeafOptimization: (a: number) => any;
858
876
  readonly breezsdk_checkLightningAddressAvailable: (a: number, b: any) => any;
859
877
  readonly breezsdk_checkMessage: (a: number, b: any) => any;
860
878
  readonly breezsdk_claimDeposit: (a: number, b: any) => any;
@@ -862,6 +880,7 @@ export interface InitOutput {
862
880
  readonly breezsdk_deleteLightningAddress: (a: number) => any;
863
881
  readonly breezsdk_disconnect: (a: number) => any;
864
882
  readonly breezsdk_getInfo: (a: number, b: any) => any;
883
+ readonly breezsdk_getLeafOptimizationProgress: (a: number) => any;
865
884
  readonly breezsdk_getLightningAddress: (a: number) => any;
866
885
  readonly breezsdk_getPayment: (a: number, b: any) => any;
867
886
  readonly breezsdk_getTokenIssuer: (a: number) => number;
@@ -883,6 +902,7 @@ export interface InitOutput {
883
902
  readonly breezsdk_removeEventListener: (a: number, b: number, c: number) => any;
884
903
  readonly breezsdk_sendPayment: (a: number, b: any) => any;
885
904
  readonly breezsdk_signMessage: (a: number, b: any) => any;
905
+ readonly breezsdk_startLeafOptimization: (a: number) => void;
886
906
  readonly breezsdk_syncWallet: (a: number, b: any) => any;
887
907
  readonly breezsdk_updateUserSettings: (a: number, b: any) => any;
888
908
  readonly connect: (a: any) => any;
@@ -932,9 +952,9 @@ export interface InitOutput {
932
952
  readonly __externref_drop_slice: (a: number, b: number) => void;
933
953
  readonly __wbindgen_export_7: WebAssembly.Table;
934
954
  readonly __externref_table_dealloc: (a: number) => void;
935
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd4a74686750ed5d4: (a: number, b: number) => void;
936
- readonly closure979_externref_shim: (a: number, b: number, c: any) => void;
937
- readonly closure561_externref_shim: (a: number, b: number, c: any, d: any) => void;
955
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdf0ebd5238280272: (a: number, b: number) => void;
956
+ readonly closure996_externref_shim: (a: number, b: number, c: any) => void;
957
+ readonly closure564_externref_shim: (a: number, b: number, c: any, d: any) => void;
938
958
  readonly __wbindgen_start: () => void;
939
959
  }
940
960