@breeztech/breez-sdk-spark 0.5.1 → 0.6.0-rc1

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