@breeztech/breez-sdk-spark 0.2.0 → 0.2.2-dev1

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.
Binary file
@@ -92,7 +92,7 @@ export interface LightningAddressInfo {
92
92
 
93
93
  export interface RegisterLightningAddressRequest {
94
94
  username: string;
95
- description: string;
95
+ description?: string;
96
96
  }
97
97
 
98
98
  export interface CheckLightningAddressRequest {
@@ -103,6 +103,7 @@ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimErro
103
103
 
104
104
  export interface PaymentMetadata {
105
105
  lnurlPayInfo?: LnurlPayInfo;
106
+ lnurlDescription?: string;
106
107
  }
107
108
 
108
109
  export interface LogEntry {
@@ -283,11 +283,11 @@ function __wbg_adapter_52(arg0, arg1) {
283
283
  }
284
284
 
285
285
  function __wbg_adapter_55(arg0, arg1, arg2) {
286
- wasm.closure770_externref_shim(arg0, arg1, arg2);
286
+ wasm.closure773_externref_shim(arg0, arg1, arg2);
287
287
  }
288
288
 
289
289
  function __wbg_adapter_180(arg0, arg1, arg2, arg3) {
290
- wasm.closure421_externref_shim(arg0, arg1, arg2, arg3);
290
+ wasm.closure424_externref_shim(arg0, arg1, arg2, arg3);
291
291
  }
292
292
 
293
293
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -1422,13 +1422,13 @@ export function __wbindgen_cb_drop(arg0) {
1422
1422
  return ret;
1423
1423
  };
1424
1424
 
1425
- export function __wbindgen_closure_wrapper7957(arg0, arg1, arg2) {
1426
- const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1425
+ export function __wbindgen_closure_wrapper7983(arg0, arg1, arg2) {
1426
+ const ret = makeMutClosure(arg0, arg1, 601, __wbg_adapter_52);
1427
1427
  return ret;
1428
1428
  };
1429
1429
 
1430
- export function __wbindgen_closure_wrapper9591(arg0, arg1, arg2) {
1431
- const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1430
+ export function __wbindgen_closure_wrapper9613(arg0, arg1, arg2) {
1431
+ const ret = makeMutClosure(arg0, arg1, 774, __wbg_adapter_55);
1432
1432
  return ret;
1433
1433
  };
1434
1434
 
@@ -60,6 +60,6 @@ export const __wbindgen_export_5: WebAssembly.Table;
60
60
  export const __wbindgen_export_6: WebAssembly.Table;
61
61
  export const __externref_table_dealloc: (a: number) => void;
62
62
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7c49586be6831c4: (a: number, b: number) => void;
63
- export const closure770_externref_shim: (a: number, b: number, c: any) => void;
64
- export const closure421_externref_shim: (a: number, b: number, c: any, d: any) => void;
63
+ export const closure773_externref_shim: (a: number, b: number, c: any) => void;
64
+ export const closure424_externref_shim: (a: number, b: number, c: any, d: any) => void;
65
65
  export const __wbindgen_start: () => void;
@@ -450,6 +450,7 @@ class IndexedDBStorage {
450
450
  lnurlPayInfo: metadata.lnurlPayInfo
451
451
  ? JSON.stringify(metadata.lnurlPayInfo)
452
452
  : null,
453
+ lnurlDescription: metadata.lnurlDescription,
453
454
  };
454
455
 
455
456
  const request = store.put(metadataToStore);
@@ -660,9 +661,12 @@ class IndexedDBStorage {
660
661
  }
661
662
 
662
663
  // If this is a Lightning payment and we have lnurl_pay_info, add it to details
663
- if (metadata && metadata.lnurlPayInfo && details && details.Lightning) {
664
+ if (metadata && metadata.lnurlPayInfo && details && details.type == 'lightning') {
664
665
  try {
665
- details.Lightning.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
666
+ details.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
667
+ if (metadata.lnurlDescription && !details.description) {
668
+ details.description = metadata.lnurlDescription;
669
+ }
666
670
  } catch (e) {
667
671
  throw new StorageError(
668
672
  `Failed to parse lnurl_pay_info JSON for payment ${payment.id}: ${e.message}`,
@@ -92,7 +92,7 @@ export interface LightningAddressInfo {
92
92
 
93
93
  export interface RegisterLightningAddressRequest {
94
94
  username: string;
95
- description: string;
95
+ description?: string;
96
96
  }
97
97
 
98
98
  export interface CheckLightningAddressRequest {
@@ -103,6 +103,7 @@ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimErro
103
103
 
104
104
  export interface PaymentMetadata {
105
105
  lnurlPayInfo?: LnurlPayInfo;
106
+ lnurlDescription?: string;
106
107
  }
107
108
 
108
109
  export interface LogEntry {
@@ -266,11 +266,11 @@ function __wbg_adapter_52(arg0, arg1) {
266
266
  }
267
267
 
268
268
  function __wbg_adapter_55(arg0, arg1, arg2) {
269
- wasm.closure770_externref_shim(arg0, arg1, arg2);
269
+ wasm.closure773_externref_shim(arg0, arg1, arg2);
270
270
  }
271
271
 
272
272
  function __wbg_adapter_180(arg0, arg1, arg2, arg3) {
273
- wasm.closure421_externref_shim(arg0, arg1, arg2, arg3);
273
+ wasm.closure424_externref_shim(arg0, arg1, arg2, arg3);
274
274
  }
275
275
 
276
276
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -1281,12 +1281,12 @@ const imports = {
1281
1281
  const ret = false;
1282
1282
  return ret;
1283
1283
  },
1284
- __wbindgen_closure_wrapper7957: function(arg0, arg1, arg2) {
1285
- const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1284
+ __wbindgen_closure_wrapper7983: function(arg0, arg1, arg2) {
1285
+ const ret = makeMutClosure(arg0, arg1, 601, __wbg_adapter_52);
1286
1286
  return ret;
1287
1287
  },
1288
- __wbindgen_closure_wrapper9591: function(arg0, arg1, arg2) {
1289
- const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1288
+ __wbindgen_closure_wrapper9613: function(arg0, arg1, arg2) {
1289
+ const ret = makeMutClosure(arg0, arg1, 774, __wbg_adapter_55);
1290
1290
  return ret;
1291
1291
  },
1292
1292
  __wbindgen_debug_string: function(arg0, arg1) {
Binary file
@@ -60,6 +60,6 @@ export const __wbindgen_export_5: WebAssembly.Table;
60
60
  export const __wbindgen_export_6: WebAssembly.Table;
61
61
  export const __externref_table_dealloc: (a: number) => void;
62
62
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7c49586be6831c4: (a: number, b: number) => void;
63
- export const closure770_externref_shim: (a: number, b: number, c: any) => void;
64
- export const closure421_externref_shim: (a: number, b: number, c: any, d: any) => void;
63
+ export const closure773_externref_shim: (a: number, b: number, c: any) => void;
64
+ export const closure424_externref_shim: (a: number, b: number, c: any, d: any) => void;
65
65
  export const __wbindgen_start: () => void;
@@ -92,7 +92,7 @@ export interface LightningAddressInfo {
92
92
 
93
93
  export interface RegisterLightningAddressRequest {
94
94
  username: string;
95
- description: string;
95
+ description?: string;
96
96
  }
97
97
 
98
98
  export interface CheckLightningAddressRequest {
@@ -103,6 +103,7 @@ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimErro
103
103
 
104
104
  export interface PaymentMetadata {
105
105
  lnurlPayInfo?: LnurlPayInfo;
106
+ lnurlDescription?: string;
106
107
  }
107
108
 
108
109
  export interface LogEntry {
@@ -279,11 +279,11 @@ function __wbg_adapter_52(arg0, arg1) {
279
279
  }
280
280
 
281
281
  function __wbg_adapter_55(arg0, arg1, arg2) {
282
- wasm.closure770_externref_shim(arg0, arg1, arg2);
282
+ wasm.closure773_externref_shim(arg0, arg1, arg2);
283
283
  }
284
284
 
285
285
  function __wbg_adapter_180(arg0, arg1, arg2, arg3) {
286
- wasm.closure421_externref_shim(arg0, arg1, arg2, arg3);
286
+ wasm.closure424_externref_shim(arg0, arg1, arg2, arg3);
287
287
  }
288
288
 
289
289
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -1423,13 +1423,13 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
1423
1423
  return ret;
1424
1424
  };
1425
1425
 
1426
- module.exports.__wbindgen_closure_wrapper7957 = function(arg0, arg1, arg2) {
1427
- const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1426
+ module.exports.__wbindgen_closure_wrapper7983 = function(arg0, arg1, arg2) {
1427
+ const ret = makeMutClosure(arg0, arg1, 601, __wbg_adapter_52);
1428
1428
  return ret;
1429
1429
  };
1430
1430
 
1431
- module.exports.__wbindgen_closure_wrapper9591 = function(arg0, arg1, arg2) {
1432
- const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1431
+ module.exports.__wbindgen_closure_wrapper9613 = function(arg0, arg1, arg2) {
1432
+ const ret = makeMutClosure(arg0, arg1, 774, __wbg_adapter_55);
1433
1433
  return ret;
1434
1434
  };
1435
1435
 
Binary file
@@ -60,6 +60,6 @@ export const __wbindgen_export_5: WebAssembly.Table;
60
60
  export const __wbindgen_export_6: WebAssembly.Table;
61
61
  export const __externref_table_dealloc: (a: number) => void;
62
62
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7c49586be6831c4: (a: number, b: number) => void;
63
- export const closure770_externref_shim: (a: number, b: number, c: any) => void;
64
- export const closure421_externref_shim: (a: number, b: number, c: any, d: any) => void;
63
+ export const closure773_externref_shim: (a: number, b: number, c: any) => void;
64
+ export const closure424_externref_shim: (a: number, b: number, c: any, d: any) => void;
65
65
  export const __wbindgen_start: () => void;
@@ -126,7 +126,7 @@ class SqliteStorage {
126
126
  const actualLimit = limit !== null ? limit : 4294967295; // u32::MAX
127
127
 
128
128
  const stmt = this.db.prepare(`
129
- SELECT p.id, p.payment_type, p.status, p.amount, p.fees, p.timestamp, p.details, p.method, pm.lnurl_pay_info
129
+ SELECT p.id, p.payment_type, p.status, p.amount, p.fees, p.timestamp, p.details, p.method, pm.lnurl_pay_info, pm.lnurl_description
130
130
  FROM payments p
131
131
  LEFT JOIN payment_metadata pm ON p.id = pm.payment_id
132
132
  ORDER BY p.timestamp DESC
@@ -188,7 +188,7 @@ class SqliteStorage {
188
188
  }
189
189
 
190
190
  const stmt = this.db.prepare(`
191
- SELECT p.id, p.payment_type, p.status, p.amount, p.fees, p.timestamp, p.details, p.method, pm.lnurl_pay_info
191
+ SELECT p.id, p.payment_type, p.status, p.amount, p.fees, p.timestamp, p.details, p.method, pm.lnurl_pay_info, pm.lnurl_description
192
192
  FROM payments p
193
193
  LEFT JOIN payment_metadata pm ON p.id = pm.payment_id
194
194
  WHERE p.id = ?
@@ -217,13 +217,14 @@ class SqliteStorage {
217
217
  setPaymentMetadata(paymentId, metadata) {
218
218
  try {
219
219
  const stmt = this.db.prepare(`
220
- INSERT OR REPLACE INTO payment_metadata (payment_id, lnurl_pay_info)
221
- VALUES (?, ?)
220
+ INSERT OR REPLACE INTO payment_metadata (payment_id, lnurl_pay_info, lnurl_description)
221
+ VALUES (?, ?, ?)
222
222
  `);
223
223
 
224
224
  stmt.run(
225
225
  paymentId,
226
- metadata.lnurlPayInfo ? JSON.stringify(metadata.lnurlPayInfo) : null
226
+ metadata.lnurlPayInfo ? JSON.stringify(metadata.lnurlPayInfo) : null,
227
+ metadata.lnurlDescription
227
228
  );
228
229
  return Promise.resolve();
229
230
  } catch (error) {
@@ -363,9 +364,12 @@ class SqliteStorage {
363
364
  }
364
365
 
365
366
  // If this is a Lightning payment and we have lnurl_pay_info, add it to details
366
- if (row.lnurl_pay_info && details && details.Lightning) {
367
+ if (row.lnurl_pay_info && details && details.type == 'lightning') {
367
368
  try {
368
- details.Lightning.lnurlPayInfo = JSON.parse(row.lnurl_pay_info);
369
+ details.lnurlPayInfo = JSON.parse(row.lnurl_pay_info);
370
+ if (row.lnurl_description && !details.description) {
371
+ details.description = row.lnurl_description;
372
+ }
369
373
  } catch (e) {
370
374
  throw new StorageError(
371
375
  `Failed to parse lnurl_pay_info JSON for payment ${row.id}: ${e.message}`,
@@ -145,6 +145,10 @@ class MigrationManager {
145
145
  `CREATE INDEX IF NOT EXISTS idx_payment_metadata_payment_id ON payment_metadata(payment_id)`,
146
146
  ],
147
147
  },
148
+ {
149
+ name: "Add lnurl_description column to payment_metadata",
150
+ sql: `ALTER TABLE payment_metadata ADD COLUMN lnurl_description TEXT`,
151
+ }
148
152
  ];
149
153
  }
150
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.2.0",
3
+ "version": "0.2.2-dev1",
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)",
@@ -92,7 +92,7 @@ export interface LightningAddressInfo {
92
92
 
93
93
  export interface RegisterLightningAddressRequest {
94
94
  username: string;
95
- description: string;
95
+ description?: string;
96
96
  }
97
97
 
98
98
  export interface CheckLightningAddressRequest {
@@ -103,6 +103,7 @@ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimErro
103
103
 
104
104
  export interface PaymentMetadata {
105
105
  lnurlPayInfo?: LnurlPayInfo;
106
+ lnurlDescription?: string;
106
107
  }
107
108
 
108
109
  export interface LogEntry {
@@ -624,8 +625,8 @@ export interface InitOutput {
624
625
  readonly __wbindgen_export_6: WebAssembly.Table;
625
626
  readonly __externref_table_dealloc: (a: number) => void;
626
627
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7c49586be6831c4: (a: number, b: number) => void;
627
- readonly closure770_externref_shim: (a: number, b: number, c: any) => void;
628
- readonly closure421_externref_shim: (a: number, b: number, c: any, d: any) => void;
628
+ readonly closure773_externref_shim: (a: number, b: number, c: any) => void;
629
+ readonly closure424_externref_shim: (a: number, b: number, c: any, d: any) => void;
629
630
  readonly __wbindgen_start: () => void;
630
631
  }
631
632
 
@@ -275,11 +275,11 @@ function __wbg_adapter_52(arg0, arg1) {
275
275
  }
276
276
 
277
277
  function __wbg_adapter_55(arg0, arg1, arg2) {
278
- wasm.closure770_externref_shim(arg0, arg1, arg2);
278
+ wasm.closure773_externref_shim(arg0, arg1, arg2);
279
279
  }
280
280
 
281
281
  function __wbg_adapter_180(arg0, arg1, arg2, arg3) {
282
- wasm.closure421_externref_shim(arg0, arg1, arg2, arg3);
282
+ wasm.closure424_externref_shim(arg0, arg1, arg2, arg3);
283
283
  }
284
284
 
285
285
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -1322,12 +1322,12 @@ function __wbg_get_imports() {
1322
1322
  const ret = false;
1323
1323
  return ret;
1324
1324
  };
1325
- imports.wbg.__wbindgen_closure_wrapper7957 = function(arg0, arg1, arg2) {
1326
- const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1325
+ imports.wbg.__wbindgen_closure_wrapper7983 = function(arg0, arg1, arg2) {
1326
+ const ret = makeMutClosure(arg0, arg1, 601, __wbg_adapter_52);
1327
1327
  return ret;
1328
1328
  };
1329
- imports.wbg.__wbindgen_closure_wrapper9591 = function(arg0, arg1, arg2) {
1330
- const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1329
+ imports.wbg.__wbindgen_closure_wrapper9613 = function(arg0, arg1, arg2) {
1330
+ const ret = makeMutClosure(arg0, arg1, 774, __wbg_adapter_55);
1331
1331
  return ret;
1332
1332
  };
1333
1333
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -60,6 +60,6 @@ export const __wbindgen_export_5: WebAssembly.Table;
60
60
  export const __wbindgen_export_6: WebAssembly.Table;
61
61
  export const __externref_table_dealloc: (a: number) => void;
62
62
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf7c49586be6831c4: (a: number, b: number) => void;
63
- export const closure770_externref_shim: (a: number, b: number, c: any) => void;
64
- export const closure421_externref_shim: (a: number, b: number, c: any, d: any) => void;
63
+ export const closure773_externref_shim: (a: number, b: number, c: any) => void;
64
+ export const closure424_externref_shim: (a: number, b: number, c: any, d: any) => void;
65
65
  export const __wbindgen_start: () => void;
@@ -450,6 +450,7 @@ class IndexedDBStorage {
450
450
  lnurlPayInfo: metadata.lnurlPayInfo
451
451
  ? JSON.stringify(metadata.lnurlPayInfo)
452
452
  : null,
453
+ lnurlDescription: metadata.lnurlDescription,
453
454
  };
454
455
 
455
456
  const request = store.put(metadataToStore);
@@ -660,9 +661,12 @@ class IndexedDBStorage {
660
661
  }
661
662
 
662
663
  // If this is a Lightning payment and we have lnurl_pay_info, add it to details
663
- if (metadata && metadata.lnurlPayInfo && details && details.Lightning) {
664
+ if (metadata && metadata.lnurlPayInfo && details && details.type == 'lightning') {
664
665
  try {
665
- details.Lightning.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
666
+ details.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
667
+ if (metadata.lnurlDescription && !details.description) {
668
+ details.description = metadata.lnurlDescription;
669
+ }
666
670
  } catch (e) {
667
671
  throw new StorageError(
668
672
  `Failed to parse lnurl_pay_info JSON for payment ${payment.id}: ${e.message}`,