@breeztech/breez-sdk-spark 0.0.1-dev2
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.
- package/breez-sdk-spark.tgz +0 -0
- package/bundler/breez_sdk_spark_wasm.d.ts +403 -0
- package/bundler/breez_sdk_spark_wasm.js +5 -0
- package/bundler/breez_sdk_spark_wasm_bg.js +1301 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +65 -0
- package/bundler/package.json +17 -0
- package/bundler/snippets/wasm-array-cp-201e2a98f0e691f7/copy.min.js +1 -0
- package/deno/breez_sdk_spark_wasm.d.ts +403 -0
- package/deno/breez_sdk_spark_wasm.js +1178 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +65 -0
- package/deno/snippets/wasm-array-cp-201e2a98f0e691f7/copy.min.js +1 -0
- package/nodejs/breez_sdk_spark_wasm.d.ts +403 -0
- package/nodejs/breez_sdk_spark_wasm.js +1312 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +65 -0
- package/nodejs/package.json +11 -0
- package/nodejs/snippets/wasm-array-cp-201e2a98f0e691f7/copy.min.js +1 -0
- package/package.json +33 -0
- package/web/breez_sdk_spark_wasm.d.ts +492 -0
- package/web/breez_sdk_spark_wasm.js +1269 -0
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +65 -0
- package/web/package.json +15 -0
- package/web/snippets/wasm-array-cp-201e2a98f0e691f7/copy.min.js +1 -0
|
Binary file
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export function initLogging(logger: Logger, filter?: string | null): Promise<void>;
|
|
4
|
+
export function defaultConfig(network: Network): Config;
|
|
5
|
+
export function parse(input: string): Promise<InputType>;
|
|
6
|
+
/**
|
|
7
|
+
* Entry point invoked by JavaScript in a worker.
|
|
8
|
+
*/
|
|
9
|
+
export function task_worker_entry_point(ptr: number): void;
|
|
10
|
+
/**
|
|
11
|
+
* The `ReadableStreamType` enum.
|
|
12
|
+
*
|
|
13
|
+
* *This API requires the following crate features to be activated: `ReadableStreamType`*
|
|
14
|
+
*/
|
|
15
|
+
type ReadableStreamType = "bytes";
|
|
16
|
+
export interface LogEntry {
|
|
17
|
+
line: string;
|
|
18
|
+
level: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GetPaymentResponse {
|
|
22
|
+
payment: Payment;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetPaymentRequest {
|
|
26
|
+
paymentId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ListPaymentsResponse {
|
|
30
|
+
payments: Payment[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ListPaymentsRequest {
|
|
34
|
+
offset?: number;
|
|
35
|
+
limit?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SendPaymentResponse {
|
|
39
|
+
payment: Payment;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SendPaymentRequest {
|
|
43
|
+
prepareResponse: PrepareSendPaymentResponse;
|
|
44
|
+
options?: SendPaymentOptions;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; useSpark: boolean };
|
|
48
|
+
|
|
49
|
+
export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
|
|
50
|
+
|
|
51
|
+
export interface PrepareSendPaymentResponse {
|
|
52
|
+
paymentMethod: SendPaymentMethod;
|
|
53
|
+
amountSats: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface PrepareSendPaymentRequest {
|
|
57
|
+
paymentRequest: string;
|
|
58
|
+
amountSats?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface LnurlPayResponse {
|
|
62
|
+
payment: Payment;
|
|
63
|
+
successAction?: SuccessActionProcessed;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface LnurlPayRequest {
|
|
67
|
+
prepareResponse: PrepareLnurlPayResponse;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface PrepareLnurlPayResponse {
|
|
71
|
+
amountSats: number;
|
|
72
|
+
comment?: string;
|
|
73
|
+
payRequest: LnurlPayRequestDetails;
|
|
74
|
+
feeSats: number;
|
|
75
|
+
invoiceDetails: Bolt11InvoiceDetails;
|
|
76
|
+
successAction?: SuccessAction;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PrepareLnurlPayRequest {
|
|
80
|
+
amountSats: number;
|
|
81
|
+
comment?: string;
|
|
82
|
+
payRequest: LnurlPayRequestDetails;
|
|
83
|
+
validateSuccessActionUrl?: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ReceivePaymentResponse {
|
|
87
|
+
paymentRequest: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ReceivePaymentRequest {
|
|
91
|
+
prepareResponse: PrepareReceivePaymentResponse;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface PrepareReceivePaymentResponse {
|
|
95
|
+
paymentMethod: ReceivePaymentMethod;
|
|
96
|
+
feeSats: number;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface PrepareReceivePaymentRequest {
|
|
100
|
+
paymentMethod: ReceivePaymentMethod;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; feeSats: number };
|
|
104
|
+
|
|
105
|
+
export interface SendOnchainSpeedFeeQuote {
|
|
106
|
+
userFeeSat: number;
|
|
107
|
+
l1BroadcastFeeSat: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface SendOnchainFeeQuote {
|
|
111
|
+
id: string;
|
|
112
|
+
expiresAt: number;
|
|
113
|
+
speedFast: SendOnchainSpeedFeeQuote;
|
|
114
|
+
speedMedium: SendOnchainSpeedFeeQuote;
|
|
115
|
+
speedSlow: SendOnchainSpeedFeeQuote;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "bitcoinAddress" } | { type: "bolt11Invoice"; description: string; amountSats?: number };
|
|
119
|
+
|
|
120
|
+
export interface SyncWalletResponse {}
|
|
121
|
+
|
|
122
|
+
export interface SyncWalletRequest {}
|
|
123
|
+
|
|
124
|
+
export interface GetInfoResponse {
|
|
125
|
+
balanceSats: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface GetInfoRequest {}
|
|
129
|
+
|
|
130
|
+
export interface Credentials {
|
|
131
|
+
username: string;
|
|
132
|
+
password: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number };
|
|
136
|
+
|
|
137
|
+
export interface Config {
|
|
138
|
+
network: Network;
|
|
139
|
+
syncIntervalSecs: number;
|
|
140
|
+
maxDepositClaimFee?: Fee;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type Network = "mainnet" | "regtest";
|
|
144
|
+
|
|
145
|
+
export interface AesSuccessActionData {
|
|
146
|
+
description: string;
|
|
147
|
+
ciphertext: string;
|
|
148
|
+
iv: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
|
|
152
|
+
|
|
153
|
+
export interface UrlSuccessActionData {
|
|
154
|
+
description: string;
|
|
155
|
+
url: string;
|
|
156
|
+
matchesCallbackDomain: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface MessageSuccessActionData {
|
|
160
|
+
message: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface AesSuccessActionDataDecrypted {
|
|
164
|
+
description: string;
|
|
165
|
+
plaintext: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type AesSuccessActionDataResult = { type: "decrypted"; data: AesSuccessActionDataDecrypted } | { type: "errorStatus"; reason: string };
|
|
169
|
+
|
|
170
|
+
export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionDataResult } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
|
|
171
|
+
|
|
172
|
+
export interface LnurlPayInfo {
|
|
173
|
+
lnAddress?: string;
|
|
174
|
+
comment?: string;
|
|
175
|
+
domain?: string;
|
|
176
|
+
metadata?: string;
|
|
177
|
+
processedSuccessAction?: SuccessActionProcessed;
|
|
178
|
+
rawSuccessAction?: SuccessAction;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type PaymentMethod = "lightning" | "spark" | "deposit" | "withdraw" | "unknown";
|
|
182
|
+
|
|
183
|
+
export type PaymentDetails = { type: "spark" } | { type: "lightning"; description?: string; preimage?: string; invoice: string; paymentHash: string; destinationPubkey: string; lnurlPayInfo?: LnurlPayInfo } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string };
|
|
184
|
+
|
|
185
|
+
export interface Payment {
|
|
186
|
+
id: string;
|
|
187
|
+
paymentType: PaymentType;
|
|
188
|
+
status: PaymentStatus;
|
|
189
|
+
amount: number;
|
|
190
|
+
fees: number;
|
|
191
|
+
timestamp: number;
|
|
192
|
+
method: PaymentMethod;
|
|
193
|
+
details?: PaymentDetails;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type PaymentStatus = "completed" | "pending" | "failed";
|
|
197
|
+
|
|
198
|
+
export type PaymentType = "send" | "receive";
|
|
199
|
+
|
|
200
|
+
export interface LnurlWithdrawRequestDetails {
|
|
201
|
+
callback: string;
|
|
202
|
+
k1: string;
|
|
203
|
+
defaultDescription: string;
|
|
204
|
+
minWithdrawable: number;
|
|
205
|
+
maxWithdrawable: number;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface Bolt12InvoiceRequestDetails {}
|
|
209
|
+
|
|
210
|
+
export interface Bip21Extra {
|
|
211
|
+
key: string;
|
|
212
|
+
value: string;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface Bip21Details {
|
|
216
|
+
amountSat?: number;
|
|
217
|
+
assetId?: string;
|
|
218
|
+
uri: string;
|
|
219
|
+
extras: Bip21Extra[];
|
|
220
|
+
label?: string;
|
|
221
|
+
message?: string;
|
|
222
|
+
paymentMethods: InputType[];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface LnurlAuthRequestDetails {
|
|
226
|
+
k1: string;
|
|
227
|
+
action?: string;
|
|
228
|
+
domain: string;
|
|
229
|
+
url: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface SilentPaymentAddressDetails {
|
|
233
|
+
address: string;
|
|
234
|
+
network: BitcoinNetwork;
|
|
235
|
+
source: PaymentRequestSource;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface LnurlPayRequestDetails {
|
|
239
|
+
callback: string;
|
|
240
|
+
minSendable: number;
|
|
241
|
+
maxSendable: number;
|
|
242
|
+
metadataStr: string;
|
|
243
|
+
commentAllowed: number;
|
|
244
|
+
domain: string;
|
|
245
|
+
url: string;
|
|
246
|
+
address?: string;
|
|
247
|
+
allowsNostr: boolean;
|
|
248
|
+
nostrPubkey?: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface LightningAddressDetails {
|
|
252
|
+
address: string;
|
|
253
|
+
payRequest: LnurlPayRequestDetails;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export type Amount = { type: "bitcoin"; amountMsat: number } | { type: "currency"; iso4217Code: string; fractionalAmount: number };
|
|
257
|
+
|
|
258
|
+
export interface Bolt12OfferBlindedPath {
|
|
259
|
+
blindedHops: string[];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface Bolt12OfferDetails {
|
|
263
|
+
absoluteExpiry?: number;
|
|
264
|
+
chains: string[];
|
|
265
|
+
description?: string;
|
|
266
|
+
issuer?: string;
|
|
267
|
+
minAmount?: Amount;
|
|
268
|
+
offer: Bolt12Offer;
|
|
269
|
+
paths: Bolt12OfferBlindedPath[];
|
|
270
|
+
signingPubkey?: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface Bolt12Offer {
|
|
274
|
+
offer: string;
|
|
275
|
+
source: PaymentRequestSource;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface Bolt12Invoice {
|
|
279
|
+
invoice: string;
|
|
280
|
+
source: PaymentRequestSource;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface Bolt12InvoiceDetails {
|
|
284
|
+
amountMsat: number;
|
|
285
|
+
invoice: Bolt12Invoice;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface Bolt11RouteHintHop {
|
|
289
|
+
srcNodeId: string;
|
|
290
|
+
shortChannelId: string;
|
|
291
|
+
feesBaseMsat: number;
|
|
292
|
+
feesProportionalMillionths: number;
|
|
293
|
+
cltvExpiryDelta: number;
|
|
294
|
+
htlcMinimumMsat?: number;
|
|
295
|
+
htlcMaximumMsat?: number;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface Bolt11RouteHint {
|
|
299
|
+
hops: Bolt11RouteHintHop[];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface Bolt11Invoice {
|
|
303
|
+
bolt11: string;
|
|
304
|
+
source: PaymentRequestSource;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export interface Bolt11InvoiceDetails {
|
|
308
|
+
amountMsat?: number;
|
|
309
|
+
description?: string;
|
|
310
|
+
descriptionHash?: string;
|
|
311
|
+
expiry: number;
|
|
312
|
+
invoice: Bolt11Invoice;
|
|
313
|
+
minFinalCltvExpiryDelta: number;
|
|
314
|
+
network: BitcoinNetwork;
|
|
315
|
+
payeePubkey: string;
|
|
316
|
+
paymentHash: string;
|
|
317
|
+
paymentSecret: string;
|
|
318
|
+
routingHints: Bolt11RouteHint[];
|
|
319
|
+
timestamp: number;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface PaymentRequestSource {
|
|
323
|
+
bip21Uri?: string;
|
|
324
|
+
bip353Address?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
|
|
328
|
+
|
|
329
|
+
export interface BitcoinAddressDetails {
|
|
330
|
+
address: string;
|
|
331
|
+
network: BitcoinNetwork;
|
|
332
|
+
source: PaymentRequestSource;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
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);
|
|
336
|
+
|
|
337
|
+
export type DepositClaimError = { type: "depositClaimFeeExceeded"; tx: string; vout: number; maxFee: Fee; actualFee: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
|
|
338
|
+
|
|
339
|
+
export interface DepositInfo {
|
|
340
|
+
txid: string;
|
|
341
|
+
vout: number;
|
|
342
|
+
amountSats: number;
|
|
343
|
+
refundTx?: string;
|
|
344
|
+
refundTxId?: string;
|
|
345
|
+
claimError?: DepositClaimError;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export type SdkEvent = { type: "synced" } | { type: "claimDepositsFailed"; unclaimedDeposits: DepositInfo[] } | { type: "claimDepositsSucceeded"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment };
|
|
349
|
+
|
|
350
|
+
export interface Logger {
|
|
351
|
+
log: (l: LogEntry) => void;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface EventListener {
|
|
355
|
+
onEvent: (e: SdkEvent) => void;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export class BreezSdk {
|
|
359
|
+
private constructor();
|
|
360
|
+
free(): void;
|
|
361
|
+
addEventListener(listener: EventListener): string;
|
|
362
|
+
removeEventListener(id: string): boolean;
|
|
363
|
+
disconnect(): void;
|
|
364
|
+
getInfo(request: GetInfoRequest): GetInfoResponse;
|
|
365
|
+
prepareReceivePayment(request: PrepareReceivePaymentRequest): PrepareReceivePaymentResponse;
|
|
366
|
+
receivePayment(request: ReceivePaymentRequest): Promise<ReceivePaymentResponse>;
|
|
367
|
+
prepareSendPayment(request: PrepareSendPaymentRequest): Promise<PrepareSendPaymentResponse>;
|
|
368
|
+
prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
|
|
369
|
+
lnurlPay(request: LnurlPayRequest): Promise<LnurlPayResponse>;
|
|
370
|
+
sendPayment(request: SendPaymentRequest): Promise<SendPaymentResponse>;
|
|
371
|
+
syncWallet(request: SyncWalletRequest): SyncWalletResponse;
|
|
372
|
+
listPayments(request: ListPaymentsRequest): ListPaymentsResponse;
|
|
373
|
+
getPayment(request: GetPaymentRequest): GetPaymentResponse;
|
|
374
|
+
}
|
|
375
|
+
export class IntoUnderlyingByteSource {
|
|
376
|
+
private constructor();
|
|
377
|
+
free(): void;
|
|
378
|
+
start(controller: ReadableByteStreamController): void;
|
|
379
|
+
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
380
|
+
cancel(): void;
|
|
381
|
+
readonly type: ReadableStreamType;
|
|
382
|
+
readonly autoAllocateChunkSize: number;
|
|
383
|
+
}
|
|
384
|
+
export class IntoUnderlyingSink {
|
|
385
|
+
private constructor();
|
|
386
|
+
free(): void;
|
|
387
|
+
write(chunk: any): Promise<any>;
|
|
388
|
+
close(): Promise<any>;
|
|
389
|
+
abort(reason: any): Promise<any>;
|
|
390
|
+
}
|
|
391
|
+
export class IntoUnderlyingSource {
|
|
392
|
+
private constructor();
|
|
393
|
+
free(): void;
|
|
394
|
+
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
395
|
+
cancel(): void;
|
|
396
|
+
}
|
|
397
|
+
export class SdkBuilder {
|
|
398
|
+
private constructor();
|
|
399
|
+
free(): void;
|
|
400
|
+
static new(config: Config, mnemonic: string, data_dir: string): SdkBuilder;
|
|
401
|
+
withRestChainService(url: string, credentials?: Credentials | null): SdkBuilder;
|
|
402
|
+
build(): Promise<BreezSdk>;
|
|
403
|
+
}
|