@breeztech/breez-sdk-spark 0.12.2-dev1 → 0.12.2-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.
- package/README.md +4 -4
- package/breez-sdk-spark.tgz +0 -0
- package/bundler/breez_sdk_spark_wasm.d.ts +731 -601
- package/bundler/breez_sdk_spark_wasm_bg.js +151 -54
- package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +7 -5
- package/bundler/storage/index.js +65 -43
- package/deno/breez_sdk_spark_wasm.d.ts +731 -601
- package/deno/breez_sdk_spark_wasm.js +141 -54
- package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +7 -5
- package/nodejs/breez_sdk_spark_wasm.d.ts +731 -601
- package/nodejs/breez_sdk_spark_wasm.js +151 -54
- package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +7 -5
- package/nodejs/index.js +16 -2
- package/nodejs/package.json +1 -0
- package/nodejs/postgres-storage/index.cjs +42 -31
- package/nodejs/postgres-storage/migrations.cjs +24 -0
- package/nodejs/postgres-token-store/errors.cjs +13 -0
- package/nodejs/postgres-token-store/index.cjs +857 -0
- package/nodejs/postgres-token-store/migrations.cjs +163 -0
- package/nodejs/postgres-token-store/package.json +9 -0
- package/nodejs/postgres-tree-store/index.cjs +12 -2
- package/nodejs/storage/index.cjs +19 -28
- package/nodejs/storage/migrations.cjs +18 -0
- package/package.json +1 -1
- package/web/breez_sdk_spark_wasm.d.ts +738 -606
- package/web/breez_sdk_spark_wasm.js +141 -54
- package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
- package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +7 -5
- package/web/storage/index.js +65 -43
|
@@ -245,19 +245,6 @@ module.exports.getSparkStatus = function() {
|
|
|
245
245
|
return ret;
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
-
/**
|
|
249
|
-
* @param {Config} config
|
|
250
|
-
* @param {ExternalSigner} signer
|
|
251
|
-
* @param {string} storage_dir
|
|
252
|
-
* @returns {Promise<BreezSdk>}
|
|
253
|
-
*/
|
|
254
|
-
module.exports.connectWithSigner = function(config, signer, storage_dir) {
|
|
255
|
-
const ptr0 = passStringToWasm0(storage_dir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
-
const len0 = WASM_VECTOR_LEN;
|
|
257
|
-
const ret = wasm.connectWithSigner(config, signer, ptr0, len0);
|
|
258
|
-
return ret;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
248
|
/**
|
|
262
249
|
* @param {ConnectRequest} request
|
|
263
250
|
* @returns {Promise<BreezSdk>}
|
|
@@ -267,15 +254,6 @@ module.exports.connect = function(request) {
|
|
|
267
254
|
return ret;
|
|
268
255
|
};
|
|
269
256
|
|
|
270
|
-
/**
|
|
271
|
-
* @param {Network} network
|
|
272
|
-
* @returns {Config}
|
|
273
|
-
*/
|
|
274
|
-
module.exports.defaultConfig = function(network) {
|
|
275
|
-
const ret = wasm.defaultConfig(network);
|
|
276
|
-
return ret;
|
|
277
|
-
};
|
|
278
|
-
|
|
279
257
|
/**
|
|
280
258
|
* @param {Logger} logger
|
|
281
259
|
* @param {string | null} [filter]
|
|
@@ -288,6 +266,15 @@ module.exports.initLogging = function(logger, filter) {
|
|
|
288
266
|
return ret;
|
|
289
267
|
};
|
|
290
268
|
|
|
269
|
+
/**
|
|
270
|
+
* @param {Network} network
|
|
271
|
+
* @returns {Config}
|
|
272
|
+
*/
|
|
273
|
+
module.exports.defaultConfig = function(network) {
|
|
274
|
+
const ret = wasm.defaultConfig(network);
|
|
275
|
+
return ret;
|
|
276
|
+
};
|
|
277
|
+
|
|
291
278
|
function takeFromExternrefTable0(idx) {
|
|
292
279
|
const value = wasm.__wbindgen_export_5.get(idx);
|
|
293
280
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -312,6 +299,19 @@ module.exports.defaultExternalSigner = function(mnemonic, passphrase, network, k
|
|
|
312
299
|
return DefaultSigner.__wrap(ret[0]);
|
|
313
300
|
};
|
|
314
301
|
|
|
302
|
+
/**
|
|
303
|
+
* @param {Config} config
|
|
304
|
+
* @param {ExternalSigner} signer
|
|
305
|
+
* @param {string} storage_dir
|
|
306
|
+
* @returns {Promise<BreezSdk>}
|
|
307
|
+
*/
|
|
308
|
+
module.exports.connectWithSigner = function(config, signer, storage_dir) {
|
|
309
|
+
const ptr0 = passStringToWasm0(storage_dir, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
310
|
+
const len0 = WASM_VECTOR_LEN;
|
|
311
|
+
const ret = wasm.connectWithSigner(config, signer, ptr0, len0);
|
|
312
|
+
return ret;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
315
|
function passArray8ToWasm0(arg, malloc) {
|
|
316
316
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
317
317
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
@@ -330,15 +330,15 @@ module.exports.task_worker_entry_point = function(ptr) {
|
|
|
330
330
|
};
|
|
331
331
|
|
|
332
332
|
function __wbg_adapter_64(arg0, arg1, arg2) {
|
|
333
|
-
wasm.
|
|
333
|
+
wasm.closure456_externref_shim(arg0, arg1, arg2);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
function __wbg_adapter_69(arg0, arg1) {
|
|
337
337
|
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1bbbe552b190da27(arg0, arg1);
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
function
|
|
341
|
-
wasm.
|
|
340
|
+
function __wbg_adapter_395(arg0, arg1, arg2, arg3) {
|
|
341
|
+
wasm.closure736_externref_shim(arg0, arg1, arg2, arg3);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
@@ -475,6 +475,13 @@ class BreezSdk {
|
|
|
475
475
|
const ret = wasm.breezsdk_listPayments(this.__wbg_ptr, request);
|
|
476
476
|
return ret;
|
|
477
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* @returns {Promise<Webhook[]>}
|
|
480
|
+
*/
|
|
481
|
+
listWebhooks() {
|
|
482
|
+
const ret = wasm.breezsdk_listWebhooks(this.__wbg_ptr);
|
|
483
|
+
return ret;
|
|
484
|
+
}
|
|
478
485
|
/**
|
|
479
486
|
* @param {string} id
|
|
480
487
|
* @returns {Promise<void>}
|
|
@@ -538,6 +545,14 @@ class BreezSdk {
|
|
|
538
545
|
const ret = wasm.breezsdk_recommendedFees(this.__wbg_ptr);
|
|
539
546
|
return ret;
|
|
540
547
|
}
|
|
548
|
+
/**
|
|
549
|
+
* @param {RegisterWebhookRequest} request
|
|
550
|
+
* @returns {Promise<RegisterWebhookResponse>}
|
|
551
|
+
*/
|
|
552
|
+
registerWebhook(request) {
|
|
553
|
+
const ret = wasm.breezsdk_registerWebhook(this.__wbg_ptr, request);
|
|
554
|
+
return ret;
|
|
555
|
+
}
|
|
541
556
|
/**
|
|
542
557
|
* @returns {Promise<UserSettings>}
|
|
543
558
|
*/
|
|
@@ -569,6 +584,14 @@ class BreezSdk {
|
|
|
569
584
|
const ret = wasm.breezsdk_claimHtlcPayment(this.__wbg_ptr, request);
|
|
570
585
|
return ret;
|
|
571
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* @param {UnregisterWebhookRequest} request
|
|
589
|
+
* @returns {Promise<void>}
|
|
590
|
+
*/
|
|
591
|
+
unregisterWebhook(request) {
|
|
592
|
+
const ret = wasm.breezsdk_unregisterWebhook(this.__wbg_ptr, request);
|
|
593
|
+
return ret;
|
|
594
|
+
}
|
|
572
595
|
/**
|
|
573
596
|
* @param {GetTokensMetadataRequest} request
|
|
574
597
|
* @returns {Promise<GetTokensMetadataResponse>}
|
|
@@ -633,8 +656,12 @@ class BreezSdk {
|
|
|
633
656
|
const ret = wasm.breezsdk_listUnclaimedDeposits(this.__wbg_ptr, request);
|
|
634
657
|
return ret;
|
|
635
658
|
}
|
|
659
|
+
/**
|
|
660
|
+
* @returns {Promise<void>}
|
|
661
|
+
*/
|
|
636
662
|
startLeafOptimization() {
|
|
637
|
-
wasm.breezsdk_startLeafOptimization(this.__wbg_ptr);
|
|
663
|
+
const ret = wasm.breezsdk_startLeafOptimization(this.__wbg_ptr);
|
|
664
|
+
return ret;
|
|
638
665
|
}
|
|
639
666
|
/**
|
|
640
667
|
* @returns {Promise<void>}
|
|
@@ -1243,9 +1270,9 @@ class SdkBuilder {
|
|
|
1243
1270
|
* @param {PostgresStorageConfig} config
|
|
1244
1271
|
* @returns {SdkBuilder}
|
|
1245
1272
|
*/
|
|
1246
|
-
|
|
1273
|
+
withPostgresBackend(config) {
|
|
1247
1274
|
const ptr = this.__destroy_into_raw();
|
|
1248
|
-
const ret = wasm.
|
|
1275
|
+
const ret = wasm.sdkbuilder_withPostgresBackend(ptr, config);
|
|
1249
1276
|
return SdkBuilder.__wrap(ret);
|
|
1250
1277
|
}
|
|
1251
1278
|
/**
|
|
@@ -1261,15 +1288,6 @@ class SdkBuilder {
|
|
|
1261
1288
|
const ret = wasm.sdkbuilder_withRestChainService(ptr, ptr0, len0, api_type, isLikeNone(credentials) ? 0 : addToExternrefTable0(credentials));
|
|
1262
1289
|
return SdkBuilder.__wrap(ret);
|
|
1263
1290
|
}
|
|
1264
|
-
/**
|
|
1265
|
-
* @param {PostgresStorageConfig} config
|
|
1266
|
-
* @returns {SdkBuilder}
|
|
1267
|
-
*/
|
|
1268
|
-
withPostgresTreeStore(config) {
|
|
1269
|
-
const ptr = this.__destroy_into_raw();
|
|
1270
|
-
const ret = wasm.sdkbuilder_withPostgresTreeStore(ptr, config);
|
|
1271
|
-
return SdkBuilder.__wrap(ret);
|
|
1272
|
-
}
|
|
1273
1291
|
/**
|
|
1274
1292
|
* @param {Config} config
|
|
1275
1293
|
* @param {Seed} seed
|
|
@@ -1388,13 +1406,13 @@ module.exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
|
1388
1406
|
arg0.abort();
|
|
1389
1407
|
};
|
|
1390
1408
|
|
|
1391
|
-
module.exports.
|
|
1409
|
+
module.exports.__wbg_addDeposit_42b1593db58de120 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
1392
1410
|
let deferred0_0;
|
|
1393
1411
|
let deferred0_1;
|
|
1394
1412
|
try {
|
|
1395
1413
|
deferred0_0 = arg1;
|
|
1396
1414
|
deferred0_1 = arg2;
|
|
1397
|
-
const ret = arg0.addDeposit(getStringFromWasm0(arg1, arg2), arg3 >>> 0, BigInt.asUintN(64, arg4));
|
|
1415
|
+
const ret = arg0.addDeposit(getStringFromWasm0(arg1, arg2), arg3 >>> 0, BigInt.asUintN(64, arg4), arg5 !== 0);
|
|
1398
1416
|
return ret;
|
|
1399
1417
|
} finally {
|
|
1400
1418
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
@@ -1498,6 +1516,19 @@ module.exports.__wbg_cancelReservation_d85a13db3e8e3c7b = function() { return ha
|
|
|
1498
1516
|
}
|
|
1499
1517
|
}, arguments) };
|
|
1500
1518
|
|
|
1519
|
+
module.exports.__wbg_cancelReservation_fd3065607b457424 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1520
|
+
let deferred0_0;
|
|
1521
|
+
let deferred0_1;
|
|
1522
|
+
try {
|
|
1523
|
+
deferred0_0 = arg1;
|
|
1524
|
+
deferred0_1 = arg2;
|
|
1525
|
+
const ret = arg0.cancelReservation(getStringFromWasm0(arg1, arg2));
|
|
1526
|
+
return ret;
|
|
1527
|
+
} finally {
|
|
1528
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1529
|
+
}
|
|
1530
|
+
}, arguments) };
|
|
1531
|
+
|
|
1501
1532
|
module.exports.__wbg_cancel_8a308660caa6cadf = function(arg0) {
|
|
1502
1533
|
const ret = arg0.cancel();
|
|
1503
1534
|
return ret;
|
|
@@ -1545,13 +1576,23 @@ module.exports.__wbg_createDefaultStorage_458aa01b5eaead27 = function() { return
|
|
|
1545
1576
|
return ret;
|
|
1546
1577
|
}, arguments) };
|
|
1547
1578
|
|
|
1548
|
-
module.exports.
|
|
1549
|
-
const ret =
|
|
1579
|
+
module.exports.__wbg_createPostgresPool_8b4003e9db8e9432 = function() { return handleError(function (arg0) {
|
|
1580
|
+
const ret = createPostgresPool(arg0);
|
|
1550
1581
|
return ret;
|
|
1551
1582
|
}, arguments) };
|
|
1552
1583
|
|
|
1553
|
-
module.exports.
|
|
1554
|
-
const ret =
|
|
1584
|
+
module.exports.__wbg_createPostgresStorageWithPool_77aa64bddd7440db = function() { return handleError(function (arg0, arg1) {
|
|
1585
|
+
const ret = createPostgresStorageWithPool(arg0, arg1);
|
|
1586
|
+
return ret;
|
|
1587
|
+
}, arguments) };
|
|
1588
|
+
|
|
1589
|
+
module.exports.__wbg_createPostgresTokenStoreWithPool_5e7b75f5975d8b94 = function() { return handleError(function (arg0, arg1) {
|
|
1590
|
+
const ret = createPostgresTokenStoreWithPool(arg0, arg1);
|
|
1591
|
+
return ret;
|
|
1592
|
+
}, arguments) };
|
|
1593
|
+
|
|
1594
|
+
module.exports.__wbg_createPostgresTreeStoreWithPool_55e19122e69fb9e3 = function() { return handleError(function (arg0, arg1) {
|
|
1595
|
+
const ret = createPostgresTreeStoreWithPool(arg0, arg1);
|
|
1555
1596
|
return ret;
|
|
1556
1597
|
}, arguments) };
|
|
1557
1598
|
|
|
@@ -1731,6 +1772,19 @@ module.exports.__wbg_fetch_f156d10be9a5c88a = function(arg0) {
|
|
|
1731
1772
|
return ret;
|
|
1732
1773
|
};
|
|
1733
1774
|
|
|
1775
|
+
module.exports.__wbg_finalizeReservation_86ee8385c17e015b = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1776
|
+
let deferred0_0;
|
|
1777
|
+
let deferred0_1;
|
|
1778
|
+
try {
|
|
1779
|
+
deferred0_0 = arg1;
|
|
1780
|
+
deferred0_1 = arg2;
|
|
1781
|
+
const ret = arg0.finalizeReservation(getStringFromWasm0(arg1, arg2));
|
|
1782
|
+
return ret;
|
|
1783
|
+
} finally {
|
|
1784
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1785
|
+
}
|
|
1786
|
+
}, arguments) };
|
|
1787
|
+
|
|
1734
1788
|
module.exports.__wbg_finalizeReservation_a8fad570b7fe5185 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1735
1789
|
let deferred0_0;
|
|
1736
1790
|
let deferred0_1;
|
|
@@ -1882,6 +1936,11 @@ module.exports.__wbg_getStaticDepositSecretSource_8e310c718339e400 = function()
|
|
|
1882
1936
|
return ret;
|
|
1883
1937
|
}, arguments) };
|
|
1884
1938
|
|
|
1939
|
+
module.exports.__wbg_getTokenOutputs_f51d6f5d47330273 = function() { return handleError(function (arg0, arg1) {
|
|
1940
|
+
const ret = arg0.getTokenOutputs(arg1);
|
|
1941
|
+
return ret;
|
|
1942
|
+
}, arguments) };
|
|
1943
|
+
|
|
1885
1944
|
module.exports.__wbg_getTransactionHex_973b8d0555c60f99 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1886
1945
|
let deferred0_0;
|
|
1887
1946
|
let deferred0_1;
|
|
@@ -1986,6 +2045,11 @@ module.exports.__wbg_insertPayment_2afe3300c5f86ccf = function() { return handle
|
|
|
1986
2045
|
return ret;
|
|
1987
2046
|
}, arguments) };
|
|
1988
2047
|
|
|
2048
|
+
module.exports.__wbg_insertTokenOutputs_043ceea065ff8f65 = function() { return handleError(function (arg0, arg1) {
|
|
2049
|
+
const ret = arg0.insertTokenOutputs(arg1);
|
|
2050
|
+
return ret;
|
|
2051
|
+
}, arguments) };
|
|
2052
|
+
|
|
1989
2053
|
module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
|
|
1990
2054
|
let result;
|
|
1991
2055
|
try {
|
|
@@ -2119,6 +2183,11 @@ module.exports.__wbg_listPayments_d8c53ab09ffc756b = function() { return handleE
|
|
|
2119
2183
|
return ret;
|
|
2120
2184
|
}, arguments) };
|
|
2121
2185
|
|
|
2186
|
+
module.exports.__wbg_listTokensOutputs_4b4500bd5aca2c88 = function() { return handleError(function (arg0) {
|
|
2187
|
+
const ret = arg0.listTokensOutputs();
|
|
2188
|
+
return ret;
|
|
2189
|
+
}, arguments) };
|
|
2190
|
+
|
|
2122
2191
|
module.exports.__wbg_log_62b3ddcc89229688 = function(arg0, arg1) {
|
|
2123
2192
|
arg0.log(arg1);
|
|
2124
2193
|
};
|
|
@@ -2166,7 +2235,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
2166
2235
|
const a = state0.a;
|
|
2167
2236
|
state0.a = 0;
|
|
2168
2237
|
try {
|
|
2169
|
-
return
|
|
2238
|
+
return __wbg_adapter_395(a, state0.b, arg0, arg1);
|
|
2170
2239
|
} finally {
|
|
2171
2240
|
state0.a = a;
|
|
2172
2241
|
}
|
|
@@ -2263,6 +2332,11 @@ module.exports.__wbg_now_6af59e24f5a53ad4 = function() { return handleError(func
|
|
|
2263
2332
|
return ret;
|
|
2264
2333
|
}, arguments) };
|
|
2265
2334
|
|
|
2335
|
+
module.exports.__wbg_now_79892f24f17d010a = function() { return handleError(function (arg0) {
|
|
2336
|
+
const ret = arg0.now();
|
|
2337
|
+
return ret;
|
|
2338
|
+
}, arguments) };
|
|
2339
|
+
|
|
2266
2340
|
module.exports.__wbg_now_807e54c39636c349 = function() {
|
|
2267
2341
|
const ret = Date.now();
|
|
2268
2342
|
return ret;
|
|
@@ -2349,6 +2423,24 @@ module.exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(
|
|
|
2349
2423
|
return ret;
|
|
2350
2424
|
}, arguments) };
|
|
2351
2425
|
|
|
2426
|
+
module.exports.__wbg_reserveTokenOutputs_6a190cf797e7d196 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
|
2427
|
+
let deferred0_0;
|
|
2428
|
+
let deferred0_1;
|
|
2429
|
+
let deferred1_0;
|
|
2430
|
+
let deferred1_1;
|
|
2431
|
+
try {
|
|
2432
|
+
deferred0_0 = arg1;
|
|
2433
|
+
deferred0_1 = arg2;
|
|
2434
|
+
deferred1_0 = arg4;
|
|
2435
|
+
deferred1_1 = arg5;
|
|
2436
|
+
const ret = arg0.reserveTokenOutputs(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5), arg6, arg7);
|
|
2437
|
+
return ret;
|
|
2438
|
+
} finally {
|
|
2439
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2440
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2441
|
+
}
|
|
2442
|
+
}, arguments) };
|
|
2443
|
+
|
|
2352
2444
|
module.exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
2353
2445
|
const ret = Promise.resolve(arg0);
|
|
2354
2446
|
return ret;
|
|
@@ -2415,6 +2507,11 @@ module.exports.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleErr
|
|
|
2415
2507
|
return ret;
|
|
2416
2508
|
}, arguments) };
|
|
2417
2509
|
|
|
2510
|
+
module.exports.__wbg_setTokensOutputs_5b8449721027f347 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
2511
|
+
const ret = arg0.setTokensOutputs(arg1, arg2);
|
|
2512
|
+
return ret;
|
|
2513
|
+
}, arguments) };
|
|
2514
|
+
|
|
2418
2515
|
module.exports.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
|
|
2419
2516
|
arg0[arg1 >>> 0] = arg2;
|
|
2420
2517
|
};
|
|
@@ -2791,28 +2888,28 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
2791
2888
|
return ret;
|
|
2792
2889
|
};
|
|
2793
2890
|
|
|
2794
|
-
module.exports.
|
|
2795
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2891
|
+
module.exports.__wbindgen_closure_wrapper10760 = function(arg0, arg1, arg2) {
|
|
2892
|
+
const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_69);
|
|
2796
2893
|
return ret;
|
|
2797
2894
|
};
|
|
2798
2895
|
|
|
2799
|
-
module.exports.
|
|
2800
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2896
|
+
module.exports.__wbindgen_closure_wrapper16136 = function(arg0, arg1, arg2) {
|
|
2897
|
+
const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
|
|
2801
2898
|
return ret;
|
|
2802
2899
|
};
|
|
2803
2900
|
|
|
2804
|
-
module.exports.
|
|
2805
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2901
|
+
module.exports.__wbindgen_closure_wrapper6193 = function(arg0, arg1, arg2) {
|
|
2902
|
+
const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
|
|
2806
2903
|
return ret;
|
|
2807
2904
|
};
|
|
2808
2905
|
|
|
2809
|
-
module.exports.
|
|
2810
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2906
|
+
module.exports.__wbindgen_closure_wrapper6201 = function(arg0, arg1, arg2) {
|
|
2907
|
+
const ret = makeMutClosure(arg0, arg1, 457, __wbg_adapter_64);
|
|
2811
2908
|
return ret;
|
|
2812
2909
|
};
|
|
2813
2910
|
|
|
2814
|
-
module.exports.
|
|
2815
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
2911
|
+
module.exports.__wbindgen_closure_wrapper7894 = function(arg0, arg1, arg2) {
|
|
2912
|
+
const ret = makeMutClosure(arg0, arg1, 979, __wbg_adapter_69);
|
|
2816
2913
|
return ret;
|
|
2817
2914
|
};
|
|
2818
2915
|
|
|
Binary file
|
|
@@ -30,6 +30,7 @@ export const breezsdk_listFiatCurrencies: (a: number) => any;
|
|
|
30
30
|
export const breezsdk_listFiatRates: (a: number) => any;
|
|
31
31
|
export const breezsdk_listPayments: (a: number, b: any) => any;
|
|
32
32
|
export const breezsdk_listUnclaimedDeposits: (a: number, b: any) => any;
|
|
33
|
+
export const breezsdk_listWebhooks: (a: number) => any;
|
|
33
34
|
export const breezsdk_lnurlAuth: (a: number, b: any) => any;
|
|
34
35
|
export const breezsdk_lnurlPay: (a: number, b: any) => any;
|
|
35
36
|
export const breezsdk_lnurlWithdraw: (a: number, b: any) => any;
|
|
@@ -40,11 +41,13 @@ export const breezsdk_receivePayment: (a: number, b: any) => any;
|
|
|
40
41
|
export const breezsdk_recommendedFees: (a: number) => any;
|
|
41
42
|
export const breezsdk_refundDeposit: (a: number, b: any) => any;
|
|
42
43
|
export const breezsdk_registerLightningAddress: (a: number, b: any) => any;
|
|
44
|
+
export const breezsdk_registerWebhook: (a: number, b: any) => any;
|
|
43
45
|
export const breezsdk_removeEventListener: (a: number, b: number, c: number) => any;
|
|
44
46
|
export const breezsdk_sendPayment: (a: number, b: any) => any;
|
|
45
47
|
export const breezsdk_signMessage: (a: number, b: any) => any;
|
|
46
|
-
export const breezsdk_startLeafOptimization: (a: number) =>
|
|
48
|
+
export const breezsdk_startLeafOptimization: (a: number) => any;
|
|
47
49
|
export const breezsdk_syncWallet: (a: number, b: any) => any;
|
|
50
|
+
export const breezsdk_unregisterWebhook: (a: number, b: any) => any;
|
|
48
51
|
export const breezsdk_updateContact: (a: number, b: any) => any;
|
|
49
52
|
export const breezsdk_updateUserSettings: (a: number, b: any) => any;
|
|
50
53
|
export const connect: (a: any) => any;
|
|
@@ -88,8 +91,7 @@ export const sdkbuilder_withFiatService: (a: number, b: any) => number;
|
|
|
88
91
|
export const sdkbuilder_withKeySet: (a: number, b: any) => number;
|
|
89
92
|
export const sdkbuilder_withLnurlClient: (a: number, b: any) => number;
|
|
90
93
|
export const sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
|
|
91
|
-
export const
|
|
92
|
-
export const sdkbuilder_withPostgresTreeStore: (a: number, b: any) => number;
|
|
94
|
+
export const sdkbuilder_withPostgresBackend: (a: number, b: any) => number;
|
|
93
95
|
export const sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
|
|
94
96
|
export const sdkbuilder_withStorage: (a: number, b: any) => number;
|
|
95
97
|
export const tokenissuer_burnIssuerToken: (a: number, b: any) => any;
|
|
@@ -126,7 +128,7 @@ export const __wbindgen_export_5: WebAssembly.Table;
|
|
|
126
128
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
127
129
|
export const __wbindgen_export_7: WebAssembly.Table;
|
|
128
130
|
export const __externref_table_dealloc: (a: number) => void;
|
|
129
|
-
export const
|
|
131
|
+
export const closure456_externref_shim: (a: number, b: number, c: any) => void;
|
|
130
132
|
export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h1bbbe552b190da27: (a: number, b: number) => void;
|
|
131
|
-
export const
|
|
133
|
+
export const closure736_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
132
134
|
export const __wbindgen_start: () => void;
|
package/nodejs/index.js
CHANGED
|
@@ -16,8 +16,10 @@ try {
|
|
|
16
16
|
|
|
17
17
|
// Automatically import and set up the PostgreSQL storage for Node.js
|
|
18
18
|
try {
|
|
19
|
-
const { createPostgresStorage } = require('./postgres-storage/index.cjs');
|
|
19
|
+
const { createPostgresStorage, createPostgresPool, createPostgresStorageWithPool } = require('./postgres-storage/index.cjs');
|
|
20
20
|
global.createPostgresStorage = createPostgresStorage;
|
|
21
|
+
global.createPostgresPool = createPostgresPool;
|
|
22
|
+
global.createPostgresStorageWithPool = createPostgresStorageWithPool;
|
|
21
23
|
} catch (error) {
|
|
22
24
|
if (error.code !== 'MODULE_NOT_FOUND') {
|
|
23
25
|
console.warn('Breez SDK: Failed to load PostgreSQL storage:', error.message);
|
|
@@ -26,13 +28,25 @@ try {
|
|
|
26
28
|
|
|
27
29
|
// Automatically import and set up the PostgreSQL tree store for Node.js
|
|
28
30
|
try {
|
|
29
|
-
const { createPostgresTreeStore } = require('./postgres-tree-store/index.cjs');
|
|
31
|
+
const { createPostgresTreeStore, createPostgresTreeStoreWithPool } = require('./postgres-tree-store/index.cjs');
|
|
30
32
|
global.createPostgresTreeStore = createPostgresTreeStore;
|
|
33
|
+
global.createPostgresTreeStoreWithPool = createPostgresTreeStoreWithPool;
|
|
31
34
|
} catch (error) {
|
|
32
35
|
if (error.code !== 'MODULE_NOT_FOUND') {
|
|
33
36
|
console.warn('Breez SDK: Failed to load PostgreSQL tree store:', error.message);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
// Automatically import and set up the PostgreSQL token store for Node.js
|
|
41
|
+
try {
|
|
42
|
+
const { createPostgresTokenStore, createPostgresTokenStoreWithPool } = require('./postgres-token-store/index.cjs');
|
|
43
|
+
global.createPostgresTokenStore = createPostgresTokenStore;
|
|
44
|
+
global.createPostgresTokenStoreWithPool = createPostgresTokenStoreWithPool;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error.code !== 'MODULE_NOT_FOUND') {
|
|
47
|
+
console.warn('Breez SDK: Failed to load PostgreSQL token store:', error.message);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
37
51
|
// Export all WASM functions
|
|
38
52
|
module.exports = wasmModule;
|
package/nodejs/package.json
CHANGED
|
@@ -50,6 +50,7 @@ const SELECT_PAYMENT_SQL = `
|
|
|
50
50
|
pm.lnurl_pay_info,
|
|
51
51
|
pm.lnurl_withdraw_info,
|
|
52
52
|
pm.conversion_info,
|
|
53
|
+
pm.conversion_status,
|
|
53
54
|
t.metadata AS token_metadata,
|
|
54
55
|
t.tx_hash AS token_tx_hash,
|
|
55
56
|
t.tx_type AS token_tx_type,
|
|
@@ -281,20 +282,6 @@ class PostgresStorage {
|
|
|
281
282
|
params.push(paymentDetailsFilter.txType);
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
// Filter by LNURL preimage status
|
|
285
|
-
if (
|
|
286
|
-
paymentDetailsFilter.type === "lightning" &&
|
|
287
|
-
paymentDetailsFilter.hasLnurlPreimage !== undefined
|
|
288
|
-
) {
|
|
289
|
-
if (paymentDetailsFilter.hasLnurlPreimage) {
|
|
290
|
-
paymentDetailsClauses.push("lrm.preimage IS NOT NULL");
|
|
291
|
-
} else {
|
|
292
|
-
paymentDetailsClauses.push(
|
|
293
|
-
"lrm.payment_hash IS NOT NULL AND l.preimage IS NOT NULL AND lrm.preimage IS NULL"
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
285
|
if (paymentDetailsClauses.length > 0) {
|
|
299
286
|
allPaymentDetailsClauses.push(
|
|
300
287
|
`(${paymentDetailsClauses.join(" AND ")})`
|
|
@@ -564,14 +551,15 @@ class PostgresStorage {
|
|
|
564
551
|
async insertPaymentMetadata(paymentId, metadata) {
|
|
565
552
|
try {
|
|
566
553
|
await this.pool.query(
|
|
567
|
-
`INSERT INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, conversion_info)
|
|
568
|
-
VALUES ($1, $2, $3, $4, $5, $6)
|
|
554
|
+
`INSERT INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, conversion_info, conversion_status)
|
|
555
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
|
569
556
|
ON CONFLICT(payment_id) DO UPDATE SET
|
|
570
557
|
parent_payment_id = COALESCE(EXCLUDED.parent_payment_id, payment_metadata.parent_payment_id),
|
|
571
558
|
lnurl_pay_info = COALESCE(EXCLUDED.lnurl_pay_info, payment_metadata.lnurl_pay_info),
|
|
572
559
|
lnurl_withdraw_info = COALESCE(EXCLUDED.lnurl_withdraw_info, payment_metadata.lnurl_withdraw_info),
|
|
573
560
|
lnurl_description = COALESCE(EXCLUDED.lnurl_description, payment_metadata.lnurl_description),
|
|
574
|
-
conversion_info = COALESCE(EXCLUDED.conversion_info, payment_metadata.conversion_info)
|
|
561
|
+
conversion_info = COALESCE(EXCLUDED.conversion_info, payment_metadata.conversion_info),
|
|
562
|
+
conversion_status = COALESCE(EXCLUDED.conversion_status, payment_metadata.conversion_status)`,
|
|
575
563
|
[
|
|
576
564
|
paymentId,
|
|
577
565
|
metadata.parentPaymentId,
|
|
@@ -585,6 +573,7 @@ class PostgresStorage {
|
|
|
585
573
|
metadata.conversionInfo
|
|
586
574
|
? JSON.stringify(metadata.conversionInfo)
|
|
587
575
|
: null,
|
|
576
|
+
metadata.conversionStatus ?? null,
|
|
588
577
|
]
|
|
589
578
|
);
|
|
590
579
|
} catch (error) {
|
|
@@ -597,13 +586,13 @@ class PostgresStorage {
|
|
|
597
586
|
|
|
598
587
|
// ===== Deposit Operations =====
|
|
599
588
|
|
|
600
|
-
async addDeposit(txid, vout, amountSats) {
|
|
589
|
+
async addDeposit(txid, vout, amountSats, isMature) {
|
|
601
590
|
try {
|
|
602
591
|
await this.pool.query(
|
|
603
|
-
`INSERT INTO unclaimed_deposits (txid, vout, amount_sats)
|
|
604
|
-
VALUES ($1, $2, $3)
|
|
605
|
-
ON CONFLICT(txid, vout) DO
|
|
606
|
-
[txid, vout, amountSats]
|
|
592
|
+
`INSERT INTO unclaimed_deposits (txid, vout, amount_sats, is_mature)
|
|
593
|
+
VALUES ($1, $2, $3, $4)
|
|
594
|
+
ON CONFLICT(txid, vout) DO UPDATE SET is_mature = EXCLUDED.is_mature, amount_sats = EXCLUDED.amount_sats`,
|
|
595
|
+
[txid, vout, amountSats, isMature]
|
|
607
596
|
);
|
|
608
597
|
} catch (error) {
|
|
609
598
|
throw new StorageError(
|
|
@@ -630,13 +619,14 @@ class PostgresStorage {
|
|
|
630
619
|
async listDeposits() {
|
|
631
620
|
try {
|
|
632
621
|
const result = await this.pool.query(
|
|
633
|
-
"SELECT txid, vout, amount_sats, claim_error, refund_tx, refund_tx_id FROM unclaimed_deposits"
|
|
622
|
+
"SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id FROM unclaimed_deposits"
|
|
634
623
|
);
|
|
635
624
|
|
|
636
625
|
return result.rows.map((row) => ({
|
|
637
626
|
txid: row.txid,
|
|
638
627
|
vout: row.vout,
|
|
639
628
|
amountSats: row.amount_sats != null ? BigInt(row.amount_sats) : BigInt(0),
|
|
629
|
+
isMature: row.is_mature ?? true,
|
|
640
630
|
claimError: row.claim_error || null,
|
|
641
631
|
refundTx: row.refund_tx,
|
|
642
632
|
refundTxId: row.refund_tx_id,
|
|
@@ -682,19 +672,17 @@ class PostgresStorage {
|
|
|
682
672
|
await this._withTransaction(async (client) => {
|
|
683
673
|
for (const item of metadata) {
|
|
684
674
|
await client.query(
|
|
685
|
-
`INSERT INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment
|
|
686
|
-
VALUES ($1, $2, $3, $4
|
|
675
|
+
`INSERT INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment)
|
|
676
|
+
VALUES ($1, $2, $3, $4)
|
|
687
677
|
ON CONFLICT(payment_hash) DO UPDATE SET
|
|
688
678
|
nostr_zap_request = EXCLUDED.nostr_zap_request,
|
|
689
679
|
nostr_zap_receipt = EXCLUDED.nostr_zap_receipt,
|
|
690
|
-
sender_comment = EXCLUDED.sender_comment
|
|
691
|
-
preimage = EXCLUDED.preimage`,
|
|
680
|
+
sender_comment = EXCLUDED.sender_comment`,
|
|
692
681
|
[
|
|
693
682
|
item.paymentHash,
|
|
694
683
|
item.nostrZapRequest || null,
|
|
695
684
|
item.nostrZapReceipt || null,
|
|
696
685
|
item.senderComment || null,
|
|
697
|
-
item.preimage || null,
|
|
698
686
|
]
|
|
699
687
|
);
|
|
700
688
|
}
|
|
@@ -829,7 +817,9 @@ class PostgresStorage {
|
|
|
829
817
|
timestamp: Number(row.timestamp),
|
|
830
818
|
method,
|
|
831
819
|
details,
|
|
832
|
-
conversionDetails:
|
|
820
|
+
conversionDetails: row.conversion_status
|
|
821
|
+
? { status: row.conversion_status, from: null, to: null }
|
|
822
|
+
: null,
|
|
833
823
|
};
|
|
834
824
|
}
|
|
835
825
|
|
|
@@ -1364,16 +1354,37 @@ function defaultPostgresStorageConfig(connectionString) {
|
|
|
1364
1354
|
* @returns {Promise<PostgresStorage>}
|
|
1365
1355
|
*/
|
|
1366
1356
|
async function createPostgresStorage(config, logger = null) {
|
|
1367
|
-
const pool =
|
|
1357
|
+
const pool = createPostgresPool(config);
|
|
1358
|
+
return createPostgresStorageWithPool(pool, logger);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Create a pg.Pool from a config object.
|
|
1363
|
+
* The returned pool can be shared across multiple store implementations.
|
|
1364
|
+
*
|
|
1365
|
+
* @param {object} config - PostgreSQL configuration (from defaultPostgresStorageConfig)
|
|
1366
|
+
* @returns {pg.Pool}
|
|
1367
|
+
*/
|
|
1368
|
+
function createPostgresPool(config) {
|
|
1369
|
+
return new pg.Pool({
|
|
1368
1370
|
connectionString: config.connectionString,
|
|
1369
1371
|
max: config.maxPoolSize,
|
|
1370
1372
|
connectionTimeoutMillis: config.createTimeoutSecs * 1000,
|
|
1371
1373
|
idleTimeoutMillis: config.recycleTimeoutSecs * 1000,
|
|
1372
1374
|
});
|
|
1375
|
+
}
|
|
1373
1376
|
|
|
1377
|
+
/**
|
|
1378
|
+
* Create a PostgresStorage instance from an existing pg.Pool.
|
|
1379
|
+
*
|
|
1380
|
+
* @param {pg.Pool} pool - An existing connection pool
|
|
1381
|
+
* @param {object} [logger] - Optional logger
|
|
1382
|
+
* @returns {Promise<PostgresStorage>}
|
|
1383
|
+
*/
|
|
1384
|
+
async function createPostgresStorageWithPool(pool, logger = null) {
|
|
1374
1385
|
const storage = new PostgresStorage(pool, logger);
|
|
1375
1386
|
await storage.initialize();
|
|
1376
1387
|
return storage;
|
|
1377
1388
|
}
|
|
1378
1389
|
|
|
1379
|
-
module.exports = { PostgresStorage, createPostgresStorage, defaultPostgresStorageConfig, StorageError };
|
|
1390
|
+
module.exports = { PostgresStorage, createPostgresStorage, createPostgresPool, createPostgresStorageWithPool, defaultPostgresStorageConfig, StorageError };
|
|
@@ -234,6 +234,30 @@ class PostgresMigrationManager {
|
|
|
234
234
|
)`,
|
|
235
235
|
],
|
|
236
236
|
},
|
|
237
|
+
{
|
|
238
|
+
name: "Drop preimage column from lnurl_receive_metadata",
|
|
239
|
+
sql: [
|
|
240
|
+
`ALTER TABLE lnurl_receive_metadata DROP COLUMN IF EXISTS preimage`,
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "Clear cached lightning address for CachedLightningAddress format change",
|
|
245
|
+
sql: [
|
|
246
|
+
`DELETE FROM settings WHERE key = 'lightning_address'`,
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "Add is_mature to unclaimed_deposits",
|
|
251
|
+
sql: [
|
|
252
|
+
`ALTER TABLE unclaimed_deposits ADD COLUMN is_mature BOOLEAN NOT NULL DEFAULT TRUE`,
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "Add conversion_status to payment_metadata",
|
|
257
|
+
sql: [
|
|
258
|
+
`ALTER TABLE payment_metadata ADD COLUMN IF NOT EXISTS conversion_status TEXT`,
|
|
259
|
+
],
|
|
260
|
+
},
|
|
237
261
|
];
|
|
238
262
|
}
|
|
239
263
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// errors.cjs - Token store error wrapper with cause chain support
|
|
2
|
+
class TokenStoreError extends Error {
|
|
3
|
+
constructor(message, cause = null) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'TokenStoreError';
|
|
6
|
+
this.cause = cause;
|
|
7
|
+
if (Error.captureStackTrace) {
|
|
8
|
+
Error.captureStackTrace(this, TokenStoreError);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = { TokenStoreError };
|