@breeztech/breez-sdk-spark 0.4.2 → 0.4.3-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,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function defaultConfig(network: Network): Config;
4
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
3
  export function connect(request: ConnectRequest): Promise<BreezSdk>;
4
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
+ export function defaultConfig(network: Network): Config;
6
6
  /**
7
7
  * Entry point invoked by JavaScript in a worker.
8
8
  */
@@ -42,6 +42,14 @@ export interface BitcoinChainService {
42
42
  getTransactionStatus(txid: string): Promise<TxStatus>;
43
43
  getTransactionHex(txid: string): Promise<string>;
44
44
  broadcastTransaction(tx: string): Promise<void>;
45
+ recommendedFees(): Promise<RecommendedFees>;
46
+ }
47
+
48
+ export interface Utxo {
49
+ txid: string;
50
+ vout: number;
51
+ value: number;
52
+ status: TxStatus;
45
53
  }
46
54
 
47
55
  export interface TxStatus {
@@ -50,33 +58,81 @@ export interface TxStatus {
50
58
  blockTime?: number;
51
59
  }
52
60
 
53
- export interface Utxo {
54
- txid: string;
55
- vout: number;
56
- value: number;
57
- status: TxStatus;
61
+ export type ChainApiType = "esplora" | "mempoolSpace";
62
+
63
+ export interface RecommendedFees {
64
+ fastestFee: number;
65
+ halfHourFee: number;
66
+ hourFee: number;
67
+ economyFee: number;
68
+ minimumFee: number;
58
69
  }
59
70
 
60
71
  export interface PaymentObserver {
61
72
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
62
73
  }
63
74
 
64
- export interface CurrencyInfo {
65
- name: string;
66
- fractionSize: number;
67
- spacing?: number;
68
- symbol?: Symbol;
69
- uniqSymbol?: Symbol;
70
- localizedName: LocalizedName[];
71
- localeOverrides: LocaleOverrides[];
75
+ export interface SendOnchainSpeedFeeQuote {
76
+ userFeeSat: number;
77
+ l1BroadcastFeeSat: number;
72
78
  }
73
79
 
74
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
80
+ export interface UnversionedRecordChange {
81
+ id: RecordId;
82
+ schemaVersion: string;
83
+ updatedFields: Map<string, string>;
84
+ }
75
85
 
76
- export interface LocaleOverrides {
86
+ export interface SyncWalletResponse {}
87
+
88
+ export interface SparkInvoiceDetails {
89
+ invoice: string;
90
+ identityPublicKey: string;
91
+ network: BitcoinNetwork;
92
+ amount?: bigint;
93
+ tokenIdentifier?: string;
94
+ expiryTime?: number;
95
+ description?: string;
96
+ senderPublicKey?: string;
97
+ }
98
+
99
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "lightning"; description?: string; preimage?: string; invoice: string; paymentHash: string; destinationPubkey: string; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
100
+
101
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
102
+
103
+ export interface GetPaymentResponse {
104
+ payment: Payment;
105
+ }
106
+
107
+ export interface SendOnchainFeeQuote {
108
+ id: string;
109
+ expiresAt: number;
110
+ speedFast: SendOnchainSpeedFeeQuote;
111
+ speedMedium: SendOnchainSpeedFeeQuote;
112
+ speedSlow: SendOnchainSpeedFeeQuote;
113
+ }
114
+
115
+ export interface RecordId {
116
+ type: string;
117
+ dataId: string;
118
+ }
119
+
120
+ export interface ListFiatCurrenciesResponse {
121
+ currencies: FiatCurrency[];
122
+ }
123
+
124
+ export interface Bolt12Invoice {
125
+ invoice: string;
126
+ source: PaymentRequestSource;
127
+ }
128
+
129
+ export interface ListPaymentsResponse {
130
+ payments: Payment[];
131
+ }
132
+
133
+ export interface LocalizedName {
77
134
  locale: string;
78
- spacing?: number;
79
- symbol: Symbol;
135
+ name: string;
80
136
  }
81
137
 
82
138
  export interface TokenMetadata {
@@ -89,87 +145,83 @@ export interface TokenMetadata {
89
145
  isFreezable: boolean;
90
146
  }
91
147
 
92
- export interface Record {
93
- id: RecordId;
94
- revision: number;
95
- schemaVersion: string;
96
- data: Map<string, string>;
148
+ export interface RefundDepositResponse {
149
+ txId: string;
150
+ txHex: string;
97
151
  }
98
152
 
99
- export interface GetPaymentRequest {
100
- paymentId: string;
153
+ export interface ReceivePaymentRequest {
154
+ paymentMethod: ReceivePaymentMethod;
101
155
  }
102
156
 
103
- export interface RefundDepositRequest {
104
- txid: string;
105
- vout: number;
106
- destinationAddress: string;
107
- fee: Fee;
108
- }
157
+ export type PaymentType = "send" | "receive";
109
158
 
110
- export interface LogEntry {
111
- line: string;
112
- level: string;
159
+ export interface SendPaymentRequest {
160
+ prepareResponse: PrepareSendPaymentResponse;
161
+ options?: SendPaymentOptions;
162
+ idempotencyKey?: string;
113
163
  }
114
164
 
115
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
165
+ export interface PaymentRequestSource {
166
+ bip21Uri?: string;
167
+ bip353Address?: string;
168
+ }
116
169
 
117
- export interface BitcoinAddressDetails {
170
+ export interface SilentPaymentAddressDetails {
118
171
  address: string;
119
172
  network: BitcoinNetwork;
120
173
  source: PaymentRequestSource;
121
174
  }
122
175
 
123
- export interface LnurlWithdrawInfo {
124
- withdrawUrl: string;
176
+ export interface LnurlWithdrawRequest {
177
+ amountSats: number;
178
+ withdrawRequest: LnurlWithdrawRequestDetails;
179
+ completionTimeoutSecs?: number;
125
180
  }
126
181
 
127
- 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 };
128
-
129
- export interface CheckLightningAddressRequest {
130
- username: string;
182
+ export interface GetInfoRequest {
183
+ ensureSynced?: boolean;
131
184
  }
132
185
 
133
- export interface Bolt11InvoiceDetails {
134
- amountMsat?: number;
135
- description?: string;
136
- descriptionHash?: string;
137
- expiry: number;
138
- invoice: Bolt11Invoice;
139
- minFinalCltvExpiryDelta: number;
140
- network: BitcoinNetwork;
141
- payeePubkey: string;
142
- paymentHash: string;
143
- paymentSecret: string;
144
- routingHints: Bolt11RouteHint[];
145
- timestamp: number;
186
+ export interface PrepareLnurlPayRequest {
187
+ amountSats: number;
188
+ comment?: string;
189
+ payRequest: LnurlPayRequestDetails;
190
+ validateSuccessActionUrl?: boolean;
146
191
  }
147
192
 
148
- export interface ReceivePaymentResponse {
149
- paymentRequest: string;
150
- fee: bigint;
193
+ export interface ClaimDepositResponse {
194
+ payment: Payment;
151
195
  }
152
196
 
153
- export interface Bolt11RouteHint {
154
- hops: Bolt11RouteHintHop[];
197
+ export interface SparkAddressDetails {
198
+ address: string;
199
+ identityPublicKey: string;
200
+ network: BitcoinNetwork;
201
+ source: PaymentRequestSource;
155
202
  }
156
203
 
157
- export interface Bolt11RouteHintHop {
158
- srcNodeId: string;
159
- shortChannelId: string;
160
- feesBaseMsat: number;
161
- feesProportionalMillionths: number;
162
- cltvExpiryDelta: number;
163
- htlcMinimumMsat?: number;
164
- htlcMaximumMsat?: number;
204
+ export interface CheckLightningAddressRequest {
205
+ username: string;
165
206
  }
166
207
 
167
- export interface IncomingChange {
168
- newState: Record;
169
- oldState?: Record;
208
+ export interface Symbol {
209
+ grapheme?: string;
210
+ template?: string;
211
+ rtl?: boolean;
212
+ position?: number;
170
213
  }
171
214
 
172
- 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);
215
+ export interface Payment {
216
+ id: string;
217
+ paymentType: PaymentType;
218
+ status: PaymentStatus;
219
+ amount: bigint;
220
+ fees: bigint;
221
+ timestamp: number;
222
+ method: PaymentMethod;
223
+ details?: PaymentDetails;
224
+ }
173
225
 
174
226
  export interface ConnectRequest {
175
227
  config: Config;
@@ -177,227 +229,139 @@ export interface ConnectRequest {
177
229
  storageDir: string;
178
230
  }
179
231
 
180
- export interface GetTokensMetadataResponse {
181
- tokensMetadata: TokenMetadata[];
182
- }
183
-
184
- export interface SparkInvoiceDetails {
185
- invoice: string;
186
- identityPublicKey: string;
187
- network: BitcoinNetwork;
188
- amount?: bigint;
189
- tokenIdentifier?: string;
190
- expiryTime?: number;
191
- description?: string;
192
- senderPublicKey?: string;
193
- }
194
-
195
232
  export interface UpdateUserSettingsRequest {
196
233
  sparkPrivateModeEnabled?: boolean;
197
234
  }
198
235
 
199
- export interface LnurlAuthRequestDetails {
200
- k1: string;
201
- action?: string;
202
- domain: string;
203
- url: string;
204
- }
205
-
206
- export interface LightningAddressDetails {
207
- address: string;
208
- payRequest: LnurlPayRequestDetails;
236
+ export interface Bolt12InvoiceDetails {
237
+ amountMsat: number;
238
+ invoice: Bolt12Invoice;
209
239
  }
210
240
 
211
- export interface PrepareSendPaymentRequest {
212
- paymentRequest: string;
213
- amount?: bigint;
214
- tokenIdentifier?: string;
215
- }
241
+ export type Network = "mainnet" | "regtest";
216
242
 
217
- export interface Symbol {
218
- grapheme?: string;
219
- template?: string;
220
- rtl?: boolean;
221
- position?: number;
243
+ export interface UserSettings {
244
+ sparkPrivateModeEnabled: boolean;
222
245
  }
223
246
 
224
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number };
247
+ export type SdkEvent = { type: "synced" } | { type: "dataSynced"; didPullNewRecords: boolean } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment };
225
248
 
226
- export interface Bolt12Offer {
227
- offer: string;
228
- source: PaymentRequestSource;
249
+ export interface ReceivePaymentResponse {
250
+ paymentRequest: string;
251
+ fee: bigint;
229
252
  }
230
253
 
231
- export interface UserSettings {
232
- sparkPrivateModeEnabled: boolean;
254
+ export interface MessageSuccessActionData {
255
+ message: string;
233
256
  }
234
257
 
235
- export interface CheckMessageRequest {
236
- message: string;
237
- pubkey: string;
238
- signature: string;
258
+ export interface CurrencyInfo {
259
+ name: string;
260
+ fractionSize: number;
261
+ spacing?: number;
262
+ symbol?: Symbol;
263
+ uniqSymbol?: Symbol;
264
+ localizedName: LocalizedName[];
265
+ localeOverrides: LocaleOverrides[];
239
266
  }
240
267
 
241
- 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 };
268
+ 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);
242
269
 
243
- export interface GetInfoResponse {
244
- balanceSats: number;
245
- tokenBalances: Map<string, TokenBalance>;
246
- }
270
+ 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 };
247
271
 
248
- export interface SparkAddressDetails {
249
- address: string;
250
- identityPublicKey: string;
251
- network: BitcoinNetwork;
252
- source: PaymentRequestSource;
253
- }
272
+ export interface ListUnclaimedDepositsRequest {}
254
273
 
255
- export interface Bolt12OfferBlindedPath {
256
- blindedHops: string[];
257
- }
274
+ export interface Bolt12InvoiceRequestDetails {}
258
275
 
259
- export interface PaymentRequestSource {
260
- bip21Uri?: string;
261
- bip353Address?: string;
276
+ export interface LnurlAuthRequestDetails {
277
+ k1: string;
278
+ action?: string;
279
+ domain: string;
280
+ url: string;
262
281
  }
263
282
 
264
- export interface SendOnchainSpeedFeeQuote {
265
- userFeeSat: number;
266
- l1BroadcastFeeSat: number;
283
+ export interface ListFiatRatesResponse {
284
+ rates: Rate[];
267
285
  }
268
286
 
269
- export interface LightningAddressInfo {
270
- description: string;
271
- lightningAddress: string;
272
- lnurl: string;
273
- username: string;
274
- }
287
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
275
288
 
276
- export interface Bolt12Invoice {
277
- invoice: string;
278
- source: PaymentRequestSource;
279
- }
289
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
280
290
 
281
- export interface RefundDepositResponse {
282
- txId: string;
283
- txHex: string;
291
+ export interface Record {
292
+ id: RecordId;
293
+ revision: number;
294
+ schemaVersion: string;
295
+ data: Map<string, string>;
284
296
  }
285
297
 
286
- export interface Bolt12OfferDetails {
287
- absoluteExpiry?: number;
288
- chains: string[];
298
+ export interface RegisterLightningAddressRequest {
299
+ username: string;
289
300
  description?: string;
290
- issuer?: string;
291
- minAmount?: Amount;
292
- offer: Bolt12Offer;
293
- paths: Bolt12OfferBlindedPath[];
294
- signingPubkey?: string;
295
301
  }
296
302
 
297
- export interface ProvisionalPayment {
298
- paymentId: string;
299
- amount: bigint;
300
- details: ProvisionalPaymentDetails;
301
- }
302
-
303
- export interface SyncWalletResponse {}
304
-
305
- export interface ListPaymentsRequest {
306
- typeFilter?: PaymentType[];
307
- statusFilter?: PaymentStatus[];
308
- assetFilter?: AssetFilter;
309
- fromTimestamp?: number;
310
- toTimestamp?: number;
311
- offset?: number;
312
- limit?: number;
313
- sortAscending?: boolean;
314
- }
315
-
316
- export interface SignMessageRequest {
317
- message: string;
318
- compact: boolean;
303
+ export interface GetTokensMetadataResponse {
304
+ tokensMetadata: TokenMetadata[];
319
305
  }
320
306
 
321
- export interface ListFiatCurrenciesResponse {
322
- currencies: FiatCurrency[];
323
- }
307
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
324
308
 
325
- export interface AesSuccessActionData {
326
- description: string;
327
- ciphertext: string;
328
- iv: string;
329
- }
309
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number };
330
310
 
331
- export interface Credentials {
332
- username: string;
333
- password: string;
311
+ export interface DepositInfo {
312
+ txid: string;
313
+ vout: number;
314
+ amountSats: number;
315
+ refundTx?: string;
316
+ refundTxId?: string;
317
+ claimError?: DepositClaimError;
334
318
  }
335
319
 
336
- export interface Config {
337
- apiKey?: string;
338
- network: Network;
339
- syncIntervalSecs: number;
340
- maxDepositClaimFee?: Fee;
341
- lnurlDomain?: string;
342
- preferSparkOverLightning: boolean;
343
- externalInputParsers?: ExternalInputParser[];
344
- useDefaultExternalInputParsers: boolean;
345
- realTimeSyncServerUrl?: string;
346
- privateEnabledDefault: boolean;
320
+ export interface ClaimDepositRequest {
321
+ txid: string;
322
+ vout: number;
323
+ maxFee?: Fee;
347
324
  }
348
325
 
349
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
350
-
351
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
352
-
353
- export interface Bolt12InvoiceDetails {
354
- amountMsat: number;
355
- invoice: Bolt12Invoice;
326
+ export interface TokenBalance {
327
+ balance: bigint;
328
+ tokenMetadata: TokenMetadata;
356
329
  }
357
330
 
358
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
359
-
360
331
  export interface SignMessageResponse {
361
332
  pubkey: string;
362
333
  signature: string;
363
334
  }
364
335
 
365
- export interface ClaimDepositResponse {
366
- payment: Payment;
367
- }
368
-
369
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails } | { type: "lightning"; description?: string; preimage?: string; invoice: string; paymentHash: string; destinationPubkey: string; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
370
-
371
- export interface PrepareLnurlPayRequest {
372
- amountSats: number;
373
- comment?: string;
374
- payRequest: LnurlPayRequestDetails;
375
- validateSuccessActionUrl?: boolean;
336
+ export interface Bolt12Offer {
337
+ offer: string;
338
+ source: PaymentRequestSource;
376
339
  }
377
340
 
378
- export interface DepositInfo {
379
- txid: string;
380
- vout: number;
381
- amountSats: number;
382
- refundTx?: string;
383
- refundTxId?: string;
384
- claimError?: DepositClaimError;
341
+ export interface SparkInvoicePaymentDetails {
342
+ description?: string;
343
+ invoice: string;
385
344
  }
386
345
 
387
- export interface GetTokensMetadataRequest {
388
- tokenIdentifiers: string[];
346
+ export interface Bolt11InvoiceDetails {
347
+ amountMsat?: number;
348
+ description?: string;
349
+ descriptionHash?: string;
350
+ expiry: number;
351
+ invoice: Bolt11Invoice;
352
+ minFinalCltvExpiryDelta: number;
353
+ network: BitcoinNetwork;
354
+ payeePubkey: string;
355
+ paymentHash: string;
356
+ paymentSecret: string;
357
+ routingHints: Bolt11RouteHint[];
358
+ timestamp: number;
389
359
  }
390
360
 
391
- export interface RecordChange {
392
- id: RecordId;
393
- schemaVersion: string;
394
- updatedFields: Map<string, string>;
395
- revision: number;
396
- }
361
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
397
362
 
398
- export interface FiatCurrency {
399
- id: string;
400
- info: CurrencyInfo;
363
+ export interface ListUnclaimedDepositsResponse {
364
+ deposits: DepositInfo[];
401
365
  }
402
366
 
403
367
  export interface LnurlPayRequestDetails {
@@ -413,22 +377,22 @@ export interface LnurlPayRequestDetails {
413
377
  nostrPubkey?: string;
414
378
  }
415
379
 
416
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
380
+ export interface SyncWalletRequest {}
417
381
 
418
- export interface TokenBalance {
419
- balance: bigint;
420
- tokenMetadata: TokenMetadata;
382
+ export interface AesSuccessActionData {
383
+ description: string;
384
+ ciphertext: string;
385
+ iv: string;
421
386
  }
422
387
 
423
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
388
+ 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 };
424
389
 
425
- export interface SparkInvoicePaymentDetails {
426
- description?: string;
427
- invoice: string;
390
+ export interface LocaleOverrides {
391
+ locale: string;
392
+ spacing?: number;
393
+ symbol: Symbol;
428
394
  }
429
395
 
430
- export type SdkEvent = { type: "synced" } | { type: "dataSynced"; didPullNewRecords: boolean } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment };
431
-
432
396
  export interface LnurlWithdrawRequestDetails {
433
397
  callback: string;
434
398
  k1: string;
@@ -437,24 +401,10 @@ export interface LnurlWithdrawRequestDetails {
437
401
  maxWithdrawable: number;
438
402
  }
439
403
 
440
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
441
-
442
- export interface PaymentMetadata {
443
- lnurlPayInfo?: LnurlPayInfo;
444
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
445
- lnurlDescription?: string;
446
- }
447
-
448
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
449
-
450
- export interface GetPaymentResponse {
451
- payment: Payment;
452
- }
453
-
454
- export interface SilentPaymentAddressDetails {
455
- address: string;
456
- network: BitcoinNetwork;
457
- source: PaymentRequestSource;
404
+ export interface ExternalInputParser {
405
+ providerId: string;
406
+ inputRegex: string;
407
+ parserUrl: string;
458
408
  }
459
409
 
460
410
  export interface Bip21Extra {
@@ -462,52 +412,51 @@ export interface Bip21Extra {
462
412
  value: string;
463
413
  }
464
414
 
465
- export interface UnversionedRecordChange {
466
- id: RecordId;
467
- schemaVersion: string;
468
- updatedFields: Map<string, string>;
415
+ export interface LnurlPayInfo {
416
+ lnAddress?: string;
417
+ comment?: string;
418
+ domain?: string;
419
+ metadata?: string;
420
+ processedSuccessAction?: SuccessActionProcessed;
421
+ rawSuccessAction?: SuccessAction;
469
422
  }
470
423
 
471
- export interface LnurlPayResponse {
472
- payment: Payment;
473
- successAction?: SuccessActionProcessed;
424
+ export interface PaymentMetadata {
425
+ lnurlPayInfo?: LnurlPayInfo;
426
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
427
+ lnurlDescription?: string;
474
428
  }
475
429
 
476
- export interface SendPaymentResponse {
477
- payment: Payment;
478
- }
430
+ export type DepositClaimError = { type: "depositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; actualFee: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
479
431
 
480
- export interface ListFiatRatesResponse {
481
- rates: Rate[];
432
+ export interface LightningAddressInfo {
433
+ description: string;
434
+ lightningAddress: string;
435
+ lnurl: string;
436
+ username: string;
482
437
  }
483
438
 
484
- export interface Payment {
485
- id: string;
486
- paymentType: PaymentType;
487
- status: PaymentStatus;
488
- amount: bigint;
489
- fees: bigint;
490
- timestamp: number;
491
- method: PaymentMethod;
492
- details?: PaymentDetails;
439
+ export interface ListPaymentsRequest {
440
+ typeFilter?: PaymentType[];
441
+ statusFilter?: PaymentStatus[];
442
+ assetFilter?: AssetFilter;
443
+ fromTimestamp?: number;
444
+ toTimestamp?: number;
445
+ offset?: number;
446
+ limit?: number;
447
+ sortAscending?: boolean;
493
448
  }
494
449
 
495
- export interface LnurlPayInfo {
496
- lnAddress?: string;
497
- comment?: string;
498
- domain?: string;
499
- metadata?: string;
500
- processedSuccessAction?: SuccessActionProcessed;
501
- rawSuccessAction?: SuccessAction;
450
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
451
+
452
+ export interface SignMessageRequest {
453
+ message: string;
454
+ compact: boolean;
502
455
  }
503
456
 
504
457
  export interface LnurlPayRequest {
505
458
  prepareResponse: PrepareLnurlPayResponse;
506
- }
507
-
508
- export interface LocalizedName {
509
- locale: string;
510
- name: string;
459
+ idempotencyKey?: string;
511
460
  }
512
461
 
513
462
  export interface LnurlWithdrawResponse {
@@ -515,78 +464,88 @@ export interface LnurlWithdrawResponse {
515
464
  payment?: Payment;
516
465
  }
517
466
 
518
- export interface SendPaymentRequest {
519
- prepareResponse: PrepareSendPaymentResponse;
520
- options?: SendPaymentOptions;
467
+ export interface LogEntry {
468
+ line: string;
469
+ level: string;
521
470
  }
522
471
 
523
- export interface ListPaymentsResponse {
524
- payments: Payment[];
472
+ export interface CheckMessageRequest {
473
+ message: string;
474
+ pubkey: string;
475
+ signature: string;
525
476
  }
526
477
 
527
- export type WaitForPaymentIdentifier = ({ type: "paymentId" } & string) | ({ type: "paymentRequest" } & string);
478
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
528
479
 
529
- export interface RecordId {
530
- type: string;
531
- dataId: string;
480
+ export interface RefundDepositRequest {
481
+ txid: string;
482
+ vout: number;
483
+ destinationAddress: string;
484
+ fee: Fee;
532
485
  }
533
486
 
534
- export type PaymentStatus = "completed" | "pending" | "failed";
535
-
536
- export interface UrlSuccessActionData {
537
- description: string;
538
- url: string;
539
- matchesCallbackDomain: boolean;
487
+ export interface Rate {
488
+ coin: string;
489
+ value: number;
540
490
  }
541
491
 
542
- export interface WaitForPaymentRequest {
543
- identifier: WaitForPaymentIdentifier;
544
- }
492
+ export type PaymentStatus = "completed" | "pending" | "failed";
545
493
 
546
- export interface AesSuccessActionDataDecrypted {
547
- description: string;
548
- plaintext: string;
494
+ export interface CheckMessageResponse {
495
+ isValid: boolean;
549
496
  }
550
497
 
551
- export interface ClaimDepositRequest {
552
- txid: string;
553
- vout: number;
554
- maxFee?: Fee;
498
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
499
+
500
+ export interface Bolt12OfferDetails {
501
+ absoluteExpiry?: number;
502
+ chains: string[];
503
+ description?: string;
504
+ issuer?: string;
505
+ minAmount?: Amount;
506
+ offer: Bolt12Offer;
507
+ paths: Bolt12OfferBlindedPath[];
508
+ signingPubkey?: string;
555
509
  }
556
510
 
557
- export interface PrepareSendPaymentResponse {
558
- paymentMethod: SendPaymentMethod;
559
- amount: bigint;
560
- tokenIdentifier?: string;
511
+ export interface LnurlWithdrawInfo {
512
+ withdrawUrl: string;
561
513
  }
562
514
 
563
- export interface SyncWalletRequest {}
515
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
564
516
 
565
- export interface RegisterLightningAddressRequest {
566
- username: string;
567
- description?: string;
517
+ export interface SendPaymentResponse {
518
+ payment: Payment;
568
519
  }
569
520
 
570
- export interface GetInfoRequest {
571
- ensureSynced?: boolean;
521
+ export interface UrlSuccessActionData {
522
+ description: string;
523
+ url: string;
524
+ matchesCallbackDomain: boolean;
572
525
  }
573
526
 
574
- export interface ReceivePaymentRequest {
575
- paymentMethod: ReceivePaymentMethod;
527
+ export interface GetInfoResponse {
528
+ balanceSats: number;
529
+ tokenBalances: Map<string, TokenBalance>;
576
530
  }
577
531
 
578
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
532
+ export interface LnurlPayResponse {
533
+ payment: Payment;
534
+ successAction?: SuccessActionProcessed;
535
+ }
579
536
 
580
- export interface Bolt11Invoice {
581
- bolt11: string;
582
- source: PaymentRequestSource;
537
+ export interface Credentials {
538
+ username: string;
539
+ password: string;
583
540
  }
584
541
 
585
- export type Network = "mainnet" | "regtest";
542
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
586
543
 
587
- export interface Bolt12InvoiceRequestDetails {}
544
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
588
545
 
589
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
546
+ export interface GetPaymentRequest {
547
+ paymentId: string;
548
+ }
590
549
 
591
550
  export interface PrepareLnurlPayResponse {
592
551
  amountSats: number;
@@ -597,6 +556,13 @@ export interface PrepareLnurlPayResponse {
597
556
  successAction?: SuccessAction;
598
557
  }
599
558
 
559
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
560
+
561
+ export interface FiatCurrency {
562
+ id: string;
563
+ info: CurrencyInfo;
564
+ }
565
+
600
566
  export interface Bip21Details {
601
567
  amountSat?: number;
602
568
  assetId?: string;
@@ -607,64 +573,97 @@ export interface Bip21Details {
607
573
  paymentMethods: InputType[];
608
574
  }
609
575
 
610
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
576
+ export interface LightningAddressDetails {
577
+ address: string;
578
+ payRequest: LnurlPayRequestDetails;
579
+ }
611
580
 
612
- export interface ExternalInputParser {
613
- providerId: string;
614
- inputRegex: string;
615
- parserUrl: string;
581
+ export interface GetTokensMetadataRequest {
582
+ tokenIdentifiers: string[];
616
583
  }
617
584
 
618
- export interface LnurlWithdrawRequest {
619
- amountSats: number;
620
- withdrawRequest: LnurlWithdrawRequestDetails;
621
- completionTimeoutSecs?: number;
585
+ export interface Bolt11RouteHintHop {
586
+ srcNodeId: string;
587
+ shortChannelId: string;
588
+ feesBaseMsat: number;
589
+ feesProportionalMillionths: number;
590
+ cltvExpiryDelta: number;
591
+ htlcMinimumMsat?: number;
592
+ htlcMaximumMsat?: number;
622
593
  }
623
594
 
624
- export interface MessageSuccessActionData {
625
- message: string;
595
+ export interface Bolt11Invoice {
596
+ bolt11: string;
597
+ source: PaymentRequestSource;
626
598
  }
627
599
 
628
- export interface ListUnclaimedDepositsRequest {}
600
+ export interface OutgoingChange {
601
+ change: RecordChange;
602
+ parent?: Record;
603
+ }
629
604
 
630
- export interface ListUnclaimedDepositsResponse {
631
- deposits: DepositInfo[];
605
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
606
+
607
+ export interface BitcoinAddressDetails {
608
+ address: string;
609
+ network: BitcoinNetwork;
610
+ source: PaymentRequestSource;
632
611
  }
633
612
 
634
- export type DepositClaimError = { type: "depositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; actualFee: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
613
+ export interface Config {
614
+ apiKey?: string;
615
+ network: Network;
616
+ syncIntervalSecs: number;
617
+ maxDepositClaimFee?: Fee;
618
+ lnurlDomain?: string;
619
+ preferSparkOverLightning: boolean;
620
+ externalInputParsers?: ExternalInputParser[];
621
+ useDefaultExternalInputParsers: boolean;
622
+ realTimeSyncServerUrl?: string;
623
+ privateEnabledDefault: boolean;
624
+ }
635
625
 
636
- export interface Rate {
637
- coin: string;
638
- value: number;
626
+ export interface Bolt12OfferBlindedPath {
627
+ blindedHops: string[];
639
628
  }
640
629
 
641
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
630
+ export interface Bolt11RouteHint {
631
+ hops: Bolt11RouteHintHop[];
632
+ }
642
633
 
643
- export interface WaitForPaymentResponse {
644
- payment: Payment;
634
+ export interface PrepareSendPaymentResponse {
635
+ paymentMethod: SendPaymentMethod;
636
+ amount: bigint;
637
+ tokenIdentifier?: string;
645
638
  }
646
639
 
647
- export interface OutgoingChange {
648
- change: RecordChange;
649
- parent?: Record;
640
+ export interface PrepareSendPaymentRequest {
641
+ paymentRequest: string;
642
+ amount?: bigint;
643
+ tokenIdentifier?: string;
650
644
  }
651
645
 
652
- export interface CheckMessageResponse {
653
- isValid: boolean;
646
+ export interface RecordChange {
647
+ id: RecordId;
648
+ schemaVersion: string;
649
+ updatedFields: Map<string, string>;
650
+ revision: number;
654
651
  }
655
652
 
656
- export interface SendOnchainFeeQuote {
657
- id: string;
658
- expiresAt: number;
659
- speedFast: SendOnchainSpeedFeeQuote;
660
- speedMedium: SendOnchainSpeedFeeQuote;
661
- speedSlow: SendOnchainSpeedFeeQuote;
653
+ export interface AesSuccessActionDataDecrypted {
654
+ description: string;
655
+ plaintext: string;
662
656
  }
663
657
 
664
- export type PaymentType = "send" | "receive";
658
+ export interface ProvisionalPayment {
659
+ paymentId: string;
660
+ amount: bigint;
661
+ details: ProvisionalPaymentDetails;
662
+ }
665
663
 
666
- export interface FreezeIssuerTokenRequest {
667
- address: string;
664
+ export interface IncomingChange {
665
+ newState: Record;
666
+ oldState?: Record;
668
667
  }
669
668
 
670
669
  export interface UnfreezeIssuerTokenResponse {
@@ -672,6 +671,11 @@ export interface UnfreezeIssuerTokenResponse {
672
671
  impactedTokenAmount: bigint;
673
672
  }
674
673
 
674
+ export interface FreezeIssuerTokenResponse {
675
+ impactedOutputIds: string[];
676
+ impactedTokenAmount: bigint;
677
+ }
678
+
675
679
  export interface BurnIssuerTokenRequest {
676
680
  amount: bigint;
677
681
  }
@@ -680,11 +684,6 @@ export interface MintIssuerTokenRequest {
680
684
  amount: bigint;
681
685
  }
682
686
 
683
- export interface FreezeIssuerTokenResponse {
684
- impactedOutputIds: string[];
685
- impactedTokenAmount: bigint;
686
- }
687
-
688
687
  export interface CreateIssuerTokenRequest {
689
688
  name: string;
690
689
  ticker: string;
@@ -697,6 +696,10 @@ export interface UnfreezeIssuerTokenRequest {
697
696
  address: string;
698
697
  }
699
698
 
699
+ export interface FreezeIssuerTokenRequest {
700
+ address: string;
701
+ }
702
+
700
703
  export interface Storage {
701
704
  getCachedItem: (key: string) => Promise<string | null>;
702
705
  setCachedItem: (key: string, value: string) => Promise<void>;
@@ -738,7 +741,7 @@ export class BreezSdk {
738
741
  listFiatRates(): Promise<ListFiatRatesResponse>;
739
742
  receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
740
743
  getTokenIssuer(): TokenIssuer;
741
- waitForPayment(request: WaitForPaymentRequest): Promise<WaitForPaymentResponse>;
744
+ recommendedFees(): Promise<RecommendedFees>;
742
745
  getUserSettings(): Promise<UserSettings>;
743
746
  prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
744
747
  addEventListener(listener: EventListener): Promise<string>;
@@ -788,7 +791,7 @@ export class SdkBuilder {
788
791
  withChainService(chain_service: BitcoinChainService): SdkBuilder;
789
792
  withDefaultStorage(storage_dir: string): Promise<SdkBuilder>;
790
793
  withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
791
- withRestChainService(url: string, credentials?: Credentials | null): SdkBuilder;
794
+ withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
792
795
  static new(config: Config, seed: Seed): SdkBuilder;
793
796
  build(): Promise<BreezSdk>;
794
797
  }