@breeztech/breez-sdk-spark 0.9.0 → 0.10.0
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 +578 -554
- package/bundler/breez_sdk_spark_wasm_bg.js +29 -30
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +3 -3
- package/bundler/storage/index.js +64 -15
- package/deno/breez_sdk_spark_wasm.d.ts +578 -554
- package/deno/breez_sdk_spark_wasm.js +29 -30
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +3 -3
- package/nodejs/breez_sdk_spark_wasm.d.ts +578 -554
- package/nodejs/breez_sdk_spark_wasm.js +29 -30
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +3 -3
- package/nodejs/storage/index.cjs +18 -3
- package/nodejs/storage/migrations.cjs +11 -0
- package/package.json +1 -1
- package/web/breez_sdk_spark_wasm.d.ts +581 -557
- package/web/breez_sdk_spark_wasm.js +29 -30
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +3 -3
- package/web/storage/index.js +64 -15
|
@@ -221,6 +221,17 @@ function debugString(val) {
|
|
|
221
221
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
222
222
|
return className;
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* @param {Logger} logger
|
|
226
|
+
* @param {string | null} [filter]
|
|
227
|
+
* @returns {Promise<void>}
|
|
228
|
+
*/
|
|
229
|
+
export function initLogging(logger, filter) {
|
|
230
|
+
var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
231
|
+
var len0 = WASM_VECTOR_LEN;
|
|
232
|
+
const ret = wasm.initLogging(logger, ptr0, len0);
|
|
233
|
+
return ret;
|
|
234
|
+
}
|
|
224
235
|
|
|
225
236
|
function takeFromExternrefTable0(idx) {
|
|
226
237
|
const value = wasm.__wbindgen_export_5.get(idx);
|
|
@@ -246,18 +257,6 @@ export function defaultExternalSigner(mnemonic, passphrase, network, key_set_con
|
|
|
246
257
|
return DefaultSigner.__wrap(ret[0]);
|
|
247
258
|
}
|
|
248
259
|
|
|
249
|
-
/**
|
|
250
|
-
* @param {Logger} logger
|
|
251
|
-
* @param {string | null} [filter]
|
|
252
|
-
* @returns {Promise<void>}
|
|
253
|
-
*/
|
|
254
|
-
export function initLogging(logger, filter) {
|
|
255
|
-
var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
-
var len0 = WASM_VECTOR_LEN;
|
|
257
|
-
const ret = wasm.initLogging(logger, ptr0, len0);
|
|
258
|
-
return ret;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
260
|
/**
|
|
262
261
|
* @param {Network} network
|
|
263
262
|
* @returns {Config}
|
|
@@ -268,13 +267,11 @@ export function defaultConfig(network) {
|
|
|
268
267
|
}
|
|
269
268
|
|
|
270
269
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
|
|
274
|
-
* @returns {Promise<SparkStatus>}
|
|
270
|
+
* @param {ConnectRequest} request
|
|
271
|
+
* @returns {Promise<BreezSdk>}
|
|
275
272
|
*/
|
|
276
|
-
export function
|
|
277
|
-
const ret = wasm.
|
|
273
|
+
export function connect(request) {
|
|
274
|
+
const ret = wasm.connect(request);
|
|
278
275
|
return ret;
|
|
279
276
|
}
|
|
280
277
|
|
|
@@ -292,11 +289,13 @@ export function connectWithSigner(config, signer, storage_dir) {
|
|
|
292
289
|
}
|
|
293
290
|
|
|
294
291
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
292
|
+
* Creates a default external signer from a mnemonic phrase.
|
|
293
|
+
*
|
|
294
|
+
* This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
|
|
295
|
+
* @returns {Promise<SparkStatus>}
|
|
297
296
|
*/
|
|
298
|
-
export function
|
|
299
|
-
const ret = wasm.
|
|
297
|
+
export function getSparkStatus() {
|
|
298
|
+
const ret = wasm.getSparkStatus();
|
|
300
299
|
return ret;
|
|
301
300
|
}
|
|
302
301
|
|
|
@@ -318,15 +317,15 @@ export function task_worker_entry_point(ptr) {
|
|
|
318
317
|
}
|
|
319
318
|
|
|
320
319
|
function __wbg_adapter_64(arg0, arg1) {
|
|
321
|
-
wasm.
|
|
320
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce61e5994b0c00ad(arg0, arg1);
|
|
322
321
|
}
|
|
323
322
|
|
|
324
323
|
function __wbg_adapter_67(arg0, arg1, arg2) {
|
|
325
|
-
wasm.
|
|
324
|
+
wasm.closure1048_externref_shim(arg0, arg1, arg2);
|
|
326
325
|
}
|
|
327
326
|
|
|
328
327
|
function __wbg_adapter_285(arg0, arg1, arg2, arg3) {
|
|
329
|
-
wasm.
|
|
328
|
+
wasm.closure642_externref_shim(arg0, arg1, arg2, arg3);
|
|
330
329
|
}
|
|
331
330
|
|
|
332
331
|
const __wbindgen_enum_ReadableStreamType = ["bytes"];
|
|
@@ -1825,7 +1824,7 @@ export function __wbg_listDeposits_7ca6e22afc06d560() { return handleError(funct
|
|
|
1825
1824
|
return ret;
|
|
1826
1825
|
}, arguments) };
|
|
1827
1826
|
|
|
1828
|
-
export function
|
|
1827
|
+
export function __wbg_listPayments_d8c53ab09ffc756b() { return handleError(function (arg0, arg1) {
|
|
1829
1828
|
const ret = arg0.listPayments(arg1);
|
|
1830
1829
|
return ret;
|
|
1831
1830
|
}, arguments) };
|
|
@@ -2402,13 +2401,13 @@ export function __wbindgen_cb_drop(arg0) {
|
|
|
2402
2401
|
return ret;
|
|
2403
2402
|
};
|
|
2404
2403
|
|
|
2405
|
-
export function
|
|
2406
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2404
|
+
export function __wbindgen_closure_wrapper11704(arg0, arg1, arg2) {
|
|
2405
|
+
const ret = makeMutClosure(arg0, arg1, 817, __wbg_adapter_64);
|
|
2407
2406
|
return ret;
|
|
2408
2407
|
};
|
|
2409
2408
|
|
|
2410
|
-
export function
|
|
2411
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2409
|
+
export function __wbindgen_closure_wrapper13627(arg0, arg1, arg2) {
|
|
2410
|
+
const ret = makeMutClosure(arg0, arg1, 1049, __wbg_adapter_67);
|
|
2412
2411
|
return ret;
|
|
2413
2412
|
};
|
|
2414
2413
|
|
|
Binary file
|
|
@@ -113,7 +113,7 @@ export const __wbindgen_export_5: WebAssembly.Table;
|
|
|
113
113
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
114
114
|
export const __wbindgen_export_7: WebAssembly.Table;
|
|
115
115
|
export const __externref_table_dealloc: (a: number) => void;
|
|
116
|
-
export const
|
|
117
|
-
export const
|
|
118
|
-
export const
|
|
116
|
+
export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce61e5994b0c00ad: (a: number, b: number) => void;
|
|
117
|
+
export const closure1048_externref_shim: (a: number, b: number, c: any) => void;
|
|
118
|
+
export const closure642_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
119
119
|
export const __wbindgen_start: () => void;
|
package/bundler/storage/index.js
CHANGED
|
@@ -330,6 +330,17 @@ class MigrationManager {
|
|
|
330
330
|
if (db.objectStoreNames.contains("settings")) {
|
|
331
331
|
transaction.objectStore("settings").delete("sync_initial_complete");
|
|
332
332
|
}
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "Add preimage to lnurl_receive_metadata for LUD-21 and NIP-57",
|
|
337
|
+
upgrade: (db, transaction) => {
|
|
338
|
+
// IndexedDB doesn't need schema changes for new fields on existing stores.
|
|
339
|
+
// Just clear the lnurl_metadata_updated_after setting to force re-sync.
|
|
340
|
+
if (db.objectStoreNames.contains("settings")) {
|
|
341
|
+
const settings = transaction.objectStore("settings");
|
|
342
|
+
settings.delete("lnurl_metadata_updated_after");
|
|
343
|
+
}
|
|
333
344
|
}
|
|
334
345
|
},
|
|
335
346
|
{
|
|
@@ -397,7 +408,16 @@ class MigrationManager {
|
|
|
397
408
|
};
|
|
398
409
|
}
|
|
399
410
|
},
|
|
400
|
-
}
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
name: "Clear cached lightning address for LnurlInfo schema change",
|
|
414
|
+
upgrade: (db, transaction) => {
|
|
415
|
+
if (db.objectStoreNames.contains("settings")) {
|
|
416
|
+
const settings = transaction.objectStore("settings");
|
|
417
|
+
settings.delete("lightning_address");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
},
|
|
401
421
|
];
|
|
402
422
|
}
|
|
403
423
|
}
|
|
@@ -421,7 +441,7 @@ class IndexedDBStorage {
|
|
|
421
441
|
this.db = null;
|
|
422
442
|
this.migrationManager = null;
|
|
423
443
|
this.logger = logger;
|
|
424
|
-
this.dbVersion =
|
|
444
|
+
this.dbVersion = 13; // Current schema version
|
|
425
445
|
}
|
|
426
446
|
|
|
427
447
|
/**
|
|
@@ -697,24 +717,28 @@ class IndexedDBStorage {
|
|
|
697
717
|
metadata
|
|
698
718
|
);
|
|
699
719
|
|
|
700
|
-
//
|
|
701
|
-
|
|
702
|
-
cursor.continue();
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// Fetch lnurl receive metadata if it's a lightning payment
|
|
720
|
+
// Fetch lnurl receive metadata before filtering, so Lightning
|
|
721
|
+
// filters can check lnurlReceiveMetadata fields
|
|
707
722
|
this._fetchLnurlReceiveMetadata(
|
|
708
723
|
paymentWithMetadata,
|
|
709
724
|
lnurlReceiveMetadataStore
|
|
710
725
|
)
|
|
711
726
|
.then((mergedPayment) => {
|
|
727
|
+
// Apply filters after lnurl metadata is populated
|
|
728
|
+
if (!this._matchesFilters(mergedPayment, request)) {
|
|
729
|
+
cursor.continue();
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
712
732
|
payments.push(mergedPayment);
|
|
713
733
|
count++;
|
|
714
734
|
cursor.continue();
|
|
715
735
|
})
|
|
716
736
|
.catch(() => {
|
|
717
|
-
//
|
|
737
|
+
// Apply filters even if lnurl metadata fetch fails
|
|
738
|
+
if (!this._matchesFilters(paymentWithMetadata, request)) {
|
|
739
|
+
cursor.continue();
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
718
742
|
payments.push(paymentWithMetadata);
|
|
719
743
|
count++;
|
|
720
744
|
cursor.continue();
|
|
@@ -1317,6 +1341,7 @@ class IndexedDBStorage {
|
|
|
1317
1341
|
nostrZapRequest: item.nostrZapRequest || null,
|
|
1318
1342
|
nostrZapReceipt: item.nostrZapReceipt || null,
|
|
1319
1343
|
senderComment: item.senderComment || null,
|
|
1344
|
+
preimage: item.preimage || null,
|
|
1320
1345
|
});
|
|
1321
1346
|
|
|
1322
1347
|
request.onsuccess = () => {
|
|
@@ -1933,6 +1958,33 @@ class IndexedDBStorage {
|
|
|
1933
1958
|
continue;
|
|
1934
1959
|
}
|
|
1935
1960
|
}
|
|
1961
|
+
// Filter by LNURL preimage status
|
|
1962
|
+
if (
|
|
1963
|
+
paymentDetailsFilter.type === "lightning" &&
|
|
1964
|
+
paymentDetailsFilter.hasLnurlPreimage != null
|
|
1965
|
+
) {
|
|
1966
|
+
if (details.type !== "lightning") {
|
|
1967
|
+
continue;
|
|
1968
|
+
}
|
|
1969
|
+
if (paymentDetailsFilter.hasLnurlPreimage) {
|
|
1970
|
+
// Has lnurl preimage - check lnurlReceiveMetadata.preimage exists
|
|
1971
|
+
if (
|
|
1972
|
+
!details.lnurlReceiveMetadata ||
|
|
1973
|
+
!details.lnurlReceiveMetadata.preimage
|
|
1974
|
+
) {
|
|
1975
|
+
continue;
|
|
1976
|
+
}
|
|
1977
|
+
} else {
|
|
1978
|
+
// Pending: has lnurl metadata, has lightning preimage, but lnurl preimage not yet sent
|
|
1979
|
+
if (
|
|
1980
|
+
!details.lnurlReceiveMetadata ||
|
|
1981
|
+
!details.htlcDetails?.preimage ||
|
|
1982
|
+
details.lnurlReceiveMetadata.preimage
|
|
1983
|
+
) {
|
|
1984
|
+
continue;
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1936
1988
|
|
|
1937
1989
|
|
|
1938
1990
|
paymentDetailsFilterMatches = true;
|
|
@@ -2095,15 +2147,12 @@ class IndexedDBStorage {
|
|
|
2095
2147
|
|
|
2096
2148
|
lnurlReceiveRequest.onsuccess = () => {
|
|
2097
2149
|
const lnurlReceiveMetadata = lnurlReceiveRequest.result;
|
|
2098
|
-
if (
|
|
2099
|
-
lnurlReceiveMetadata &&
|
|
2100
|
-
(lnurlReceiveMetadata.nostrZapRequest ||
|
|
2101
|
-
lnurlReceiveMetadata.senderComment)
|
|
2102
|
-
) {
|
|
2150
|
+
if (lnurlReceiveMetadata) {
|
|
2103
2151
|
payment.details.lnurlReceiveMetadata = {
|
|
2104
2152
|
nostrZapRequest: lnurlReceiveMetadata.nostrZapRequest || null,
|
|
2105
2153
|
nostrZapReceipt: lnurlReceiveMetadata.nostrZapReceipt || null,
|
|
2106
2154
|
senderComment: lnurlReceiveMetadata.senderComment || null,
|
|
2155
|
+
preimage: lnurlReceiveMetadata.preimage || null,
|
|
2107
2156
|
};
|
|
2108
2157
|
}
|
|
2109
2158
|
resolve(payment);
|