@breeztech/breez-sdk-spark 0.9.1 → 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.
@@ -217,6 +217,17 @@ function debugString(val) {
217
217
  // TODO we could test for more things here, like `Set`s and `Map`s.
218
218
  return className;
219
219
  }
220
+ /**
221
+ * @param {Logger} logger
222
+ * @param {string | null} [filter]
223
+ * @returns {Promise<void>}
224
+ */
225
+ module.exports.initLogging = function(logger, filter) {
226
+ var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
227
+ var len0 = WASM_VECTOR_LEN;
228
+ const ret = wasm.initLogging(logger, ptr0, len0);
229
+ return ret;
230
+ };
220
231
 
221
232
  function takeFromExternrefTable0(idx) {
222
233
  const value = wasm.__wbindgen_export_5.get(idx);
@@ -242,18 +253,6 @@ module.exports.defaultExternalSigner = function(mnemonic, passphrase, network, k
242
253
  return DefaultSigner.__wrap(ret[0]);
243
254
  };
244
255
 
245
- /**
246
- * @param {Logger} logger
247
- * @param {string | null} [filter]
248
- * @returns {Promise<void>}
249
- */
250
- module.exports.initLogging = function(logger, filter) {
251
- var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
252
- var len0 = WASM_VECTOR_LEN;
253
- const ret = wasm.initLogging(logger, ptr0, len0);
254
- return ret;
255
- };
256
-
257
256
  /**
258
257
  * @param {Network} network
259
258
  * @returns {Config}
@@ -264,13 +263,11 @@ module.exports.defaultConfig = function(network) {
264
263
  };
265
264
 
266
265
  /**
267
- * Creates a default external signer from a mnemonic phrase.
268
- *
269
- * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
270
- * @returns {Promise<SparkStatus>}
266
+ * @param {ConnectRequest} request
267
+ * @returns {Promise<BreezSdk>}
271
268
  */
272
- module.exports.getSparkStatus = function() {
273
- const ret = wasm.getSparkStatus();
269
+ module.exports.connect = function(request) {
270
+ const ret = wasm.connect(request);
274
271
  return ret;
275
272
  };
276
273
 
@@ -288,11 +285,13 @@ module.exports.connectWithSigner = function(config, signer, storage_dir) {
288
285
  };
289
286
 
290
287
  /**
291
- * @param {ConnectRequest} request
292
- * @returns {Promise<BreezSdk>}
288
+ * Creates a default external signer from a mnemonic phrase.
289
+ *
290
+ * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
291
+ * @returns {Promise<SparkStatus>}
293
292
  */
294
- module.exports.connect = function(request) {
295
- const ret = wasm.connect(request);
293
+ module.exports.getSparkStatus = function() {
294
+ const ret = wasm.getSparkStatus();
296
295
  return ret;
297
296
  };
298
297
 
@@ -314,15 +313,15 @@ module.exports.task_worker_entry_point = function(ptr) {
314
313
  };
315
314
 
316
315
  function __wbg_adapter_64(arg0, arg1) {
317
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4867a1ac48fc7b64(arg0, arg1);
316
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce61e5994b0c00ad(arg0, arg1);
318
317
  }
319
318
 
320
319
  function __wbg_adapter_67(arg0, arg1, arg2) {
321
- wasm.closure1081_externref_shim(arg0, arg1, arg2);
320
+ wasm.closure1048_externref_shim(arg0, arg1, arg2);
322
321
  }
323
322
 
324
323
  function __wbg_adapter_285(arg0, arg1, arg2, arg3) {
325
- wasm.closure666_externref_shim(arg0, arg1, arg2, arg3);
324
+ wasm.closure642_externref_shim(arg0, arg1, arg2, arg3);
326
325
  }
327
326
 
328
327
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -1828,7 +1827,7 @@ module.exports.__wbg_listDeposits_7ca6e22afc06d560 = function() { return handleE
1828
1827
  return ret;
1829
1828
  }, arguments) };
1830
1829
 
1831
- module.exports.__wbg_listPayments_3b9302bf121fdc4d = function() { return handleError(function (arg0, arg1) {
1830
+ module.exports.__wbg_listPayments_d8c53ab09ffc756b = function() { return handleError(function (arg0, arg1) {
1832
1831
  const ret = arg0.listPayments(arg1);
1833
1832
  return ret;
1834
1833
  }, arguments) };
@@ -2405,13 +2404,13 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
2405
2404
  return ret;
2406
2405
  };
2407
2406
 
2408
- module.exports.__wbindgen_closure_wrapper11908 = function(arg0, arg1, arg2) {
2409
- const ret = makeMutClosure(arg0, arg1, 844, __wbg_adapter_64);
2407
+ module.exports.__wbindgen_closure_wrapper11704 = function(arg0, arg1, arg2) {
2408
+ const ret = makeMutClosure(arg0, arg1, 817, __wbg_adapter_64);
2410
2409
  return ret;
2411
2410
  };
2412
2411
 
2413
- module.exports.__wbindgen_closure_wrapper13858 = function(arg0, arg1, arg2) {
2414
- const ret = makeMutClosure(arg0, arg1, 1082, __wbg_adapter_67);
2412
+ module.exports.__wbindgen_closure_wrapper13627 = function(arg0, arg1, arg2) {
2413
+ const ret = makeMutClosure(arg0, arg1, 1049, __wbg_adapter_67);
2415
2414
  return ret;
2416
2415
  };
2417
2416
 
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 _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4867a1ac48fc7b64: (a: number, b: number) => void;
117
- export const closure1081_externref_shim: (a: number, b: number, c: any) => void;
118
- export const closure666_externref_shim: (a: number, b: number, c: any, d: any) => void;
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;
@@ -62,6 +62,7 @@ const SELECT_PAYMENT_SQL = `
62
62
  lrm.nostr_zap_request AS lnurl_nostr_zap_request,
63
63
  lrm.nostr_zap_receipt AS lnurl_nostr_zap_receipt,
64
64
  lrm.sender_comment AS lnurl_sender_comment,
65
+ lrm.payment_hash AS lnurl_payment_hash,
65
66
  pm.parent_payment_id
66
67
  FROM payments p
67
68
  LEFT JOIN payment_details_lightning l ON p.id = l.payment_id
@@ -259,6 +260,19 @@ class SqliteStorage {
259
260
  paymentDetailsClauses.push("t.tx_type = ?");
260
261
  params.push(paymentDetailsFilter.txType);
261
262
  }
263
+ // Filter by LNURL preimage status
264
+ if (
265
+ paymentDetailsFilter.type === "lightning" &&
266
+ paymentDetailsFilter.hasLnurlPreimage !== undefined
267
+ ) {
268
+ if (paymentDetailsFilter.hasLnurlPreimage) {
269
+ paymentDetailsClauses.push("lrm.preimage IS NOT NULL");
270
+ } else {
271
+ paymentDetailsClauses.push(
272
+ "lrm.payment_hash IS NOT NULL AND l.preimage IS NOT NULL AND lrm.preimage IS NULL"
273
+ );
274
+ }
275
+ }
262
276
 
263
277
 
264
278
  if (paymentDetailsClauses.length > 0) {
@@ -681,7 +695,7 @@ class SqliteStorage {
681
695
  setLnurlMetadata(metadata) {
682
696
  try {
683
697
  const stmt = this.db.prepare(
684
- "INSERT OR REPLACE INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment) VALUES (?, ?, ?, ?)"
698
+ "INSERT OR REPLACE INTO lnurl_receive_metadata (payment_hash, nostr_zap_request, nostr_zap_receipt, sender_comment, preimage) VALUES (?, ?, ?, ?, ?)"
685
699
  );
686
700
 
687
701
  const transaction = this.db.transaction(() => {
@@ -690,7 +704,8 @@ class SqliteStorage {
690
704
  item.paymentHash,
691
705
  item.nostrZapRequest || null,
692
706
  item.nostrZapReceipt || null,
693
- item.senderComment || null
707
+ item.senderComment || null,
708
+ item.preimage || null
694
709
  );
695
710
  }
696
711
  });
@@ -749,7 +764,7 @@ class SqliteStorage {
749
764
  }
750
765
  }
751
766
 
752
- if (row.lnurl_nostr_zap_request || row.lnurl_sender_comment) {
767
+ if (row.lnurl_payment_hash) {
753
768
  details.lnurlReceiveMetadata = {
754
769
  nostrZapRequest: row.lnurl_nostr_zap_request || null,
755
770
  nostrZapReceipt: row.lnurl_nostr_zap_receipt || null,
@@ -344,6 +344,13 @@ class MigrationManager {
344
344
  `DELETE FROM sync_state`,
345
345
  `UPDATE sync_revision SET revision = 0`,
346
346
  `DELETE FROM settings WHERE key = 'sync_initial_complete'`
347
+ ],
348
+ },
349
+ {
350
+ name: "Add preimage column to lnurl_receive_metadata for LUD-21 and NIP-57",
351
+ sql: [
352
+ `ALTER TABLE lnurl_receive_metadata ADD COLUMN preimage TEXT`,
353
+ `DELETE FROM settings WHERE key = 'lnurl_metadata_updated_after'`
347
354
  ]
348
355
  },
349
356
  {
@@ -367,6 +374,10 @@ class MigrationManager {
367
374
  WHERE key = 'sync_offset' AND json_valid(value)`,
368
375
  ]
369
376
  },
377
+ {
378
+ name: "Clear cached lightning address for LnurlInfo schema change",
379
+ sql: `DELETE FROM settings WHERE key = 'lightning_address'`
380
+ },
370
381
  ];
371
382
  }
372
383
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Breez Spark SDK",
5
5
  "repository": "https://github.com/breez/spark-sdk",
6
6
  "author": "Breez <contact@breez.technology> (https://github.com/breez)",