@breeztech/breez-sdk-spark 0.7.2 → 0.7.4

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.
@@ -309,11 +309,11 @@ function __wbg_adapter_64(arg0, arg1) {
309
309
  }
310
310
 
311
311
  function __wbg_adapter_67(arg0, arg1, arg2) {
312
- wasm.closure1047_externref_shim(arg0, arg1, arg2);
312
+ wasm.closure1052_externref_shim(arg0, arg1, arg2);
313
313
  }
314
314
 
315
- function __wbg_adapter_349(arg0, arg1, arg2, arg3) {
316
- wasm.closure632_externref_shim(arg0, arg1, arg2, arg3);
315
+ function __wbg_adapter_353(arg0, arg1, arg2, arg3) {
316
+ wasm.closure637_externref_shim(arg0, arg1, arg2, arg3);
317
317
  }
318
318
 
319
319
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -360,6 +360,14 @@ class BreezSdk {
360
360
  const ret = wasm.breezsdk_disconnect(this.__wbg_ptr);
361
361
  return ret;
362
362
  }
363
+ /**
364
+ * @param {LnurlAuthRequestDetails} request_data
365
+ * @returns {Promise<LnurlCallbackStatus>}
366
+ */
367
+ lnurlAuth(request_data) {
368
+ const ret = wasm.breezsdk_lnurlAuth(this.__wbg_ptr, request_data);
369
+ return ret;
370
+ }
363
371
  /**
364
372
  * @param {GetPaymentRequest} request
365
373
  * @returns {Promise<GetPaymentResponse>}
@@ -540,6 +548,14 @@ class BreezSdk {
540
548
  const ret = wasm.breezsdk_removeEventListener(this.__wbg_ptr, ptr0, len0);
541
549
  return ret;
542
550
  }
551
+ /**
552
+ * @param {FetchConversionLimitsRequest} request
553
+ * @returns {Promise<FetchConversionLimitsResponse>}
554
+ */
555
+ fetchConversionLimits(request) {
556
+ const ret = wasm.breezsdk_fetchConversionLimits(this.__wbg_ptr, request);
557
+ return ret;
558
+ }
543
559
  /**
544
560
  * @param {ListUnclaimedDepositsRequest} request
545
561
  * @returns {Promise<ListUnclaimedDepositsResponse>}
@@ -573,14 +589,6 @@ class BreezSdk {
573
589
  const ret = wasm.breezsdk_registerLightningAddress(this.__wbg_ptr, request);
574
590
  return ret;
575
591
  }
576
- /**
577
- * @param {FetchTokenConversionLimitsRequest} request
578
- * @returns {Promise<FetchTokenConversionLimitsResponse>}
579
- */
580
- fetchTokenConversionLimits(request) {
581
- const ret = wasm.breezsdk_fetchTokenConversionLimits(this.__wbg_ptr, request);
582
- return ret;
583
- }
584
592
  /**
585
593
  * @returns {OptimizationProgress}
586
594
  */
@@ -654,16 +662,14 @@ class DefaultSigner {
654
662
  wasm.__wbg_defaultsigner_free(ptr, 0);
655
663
  }
656
664
  /**
657
- * @param {Uint8Array} message
665
+ * @param {MessageBytes} message
658
666
  * @param {string} path
659
667
  * @returns {Promise<EcdsaSignatureBytes>}
660
668
  */
661
669
  signEcdsa(message, path) {
662
- const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
670
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
663
671
  const len0 = WASM_VECTOR_LEN;
664
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
665
- const len1 = WASM_VECTOR_LEN;
666
- const ret = wasm.defaultsigner_signEcdsa(this.__wbg_ptr, ptr0, len0, ptr1, len1);
672
+ const ret = wasm.defaultsigner_signEcdsa(this.__wbg_ptr, message, ptr0, len0);
667
673
  return ret;
668
674
  }
669
675
  /**
@@ -674,6 +680,19 @@ class DefaultSigner {
674
680
  const ret = wasm.defaultsigner_signFrost(this.__wbg_ptr, request);
675
681
  return ret;
676
682
  }
683
+ /**
684
+ * @param {Uint8Array} message
685
+ * @param {string} path
686
+ * @returns {Promise<HashedMessageBytes>}
687
+ */
688
+ hmacSha256(message, path) {
689
+ const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
690
+ const len0 = WASM_VECTOR_LEN;
691
+ const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
692
+ const len1 = WASM_VECTOR_LEN;
693
+ const ret = wasm.defaultsigner_hmacSha256(this.__wbg_ptr, ptr0, len0, ptr1, len1);
694
+ return ret;
695
+ }
677
696
  /**
678
697
  * @param {Uint8Array} message
679
698
  * @param {string} path
@@ -758,16 +777,14 @@ class DefaultSigner {
758
777
  return ret;
759
778
  }
760
779
  /**
761
- * @param {Uint8Array} message
780
+ * @param {MessageBytes} message
762
781
  * @param {string} path
763
782
  * @returns {Promise<RecoverableEcdsaSignatureBytes>}
764
783
  */
765
784
  signEcdsaRecoverable(message, path) {
766
- const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
785
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
767
786
  const len0 = WASM_VECTOR_LEN;
768
- const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
769
- const len1 = WASM_VECTOR_LEN;
770
- const ret = wasm.defaultsigner_signEcdsaRecoverable(this.__wbg_ptr, ptr0, len0, ptr1, len1);
787
+ const ret = wasm.defaultsigner_signEcdsaRecoverable(this.__wbg_ptr, message, ptr0, len0);
771
788
  return ret;
772
789
  }
773
790
  /**
@@ -1642,6 +1659,21 @@ module.exports.__wbg_headers_9cb51cfd2ac780a4 = function(arg0) {
1642
1659
  return ret;
1643
1660
  };
1644
1661
 
1662
+ module.exports.__wbg_hmacSha256_c6633de6089f686f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1663
+ let deferred1_0;
1664
+ let deferred1_1;
1665
+ try {
1666
+ var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
1667
+ wasm.__wbindgen_free(arg1, arg2 * 1, 1);
1668
+ deferred1_0 = arg3;
1669
+ deferred1_1 = arg4;
1670
+ const ret = arg0.hmacSha256(v0, getStringFromWasm0(arg3, arg4));
1671
+ return ret;
1672
+ } finally {
1673
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1674
+ }
1675
+ }, arguments) };
1676
+
1645
1677
  module.exports.__wbg_identityPublicKey_c8b35005055a3df0 = function() { return handleError(function (arg0) {
1646
1678
  const ret = arg0.identityPublicKey();
1647
1679
  return ret;
@@ -1811,7 +1843,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
1811
1843
  const a = state0.a;
1812
1844
  state0.a = 0;
1813
1845
  try {
1814
- return __wbg_adapter_349(a, state0.b, arg0, arg1);
1846
+ return __wbg_adapter_353(a, state0.b, arg0, arg1);
1815
1847
  } finally {
1816
1848
  state0.a = a;
1817
1849
  }
@@ -2098,33 +2130,29 @@ module.exports.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
2098
2130
  arg0.signal = arg1;
2099
2131
  };
2100
2132
 
2101
- module.exports.__wbg_signEcdsaRecoverable_673b67f4f9ec42e7 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2102
- let deferred1_0;
2103
- let deferred1_1;
2133
+ module.exports.__wbg_signEcdsaRecoverable_756dd79f08e5ed39 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2134
+ let deferred0_0;
2135
+ let deferred0_1;
2104
2136
  try {
2105
- var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
2106
- wasm.__wbindgen_free(arg1, arg2 * 1, 1);
2107
- deferred1_0 = arg3;
2108
- deferred1_1 = arg4;
2109
- const ret = arg0.signEcdsaRecoverable(v0, getStringFromWasm0(arg3, arg4));
2137
+ deferred0_0 = arg2;
2138
+ deferred0_1 = arg3;
2139
+ const ret = arg0.signEcdsaRecoverable(arg1, getStringFromWasm0(arg2, arg3));
2110
2140
  return ret;
2111
2141
  } finally {
2112
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2142
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2113
2143
  }
2114
2144
  }, arguments) };
2115
2145
 
2116
- module.exports.__wbg_signEcdsa_b0be26cee51844bc = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2117
- let deferred1_0;
2118
- let deferred1_1;
2146
+ module.exports.__wbg_signEcdsa_0ebea9dfc3b7c28f = function() { return handleError(function (arg0, arg1, arg2, arg3) {
2147
+ let deferred0_0;
2148
+ let deferred0_1;
2119
2149
  try {
2120
- var v0 = getArrayU8FromWasm0(arg1, arg2).slice();
2121
- wasm.__wbindgen_free(arg1, arg2 * 1, 1);
2122
- deferred1_0 = arg3;
2123
- deferred1_1 = arg4;
2124
- const ret = arg0.signEcdsa(v0, getStringFromWasm0(arg3, arg4));
2150
+ deferred0_0 = arg2;
2151
+ deferred0_1 = arg3;
2152
+ const ret = arg0.signEcdsa(arg1, getStringFromWasm0(arg2, arg3));
2125
2153
  return ret;
2126
2154
  } finally {
2127
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2155
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2128
2156
  }
2129
2157
  }, arguments) };
2130
2158
 
@@ -2358,13 +2386,13 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
2358
2386
  return ret;
2359
2387
  };
2360
2388
 
2361
- module.exports.__wbindgen_closure_wrapper11144 = function(arg0, arg1, arg2) {
2362
- const ret = makeMutClosure(arg0, arg1, 812, __wbg_adapter_64);
2389
+ module.exports.__wbindgen_closure_wrapper11278 = function(arg0, arg1, arg2) {
2390
+ const ret = makeMutClosure(arg0, arg1, 817, __wbg_adapter_64);
2363
2391
  return ret;
2364
2392
  };
2365
2393
 
2366
- module.exports.__wbindgen_closure_wrapper13050 = function(arg0, arg1, arg2) {
2367
- const ret = makeMutClosure(arg0, arg1, 1048, __wbg_adapter_67);
2394
+ module.exports.__wbindgen_closure_wrapper13182 = function(arg0, arg1, arg2) {
2395
+ const ret = makeMutClosure(arg0, arg1, 1053, __wbg_adapter_67);
2368
2396
  return ret;
2369
2397
  };
2370
2398
 
Binary file
@@ -13,7 +13,7 @@ export const breezsdk_claimDeposit: (a: number, b: any) => any;
13
13
  export const breezsdk_claimHtlcPayment: (a: number, b: any) => any;
14
14
  export const breezsdk_deleteLightningAddress: (a: number) => any;
15
15
  export const breezsdk_disconnect: (a: number) => any;
16
- export const breezsdk_fetchTokenConversionLimits: (a: number, b: any) => any;
16
+ export const breezsdk_fetchConversionLimits: (a: number, b: any) => any;
17
17
  export const breezsdk_getInfo: (a: number, b: any) => any;
18
18
  export const breezsdk_getLeafOptimizationProgress: (a: number) => any;
19
19
  export const breezsdk_getLightningAddress: (a: number) => any;
@@ -25,6 +25,7 @@ export const breezsdk_listFiatCurrencies: (a: number) => any;
25
25
  export const breezsdk_listFiatRates: (a: number) => any;
26
26
  export const breezsdk_listPayments: (a: number, b: any) => any;
27
27
  export const breezsdk_listUnclaimedDeposits: (a: number, b: any) => any;
28
+ export const breezsdk_lnurlAuth: (a: number, b: any) => any;
28
29
  export const breezsdk_lnurlPay: (a: number, b: any) => any;
29
30
  export const breezsdk_lnurlWithdraw: (a: number, b: any) => any;
30
31
  export const breezsdk_parse: (a: number, b: number, c: number) => any;
@@ -56,9 +57,10 @@ export const defaultsigner_getPublicKeyFromPrivateKeySource: (a: number, b: any)
56
57
  export const defaultsigner_getStaticDepositPrivateKey: (a: number, b: number) => any;
57
58
  export const defaultsigner_getStaticDepositPrivateKeySource: (a: number, b: number) => any;
58
59
  export const defaultsigner_getStaticDepositPublicKey: (a: number, b: number) => any;
60
+ export const defaultsigner_hmacSha256: (a: number, b: number, c: number, d: number, e: number) => any;
59
61
  export const defaultsigner_identityPublicKey: (a: number) => [number, number, number];
60
- export const defaultsigner_signEcdsa: (a: number, b: number, c: number, d: number, e: number) => any;
61
- export const defaultsigner_signEcdsaRecoverable: (a: number, b: number, c: number, d: number, e: number) => any;
62
+ export const defaultsigner_signEcdsa: (a: number, b: any, c: number, d: number) => any;
63
+ export const defaultsigner_signEcdsaRecoverable: (a: number, b: any, c: number, d: number) => any;
62
64
  export const defaultsigner_signFrost: (a: number, b: any) => any;
63
65
  export const defaultsigner_signHashSchnorr: (a: number, b: number, c: number, d: number, e: number) => any;
64
66
  export const defaultsigner_splitSecretWithProofs: (a: number, b: any, c: number, d: number) => any;
@@ -110,6 +112,6 @@ export const __externref_drop_slice: (a: number, b: number) => void;
110
112
  export const __wbindgen_export_7: WebAssembly.Table;
111
113
  export const __externref_table_dealloc: (a: number) => void;
112
114
  export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdf0ebd5238280272: (a: number, b: number) => void;
113
- export const closure1047_externref_shim: (a: number, b: number, c: any) => void;
114
- export const closure632_externref_shim: (a: number, b: number, c: any, d: any) => void;
115
+ export const closure1052_externref_shim: (a: number, b: number, c: any) => void;
116
+ export const closure637_externref_shim: (a: number, b: number, c: any, d: any) => void;
115
117
  export const __wbindgen_start: () => void;
@@ -179,14 +179,13 @@ class SqliteStorage {
179
179
  paymentDetailsFilter.conversionRefundNeeded !== undefined
180
180
  ) {
181
181
  const typeCheck = paymentDetailsFilter.type === "spark" ? "p.spark = 1" : "p.spark IS NULL";
182
- const nullCheck =
182
+ const refundNeeded =
183
183
  paymentDetailsFilter.conversionRefundNeeded === true
184
- ? "IS NULL"
185
- : "IS NOT NULL";
184
+ ? "= 'refundNeeded'"
185
+ : "!= 'refundNeeded'";
186
186
  paymentDetailsClauses.push(
187
- `${typeCheck} AND pm.token_conversion_info IS NOT NULL AND
188
- json_extract(pm.token_conversion_info, '$.paymentId') IS NULL AND
189
- json_extract(pm.token_conversion_info, '$.refundIdentifier') ${nullCheck}`
187
+ `${typeCheck} AND pm.conversion_info IS NOT NULL AND
188
+ json_extract(pm.conversion_info, '$.status') ${refundNeeded}`
190
189
  );
191
190
  }
192
191
  // Filter by token transaction hash
@@ -247,7 +246,7 @@ class SqliteStorage {
247
246
  , l.preimage AS lightning_preimage
248
247
  , pm.lnurl_pay_info
249
248
  , pm.lnurl_withdraw_info
250
- , pm.token_conversion_info
249
+ , pm.conversion_info
251
250
  , t.metadata AS token_metadata
252
251
  , t.tx_hash AS token_tx_hash
253
252
  , t.invoice_details AS token_invoice_details
@@ -427,7 +426,7 @@ class SqliteStorage {
427
426
  , l.preimage AS lightning_preimage
428
427
  , pm.lnurl_pay_info
429
428
  , pm.lnurl_withdraw_info
430
- , pm.token_conversion_info
429
+ , pm.conversion_info
431
430
  , t.metadata AS token_metadata
432
431
  , t.tx_hash AS token_tx_hash
433
432
  , t.invoice_details AS token_invoice_details
@@ -491,7 +490,7 @@ class SqliteStorage {
491
490
  , l.preimage AS lightning_preimage
492
491
  , pm.lnurl_pay_info
493
492
  , pm.lnurl_withdraw_info
494
- , pm.token_conversion_info
493
+ , pm.conversion_info
495
494
  , t.metadata AS token_metadata
496
495
  , t.tx_hash AS token_tx_hash
497
496
  , t.invoice_details AS token_invoice_details
@@ -530,7 +529,7 @@ class SqliteStorage {
530
529
  setPaymentMetadata(paymentId, metadata) {
531
530
  try {
532
531
  const stmt = this.db.prepare(`
533
- INSERT OR REPLACE INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, token_conversion_info)
532
+ INSERT OR REPLACE INTO payment_metadata (payment_id, parent_payment_id, lnurl_pay_info, lnurl_withdraw_info, lnurl_description, conversion_info)
534
533
  VALUES (?, ?, ?, ?, ?, ?)
535
534
  `);
536
535
 
@@ -542,8 +541,8 @@ class SqliteStorage {
542
541
  ? JSON.stringify(metadata.lnurlWithdrawInfo)
543
542
  : null,
544
543
  metadata.lnurlDescription,
545
- metadata.tokenConversionInfo
546
- ? JSON.stringify(metadata.tokenConversionInfo)
544
+ metadata.conversionInfo
545
+ ? JSON.stringify(metadata.conversionInfo)
547
546
  : null
548
547
  );
549
548
  return Promise.resolve();
@@ -747,8 +746,8 @@ class SqliteStorage {
747
746
  htlcDetails: row.spark_htlc_details
748
747
  ? JSON.parse(row.spark_htlc_details)
749
748
  : null,
750
- tokenConversionInfo: row.token_conversion_info
751
- ? JSON.parse(row.token_conversion_info)
749
+ conversionInfo: row.conversion_info
750
+ ? JSON.parse(row.conversion_info)
752
751
  : null,
753
752
  };
754
753
  } else if (row.token_metadata) {
@@ -759,8 +758,8 @@ class SqliteStorage {
759
758
  invoiceDetails: row.token_invoice_details
760
759
  ? JSON.parse(row.token_invoice_details)
761
760
  : null,
762
- tokenConversionInfo: row.token_conversion_info
763
- ? JSON.parse(row.token_conversion_info)
761
+ conversionInfo: row.conversion_info
762
+ ? JSON.parse(row.conversion_info)
764
763
  : null,
765
764
  };
766
765
  }
@@ -315,6 +315,12 @@ class MigrationManager {
315
315
  name: "Add parent payment id to payment_metadata",
316
316
  sql: `ALTER TABLE payment_metadata ADD COLUMN parent_payment_id TEXT`
317
317
  },
318
+ {
319
+ name: "Add conversion info to payment_metadata",
320
+ sql: [
321
+ `ALTER TABLE payment_metadata DROP COLUMN token_conversion_info`,
322
+ `ALTER TABLE payment_metadata ADD COLUMN conversion_info TEXT`]
323
+ },
318
324
  ];
319
325
  }
320
326
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
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)",