@breeztech/breez-sdk-spark 0.11.0-dev2 → 0.11.0-dev3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,16 +9,16 @@
9
9
  * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
10
10
  */
11
11
  export function defaultPostgresStorageConfig(connection_string: string): PostgresStorageConfig;
12
+ export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
13
+ export function defaultConfig(network: Network): Config;
14
+ export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
15
+ export function connect(request: ConnectRequest): Promise<BreezSdk>;
12
16
  /**
13
17
  * Creates a default external signer from a mnemonic phrase.
14
18
  *
15
19
  * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
16
20
  */
17
21
  export function getSparkStatus(): Promise<SparkStatus>;
18
- export function defaultConfig(network: Network): Config;
19
- export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
20
- export function defaultExternalSigner(mnemonic: string, passphrase: string | null | undefined, network: Network, key_set_config?: KeySetConfig | null): DefaultSigner;
21
- export function connect(request: ConnectRequest): Promise<BreezSdk>;
22
22
  export function connectWithSigner(config: Config, signer: ExternalSigner, storage_dir: string): Promise<BreezSdk>;
23
23
  /**
24
24
  * Entry point invoked by JavaScript in a worker.
@@ -30,6 +30,49 @@ export function task_worker_entry_point(ptr: number): void;
30
30
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
31
31
  */
32
32
  type ReadableStreamType = "bytes";
33
+
34
+ /** Serialized tree node. Key fields used by store implementations: id, status, value. */
35
+ interface TreeNode {
36
+ id: string;
37
+ tree_id: string;
38
+ value: number;
39
+ status: string;
40
+ [key: string]: unknown;
41
+ }
42
+
43
+ interface Leaves {
44
+ available: TreeNode[];
45
+ notAvailable: TreeNode[];
46
+ availableMissingFromOperators: TreeNode[];
47
+ reservedForPayment: TreeNode[];
48
+ reservedForSwap: TreeNode[];
49
+ }
50
+
51
+ interface LeavesReservation {
52
+ id: string;
53
+ leaves: TreeNode[];
54
+ }
55
+
56
+ type TargetAmounts =
57
+ | { type: 'amountAndFee'; amountSats: number; feeSats: number | null }
58
+ | { type: 'exactDenominations'; denominations: number[] };
59
+
60
+ type ReserveResult =
61
+ | { type: 'success'; reservation: LeavesReservation }
62
+ | { type: 'insufficientFunds' }
63
+ | { type: 'waitForPending'; needed: number; available: number; pending: number };
64
+
65
+ export interface TreeStore {
66
+ addLeaves: (leaves: TreeNode[]) => Promise<void>;
67
+ getLeaves: () => Promise<Leaves>;
68
+ setLeaves: (leaves: TreeNode[], missingLeaves: TreeNode[], refreshStartedAtMs: number) => Promise<void>;
69
+ cancelReservation: (id: string) => Promise<void>;
70
+ finalizeReservation: (id: string, newLeaves: TreeNode[] | null) => Promise<void>;
71
+ tryReserveLeaves: (targetAmounts: TargetAmounts | null, exactOnly: boolean, purpose: string) => Promise<ReserveResult>;
72
+ now: () => Promise<number>;
73
+ updateReservation: (reservationId: string, reservedLeaves: TreeNode[], changeLeaves: TreeNode[]) => Promise<LeavesReservation>;
74
+ }
75
+
33
76
  /**
34
77
  * Configuration for PostgreSQL storage connection pool.
35
78
  */
@@ -84,6 +127,14 @@ export interface BitcoinChainService {
84
127
  recommendedFees(): Promise<RecommendedFees>;
85
128
  }
86
129
 
130
+ export interface RecommendedFees {
131
+ fastestFee: number;
132
+ halfHourFee: number;
133
+ hourFee: number;
134
+ economyFee: number;
135
+ minimumFee: number;
136
+ }
137
+
87
138
  export interface TxStatus {
88
139
  confirmed: boolean;
89
140
  blockHeight?: number;
@@ -99,119 +150,132 @@ export interface Utxo {
99
150
  status: TxStatus;
100
151
  }
101
152
 
102
- export interface RecommendedFees {
103
- fastestFee: number;
104
- halfHourFee: number;
105
- hourFee: number;
106
- economyFee: number;
107
- minimumFee: number;
108
- }
109
-
110
153
  export interface PaymentObserver {
111
154
  beforeSend: (payments: ProvisionalPayment[]) => Promise<void>;
112
155
  }
113
156
 
114
- export interface BitcoinAddressDetails {
115
- address: string;
116
- network: BitcoinNetwork;
117
- source: PaymentRequestSource;
157
+ export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
158
+
159
+ export interface Bolt12InvoiceDetails {
160
+ amountMsat: number;
161
+ invoice: Bolt12Invoice;
118
162
  }
119
163
 
120
- export interface Contact {
121
- id: string;
122
- name: string;
123
- paymentIdentifier: string;
124
- createdAt: number;
125
- updatedAt: number;
164
+ export interface ConnectRequest {
165
+ config: Config;
166
+ seed: Seed;
167
+ storageDir: string;
126
168
  }
127
169
 
128
- export interface ListUnclaimedDepositsRequest {}
170
+ export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
129
171
 
130
- export interface PrepareSendPaymentRequest {
131
- paymentRequest: string;
132
- amount?: bigint;
133
- tokenIdentifier?: string;
134
- conversionOptions?: ConversionOptions;
135
- feePolicy?: FeePolicy;
172
+ export interface Bolt11RouteHintHop {
173
+ srcNodeId: string;
174
+ shortChannelId: string;
175
+ feesBaseMsat: number;
176
+ feesProportionalMillionths: number;
177
+ cltvExpiryDelta: number;
178
+ htlcMinimumMsat?: number;
179
+ htlcMaximumMsat?: number;
136
180
  }
137
181
 
138
- export interface KeySetConfig {
139
- keySetType: KeySetType;
140
- useAddressIndex: boolean;
141
- accountNumber?: number;
182
+ export interface LightningAddressDetails {
183
+ address: string;
184
+ payRequest: LnurlPayRequestDetails;
142
185
  }
143
186
 
144
- export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
187
+ export interface LnurlAuthRequestDetails {
188
+ k1: string;
189
+ action?: string;
190
+ domain: string;
191
+ url: string;
192
+ }
145
193
 
146
- export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
194
+ export interface LnurlInfo {
195
+ url: string;
196
+ bech32: string;
197
+ }
147
198
 
148
- export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
199
+ export interface ConversionDetails {
200
+ from: ConversionStep;
201
+ to: ConversionStep;
202
+ }
149
203
 
150
- export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails);
204
+ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
151
205
 
152
- export interface ConversionStep {
153
- paymentId: string;
154
- amount: bigint;
155
- fee: bigint;
156
- method: PaymentMethod;
157
- tokenMetadata?: TokenMetadata;
206
+ export interface TokenMetadata {
207
+ identifier: string;
208
+ issuerPublicKey: string;
209
+ name: string;
210
+ ticker: string;
211
+ decimals: number;
212
+ maxSupply: string;
213
+ isFreezable: boolean;
158
214
  }
159
215
 
160
- export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
216
+ export interface OutgoingChange {
217
+ change: RecordChange;
218
+ parent?: Record;
219
+ }
161
220
 
162
- export interface Config {
163
- apiKey?: string;
164
- network: Network;
165
- syncIntervalSecs: number;
166
- maxDepositClaimFee?: MaxFee;
167
- lnurlDomain?: string;
168
- preferSparkOverLightning: boolean;
169
- externalInputParsers?: ExternalInputParser[];
170
- useDefaultExternalInputParsers: boolean;
171
- realTimeSyncServerUrl?: string;
172
- privateEnabledDefault: boolean;
173
- optimizationConfig: OptimizationConfig;
174
- stableBalanceConfig?: StableBalanceConfig;
175
- /**
176
- * Maximum number of concurrent transfer claims.
177
- *
178
- * Controls how many pending Spark transfers can be claimed in parallel.
179
- * Default is 4. Increase for server environments with high incoming
180
- * payment volume to improve throughput.
181
- */
182
- maxConcurrentClaims: number;
183
- supportLnurlVerify: boolean;
221
+ export interface GetInfoRequest {
222
+ ensureSynced?: boolean;
184
223
  }
185
224
 
186
- export interface Bolt11Invoice {
187
- bolt11: string;
188
- source: PaymentRequestSource;
225
+ export interface Bip21Details {
226
+ amountSat?: number;
227
+ assetId?: string;
228
+ uri: string;
229
+ extras: Bip21Extra[];
230
+ label?: string;
231
+ message?: string;
232
+ paymentMethods: InputType[];
189
233
  }
190
234
 
191
- export type PaymentStatus = "completed" | "pending" | "failed";
235
+ export interface ListPaymentsResponse {
236
+ payments: Payment[];
237
+ }
192
238
 
193
- export type PaymentType = "send" | "receive";
239
+ export interface SendOnchainSpeedFeeQuote {
240
+ userFeeSat: number;
241
+ l1BroadcastFeeSat: number;
242
+ }
194
243
 
195
- export interface LnurlReceiveMetadata {
196
- nostrZapRequest?: string;
197
- nostrZapReceipt?: string;
198
- senderComment?: string;
244
+ export interface SignMessageRequest {
245
+ message: string;
246
+ compact: boolean;
199
247
  }
200
248
 
201
- export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
249
+ export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
202
250
 
203
- export interface Bolt11RouteHint {
204
- hops: Bolt11RouteHintHop[];
251
+ export interface CheckMessageRequest {
252
+ message: string;
253
+ pubkey: string;
254
+ signature: string;
205
255
  }
206
256
 
207
- export interface ConversionOptions {
208
- conversionType: ConversionType;
209
- maxSlippageBps?: number;
210
- completionTimeoutSecs?: number;
257
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
258
+
259
+ export interface SendPaymentResponse {
260
+ payment: Payment;
211
261
  }
212
262
 
213
- export interface GetInfoRequest {
214
- ensureSynced?: boolean;
263
+ export interface Bolt11Invoice {
264
+ bolt11: string;
265
+ source: PaymentRequestSource;
266
+ }
267
+
268
+ export interface LnurlWithdrawRequestDetails {
269
+ callback: string;
270
+ k1: string;
271
+ defaultDescription: string;
272
+ minWithdrawable: number;
273
+ maxWithdrawable: number;
274
+ }
275
+
276
+ export interface ListContactsRequest {
277
+ offset?: number;
278
+ limit?: number;
215
279
  }
216
280
 
217
281
  export interface Record {
@@ -221,121 +285,110 @@ export interface Record {
221
285
  data: Map<string, string>;
222
286
  }
223
287
 
224
- export interface SignMessageRequest {
225
- message: string;
226
- compact: boolean;
288
+ export interface Payment {
289
+ id: string;
290
+ paymentType: PaymentType;
291
+ status: PaymentStatus;
292
+ amount: bigint;
293
+ fees: bigint;
294
+ timestamp: number;
295
+ method: PaymentMethod;
296
+ details?: PaymentDetails;
297
+ conversionDetails?: ConversionDetails;
227
298
  }
228
299
 
229
- export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
300
+ export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
230
301
 
231
- export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string };
302
+ export type PaymentStatus = "completed" | "pending" | "failed";
232
303
 
233
- export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
304
+ export interface ListUnclaimedDepositsRequest {}
234
305
 
235
- export interface LnurlPayRequestDetails {
236
- callback: string;
237
- minSendable: number;
238
- maxSendable: number;
239
- metadataStr: string;
240
- commentAllowed: number;
241
- domain: string;
242
- url: string;
243
- address?: string;
244
- allowsNostr?: boolean;
245
- nostrPubkey?: string;
306
+ export interface Bip21Extra {
307
+ key: string;
308
+ value: string;
246
309
  }
247
310
 
248
- export interface UserSettings {
249
- sparkPrivateModeEnabled: boolean;
311
+ export interface ListFiatCurrenciesResponse {
312
+ currencies: FiatCurrency[];
250
313
  }
251
314
 
252
- export interface RegisterLightningAddressRequest {
253
- username: string;
254
- description?: string;
315
+ export interface SendOnchainFeeQuote {
316
+ id: string;
317
+ expiresAt: number;
318
+ speedFast: SendOnchainSpeedFeeQuote;
319
+ speedMedium: SendOnchainSpeedFeeQuote;
320
+ speedSlow: SendOnchainSpeedFeeQuote;
255
321
  }
256
322
 
257
- export interface ClaimHtlcPaymentResponse {
258
- payment: Payment;
323
+ export interface PaymentRequestSource {
324
+ bip21Uri?: string;
325
+ bip353Address?: string;
259
326
  }
260
327
 
261
- export interface RefundDepositRequest {
262
- txid: string;
263
- vout: number;
264
- destinationAddress: string;
265
- fee: Fee;
266
- }
328
+ export type PaymentType = "send" | "receive";
267
329
 
268
- export interface GetInfoResponse {
269
- identityPubkey: string;
270
- balanceSats: number;
271
- tokenBalances: Map<string, TokenBalance>;
272
- }
330
+ export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
273
331
 
274
- export interface LocaleOverrides {
275
- locale: string;
276
- spacing?: number;
277
- symbol: Symbol;
332
+ export interface TokenBalance {
333
+ balance: bigint;
334
+ tokenMetadata: TokenMetadata;
278
335
  }
279
336
 
280
- export interface PrepareLnurlPayRequest {
281
- amountSats: number;
282
- comment?: string;
283
- payRequest: LnurlPayRequestDetails;
284
- validateSuccessActionUrl?: boolean;
285
- conversionOptions?: ConversionOptions;
286
- feePolicy?: FeePolicy;
287
- }
337
+ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
288
338
 
289
- export interface LightningAddressInfo {
290
- description: string;
291
- lightningAddress: string;
292
- lnurl: LnurlInfo;
293
- username: string;
339
+ export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
340
+
341
+ 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);
342
+
343
+ export interface BuyBitcoinResponse {
344
+ url: string;
294
345
  }
295
346
 
296
- export interface GetPaymentRequest {
347
+ export interface ConversionStep {
297
348
  paymentId: string;
349
+ amount: bigint;
350
+ fee: bigint;
351
+ method: PaymentMethod;
352
+ tokenMetadata?: TokenMetadata;
298
353
  }
299
354
 
300
- export interface Bolt11InvoiceDetails {
301
- amountMsat?: number;
302
- description?: string;
303
- descriptionHash?: string;
304
- expiry: number;
305
- invoice: Bolt11Invoice;
306
- minFinalCltvExpiryDelta: number;
307
- network: BitcoinNetwork;
308
- payeePubkey: string;
309
- paymentHash: string;
310
- paymentSecret: string;
311
- routingHints: Bolt11RouteHint[];
312
- timestamp: number;
355
+ export interface RecordChange {
356
+ id: RecordId;
357
+ schemaVersion: string;
358
+ updatedFields: Map<string, string>;
359
+ localRevision: number;
313
360
  }
314
361
 
315
- export interface TokenMetadata {
316
- identifier: string;
317
- issuerPublicKey: string;
362
+ export interface LocalizedName {
363
+ locale: string;
318
364
  name: string;
319
- ticker: string;
320
- decimals: number;
321
- maxSupply: string;
322
- isFreezable: boolean;
323
365
  }
324
366
 
325
- export interface LnurlWithdrawResponse {
326
- paymentRequest: string;
327
- payment?: Payment;
367
+ export interface PrepareSendPaymentResponse {
368
+ paymentMethod: SendPaymentMethod;
369
+ amount: bigint;
370
+ tokenIdentifier?: string;
371
+ conversionEstimate?: ConversionEstimate;
372
+ feePolicy: FeePolicy;
328
373
  }
329
374
 
330
- export interface OptimizationProgress {
331
- isRunning: boolean;
332
- currentRound: number;
333
- totalRounds: number;
375
+ export interface ClaimDepositRequest {
376
+ txid: string;
377
+ vout: number;
378
+ maxFee?: MaxFee;
334
379
  }
335
380
 
336
- export interface LogEntry {
337
- line: string;
338
- level: string;
381
+ export interface ReceivePaymentResponse {
382
+ paymentRequest: string;
383
+ fee: bigint;
384
+ }
385
+
386
+ export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
387
+
388
+ export interface UpdateContactRequest {
389
+ id: string;
390
+ name: string;
391
+ paymentIdentifier: string;
339
392
  }
340
393
 
341
394
  export interface SilentPaymentAddressDetails {
@@ -344,84 +397,81 @@ export interface SilentPaymentAddressDetails {
344
397
  source: PaymentRequestSource;
345
398
  }
346
399
 
347
- export interface ListUnclaimedDepositsResponse {
348
- deposits: DepositInfo[];
349
- }
350
-
351
- export interface AesSuccessActionData {
352
- description: string;
353
- ciphertext: string;
354
- iv: string;
400
+ export interface FiatCurrency {
401
+ id: string;
402
+ info: CurrencyInfo;
355
403
  }
356
404
 
357
- export interface SendPaymentRequest {
358
- prepareResponse: PrepareSendPaymentResponse;
359
- options?: SendPaymentOptions;
360
- idempotencyKey?: string;
405
+ export interface GetPaymentResponse {
406
+ payment: Payment;
361
407
  }
362
408
 
363
- export interface Bolt12InvoiceRequestDetails {}
364
-
365
- export interface SparkHtlcOptions {
366
- paymentHash: string;
367
- expiryDurationSecs: number;
409
+ export interface Config {
410
+ apiKey?: string;
411
+ network: Network;
412
+ syncIntervalSecs: number;
413
+ maxDepositClaimFee?: MaxFee;
414
+ lnurlDomain?: string;
415
+ preferSparkOverLightning: boolean;
416
+ externalInputParsers?: ExternalInputParser[];
417
+ useDefaultExternalInputParsers: boolean;
418
+ realTimeSyncServerUrl?: string;
419
+ privateEnabledDefault: boolean;
420
+ optimizationConfig: OptimizationConfig;
421
+ stableBalanceConfig?: StableBalanceConfig;
422
+ /**
423
+ * Maximum number of concurrent transfer claims.
424
+ *
425
+ * Controls how many pending Spark transfers can be claimed in parallel.
426
+ * Default is 4. Increase for server environments with high incoming
427
+ * payment volume to improve throughput.
428
+ */
429
+ maxConcurrentClaims: number;
430
+ supportLnurlVerify: boolean;
368
431
  }
369
432
 
370
- export interface Payment {
371
- id: string;
372
- paymentType: PaymentType;
373
- status: PaymentStatus;
374
- amount: bigint;
375
- fees: bigint;
376
- timestamp: number;
377
- method: PaymentMethod;
378
- details?: PaymentDetails;
379
- conversionDetails?: ConversionDetails;
433
+ export interface ClaimDepositResponse {
434
+ payment: Payment;
380
435
  }
381
436
 
382
- export interface SignMessageResponse {
383
- pubkey: string;
384
- signature: string;
437
+ export interface IncomingChange {
438
+ newState: Record;
439
+ oldState?: Record;
385
440
  }
386
441
 
387
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
388
-
389
- export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
442
+ export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
390
443
 
391
- export interface StorageListPaymentsRequest {
392
- typeFilter?: PaymentType[];
393
- statusFilter?: PaymentStatus[];
394
- assetFilter?: AssetFilter;
395
- paymentDetailsFilter?: StoragePaymentDetailsFilter[];
396
- fromTimestamp?: number;
397
- toTimestamp?: number;
398
- offset?: number;
399
- limit?: number;
400
- sortAscending?: boolean;
444
+ export interface OptimizationConfig {
445
+ autoEnabled: boolean;
446
+ multiplicity: number;
401
447
  }
402
448
 
403
- export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
449
+ export interface PrepareSendPaymentRequest {
450
+ paymentRequest: string;
451
+ amount?: bigint;
452
+ tokenIdentifier?: string;
453
+ conversionOptions?: ConversionOptions;
454
+ feePolicy?: FeePolicy;
455
+ }
404
456
 
405
- export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
457
+ export interface MessageSuccessActionData {
458
+ message: string;
459
+ }
406
460
 
407
- export interface SyncWalletRequest {}
461
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
408
462
 
409
- export interface LnurlPayInfo {
410
- lnAddress?: string;
411
- comment?: string;
412
- domain?: string;
413
- metadata?: string;
414
- processedSuccessAction?: SuccessActionProcessed;
415
- rawSuccessAction?: SuccessAction;
463
+ export interface SignMessageResponse {
464
+ pubkey: string;
465
+ signature: string;
416
466
  }
417
467
 
418
- export interface ConversionEstimate {
419
- options: ConversionOptions;
420
- amount: bigint;
421
- fee: bigint;
468
+ export interface KeySetConfig {
469
+ keySetType: KeySetType;
470
+ useAddressIndex: boolean;
471
+ accountNumber?: number;
422
472
  }
423
473
 
424
- export type FeePolicy = "feesExcluded" | "feesIncluded";
474
+ 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 };
425
475
 
426
476
  export interface UnversionedRecordChange {
427
477
  id: RecordId;
@@ -429,12 +479,9 @@ export interface UnversionedRecordChange {
429
479
  updatedFields: Map<string, string>;
430
480
  }
431
481
 
432
- export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
433
-
434
- export interface CheckMessageRequest {
435
- message: string;
436
- pubkey: string;
437
- signature: string;
482
+ export interface AddContactRequest {
483
+ name: string;
484
+ paymentIdentifier: string;
438
485
  }
439
486
 
440
487
  export interface DepositInfo {
@@ -446,50 +493,51 @@ export interface DepositInfo {
446
493
  claimError?: DepositClaimError;
447
494
  }
448
495
 
449
- export interface ListFiatCurrenciesResponse {
450
- currencies: FiatCurrency[];
496
+ export interface SetLnurlMetadataItem {
497
+ paymentHash: string;
498
+ senderComment?: string;
499
+ nostrZapRequest?: string;
500
+ nostrZapReceipt?: string;
501
+ preimage?: string;
451
502
  }
452
503
 
453
- export interface PaymentRequestSource {
454
- bip21Uri?: string;
455
- bip353Address?: string;
504
+ export interface AesSuccessActionDataDecrypted {
505
+ description: string;
506
+ plaintext: string;
456
507
  }
457
508
 
458
- export interface ReceivePaymentRequest {
459
- paymentMethod: ReceivePaymentMethod;
460
- }
509
+ export type KeySetType = "default" | "taproot" | "nativeSegwit" | "wrappedSegwit" | "legacy";
461
510
 
462
- export interface CheckMessageResponse {
463
- isValid: boolean;
511
+ export interface UserSettings {
512
+ sparkPrivateModeEnabled: boolean;
464
513
  }
465
514
 
466
- export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
467
-
468
- export interface CheckLightningAddressRequest {
469
- username: string;
515
+ export interface GetTokensMetadataRequest {
516
+ tokenIdentifiers: string[];
470
517
  }
471
518
 
472
- export interface ListPaymentsResponse {
473
- payments: Payment[];
474
- }
519
+ export type FeePolicy = "feesExcluded" | "feesIncluded";
475
520
 
476
- export interface RecordChange {
477
- id: RecordId;
478
- schemaVersion: string;
479
- updatedFields: Map<string, string>;
480
- localRevision: number;
481
- }
521
+ export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
482
522
 
483
- export interface BuyBitcoinResponse {
484
- url: string;
523
+ export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
524
+
525
+ export interface Credentials {
526
+ username: string;
527
+ password: string;
485
528
  }
486
529
 
487
- export interface TokenBalance {
488
- balance: bigint;
489
- tokenMetadata: TokenMetadata;
530
+ export interface CheckMessageResponse {
531
+ isValid: boolean;
490
532
  }
491
533
 
492
- export type OptimizationEvent = { type: "started"; totalRounds: number } | { type: "roundCompleted"; currentRound: number; totalRounds: number } | { type: "completed" } | { type: "cancelled" } | { type: "failed"; error: string } | { type: "skipped" };
534
+ export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "optimization"; optimizationEvent: OptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo };
535
+
536
+ export interface AesSuccessActionData {
537
+ description: string;
538
+ ciphertext: string;
539
+ iv: string;
540
+ }
493
541
 
494
542
  export interface SparkHtlcDetails {
495
543
  paymentHash: string;
@@ -498,211 +546,211 @@ export interface SparkHtlcDetails {
498
546
  status: SparkHtlcStatus;
499
547
  }
500
548
 
501
- export interface ListPaymentsRequest {
502
- typeFilter?: PaymentType[];
503
- statusFilter?: PaymentStatus[];
504
- assetFilter?: AssetFilter;
505
- paymentDetailsFilter?: PaymentDetailsFilter[];
506
- fromTimestamp?: number;
507
- toTimestamp?: number;
508
- offset?: number;
509
- limit?: number;
510
- sortAscending?: boolean;
511
- }
512
-
513
- export interface LnurlWithdrawInfo {
514
- withdrawUrl: string;
515
- }
516
-
517
549
  export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
518
550
 
519
- export interface LnurlErrorDetails {
520
- reason: string;
551
+ export interface Symbol {
552
+ grapheme?: string;
553
+ template?: string;
554
+ rtl?: boolean;
555
+ position?: number;
521
556
  }
522
557
 
523
- export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
524
-
525
- export interface SendPaymentResponse {
558
+ export interface LnurlPayResponse {
526
559
  payment: Payment;
560
+ successAction?: SuccessActionProcessed;
527
561
  }
528
562
 
529
- export interface UpdateUserSettingsRequest {
530
- sparkPrivateModeEnabled?: boolean;
531
- }
563
+ export type Network = "mainnet" | "regtest";
532
564
 
533
- export interface BuyBitcoinRequest {
534
- lockedAmountSat?: number;
535
- redirectUrl?: string;
565
+ export interface SyncWalletRequest {}
566
+
567
+ export interface LnurlPayInfo {
568
+ lnAddress?: string;
569
+ comment?: string;
570
+ domain?: string;
571
+ metadata?: string;
572
+ processedSuccessAction?: SuccessActionProcessed;
573
+ rawSuccessAction?: SuccessAction;
536
574
  }
537
575
 
576
+ export type ProvisionalPaymentDetails = { type: "bitcoin"; withdrawalAddress: string } | { type: "lightning"; invoice: string } | { type: "spark"; payRequest: string } | { type: "token"; tokenId: string; payRequest: string };
577
+
538
578
  export interface ProvisionalPayment {
539
579
  paymentId: string;
540
580
  amount: bigint;
541
581
  details: ProvisionalPaymentDetails;
542
582
  }
543
583
 
544
- export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "optimization"; optimizationEvent: OptimizationEvent };
584
+ export interface FetchConversionLimitsResponse {
585
+ minFromAmount?: bigint;
586
+ minToAmount?: bigint;
587
+ }
545
588
 
546
- export interface SparkInvoiceDetails {
547
- invoice: string;
548
- identityPublicKey: string;
549
- network: BitcoinNetwork;
550
- amount?: string;
551
- tokenIdentifier?: string;
552
- expiryTime?: number;
589
+ export interface GetTokensMetadataResponse {
590
+ tokensMetadata: TokenMetadata[];
591
+ }
592
+
593
+ export interface Bolt12OfferDetails {
594
+ absoluteExpiry?: number;
595
+ chains: string[];
553
596
  description?: string;
554
- senderPublicKey?: string;
597
+ issuer?: string;
598
+ minAmount?: Amount;
599
+ offer: Bolt12Offer;
600
+ paths: Bolt12OfferBlindedPath[];
601
+ signingPubkey?: string;
555
602
  }
556
603
 
557
- export interface ClaimDepositRequest {
558
- txid: string;
559
- vout: number;
560
- maxFee?: MaxFee;
604
+ export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; hasLnurlPreimage?: boolean };
605
+
606
+ export interface ClaimHtlcPaymentResponse {
607
+ payment: Payment;
561
608
  }
562
609
 
563
- export interface LightningAddressDetails {
610
+ export interface LnurlPayRequest {
611
+ prepareResponse: PrepareLnurlPayResponse;
612
+ idempotencyKey?: string;
613
+ }
614
+
615
+ export interface SparkAddressDetails {
564
616
  address: string;
565
- payRequest: LnurlPayRequestDetails;
617
+ identityPublicKey: string;
618
+ network: BitcoinNetwork;
619
+ source: PaymentRequestSource;
566
620
  }
567
621
 
568
- export interface UrlSuccessActionData {
569
- description: string;
570
- url: string;
571
- matchesCallbackDomain: boolean;
622
+ export interface ConversionEstimate {
623
+ options: ConversionOptions;
624
+ amount: bigint;
625
+ fee: bigint;
572
626
  }
573
627
 
574
- export interface FiatCurrency {
575
- id: string;
576
- info: CurrencyInfo;
628
+ export interface ExternalInputParser {
629
+ providerId: string;
630
+ inputRegex: string;
631
+ parserUrl: string;
577
632
  }
578
633
 
579
- export interface ClaimDepositResponse {
580
- payment: Payment;
634
+ export interface ListPaymentsRequest {
635
+ typeFilter?: PaymentType[];
636
+ statusFilter?: PaymentStatus[];
637
+ assetFilter?: AssetFilter;
638
+ paymentDetailsFilter?: PaymentDetailsFilter[];
639
+ fromTimestamp?: number;
640
+ toTimestamp?: number;
641
+ offset?: number;
642
+ limit?: number;
643
+ sortAscending?: boolean;
581
644
  }
582
645
 
583
- export type ConversionStatus = "completed" | "refundNeeded" | "refunded";
646
+ export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
584
647
 
585
- export type TokenTransactionType = "transfer" | "mint" | "burn";
648
+ export interface LnurlPayRequestDetails {
649
+ callback: string;
650
+ minSendable: number;
651
+ maxSendable: number;
652
+ metadataStr: string;
653
+ commentAllowed: number;
654
+ domain: string;
655
+ url: string;
656
+ address?: string;
657
+ allowsNostr?: boolean;
658
+ nostrPubkey?: string;
659
+ }
586
660
 
587
- export interface SetLnurlMetadataItem {
588
- paymentHash: string;
589
- senderComment?: string;
590
- nostrZapRequest?: string;
591
- nostrZapReceipt?: string;
592
- preimage?: string;
661
+ export interface PrepareLnurlPayResponse {
662
+ amountSats: number;
663
+ comment?: string;
664
+ payRequest: LnurlPayRequestDetails;
665
+ feeSats: number;
666
+ invoiceDetails: Bolt11InvoiceDetails;
667
+ successAction?: SuccessAction;
668
+ conversionEstimate?: ConversionEstimate;
669
+ feePolicy: FeePolicy;
593
670
  }
594
671
 
595
- export interface AddContactRequest {
596
- name: string;
597
- paymentIdentifier: string;
672
+ export interface SendPaymentRequest {
673
+ prepareResponse: PrepareSendPaymentResponse;
674
+ options?: SendPaymentOptions;
675
+ idempotencyKey?: string;
598
676
  }
599
677
 
600
- export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; hasLnurlPreimage?: boolean };
678
+ 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 };
601
679
 
602
- export interface PaymentMetadata {
603
- parentPaymentId?: string;
604
- lnurlPayInfo?: LnurlPayInfo;
605
- lnurlWithdrawInfo?: LnurlWithdrawInfo;
606
- lnurlDescription?: string;
607
- conversionInfo?: ConversionInfo;
680
+ export interface Bolt12Invoice {
681
+ invoice: string;
682
+ source: PaymentRequestSource;
608
683
  }
609
684
 
610
- export interface StableBalanceConfig {
611
- tokenIdentifier: string;
612
- thresholdSats?: number;
613
- maxSlippageBps?: number;
614
- reservedSats?: number;
685
+ export interface LightningAddressInfo {
686
+ description: string;
687
+ lightningAddress: string;
688
+ lnurl: LnurlInfo;
689
+ username: string;
615
690
  }
616
691
 
617
- export interface FetchConversionLimitsRequest {
618
- conversionType: ConversionType;
619
- tokenIdentifier?: string;
692
+ export interface ReceivePaymentRequest {
693
+ paymentMethod: ReceivePaymentMethod;
620
694
  }
621
695
 
622
- export interface Bip21Extra {
623
- key: string;
624
- value: string;
625
- }
696
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
626
697
 
627
- export interface Rate {
628
- coin: string;
629
- value: number;
630
- }
698
+ export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
631
699
 
632
- export interface ConversionDetails {
633
- from: ConversionStep;
634
- to: ConversionStep;
635
- }
700
+ export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
636
701
 
637
- export interface LnurlInfo {
638
- url: string;
639
- bech32: string;
640
- }
702
+ export interface Bolt12InvoiceRequestDetails {}
641
703
 
642
- export interface Bolt12InvoiceDetails {
643
- amountMsat: number;
644
- invoice: Bolt12Invoice;
704
+ export interface BitcoinAddressDetails {
705
+ address: string;
706
+ network: BitcoinNetwork;
707
+ source: PaymentRequestSource;
645
708
  }
646
709
 
647
- export interface ClaimHtlcPaymentRequest {
648
- preimage: string;
710
+ export interface ConversionInfo {
711
+ poolId: string;
712
+ conversionId: string;
713
+ status: ConversionStatus;
714
+ fee?: string;
715
+ purpose?: ConversionPurpose;
649
716
  }
650
717
 
651
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string };
718
+ export type AssetFilter = { type: "bitcoin" } | { type: "token"; tokenIdentifier?: string };
652
719
 
653
- export interface ReceivePaymentResponse {
654
- paymentRequest: string;
655
- fee: bigint;
720
+ export interface LnurlReceiveMetadata {
721
+ nostrZapRequest?: string;
722
+ nostrZapReceipt?: string;
723
+ senderComment?: string;
656
724
  }
657
725
 
658
- export interface GetTokensMetadataRequest {
659
- tokenIdentifiers: string[];
726
+ export interface Rate {
727
+ coin: string;
728
+ value: number;
660
729
  }
661
730
 
662
- export interface FetchConversionLimitsResponse {
663
- minFromAmount?: bigint;
664
- minToAmount?: bigint;
731
+ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
732
+
733
+ export interface UpdateUserSettingsRequest {
734
+ sparkPrivateModeEnabled?: boolean;
665
735
  }
666
736
 
667
- export interface LnurlWithdrawRequest {
668
- amountSats: number;
669
- withdrawRequest: LnurlWithdrawRequestDetails;
670
- completionTimeoutSecs?: number;
737
+ export interface SparkHtlcOptions {
738
+ paymentHash: string;
739
+ expiryDurationSecs: number;
671
740
  }
672
741
 
673
- export interface PrepareLnurlPayResponse {
742
+ export interface PrepareLnurlPayRequest {
674
743
  amountSats: number;
675
744
  comment?: string;
676
745
  payRequest: LnurlPayRequestDetails;
677
- feeSats: number;
678
- invoiceDetails: Bolt11InvoiceDetails;
679
- successAction?: SuccessAction;
680
- conversionEstimate?: ConversionEstimate;
681
- feePolicy: FeePolicy;
682
- }
683
-
684
- export interface SparkInvoicePaymentDetails {
685
- description?: string;
686
- invoice: string;
687
- }
688
-
689
- export interface OutgoingChange {
690
- change: RecordChange;
691
- parent?: Record;
692
- }
693
-
694
- export interface SyncWalletResponse {}
695
-
696
- export interface SparkAddressDetails {
697
- address: string;
698
- identityPublicKey: string;
699
- network: BitcoinNetwork;
700
- source: PaymentRequestSource;
746
+ validateSuccessActionUrl?: boolean;
747
+ conversionOptions?: ConversionOptions;
748
+ feePolicy?: FeePolicy;
701
749
  }
702
750
 
703
- export interface Bolt12Offer {
704
- offer: string;
705
- source: PaymentRequestSource;
751
+ export interface RefundDepositResponse {
752
+ txId: string;
753
+ txHex: string;
706
754
  }
707
755
 
708
756
  export interface CurrencyInfo {
@@ -715,222 +763,269 @@ export interface CurrencyInfo {
715
763
  localeOverrides: LocaleOverrides[];
716
764
  }
717
765
 
718
- export interface Bolt12OfferDetails {
719
- absoluteExpiry?: number;
720
- chains: string[];
721
- description?: string;
722
- issuer?: string;
723
- minAmount?: Amount;
724
- offer: Bolt12Offer;
725
- paths: Bolt12OfferBlindedPath[];
726
- signingPubkey?: string;
727
- }
728
-
729
- export interface LnurlPayRequest {
730
- prepareResponse: PrepareLnurlPayResponse;
731
- idempotencyKey?: string;
766
+ export interface SparkStatus {
767
+ status: ServiceStatus;
768
+ lastUpdated: number;
732
769
  }
733
770
 
734
- export interface GetPaymentResponse {
735
- payment: Payment;
771
+ export interface Contact {
772
+ id: string;
773
+ name: string;
774
+ paymentIdentifier: string;
775
+ createdAt: number;
776
+ updatedAt: number;
736
777
  }
737
778
 
738
- export interface LnurlAuthRequestDetails {
739
- k1: string;
740
- action?: string;
741
- domain: string;
779
+ export interface UrlSuccessActionData {
780
+ description: string;
742
781
  url: string;
782
+ matchesCallbackDomain: boolean;
743
783
  }
744
784
 
745
- export interface Bolt12Invoice {
746
- invoice: string;
747
- source: PaymentRequestSource;
748
- }
785
+ export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
749
786
 
750
- export interface ListContactsRequest {
751
- offset?: number;
752
- limit?: number;
787
+ export interface Bolt11InvoiceDetails {
788
+ amountMsat?: number;
789
+ description?: string;
790
+ descriptionHash?: string;
791
+ expiry: number;
792
+ invoice: Bolt11Invoice;
793
+ minFinalCltvExpiryDelta: number;
794
+ network: BitcoinNetwork;
795
+ payeePubkey: string;
796
+ paymentHash: string;
797
+ paymentSecret: string;
798
+ routingHints: Bolt11RouteHint[];
799
+ timestamp: number;
753
800
  }
754
801
 
755
- export interface SendOnchainSpeedFeeQuote {
756
- userFeeSat: number;
757
- l1BroadcastFeeSat: number;
802
+ export interface RefundDepositRequest {
803
+ txid: string;
804
+ vout: number;
805
+ destinationAddress: string;
806
+ fee: Fee;
758
807
  }
759
808
 
760
- export interface AesSuccessActionDataDecrypted {
761
- description: string;
762
- plaintext: string;
809
+ export type TokenTransactionType = "transfer" | "mint" | "burn";
810
+
811
+ export interface BuyBitcoinRequest {
812
+ lockedAmountSat?: number;
813
+ redirectUrl?: string;
763
814
  }
764
815
 
765
- export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
816
+ export interface RegisterLightningAddressRequest {
817
+ username: string;
818
+ description?: string;
819
+ }
766
820
 
767
- export interface ConversionInfo {
768
- poolId: string;
769
- conversionId: string;
770
- status: ConversionStatus;
771
- fee?: string;
772
- purpose?: ConversionPurpose;
821
+ export interface GetInfoResponse {
822
+ identityPubkey: string;
823
+ balanceSats: number;
824
+ tokenBalances: Map<string, TokenBalance>;
773
825
  }
774
826
 
775
- export interface Credentials {
776
- username: string;
777
- password: string;
827
+ export interface Bolt12Offer {
828
+ offer: string;
829
+ source: PaymentRequestSource;
778
830
  }
779
831
 
780
- export interface PrepareSendPaymentResponse {
781
- paymentMethod: SendPaymentMethod;
782
- amount: bigint;
783
- tokenIdentifier?: string;
784
- conversionEstimate?: ConversionEstimate;
785
- feePolicy: FeePolicy;
832
+ export interface PaymentMetadata {
833
+ parentPaymentId?: string;
834
+ lnurlPayInfo?: LnurlPayInfo;
835
+ lnurlWithdrawInfo?: LnurlWithdrawInfo;
836
+ lnurlDescription?: string;
837
+ conversionInfo?: ConversionInfo;
786
838
  }
787
839
 
788
- export interface RefundDepositResponse {
789
- txId: string;
790
- txHex: string;
840
+ export interface LocaleOverrides {
841
+ locale: string;
842
+ spacing?: number;
843
+ symbol: Symbol;
791
844
  }
792
845
 
793
- export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" | "major";
846
+ export interface LnurlWithdrawRequest {
847
+ amountSats: number;
848
+ withdrawRequest: LnurlWithdrawRequestDetails;
849
+ completionTimeoutSecs?: number;
850
+ }
794
851
 
795
- export interface RecordId {
796
- type: string;
797
- dataId: string;
852
+ export interface ConversionOptions {
853
+ conversionType: ConversionType;
854
+ maxSlippageBps?: number;
855
+ completionTimeoutSecs?: number;
798
856
  }
799
857
 
800
- export interface SendOnchainFeeQuote {
801
- id: string;
802
- expiresAt: number;
803
- speedFast: SendOnchainSpeedFeeQuote;
804
- speedMedium: SendOnchainSpeedFeeQuote;
805
- speedSlow: SendOnchainSpeedFeeQuote;
858
+ export interface CheckLightningAddressRequest {
859
+ username: string;
806
860
  }
807
861
 
808
- export interface Bip21Details {
809
- amountSat?: number;
810
- assetId?: string;
811
- uri: string;
812
- extras: Bip21Extra[];
813
- label?: string;
814
- message?: string;
815
- paymentMethods: InputType[];
862
+ export interface SparkInvoicePaymentDetails {
863
+ description?: string;
864
+ invoice: string;
816
865
  }
817
866
 
818
- export type Network = "mainnet" | "regtest";
867
+ export interface SparkInvoiceDetails {
868
+ invoice: string;
869
+ identityPublicKey: string;
870
+ network: BitcoinNetwork;
871
+ amount?: string;
872
+ tokenIdentifier?: string;
873
+ expiryTime?: number;
874
+ description?: string;
875
+ senderPublicKey?: string;
876
+ }
819
877
 
820
- export interface OptimizationConfig {
821
- autoEnabled: boolean;
822
- multiplicity: number;
878
+ export interface StorageListPaymentsRequest {
879
+ typeFilter?: PaymentType[];
880
+ statusFilter?: PaymentStatus[];
881
+ assetFilter?: AssetFilter;
882
+ paymentDetailsFilter?: StoragePaymentDetailsFilter[];
883
+ fromTimestamp?: number;
884
+ toTimestamp?: number;
885
+ offset?: number;
886
+ limit?: number;
887
+ sortAscending?: boolean;
823
888
  }
824
889
 
825
- export interface LnurlWithdrawRequestDetails {
826
- callback: string;
827
- k1: string;
828
- defaultDescription: string;
829
- minWithdrawable: number;
830
- maxWithdrawable: number;
890
+ export interface ListFiatRatesResponse {
891
+ rates: Rate[];
831
892
  }
832
893
 
833
- export interface LocalizedName {
834
- locale: string;
835
- name: string;
894
+ export interface LnurlWithdrawInfo {
895
+ withdrawUrl: string;
836
896
  }
837
897
 
838
- export interface Bolt11RouteHintHop {
839
- srcNodeId: string;
840
- shortChannelId: string;
841
- feesBaseMsat: number;
842
- feesProportionalMillionths: number;
843
- cltvExpiryDelta: number;
844
- htlcMinimumMsat?: number;
845
- htlcMaximumMsat?: number;
898
+ export interface StableBalanceConfig {
899
+ tokenIdentifier: string;
900
+ thresholdSats?: number;
901
+ maxSlippageBps?: number;
902
+ reservedSats?: number;
846
903
  }
847
904
 
848
- export interface MessageSuccessActionData {
849
- message: string;
905
+ export interface LnurlErrorDetails {
906
+ reason: string;
850
907
  }
851
908
 
852
- export interface Symbol {
853
- grapheme?: string;
854
- template?: string;
855
- rtl?: boolean;
856
- position?: number;
909
+ export interface FetchConversionLimitsRequest {
910
+ conversionType: ConversionType;
911
+ tokenIdentifier?: string;
857
912
  }
858
913
 
859
- export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
914
+ export interface GetPaymentRequest {
915
+ paymentId: string;
916
+ }
860
917
 
861
- export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
918
+ export interface ListUnclaimedDepositsResponse {
919
+ deposits: DepositInfo[];
920
+ }
862
921
 
863
- export interface Bolt12OfferBlindedPath {
864
- blindedHops: string[];
922
+ export interface ClaimHtlcPaymentRequest {
923
+ preimage: string;
865
924
  }
866
925
 
867
- export interface UpdateContactRequest {
868
- id: string;
869
- name: string;
870
- paymentIdentifier: string;
926
+ export interface Bolt11RouteHint {
927
+ hops: Bolt11RouteHintHop[];
871
928
  }
872
929
 
873
- export interface SparkStatus {
874
- status: ServiceStatus;
875
- lastUpdated: number;
930
+ export interface OptimizationProgress {
931
+ isRunning: boolean;
932
+ currentRound: number;
933
+ totalRounds: number;
876
934
  }
877
935
 
878
- export interface ExternalInputParser {
879
- providerId: string;
880
- inputRegex: string;
881
- parserUrl: string;
936
+ export interface LogEntry {
937
+ line: string;
938
+ level: string;
882
939
  }
883
940
 
884
- export interface ConnectRequest {
885
- config: Config;
886
- seed: Seed;
887
- storageDir: string;
941
+ export interface RecordId {
942
+ type: string;
943
+ dataId: string;
888
944
  }
889
945
 
890
- export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
946
+ export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
891
947
 
892
- export interface IncomingChange {
893
- newState: Record;
894
- oldState?: Record;
948
+ export interface LnurlWithdrawResponse {
949
+ paymentRequest: string;
950
+ payment?: Payment;
895
951
  }
896
952
 
897
- export interface ListFiatRatesResponse {
898
- rates: Rate[];
899
- }
953
+ export interface SyncWalletResponse {}
900
954
 
901
- export interface GetTokensMetadataResponse {
902
- tokensMetadata: TokenMetadata[];
955
+ export interface Bolt12OfferBlindedPath {
956
+ blindedHops: string[];
903
957
  }
904
958
 
905
- export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
906
-
907
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string };
959
+ /**
960
+ * Interface for passkey PRF (Pseudo-Random Function) operations.
961
+ *
962
+ * Implement this interface to provide passkey PRF functionality for seedless wallet restore.
963
+ *
964
+ * @example
965
+ * ```typescript
966
+ * class BrowserPasskeyPrfProvider implements PasskeyPrfProvider {
967
+ * async derivePrfSeed(salt: string): Promise<Uint8Array> {
968
+ * const credential = await navigator.credentials.get({
969
+ * publicKey: {
970
+ * challenge: new Uint8Array(32),
971
+ * rpId: window.location.hostname,
972
+ * allowCredentials: [], // or specific credential IDs
973
+ * extensions: {
974
+ * prf: { eval: { first: new TextEncoder().encode(salt) } }
975
+ * }
976
+ * }
977
+ * });
978
+ * const results = credential.getClientExtensionResults();
979
+ * return new Uint8Array(results.prf.results.first);
980
+ * }
981
+ *
982
+ * async isPrfAvailable(): Promise<boolean> {
983
+ * return window.PublicKeyCredential?.isUserVerifyingPlatformAuthenticatorAvailable?.() ?? false;
984
+ * }
985
+ * }
986
+ * ```
987
+ */
988
+ export interface PasskeyPrfProvider {
989
+ /**
990
+ * Derive a 32-byte seed from passkey PRF with the given salt.
991
+ *
992
+ * The platform authenticates the user via passkey and evaluates the PRF extension.
993
+ * The salt is used as input to the PRF to derive a deterministic output.
994
+ *
995
+ * @param salt - The salt string to use for PRF evaluation
996
+ * @returns A Promise resolving to the 32-byte PRF output
997
+ * @throws If authentication fails or PRF is not supported
998
+ */
999
+ derivePrfSeed(salt: string): Promise<Uint8Array>;
908
1000
 
909
- export interface LnurlPayResponse {
910
- payment: Payment;
911
- successAction?: SuccessActionProcessed;
1001
+ /**
1002
+ * Check if a PRF-capable passkey is available on this device.
1003
+ *
1004
+ * This allows applications to gracefully degrade if passkey PRF is not supported.
1005
+ *
1006
+ * @returns A Promise resolving to true if PRF-capable passkey is available
1007
+ */
1008
+ isPrfAvailable(): Promise<boolean>;
912
1009
  }
913
1010
 
914
- export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
1011
+ export interface FreezeIssuerTokenRequest {
1012
+ address: string;
1013
+ }
915
1014
 
916
- export interface UnfreezeIssuerTokenResponse {
1015
+ export interface FreezeIssuerTokenResponse {
917
1016
  impactedOutputIds: string[];
918
1017
  impactedTokenAmount: bigint;
919
1018
  }
920
1019
 
921
- export interface FreezeIssuerTokenRequest {
922
- address: string;
1020
+ export interface MintIssuerTokenRequest {
1021
+ amount: bigint;
923
1022
  }
924
1023
 
925
1024
  export interface UnfreezeIssuerTokenRequest {
926
1025
  address: string;
927
1026
  }
928
1027
 
929
- export interface BurnIssuerTokenRequest {
930
- amount: bigint;
931
- }
932
-
933
- export interface FreezeIssuerTokenResponse {
1028
+ export interface UnfreezeIssuerTokenResponse {
934
1029
  impactedOutputIds: string[];
935
1030
  impactedTokenAmount: bigint;
936
1031
  }
@@ -943,7 +1038,7 @@ export interface CreateIssuerTokenRequest {
943
1038
  maxSupply: bigint;
944
1039
  }
945
1040
 
946
- export interface MintIssuerTokenRequest {
1041
+ export interface BurnIssuerTokenRequest {
947
1042
  amount: bigint;
948
1043
  }
949
1044
 
@@ -970,58 +1065,57 @@ export interface ExternalSigner {
970
1065
  hmacSha256(message: Uint8Array, path: string): Promise<HashedMessageBytes>;
971
1066
  }
972
1067
 
973
- export interface MessageBytes {
974
- bytes: number[];
975
- }
976
-
977
- export interface SchnorrSignatureBytes {
978
- bytes: number[];
1068
+ export interface ExternalFrostCommitments {
1069
+ hidingCommitment: number[];
1070
+ bindingCommitment: number[];
1071
+ noncesCiphertext: number[];
979
1072
  }
980
1073
 
981
- export interface EcdsaSignatureBytes {
982
- bytes: number[];
1074
+ export interface ExternalAggregateFrostRequest {
1075
+ message: number[];
1076
+ statechainSignatures: IdentifierSignaturePair[];
1077
+ statechainPublicKeys: IdentifierPublicKeyPair[];
1078
+ verifyingKey: number[];
1079
+ statechainCommitments: IdentifierCommitmentPair[];
1080
+ selfCommitment: ExternalSigningCommitments;
1081
+ publicKey: number[];
1082
+ selfSignature: ExternalFrostSignatureShare;
1083
+ adaptorPublicKey?: number[];
983
1084
  }
984
1085
 
985
- export interface ExternalScalar {
1086
+ export interface HashedMessageBytes {
986
1087
  bytes: number[];
987
1088
  }
988
1089
 
989
- export interface ExternalVerifiableSecretShare {
990
- secretShare: ExternalSecretShare;
991
- proofs: number[][];
1090
+ export interface ExternalEncryptedSecret {
1091
+ ciphertext: number[];
992
1092
  }
993
1093
 
994
1094
  export interface PublicKeyBytes {
995
1095
  bytes: number[];
996
1096
  }
997
1097
 
998
- export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
999
-
1000
- export interface ExternalFrostCommitments {
1001
- hidingCommitment: number[];
1002
- bindingCommitment: number[];
1003
- noncesCiphertext: number[];
1098
+ export interface ExternalIdentifier {
1099
+ bytes: number[];
1004
1100
  }
1005
1101
 
1006
- export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1102
+ export interface ExternalTreeNodeId {
1103
+ id: string;
1104
+ }
1007
1105
 
1008
- export interface ExternalFrostSignatureShare {
1106
+ export interface SecretBytes {
1009
1107
  bytes: number[];
1010
1108
  }
1011
1109
 
1012
- export interface ExternalEncryptedSecret {
1013
- ciphertext: number[];
1110
+ export interface ExternalSigningCommitments {
1111
+ hiding: number[];
1112
+ binding: number[];
1014
1113
  }
1015
1114
 
1016
- export interface ExternalIdentifier {
1115
+ export interface ExternalFrostSignatureShare {
1017
1116
  bytes: number[];
1018
1117
  }
1019
1118
 
1020
- export interface IdentifierSignaturePair {
1021
- identifier: ExternalIdentifier;
1022
- signature: ExternalFrostSignatureShare;
1023
- }
1024
-
1025
1119
  export interface ExternalSignFrostRequest {
1026
1120
  message: number[];
1027
1121
  publicKey: number[];
@@ -1032,32 +1126,32 @@ export interface ExternalSignFrostRequest {
1032
1126
  adaptorPublicKey?: number[];
1033
1127
  }
1034
1128
 
1035
- export interface IdentifierCommitmentPair {
1036
- identifier: ExternalIdentifier;
1037
- commitment: ExternalSigningCommitments;
1129
+ export type ExternalSecretToSplit = { type: "secretSource"; source: ExternalSecretSource } | { type: "preimage"; data: number[] };
1130
+
1131
+ export interface ExternalFrostSignature {
1132
+ bytes: number[];
1038
1133
  }
1039
1134
 
1040
- export interface ExternalAggregateFrostRequest {
1041
- message: number[];
1042
- statechainSignatures: IdentifierSignaturePair[];
1043
- statechainPublicKeys: IdentifierPublicKeyPair[];
1044
- verifyingKey: number[];
1045
- statechainCommitments: IdentifierCommitmentPair[];
1046
- selfCommitment: ExternalSigningCommitments;
1135
+ export interface IdentifierPublicKeyPair {
1136
+ identifier: ExternalIdentifier;
1047
1137
  publicKey: number[];
1048
- selfSignature: ExternalFrostSignatureShare;
1049
- adaptorPublicKey?: number[];
1050
1138
  }
1051
1139
 
1052
- export interface SecretBytes {
1140
+ export interface ExternalScalar {
1053
1141
  bytes: number[];
1054
1142
  }
1055
1143
 
1056
- export interface ExternalFrostSignature {
1144
+ export type ExternalSecretSource = { type: "derived"; nodeId: ExternalTreeNodeId } | { type: "encrypted"; key: ExternalEncryptedSecret };
1145
+
1146
+ export interface EcdsaSignatureBytes {
1057
1147
  bytes: number[];
1058
1148
  }
1059
1149
 
1060
- export interface HashedMessageBytes {
1150
+ export interface SchnorrSignatureBytes {
1151
+ bytes: number[];
1152
+ }
1153
+
1154
+ export interface RecoverableEcdsaSignatureBytes {
1061
1155
  bytes: number[];
1062
1156
  }
1063
1157
 
@@ -1067,22 +1161,54 @@ export interface ExternalSecretShare {
1067
1161
  share: ExternalScalar;
1068
1162
  }
1069
1163
 
1070
- export interface ExternalTreeNodeId {
1071
- id: string;
1164
+ export interface IdentifierSignaturePair {
1165
+ identifier: ExternalIdentifier;
1166
+ signature: ExternalFrostSignatureShare;
1072
1167
  }
1073
1168
 
1074
- export interface RecoverableEcdsaSignatureBytes {
1169
+ export interface ExternalVerifiableSecretShare {
1170
+ secretShare: ExternalSecretShare;
1171
+ proofs: number[][];
1172
+ }
1173
+
1174
+ export interface MessageBytes {
1075
1175
  bytes: number[];
1076
1176
  }
1077
1177
 
1078
- export interface IdentifierPublicKeyPair {
1178
+ export interface IdentifierCommitmentPair {
1079
1179
  identifier: ExternalIdentifier;
1080
- publicKey: number[];
1180
+ commitment: ExternalSigningCommitments;
1081
1181
  }
1082
1182
 
1083
- export interface ExternalSigningCommitments {
1084
- hiding: number[];
1085
- binding: number[];
1183
+ /**
1184
+ * A wallet derived from a passkey.
1185
+ */
1186
+ export interface Wallet {
1187
+ /**
1188
+ * The derived seed.
1189
+ */
1190
+ seed: Seed;
1191
+ /**
1192
+ * The wallet name used for derivation.
1193
+ */
1194
+ name: string;
1195
+ }
1196
+
1197
+ /**
1198
+ * Nostr relay configuration for passkey wallet name operations.
1199
+ *
1200
+ * Used by `Passkey.listWalletNames` and `Passkey.storeWalletName`.
1201
+ */
1202
+ export interface NostrRelayConfig {
1203
+ /**
1204
+ * Optional Breez API key for authenticated access to the Breez relay.
1205
+ * When provided, the Breez relay is added and NIP-42 authentication is enabled.
1206
+ */
1207
+ breezApiKey?: string;
1208
+ /**
1209
+ * Connection timeout in seconds. Defaults to 30 when `None`.
1210
+ */
1211
+ timeoutSecs?: number;
1086
1212
  }
1087
1213
 
1088
1214
  export interface Storage {
@@ -1210,6 +1336,47 @@ export class IntoUnderlyingSource {
1210
1336
  pull(controller: ReadableStreamDefaultController): Promise<any>;
1211
1337
  cancel(): void;
1212
1338
  }
1339
+ /**
1340
+ * Passkey-based wallet operations using WebAuthn PRF extension.
1341
+ *
1342
+ * Wraps a `PasskeyPrfProvider` and optional relay configuration to provide
1343
+ * wallet derivation and name management via Nostr relays.
1344
+ */
1345
+ export class Passkey {
1346
+ free(): void;
1347
+ /**
1348
+ * Derive a wallet for a given wallet name.
1349
+ *
1350
+ * Uses the passkey PRF to derive a `Wallet` containing the seed and resolved name.
1351
+ *
1352
+ * @param walletName - Optional wallet name string (defaults to "Default")
1353
+ */
1354
+ getWallet(wallet_name?: string | null): Promise<Wallet>;
1355
+ /**
1356
+ * Check if passkey PRF is available on this device.
1357
+ */
1358
+ isAvailable(): Promise<boolean>;
1359
+ /**
1360
+ * List all wallet names published to Nostr for this passkey's identity.
1361
+ *
1362
+ * Requires 1 PRF call (for Nostr identity derivation).
1363
+ */
1364
+ listWalletNames(): Promise<string[]>;
1365
+ /**
1366
+ * Publish a wallet name to Nostr relays for this passkey's identity.
1367
+ *
1368
+ * Idempotent: if the wallet name already exists, it is not published again.
1369
+ * Requires 1 PRF call.
1370
+ */
1371
+ storeWalletName(wallet_name: string): Promise<void>;
1372
+ /**
1373
+ * Create a new `Passkey` instance.
1374
+ *
1375
+ * @param prfProvider - Platform implementation of passkey PRF operations
1376
+ * @param relayConfig - Optional configuration for Nostr relay connections
1377
+ */
1378
+ constructor(prf_provider: PasskeyPrfProvider, relay_config?: NostrRelayConfig | null);
1379
+ }
1213
1380
  export class SdkBuilder {
1214
1381
  private constructor();
1215
1382
  free(): void;
@@ -1223,6 +1390,7 @@ export class SdkBuilder {
1223
1390
  withPaymentObserver(payment_observer: PaymentObserver): SdkBuilder;
1224
1391
  withPostgresStorage(config: PostgresStorageConfig): SdkBuilder;
1225
1392
  withRestChainService(url: string, api_type: ChainApiType, credentials?: Credentials | null): SdkBuilder;
1393
+ withPostgresTreeStore(config: PostgresStorageConfig): SdkBuilder;
1226
1394
  static new(config: Config, seed: Seed): SdkBuilder;
1227
1395
  build(): Promise<BreezSdk>;
1228
1396
  }