@breeztech/breez-sdk-spark 0.7.13 → 0.7.15-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 connect(request: ConnectRequest): Promise<BreezSdk>;
4
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
3
  export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
4
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
5
+ export function connect(request: ConnectRequest): Promise<BreezSdk>;
6
6
  export function defaultConfig(network: Network): Config;
7
7
  /**
8
8
  * Creates a default external signer from a mnemonic phrase.
@@ -20,6 +20,18 @@ export function task_worker_entry_point(ptr: number): void;
20
20
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
21
21
  */
22
22
  type ReadableStreamType = "bytes";
23
+ export interface NostrRelayConfig {
24
+ /**
25
+ * Optional Breez API key for authenticated access to the Breez relay.
26
+ * When provided, the Breez relay is added and NIP-42 authentication is enabled.
27
+ */
28
+ breezApiKey?: string;
29
+ /**
30
+ * Connection timeout in seconds (default: 30)
31
+ */
32
+ timeoutSecs: number;
33
+ }
34
+
23
35
  export interface EventListener {
24
36
  onEvent: (e: SdkEvent) => void;
25
37
  }
@@ -52,11 +64,12 @@ export interface BitcoinChainService {
52
64
  recommendedFees(): Promise<RecommendedFees>;
53
65
  }
54
66
 
55
- export interface Utxo {
56
- txid: string;
57
- vout: number;
58
- value: number;
59
- status: TxStatus;
67
+ export interface RecommendedFees {
68
+ fastestFee: number;
69
+ halfHourFee: number;
70
+ hourFee: number;
71
+ economyFee: number;
72
+ minimumFee: number;
60
73
  }
61
74
 
62
75
  export type ChainApiType = "esplora" | "mempoolSpace";
@@ -67,264 +80,323 @@ export interface TxStatus {
67
80
  blockTime?: number;
68
81
  }
69
82
 
70
- export interface RecommendedFees {
71
- fastestFee: number;
72
- halfHourFee: number;
73
- hourFee: number;
74
- economyFee: number;
75
- minimumFee: number;
83
+ export interface Utxo {
84
+ txid: string;
85
+ vout: number;
86
+ value: number;
87
+ status: TxStatus;
76
88
  }
77
89
 
78
90
  export interface PaymentObserver {
79
91
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
80
92
  }
81
93
 
82
- export interface LocalizedName {
83
- locale: string;
84
- name: string;
94
+ export interface IncomingChange {
95
+ newState: Record;
96
+ oldState?: Record;
85
97
  }
86
98
 
87
- export interface ListUnclaimedDepositsResponse {
88
- deposits: DepositInfo[];
99
+ export interface GetPaymentRequest {
100
+ paymentId: string;
89
101
  }
90
102
 
91
- export interface SyncWalletRequest {}
103
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
92
104
 
93
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { 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 };
105
+ export interface GetInfoResponse {
106
+ identityPubkey: string;
107
+ balanceSats: number;
108
+ tokenBalances: Map<string, TokenBalance>;
109
+ }
94
110
 
95
- export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string };
111
+ export interface PrepareLnurlPayRequest {
112
+ payAmount: BitcoinPayAmount;
113
+ comment?: string;
114
+ payRequest: LnurlPayRequestDetails;
115
+ validateSuccessActionUrl?: boolean;
116
+ conversionOptions?: ConversionOptions;
117
+ }
96
118
 
97
- 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);
119
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
98
120
 
99
- export interface FiatCurrency {
100
- id: string;
101
- info: CurrencyInfo;
121
+ export interface LnurlErrorDetails {
122
+ reason: string;
102
123
  }
103
124
 
104
- export interface ReceivePaymentResponse {
105
- paymentRequest: string;
106
- fee: bigint;
107
- }
125
+ export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
108
126
 
109
- export interface LnurlWithdrawRequest {
110
- amountSats: number;
111
- withdrawRequest: LnurlWithdrawRequestDetails;
112
- completionTimeoutSecs?: number;
113
- }
127
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
114
128
 
115
- export interface Rate {
116
- coin: string;
117
- value: number;
118
- }
129
+ export type Network = "mainnet" | "regtest";
119
130
 
120
- export interface SendOnchainFeeQuote {
121
- id: string;
122
- expiresAt: number;
123
- speedFast: SendOnchainSpeedFeeQuote;
124
- speedMedium: SendOnchainSpeedFeeQuote;
125
- speedSlow: SendOnchainSpeedFeeQuote;
126
- }
131
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
127
132
 
128
- export interface SetLnurlMetadataItem {
129
- paymentHash: string;
130
- senderComment?: string;
131
- nostrZapRequest?: string;
132
- nostrZapReceipt?: string;
133
+ export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string };
134
+
135
+ export interface UnversionedRecordChange {
136
+ id: RecordId;
137
+ schemaVersion: string;
138
+ updatedFields: Map<string, string>;
133
139
  }
134
140
 
135
- export interface CheckMessageResponse {
136
- isValid: boolean;
141
+ export interface LnurlAuthRequestDetails {
142
+ k1: string;
143
+ action?: string;
144
+ domain: string;
145
+ url: string;
137
146
  }
138
147
 
139
- export interface PrepareSendPaymentResponse {
140
- paymentMethod: SendPaymentMethod;
141
- amount: bigint;
148
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
149
+
150
+ export interface FetchConversionLimitsRequest {
151
+ conversionType: ConversionType;
142
152
  tokenIdentifier?: string;
143
- conversionEstimate?: ConversionEstimate;
144
153
  }
145
154
 
146
- export interface Bolt12Offer {
147
- offer: string;
155
+ export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
156
+
157
+ export interface Bolt12Invoice {
158
+ invoice: string;
148
159
  source: PaymentRequestSource;
149
160
  }
150
161
 
151
- export interface UrlSuccessActionData {
152
- description: string;
162
+ export interface LnurlPayRequestDetails {
163
+ callback: string;
164
+ minSendable: number;
165
+ maxSendable: number;
166
+ metadataStr: string;
167
+ commentAllowed: number;
168
+ domain: string;
153
169
  url: string;
154
- matchesCallbackDomain: boolean;
170
+ address?: string;
171
+ allowsNostr?: boolean;
172
+ nostrPubkey?: string;
155
173
  }
156
174
 
157
- export interface GetInfoResponse {
158
- balanceSats: number;
159
- tokenBalances: Map<string, TokenBalance>;
175
+ export interface Bolt11Invoice {
176
+ bolt11: string;
177
+ source: PaymentRequestSource;
160
178
  }
161
179
 
162
- export interface BitcoinAddressDetails {
163
- address: string;
164
- network: BitcoinNetwork;
165
- source: PaymentRequestSource;
180
+ export interface Bolt12InvoiceDetails {
181
+ amountMsat: number;
182
+ invoice: Bolt12Invoice;
166
183
  }
167
184
 
168
- export interface LogEntry {
169
- line: string;
170
- level: string;
185
+ export interface PaymentRequestSource {
186
+ bip21Uri?: string;
187
+ bip353Address?: string;
171
188
  }
172
189
 
173
- export interface SendPaymentRequest {
174
- prepareResponse: PrepareSendPaymentResponse;
175
- options?: SendPaymentOptions;
176
- idempotencyKey?: string;
190
+ export interface TokenMetadata {
191
+ identifier: string;
192
+ issuerPublicKey: string;
193
+ name: string;
194
+ ticker: string;
195
+ decimals: number;
196
+ maxSupply: string;
197
+ isFreezable: boolean;
177
198
  }
178
199
 
179
- export interface GetPaymentRequest {
180
- paymentId: string;
200
+ export interface Rate {
201
+ coin: string;
202
+ value: number;
181
203
  }
182
204
 
183
- export interface Bip21Details {
184
- amountSat?: number;
185
- assetId?: string;
186
- uri: string;
187
- extras: Bip21Extra[];
188
- label?: string;
189
- message?: string;
190
- paymentMethods: InputType[];
205
+ export interface GetTokensMetadataRequest {
206
+ tokenIdentifiers: string[];
191
207
  }
192
208
 
193
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
209
+ 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);
194
210
 
195
- 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 };
211
+ export interface SparkHtlcDetails {
212
+ paymentHash: string;
213
+ preimage?: string;
214
+ expiryTime: number;
215
+ status: SparkHtlcStatus;
216
+ }
196
217
 
197
- export interface RefundDepositRequest {
198
- txid: string;
199
- vout: number;
200
- destinationAddress: string;
201
- fee: Fee;
218
+ export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" };
219
+
220
+ export interface UrlSuccessActionData {
221
+ description: string;
222
+ url: string;
223
+ matchesCallbackDomain: boolean;
202
224
  }
203
225
 
204
- export interface SyncWalletResponse {}
226
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
227
+
228
+ export type PaymentType = "send" | "receive";
229
+
230
+ export interface SyncWalletRequest {}
231
+
232
+ export interface CurrencyInfo {
233
+ name: string;
234
+ fractionSize: number;
235
+ spacing?: number;
236
+ symbol?: Symbol;
237
+ uniqSymbol?: Symbol;
238
+ localizedName: LocalizedName[];
239
+ localeOverrides: LocaleOverrides[];
240
+ }
241
+
242
+ export interface ReceivePaymentRequest {
243
+ paymentMethod: ReceivePaymentMethod;
244
+ }
205
245
 
206
246
  export interface SendPaymentResponse {
207
247
  payment: Payment;
208
248
  }
209
249
 
250
+ export interface ListUnclaimedDepositsRequest {}
251
+
210
252
  export interface ProvisionalPayment {
211
253
  paymentId: string;
212
254
  amount: bigint;
213
255
  details: ProvisionalPaymentDetails;
214
256
  }
215
257
 
216
- export interface PrepareLnurlPayRequest {
217
- amountSats: number;
218
- comment?: string;
219
- payRequest: LnurlPayRequestDetails;
220
- validateSuccessActionUrl?: boolean;
221
- }
222
-
223
- export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
224
-
225
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
226
-
227
258
  export interface SilentPaymentAddressDetails {
228
259
  address: string;
229
260
  network: BitcoinNetwork;
230
261
  source: PaymentRequestSource;
231
262
  }
232
263
 
233
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
264
+ export interface ReceivePaymentResponse {
265
+ paymentRequest: string;
266
+ fee: bigint;
267
+ }
234
268
 
235
- export interface ExternalInputParser {
236
- providerId: string;
237
- inputRegex: string;
238
- parserUrl: string;
269
+ export interface BitcoinAddressDetails {
270
+ address: string;
271
+ network: BitcoinNetwork;
272
+ source: PaymentRequestSource;
239
273
  }
240
274
 
241
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
275
+ export interface ListPaymentsResponse {
276
+ payments: Payment[];
277
+ }
242
278
 
243
279
  export interface SignMessageResponse {
244
280
  pubkey: string;
245
281
  signature: string;
246
282
  }
247
283
 
248
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
249
-
250
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
251
-
252
- export interface Bolt11Invoice {
253
- bolt11: string;
254
- source: PaymentRequestSource;
284
+ export interface ConversionStep {
285
+ paymentId: string;
286
+ amount: bigint;
287
+ fee: bigint;
288
+ method: PaymentMethod;
289
+ tokenMetadata?: TokenMetadata;
255
290
  }
256
291
 
257
- export interface SparkAddressDetails {
258
- address: string;
259
- identityPublicKey: string;
260
- network: BitcoinNetwork;
261
- source: PaymentRequestSource;
292
+ export interface SparkHtlcOptions {
293
+ paymentHash: string;
294
+ expiryDurationSecs: number;
262
295
  }
263
296
 
264
- export interface LnurlPayRequestDetails {
297
+ export interface ConversionOptions {
298
+ conversionType: ConversionType;
299
+ maxSlippageBps?: number;
300
+ completionTimeoutSecs?: number;
301
+ }
302
+
303
+ export interface DepositInfo {
304
+ txid: string;
305
+ vout: number;
306
+ amountSats: number;
307
+ refundTx?: string;
308
+ refundTxId?: string;
309
+ claimError?: DepositClaimError;
310
+ }
311
+
312
+ export interface ConversionEstimate {
313
+ options: ConversionOptions;
314
+ amount: bigint;
315
+ fee: bigint;
316
+ }
317
+
318
+ export interface Bolt12InvoiceRequestDetails {}
319
+
320
+ export interface RecordId {
321
+ type: string;
322
+ dataId: string;
323
+ }
324
+
325
+ export interface LnurlWithdrawRequestDetails {
265
326
  callback: string;
266
- minSendable: number;
267
- maxSendable: number;
268
- metadataStr: string;
269
- commentAllowed: number;
270
- domain: string;
271
- url: string;
272
- address?: string;
273
- allowsNostr?: boolean;
274
- nostrPubkey?: string;
327
+ k1: string;
328
+ defaultDescription: string;
329
+ minWithdrawable: number;
330
+ maxWithdrawable: number;
275
331
  }
276
332
 
277
- export interface Bolt12InvoiceDetails {
278
- amountMsat: number;
279
- invoice: Bolt12Invoice;
333
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
334
+
335
+ export interface PrepareSendPaymentResponse {
336
+ paymentMethod: SendPaymentMethod;
337
+ payAmount: PayAmount;
338
+ conversionEstimate?: ConversionEstimate;
280
339
  }
281
340
 
282
- export interface PaymentRequestSource {
283
- bip21Uri?: string;
284
- bip353Address?: string;
341
+ export interface SyncWalletResponse {}
342
+
343
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
344
+
345
+ export interface ListUnclaimedDepositsResponse {
346
+ deposits: DepositInfo[];
285
347
  }
286
348
 
287
- export type PaymentType = "send" | "receive";
349
+ export interface Bip21Details {
350
+ amountSat?: number;
351
+ assetId?: string;
352
+ uri: string;
353
+ extras: Bip21Extra[];
354
+ label?: string;
355
+ message?: string;
356
+ paymentMethods: InputType[];
357
+ }
288
358
 
289
- export interface Config {
290
- apiKey?: string;
291
- network: Network;
292
- syncIntervalSecs: number;
293
- maxDepositClaimFee?: MaxFee;
294
- lnurlDomain?: string;
295
- preferSparkOverLightning: boolean;
296
- externalInputParsers?: ExternalInputParser[];
297
- useDefaultExternalInputParsers: boolean;
298
- realTimeSyncServerUrl?: string;
299
- privateEnabledDefault: boolean;
300
- optimizationConfig: OptimizationConfig;
359
+ export interface SignMessageRequest {
360
+ message: string;
361
+ compact: boolean;
301
362
  }
302
363
 
303
- export interface GetTokensMetadataResponse {
304
- tokensMetadata: TokenMetadata[];
364
+ export interface RefundDepositRequest {
365
+ txid: string;
366
+ vout: number;
367
+ destinationAddress: string;
368
+ fee: Fee;
305
369
  }
306
370
 
307
- export type Network = "mainnet" | "regtest";
371
+ export interface ConversionDetails {
372
+ from: ConversionStep;
373
+ to: ConversionStep;
374
+ }
308
375
 
309
- export interface ConversionOptions {
310
- conversionType: ConversionType;
311
- maxSlippageBps?: number;
376
+ export interface TokenBalance {
377
+ balance: bigint;
378
+ tokenMetadata: TokenMetadata;
379
+ }
380
+
381
+ export interface LightningAddressDetails {
382
+ address: string;
383
+ payRequest: LnurlPayRequestDetails;
384
+ }
385
+
386
+ export interface LnurlWithdrawResponse {
387
+ paymentRequest: string;
388
+ payment?: Payment;
389
+ }
390
+
391
+ export interface LnurlWithdrawRequest {
392
+ amountSats: number;
393
+ withdrawRequest: LnurlWithdrawRequestDetails;
312
394
  completionTimeoutSecs?: number;
313
395
  }
314
396
 
315
- export interface Bolt11InvoiceDetails {
316
- amountMsat?: number;
317
- description?: string;
318
- descriptionHash?: string;
319
- expiry: number;
320
- invoice: Bolt11Invoice;
321
- minFinalCltvExpiryDelta: number;
322
- network: BitcoinNetwork;
323
- payeePubkey: string;
324
- paymentHash: string;
325
- paymentSecret: string;
326
- routingHints: Bolt11RouteHint[];
327
- timestamp: number;
397
+ export interface SendOnchainSpeedFeeQuote {
398
+ userFeeSat: number;
399
+ l1BroadcastFeeSat: number;
328
400
  }
329
401
 
330
402
  export interface OptimizationConfig {
@@ -332,82 +404,108 @@ export interface OptimizationConfig {
332
404
  multiplicity: number;
333
405
  }
334
406
 
335
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
407
+ 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 };
336
408
 
337
- export interface OptimizationProgress {
338
- isRunning: boolean;
339
- currentRound: number;
340
- totalRounds: number;
409
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
410
+
411
+ export interface Bip21Extra {
412
+ key: string;
413
+ value: string;
341
414
  }
342
415
 
343
- export interface LnurlErrorDetails {
344
- reason: string;
416
+ export interface SparkInvoicePaymentDetails {
417
+ description?: string;
418
+ invoice: string;
345
419
  }
346
420
 
347
- export interface UnversionedRecordChange {
348
- id: RecordId;
349
- schemaVersion: string;
350
- updatedFields: Map<string, string>;
421
+ export interface Bolt11RouteHintHop {
422
+ srcNodeId: string;
423
+ shortChannelId: string;
424
+ feesBaseMsat: number;
425
+ feesProportionalMillionths: number;
426
+ cltvExpiryDelta: number;
427
+ htlcMinimumMsat?: number;
428
+ htlcMaximumMsat?: number;
351
429
  }
352
430
 
353
- 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 };
431
+ export type BitcoinPayAmount = { type: "bitcoin"; amountSats: number } | { type: "drain" };
432
+
433
+ export interface Config {
434
+ apiKey?: string;
435
+ network: Network;
436
+ syncIntervalSecs: number;
437
+ maxDepositClaimFee?: MaxFee;
438
+ lnurlDomain?: string;
439
+ preferSparkOverLightning: boolean;
440
+ externalInputParsers?: ExternalInputParser[];
441
+ useDefaultExternalInputParsers: boolean;
442
+ realTimeSyncServerUrl?: string;
443
+ privateEnabledDefault: boolean;
444
+ optimizationConfig: OptimizationConfig;
445
+ }
446
+
447
+ export interface ExternalInputParser {
448
+ providerId: string;
449
+ inputRegex: string;
450
+ parserUrl: string;
451
+ }
354
452
 
355
453
  export interface CheckLightningAddressRequest {
356
454
  username: string;
357
455
  }
358
456
 
359
- export interface LightningAddressDetails {
360
- address: string;
361
- payRequest: LnurlPayRequestDetails;
457
+ export interface LnurlInfo {
458
+ url: string;
459
+ bech32: string;
362
460
  }
363
461
 
364
- export interface OutgoingChange {
365
- change: RecordChange;
366
- parent?: Record;
462
+ export interface CheckMessageRequest {
463
+ message: string;
464
+ pubkey: string;
465
+ signature: string;
367
466
  }
368
467
 
369
- export interface RecordId {
370
- type: string;
371
- dataId: string;
468
+ export interface LnurlPayResponse {
469
+ payment: Payment;
470
+ successAction?: SuccessActionProcessed;
372
471
  }
373
472
 
473
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
474
+
374
475
  export interface LnurlReceiveMetadata {
375
476
  nostrZapRequest?: string;
376
477
  nostrZapReceipt?: string;
377
478
  senderComment?: string;
378
479
  }
379
480
 
380
- export interface LnurlWithdrawRequestDetails {
381
- callback: string;
382
- k1: string;
383
- defaultDescription: string;
384
- minWithdrawable: number;
385
- maxWithdrawable: number;
386
- }
387
-
388
- export interface KeySetConfig {
389
- keySetType: KeySetType;
390
- useAddressIndex: boolean;
391
- accountNumber?: number;
481
+ export interface SparkInvoiceDetails {
482
+ invoice: string;
483
+ identityPublicKey: string;
484
+ network: BitcoinNetwork;
485
+ amount?: string;
486
+ tokenIdentifier?: string;
487
+ expiryTime?: number;
488
+ description?: string;
489
+ senderPublicKey?: string;
392
490
  }
393
491
 
394
- export interface LnurlWithdrawInfo {
395
- withdrawUrl: string;
492
+ export interface ListFiatCurrenciesResponse {
493
+ currencies: FiatCurrency[];
396
494
  }
397
495
 
398
- export interface ClaimHtlcPaymentRequest {
399
- preimage: string;
496
+ export interface LightningAddressInfo {
497
+ description: string;
498
+ lightningAddress: string;
499
+ lnurl: LnurlInfo;
500
+ username: string;
400
501
  }
401
502
 
402
- export interface LocaleOverrides {
403
- locale: string;
404
- spacing?: number;
405
- symbol: Symbol;
406
- }
503
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
407
504
 
408
- export interface RegisterLightningAddressRequest {
409
- username: string;
410
- description?: string;
505
+ export interface SendPaymentRequest {
506
+ prepareResponse: PrepareSendPaymentResponse;
507
+ options?: SendPaymentOptions;
508
+ idempotencyKey?: string;
411
509
  }
412
510
 
413
511
  export interface Payment {
@@ -419,285 +517,264 @@ export interface Payment {
419
517
  timestamp: number;
420
518
  method: PaymentMethod;
421
519
  details?: PaymentDetails;
520
+ conversionDetails?: ConversionDetails;
422
521
  }
423
522
 
424
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
425
-
426
- export interface ListPaymentsRequest {
427
- typeFilter?: PaymentType[];
428
- statusFilter?: PaymentStatus[];
429
- assetFilter?: AssetFilter;
430
- paymentDetailsFilter?: PaymentDetailsFilter[];
431
- fromTimestamp?: number;
432
- toTimestamp?: number;
433
- offset?: number;
434
- limit?: number;
435
- sortAscending?: boolean;
436
- }
437
-
438
- export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
439
-
440
- export interface TokenMetadata {
441
- identifier: string;
442
- issuerPublicKey: string;
443
- name: string;
444
- ticker: string;
445
- decimals: number;
446
- maxSupply: string;
447
- isFreezable: boolean;
448
- }
449
-
450
- export interface LnurlPayRequest {
451
- prepareResponse: PrepareLnurlPayResponse;
452
- idempotencyKey?: string;
523
+ export interface OutgoingChange {
524
+ change: RecordChange;
525
+ parent?: Record;
453
526
  }
454
527
 
455
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
456
-
457
- export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" };
528
+ export interface GetInfoRequest {
529
+ ensureSynced?: boolean;
530
+ }
458
531
 
459
- 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 };
532
+ 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 };
460
533
 
461
- export interface DepositInfo {
462
- txid: string;
463
- vout: number;
464
- amountSats: number;
465
- refundTx?: string;
466
- refundTxId?: string;
467
- claimError?: DepositClaimError;
534
+ export interface ClaimHtlcPaymentRequest {
535
+ preimage: string;
468
536
  }
469
537
 
470
- export interface GetTokensMetadataRequest {
471
- tokenIdentifiers: string[];
538
+ export interface ConversionInfo {
539
+ poolId: string;
540
+ conversionId: string;
541
+ status: ConversionStatus;
542
+ fee?: string;
543
+ purpose?: ConversionPurpose;
472
544
  }
473
545
 
474
- export interface FetchConversionLimitsResponse {
475
- minFromAmount?: bigint;
476
- minToAmount?: bigint;
546
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
547
+
548
+ export interface GetTokensMetadataResponse {
549
+ tokensMetadata: TokenMetadata[];
477
550
  }
478
551
 
479
- export interface Bolt12OfferBlindedPath {
480
- blindedHops: string[];
552
+ export interface ClaimHtlcPaymentResponse {
553
+ payment: Payment;
481
554
  }
482
555
 
483
- export interface ReceivePaymentRequest {
484
- paymentMethod: ReceivePaymentMethod;
556
+ export interface LogEntry {
557
+ line: string;
558
+ level: string;
485
559
  }
486
560
 
487
- export interface Credentials {
488
- username: string;
489
- password: string;
561
+ export interface LnurlWithdrawInfo {
562
+ withdrawUrl: string;
490
563
  }
491
564
 
492
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
565
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
566
+
567
+ export interface RefundDepositResponse {
568
+ txId: string;
569
+ txHex: string;
570
+ }
493
571
 
494
572
  export interface PrepareLnurlPayResponse {
495
- amountSats: number;
573
+ payAmount: BitcoinPayAmount;
496
574
  comment?: string;
497
575
  payRequest: LnurlPayRequestDetails;
498
576
  feeSats: number;
499
577
  invoiceDetails: Bolt11InvoiceDetails;
500
578
  successAction?: SuccessAction;
579
+ conversionEstimate?: ConversionEstimate;
501
580
  }
502
581
 
503
- export interface SparkHtlcOptions {
504
- paymentHash: string;
505
- expiryDurationSecs: number;
582
+ export interface AesSuccessActionData {
583
+ description: string;
584
+ ciphertext: string;
585
+ iv: string;
506
586
  }
507
587
 
508
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
509
-
510
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
511
-
512
- export interface SparkHtlcDetails {
513
- paymentHash: string;
514
- preimage?: string;
515
- expiryTime: number;
516
- status: SparkHtlcStatus;
588
+ export interface LocalizedName {
589
+ locale: string;
590
+ name: string;
517
591
  }
518
592
 
519
- export interface GetInfoRequest {
520
- ensureSynced?: boolean;
593
+ export interface KeySetConfig {
594
+ keySetType: KeySetType;
595
+ useAddressIndex: boolean;
596
+ accountNumber?: number;
521
597
  }
522
598
 
523
- export interface SignMessageRequest {
524
- message: string;
525
- compact: boolean;
526
- }
599
+ 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 };
527
600
 
528
- export interface Bolt12OfferDetails {
529
- absoluteExpiry?: number;
530
- chains: string[];
531
- description?: string;
532
- issuer?: string;
533
- minAmount?: Amount;
534
- offer: Bolt12Offer;
535
- paths: Bolt12OfferBlindedPath[];
536
- signingPubkey?: string;
601
+ export interface FiatCurrency {
602
+ id: string;
603
+ info: CurrencyInfo;
537
604
  }
538
605
 
539
- export interface AesSuccessActionData {
606
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
607
+
608
+ export interface AesSuccessActionDataDecrypted {
540
609
  description: string;
541
- ciphertext: string;
542
- iv: string;
610
+ plaintext: string;
543
611
  }
544
612
 
545
- export interface RefundDepositResponse {
546
- txId: string;
547
- txHex: string;
613
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
614
+
615
+ export interface RecordChange {
616
+ id: RecordId;
617
+ schemaVersion: string;
618
+ updatedFields: Map<string, string>;
619
+ revision: number;
548
620
  }
549
621
 
550
- export type PaymentStatus = "completed" | "pending" | "failed";
622
+ export type PayAmount = { type: "bitcoin"; amountSats: number } | { type: "token"; amount: string; tokenIdentifier: string } | { type: "drain" };
551
623
 
552
- export interface CheckMessageRequest {
553
- message: string;
554
- pubkey: string;
555
- signature: string;
624
+ export interface CheckMessageResponse {
625
+ isValid: boolean;
556
626
  }
557
627
 
558
- export interface ListFiatRatesResponse {
559
- rates: Rate[];
628
+ export interface Bolt12Offer {
629
+ offer: string;
630
+ source: PaymentRequestSource;
560
631
  }
561
632
 
562
- export interface MessageSuccessActionData {
563
- message: string;
633
+ export interface ListPaymentsRequest {
634
+ typeFilter?: PaymentType[];
635
+ statusFilter?: PaymentStatus[];
636
+ assetFilter?: AssetFilter;
637
+ paymentDetailsFilter?: PaymentDetailsFilter[];
638
+ fromTimestamp?: number;
639
+ toTimestamp?: number;
640
+ offset?: number;
641
+ limit?: number;
642
+ sortAscending?: boolean;
564
643
  }
565
644
 
566
- export interface CurrencyInfo {
567
- name: string;
568
- fractionSize: number;
645
+ export interface LocaleOverrides {
646
+ locale: string;
569
647
  spacing?: number;
570
- symbol?: Symbol;
571
- uniqSymbol?: Symbol;
572
- localizedName: LocalizedName[];
573
- localeOverrides: LocaleOverrides[];
648
+ symbol: Symbol;
574
649
  }
575
650
 
576
- export interface FetchConversionLimitsRequest {
577
- conversionType: ConversionType;
578
- tokenIdentifier?: string;
579
- }
651
+ export type PaymentStatus = "completed" | "pending" | "failed";
580
652
 
581
- export interface ClaimHtlcPaymentResponse {
582
- payment: Payment;
653
+ export interface SparkAddressDetails {
654
+ address: string;
655
+ identityPublicKey: string;
656
+ network: BitcoinNetwork;
657
+ source: PaymentRequestSource;
583
658
  }
584
659
 
585
- export interface LnurlAuthRequestDetails {
586
- k1: string;
587
- action?: string;
588
- domain: string;
589
- url: string;
660
+ export interface UpdateUserSettingsRequest {
661
+ sparkPrivateModeEnabled?: boolean;
590
662
  }
591
663
 
592
- export interface TokenBalance {
593
- balance: bigint;
594
- tokenMetadata: TokenMetadata;
664
+ export interface LnurlPayRequest {
665
+ prepareResponse: PrepareLnurlPayResponse;
666
+ idempotencyKey?: string;
595
667
  }
596
668
 
597
- export interface ListUnclaimedDepositsRequest {}
598
-
599
- export interface IncomingChange {
600
- newState: Record;
601
- oldState?: Record;
602
- }
669
+ export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
603
670
 
604
- export interface Bolt11RouteHintHop {
605
- srcNodeId: string;
606
- shortChannelId: string;
607
- feesBaseMsat: number;
608
- feesProportionalMillionths: number;
609
- cltvExpiryDelta: number;
610
- htlcMinimumMsat?: number;
611
- htlcMaximumMsat?: number;
671
+ export interface ConnectRequest {
672
+ config: Config;
673
+ seed: Seed;
674
+ storageDir: string;
612
675
  }
613
676
 
614
- export interface Bip21Extra {
615
- key: string;
616
- value: string;
677
+ export interface Bolt11InvoiceDetails {
678
+ amountMsat?: number;
679
+ description?: string;
680
+ descriptionHash?: string;
681
+ expiry: number;
682
+ invoice: Bolt11Invoice;
683
+ minFinalCltvExpiryDelta: number;
684
+ network: BitcoinNetwork;
685
+ payeePubkey: string;
686
+ paymentHash: string;
687
+ paymentSecret: string;
688
+ routingHints: Bolt11RouteHint[];
689
+ timestamp: number;
617
690
  }
618
691
 
619
- export interface LightningAddressInfo {
620
- description: string;
621
- lightningAddress: string;
622
- lnurl: string;
623
- username: string;
692
+ export interface UserSettings {
693
+ sparkPrivateModeEnabled: boolean;
624
694
  }
625
695
 
626
- export interface UpdateUserSettingsRequest {
627
- sparkPrivateModeEnabled?: boolean;
696
+ export interface PaymentMetadata {
697
+ parentPaymentId?: string;
698
+ lnurlPayInfo?: LnurlPayInfo;
699
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
700
+ lnurlDescription?: string;
701
+ conversionInfo?: ConversionInfo;
628
702
  }
629
703
 
630
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
704
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
631
705
 
632
706
  export interface GetPaymentResponse {
633
707
  payment: Payment;
634
708
  }
635
709
 
636
- export interface ClaimDepositResponse {
637
- payment: Payment;
710
+ export interface RegisterLightningAddressRequest {
711
+ username: string;
712
+ description?: string;
638
713
  }
639
714
 
640
- export interface ListFiatCurrenciesResponse {
641
- currencies: FiatCurrency[];
715
+ export interface Bolt11RouteHint {
716
+ hops: Bolt11RouteHintHop[];
642
717
  }
643
718
 
644
- export interface UserSettings {
645
- sparkPrivateModeEnabled: boolean;
719
+ export interface SendOnchainFeeQuote {
720
+ id: string;
721
+ expiresAt: number;
722
+ speedFast: SendOnchainSpeedFeeQuote;
723
+ speedMedium: SendOnchainSpeedFeeQuote;
724
+ speedSlow: SendOnchainSpeedFeeQuote;
646
725
  }
647
726
 
648
- export interface ConnectRequest {
649
- config: Config;
650
- seed: Seed;
651
- storageDir: string;
652
- }
727
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { 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 };
653
728
 
654
- export interface Bolt12InvoiceRequestDetails {}
729
+ export interface Record {
730
+ id: RecordId;
731
+ revision: number;
732
+ schemaVersion: string;
733
+ data: Map<string, string>;
734
+ }
655
735
 
656
- export interface SparkInvoicePaymentDetails {
657
- description?: string;
658
- invoice: string;
736
+ export interface ListFiatRatesResponse {
737
+ rates: Rate[];
659
738
  }
660
739
 
661
- export interface Bolt12Invoice {
662
- invoice: string;
663
- source: PaymentRequestSource;
740
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
741
+
742
+ export interface Symbol {
743
+ grapheme?: string;
744
+ template?: string;
745
+ rtl?: boolean;
746
+ position?: number;
664
747
  }
665
748
 
666
- export interface LnurlPayResponse {
749
+ export interface ClaimDepositResponse {
667
750
  payment: Payment;
668
- successAction?: SuccessActionProcessed;
669
751
  }
670
752
 
671
- export interface PaymentMetadata {
672
- parentPaymentId?: string;
673
- lnurlPayInfo?: LnurlPayInfo;
674
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
675
- lnurlDescription?: string;
676
- conversionInfo?: ConversionInfo;
753
+ export interface ClaimDepositRequest {
754
+ txid: string;
755
+ vout: number;
756
+ maxFee?: MaxFee;
677
757
  }
678
758
 
679
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
680
-
681
- export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
682
-
683
- export interface Bolt11RouteHint {
684
- hops: Bolt11RouteHintHop[];
759
+ export interface OptimizationProgress {
760
+ isRunning: boolean;
761
+ currentRound: number;
762
+ totalRounds: number;
685
763
  }
686
764
 
687
765
  export interface PrepareSendPaymentRequest {
688
766
  paymentRequest: string;
689
- amount?: bigint;
690
- tokenIdentifier?: string;
767
+ payAmount?: PayAmount;
691
768
  conversionOptions?: ConversionOptions;
692
769
  }
693
770
 
694
- export interface SendOnchainSpeedFeeQuote {
695
- userFeeSat: number;
696
- l1BroadcastFeeSat: number;
771
+ export interface SetLnurlMetadataItem {
772
+ paymentHash: string;
773
+ senderComment?: string;
774
+ nostrZapRequest?: string;
775
+ nostrZapReceipt?: string;
697
776
  }
698
777
 
699
- export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
700
-
701
778
  export interface LnurlPayInfo {
702
779
  lnAddress?: string;
703
780
  comment?: string;
@@ -707,87 +784,93 @@ export interface LnurlPayInfo {
707
784
  rawSuccessAction?: SuccessAction;
708
785
  }
709
786
 
710
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
711
-
712
- export interface ConversionEstimate {
713
- options: ConversionOptions;
714
- amount: bigint;
715
- fee: bigint;
716
- }
717
-
718
- export interface ListPaymentsResponse {
719
- payments: Payment[];
720
- }
721
-
722
- export interface SparkInvoiceDetails {
723
- invoice: string;
724
- identityPublicKey: string;
725
- network: BitcoinNetwork;
726
- amount?: string;
727
- tokenIdentifier?: string;
728
- expiryTime?: number;
729
- description?: string;
730
- senderPublicKey?: string;
731
- }
732
-
733
- export interface ConversionInfo {
734
- poolId: string;
735
- conversionId: string;
736
- status: ConversionStatus;
737
- fee?: string;
738
- purpose?: ConversionPurpose;
739
- }
740
-
741
- export interface Symbol {
742
- grapheme?: string;
743
- template?: string;
744
- rtl?: boolean;
745
- position?: number;
787
+ export interface FetchConversionLimitsResponse {
788
+ minFromAmount?: bigint;
789
+ minToAmount?: bigint;
746
790
  }
747
791
 
748
- export interface ClaimDepositRequest {
749
- txid: string;
750
- vout: number;
751
- maxFee?: MaxFee;
792
+ export interface MessageSuccessActionData {
793
+ message: string;
752
794
  }
753
795
 
754
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
755
-
756
- export interface LnurlWithdrawResponse {
757
- paymentRequest: string;
758
- payment?: Payment;
796
+ export interface Credentials {
797
+ username: string;
798
+ password: string;
759
799
  }
760
800
 
761
- export interface Record {
762
- id: RecordId;
763
- revision: number;
764
- schemaVersion: string;
765
- data: Map<string, string>;
801
+ export interface Bolt12OfferDetails {
802
+ absoluteExpiry?: number;
803
+ chains: string[];
804
+ description?: string;
805
+ issuer?: string;
806
+ minAmount?: Amount;
807
+ offer: Bolt12Offer;
808
+ paths: Bolt12OfferBlindedPath[];
809
+ signingPubkey?: string;
766
810
  }
767
811
 
768
- export interface AesSuccessActionDataDecrypted {
769
- description: string;
770
- plaintext: string;
812
+ export interface Bolt12OfferBlindedPath {
813
+ blindedHops: string[];
771
814
  }
772
815
 
773
- 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 };
816
+ 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 };
774
817
 
775
- export interface RecordChange {
776
- id: RecordId;
777
- schemaVersion: string;
778
- updatedFields: Map<string, string>;
779
- revision: number;
818
+ /**
819
+ * Interface for passkey PRF (Pseudo-Random Function) operations.
820
+ *
821
+ * Implement this interface to provide passkey PRF functionality for seedless wallet restore.
822
+ *
823
+ * @example
824
+ * ```typescript
825
+ * class BrowserPasskeyPrfProvider implements PasskeyPrfProvider {
826
+ * async derivePrfSeed(salt: string): Promise<Uint8Array> {
827
+ * const credential = await navigator.credentials.get({
828
+ * publicKey: {
829
+ * challenge: new Uint8Array(32),
830
+ * rpId: window.location.hostname,
831
+ * allowCredentials: [], // or specific credential IDs
832
+ * extensions: {
833
+ * prf: { eval: { first: new TextEncoder().encode(salt) } }
834
+ * }
835
+ * }
836
+ * });
837
+ * const results = credential.getClientExtensionResults();
838
+ * return new Uint8Array(results.prf.results.first);
839
+ * }
840
+ *
841
+ * async isPrfAvailable(): Promise<boolean> {
842
+ * return window.PublicKeyCredential?.isUserVerifyingPlatformAuthenticatorAvailable?.() ?? false;
843
+ * }
844
+ * }
845
+ * ```
846
+ */
847
+ export interface PasskeyPrfProvider {
848
+ /**
849
+ * Derive a 32-byte seed from passkey PRF with the given salt.
850
+ *
851
+ * The platform authenticates the user via passkey and evaluates the PRF extension.
852
+ * The salt is used as input to the PRF to derive a deterministic output.
853
+ *
854
+ * @param salt - The salt string to use for PRF evaluation
855
+ * @returns A Promise resolving to the 32-byte PRF output
856
+ * @throws If authentication fails or PRF is not supported
857
+ */
858
+ derivePrfSeed(salt: string): Promise<Uint8Array>;
859
+
860
+ /**
861
+ * Check if a PRF-capable passkey is available on this device.
862
+ *
863
+ * This allows applications to gracefully degrade if passkey PRF is not supported.
864
+ *
865
+ * @returns A Promise resolving to true if PRF-capable passkey is available
866
+ */
867
+ isPrfAvailable(): Promise<boolean>;
780
868
  }
781
869
 
782
- export interface MintIssuerTokenRequest {
870
+ export interface BurnIssuerTokenRequest {
783
871
  amount: bigint;
784
872
  }
785
873
 
786
- export interface UnfreezeIssuerTokenResponse {
787
- impactedOutputIds: string[];
788
- impactedTokenAmount: bigint;
789
- }
790
-
791
874
  export interface FreezeIssuerTokenRequest {
792
875
  address: string;
793
876
  }
@@ -800,19 +883,24 @@ export interface CreateIssuerTokenRequest {
800
883
  maxSupply: bigint;
801
884
  }
802
885
 
803
- export interface BurnIssuerTokenRequest {
804
- amount: bigint;
805
- }
806
-
807
- export interface FreezeIssuerTokenResponse {
886
+ export interface UnfreezeIssuerTokenResponse {
808
887
  impactedOutputIds: string[];
809
888
  impactedTokenAmount: bigint;
810
889
  }
811
890
 
891
+ export interface MintIssuerTokenRequest {
892
+ amount: bigint;
893
+ }
894
+
812
895
  export interface UnfreezeIssuerTokenRequest {
813
896
  address: string;
814
897
  }
815
898
 
899
+ export interface FreezeIssuerTokenResponse {
900
+ impactedOutputIds: string[];
901
+ impactedTokenAmount: bigint;
902
+ }
903
+
816
904
  export interface ExternalSigner {
817
905
  identityPublicKey(): PublicKeyBytes;
818
906
  derivePublicKey(path: string): Promise<PublicKeyBytes>;
@@ -836,12 +924,28 @@ export interface ExternalSigner {
836
924
  hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
837
925
  }
838
926
 
839
- export interface IdentifierSignaturePair {
840
- identifier: ExternalIdentifier;
841
- signature: ExternalFrostSignatureShare;
927
+ export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
928
+
929
+ export interface ExternalVerifiableSecretShare {
930
+ secretShare: ExternalSecretShare;
931
+ proofs: number[][];
842
932
  }
843
933
 
844
- export interface SecretBytes {
934
+ export interface RecoverableEcdsaSignatureBytes {
935
+ bytes: number[];
936
+ }
937
+
938
+ export interface ExternalSignFrostRequest {
939
+ message: number[];
940
+ publicKey: number[];
941
+ secret: ExternalSecretSource;
942
+ verifyingKey: number[];
943
+ selfNonceCommitment: ExternalFrostCommitments;
944
+ statechainCommitments: IdentifierCommitmentPair[];
945
+ adaptorPublicKey?: number[];
946
+ }
947
+
948
+ export interface SchnorrSignatureBytes {
845
949
  bytes: number[];
846
950
  }
847
951
 
@@ -857,68 +961,39 @@ export interface ExternalAggregateFrostRequest {
857
961
  adaptorPublicKey?: number[];
858
962
  }
859
963
 
860
- export interface RecoverableEcdsaSignatureBytes {
861
- bytes: number[];
964
+ export interface ExternalTreeNodeId {
965
+ id: string;
862
966
  }
863
967
 
864
- export interface SchnorrSignatureBytes {
968
+ export interface PublicKeyBytes {
865
969
  bytes: number[];
866
970
  }
867
971
 
972
+ export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
973
+
868
974
  export interface EcdsaSignatureBytes {
869
975
  bytes: number[];
870
976
  }
871
977
 
872
- export interface ExternalFrostSignatureShare {
978
+ export interface MessageBytes {
873
979
  bytes: number[];
874
980
  }
875
981
 
876
- export interface ExternalSecretShare {
877
- threshold: number;
878
- index: ExternalScalar;
879
- share: ExternalScalar;
880
- }
881
-
882
982
  export interface ExternalSigningCommitments {
883
983
  hiding: number[];
884
984
  binding: number[];
885
985
  }
886
986
 
887
- export interface ExternalFrostCommitments {
888
- hidingCommitment: number[];
889
- bindingCommitment: number[];
890
- noncesCiphertext: number[];
891
- }
892
-
893
- export interface ExternalVerifiableSecretShare {
894
- secretShare: ExternalSecretShare;
895
- proofs: number[][];
896
- }
897
-
898
987
  export interface ExternalEncryptedSecret {
899
988
  ciphertext: number[];
900
989
  }
901
990
 
902
- export interface ExternalSignFrostRequest {
903
- message: number[];
904
- publicKey: number[];
905
- secret: ExternalSecretSource;
906
- verifyingKey: number[];
907
- selfNonceCommitment: ExternalFrostCommitments;
908
- statechainCommitments: IdentifierCommitmentPair[];
909
- adaptorPublicKey?: number[];
910
- }
911
-
912
- export interface ExternalTreeNodeId {
913
- id: string;
914
- }
915
-
916
- export interface IdentifierPublicKeyPair {
991
+ export interface IdentifierSignaturePair {
917
992
  identifier: ExternalIdentifier;
918
- publicKey: number[];
993
+ signature: ExternalFrostSignatureShare;
919
994
  }
920
995
 
921
- export interface MessageBytes {
996
+ export interface SecretBytes {
922
997
  bytes: number[];
923
998
  }
924
999
 
@@ -927,15 +1002,11 @@ export interface IdentifierCommitmentPair {
927
1002
  commitment: ExternalSigningCommitments;
928
1003
  }
929
1004
 
930
- export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
931
-
932
- export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
933
-
934
1005
  export interface ExternalFrostSignature {
935
1006
  bytes: number[];
936
1007
  }
937
1008
 
938
- export interface PublicKeyBytes {
1009
+ export interface ExternalScalar {
939
1010
  bytes: number[];
940
1011
  }
941
1012
 
@@ -943,7 +1014,24 @@ export interface ExternalIdentifier {
943
1014
  bytes: number[];
944
1015
  }
945
1016
 
946
- export interface ExternalScalar {
1017
+ export interface IdentifierPublicKeyPair {
1018
+ identifier: ExternalIdentifier;
1019
+ publicKey: number[];
1020
+ }
1021
+
1022
+ export interface ExternalFrostCommitments {
1023
+ hidingCommitment: number[];
1024
+ bindingCommitment: number[];
1025
+ noncesCiphertext: number[];
1026
+ }
1027
+
1028
+ export interface ExternalSecretShare {
1029
+ threshold: number;
1030
+ index: ExternalScalar;
1031
+ share: ExternalScalar;
1032
+ }
1033
+
1034
+ export interface ExternalFrostSignatureShare {
947
1035
  bytes: number[];
948
1036
  }
949
1037
 
@@ -957,7 +1045,7 @@ export interface Storage {
957
1045
  deleteCachedItem: (key: string) => Promise<void>;
958
1046
  listPayments: (request: ListPaymentsRequest) => Promise<Payment[]>;
959
1047
  insertPayment: (payment: Payment) => Promise<void>;
960
- setPaymentMetadata: (paymentId: string, metadata: PaymentMetadata) => Promise<void>;
1048
+ insertPaymentMetadata: (paymentId: string, metadata: PaymentMetadata) => Promise<void>;
961
1049
  getPaymentById: (id: string) => Promise<Payment>;
962
1050
  getPaymentByInvoice: (invoice: string) => Promise<Payment>;
963
1051
  addDeposit: (txid: string, vout: number, amount_sats: number) => Promise<void>;
@@ -965,6 +1053,7 @@ export interface Storage {
965
1053
  listDeposits: () => Promise<DepositInfo[]>;
966
1054
  updateDeposit: (txid: string, vout: number, payload: UpdateDepositPayload) => Promise<void>;
967
1055
  setLnurlMetadata: (metadata: SetLnurlMetadataItem[]) => Promise<void>;
1056
+ getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: RelatedPayment[] }>;
968
1057
  syncAddOutgoingChange: (record: UnversionedRecordChange) => Promise<number>;
969
1058
  syncCompleteOutgoingSync: (record: Record) => Promise<void>;
970
1059
  syncGetPendingOutgoingChanges: (limit: number) => Promise<OutgoingChange[]>;
@@ -1082,6 +1171,60 @@ export class SdkBuilder {
1082
1171
  static new(config: Config, seed: Seed): SdkBuilder;
1083
1172
  build(): Promise<BreezSdk>;
1084
1173
  }
1174
+ /**
1175
+ * WASM wrapper for SeedlessRestore.
1176
+ *
1177
+ * Orchestrates seedless wallet creation and restore operations using
1178
+ * passkey PRF and Nostr relays.
1179
+ */
1180
+ export class SeedlessRestore {
1181
+ free(): void;
1182
+ /**
1183
+ * List all salts published to Nostr for this passkey's identity.
1184
+ *
1185
+ * This method queries Nostr relays for all kind-1 text note events
1186
+ * authored by the Nostr identity derived from the passkey.
1187
+ *
1188
+ * @returns A Promise resolving to an array of salt strings
1189
+ */
1190
+ listSalts(): Promise<any>;
1191
+ /**
1192
+ * Create a new wallet seed from a user-provided salt.
1193
+ *
1194
+ * This method:
1195
+ * 1. Derives the Nostr identity from the passkey using the magic salt
1196
+ * 2. Checks if the salt already exists on Nostr (idempotency)
1197
+ * 3. If not, publishes the salt to Nostr relays
1198
+ * 4. Derives the wallet seed from the passkey using the user's salt
1199
+ *
1200
+ * @param salt - A user-chosen salt string (e.g., "personal", "business")
1201
+ * @returns A Promise resolving to the derived wallet seed (24-word mnemonic)
1202
+ */
1203
+ createSeed(salt: string): Promise<any>;
1204
+ /**
1205
+ * Restore a wallet seed from a specific salt.
1206
+ *
1207
+ * Use this after calling listSalts() to restore a specific wallet.
1208
+ * This method only derives the seed; it does not publish anything.
1209
+ *
1210
+ * @param salt - The salt string to use for seed derivation
1211
+ * @returns A Promise resolving to the derived wallet seed (24-word mnemonic)
1212
+ */
1213
+ restoreSeed(salt: string): Promise<any>;
1214
+ /**
1215
+ * Check if passkey PRF is available on this device.
1216
+ *
1217
+ * @returns A Promise resolving to true if PRF-capable passkey is available
1218
+ */
1219
+ isPrfAvailable(): Promise<boolean>;
1220
+ /**
1221
+ * Create a new SeedlessRestore instance.
1222
+ *
1223
+ * @param prf_provider - Platform implementation of passkey PRF operations
1224
+ * @param relay_config - Configuration for Nostr relay connections
1225
+ */
1226
+ constructor(prf_provider: PasskeyPrfProvider, relay_config?: NostrRelayConfig | null);
1227
+ }
1085
1228
  export class TokenIssuer {
1086
1229
  private constructor();
1087
1230
  free(): void;