@breeztech/breez-sdk-spark 0.2.0 → 0.2.1

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 {
@@ -1422,12 +1422,12 @@ export function __wbindgen_cb_drop(arg0) {
1422
1422
  return ret;
1423
1423
  };
1424
1424
 
1425
- export function __wbindgen_closure_wrapper7957(arg0, arg1, arg2) {
1425
+ export function __wbindgen_closure_wrapper7967(arg0, arg1, arg2) {
1426
1426
  const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1427
1427
  return ret;
1428
1428
  };
1429
1429
 
1430
- export function __wbindgen_closure_wrapper9591(arg0, arg1, arg2) {
1430
+ export function __wbindgen_closure_wrapper9599(arg0, arg1, arg2) {
1431
1431
  const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1432
1432
  return ret;
1433
1433
  };
@@ -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 {
@@ -1281,11 +1281,11 @@ const imports = {
1281
1281
  const ret = false;
1282
1282
  return ret;
1283
1283
  },
1284
- __wbindgen_closure_wrapper7957: function(arg0, arg1, arg2) {
1284
+ __wbindgen_closure_wrapper7967: function(arg0, arg1, arg2) {
1285
1285
  const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1286
1286
  return ret;
1287
1287
  },
1288
- __wbindgen_closure_wrapper9591: function(arg0, arg1, arg2) {
1288
+ __wbindgen_closure_wrapper9599: function(arg0, arg1, arg2) {
1289
1289
  const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1290
1290
  return ret;
1291
1291
  },
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 {
@@ -1423,12 +1423,12 @@ 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) {
1426
+ module.exports.__wbindgen_closure_wrapper7967 = function(arg0, arg1, arg2) {
1427
1427
  const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1428
1428
  return ret;
1429
1429
  };
1430
1430
 
1431
- module.exports.__wbindgen_closure_wrapper9591 = function(arg0, arg1, arg2) {
1431
+ module.exports.__wbindgen_closure_wrapper9599 = function(arg0, arg1, arg2) {
1432
1432
  const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1433
1433
  return ret;
1434
1434
  };
Binary file
@@ -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.1",
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 {
@@ -1322,11 +1322,11 @@ 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) {
1325
+ imports.wbg.__wbindgen_closure_wrapper7967 = function(arg0, arg1, arg2) {
1326
1326
  const ret = makeMutClosure(arg0, arg1, 598, __wbg_adapter_52);
1327
1327
  return ret;
1328
1328
  };
1329
- imports.wbg.__wbindgen_closure_wrapper9591 = function(arg0, arg1, arg2) {
1329
+ imports.wbg.__wbindgen_closure_wrapper9599 = function(arg0, arg1, arg2) {
1330
1330
  const ret = makeMutClosure(arg0, arg1, 771, __wbg_adapter_55);
1331
1331
  return ret;
1332
1332
  };
Binary file
@@ -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}`,