@breeztech/breez-sdk-spark 0.9.1 → 0.11.0-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.
@@ -213,6 +213,54 @@ function debugString(val) {
213
213
  // TODO we could test for more things here, like `Set`s and `Map`s.
214
214
  return className;
215
215
  }
216
+ /**
217
+ * Creates a default PostgreSQL storage configuration with sensible defaults.
218
+ *
219
+ * Default values (from pg.Pool):
220
+ * - `maxPoolSize`: 10
221
+ * - `createTimeoutSecs`: 0 (no timeout)
222
+ * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
223
+ * @param {string} connection_string
224
+ * @returns {PostgresStorageConfig}
225
+ */
226
+ export function defaultPostgresStorageConfig(connection_string) {
227
+ const ptr0 = passStringToWasm0(connection_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
+ const len0 = WASM_VECTOR_LEN;
229
+ const ret = wasm.defaultPostgresStorageConfig(ptr0, len0);
230
+ return ret;
231
+ }
232
+
233
+ /**
234
+ * Creates a default external signer from a mnemonic phrase.
235
+ *
236
+ * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
237
+ * @returns {Promise<SparkStatus>}
238
+ */
239
+ export function getSparkStatus() {
240
+ const ret = wasm.getSparkStatus();
241
+ return ret;
242
+ }
243
+
244
+ /**
245
+ * @param {Network} network
246
+ * @returns {Config}
247
+ */
248
+ export function defaultConfig(network) {
249
+ const ret = wasm.defaultConfig(network);
250
+ return ret;
251
+ }
252
+
253
+ /**
254
+ * @param {Logger} logger
255
+ * @param {string | null} [filter]
256
+ * @returns {Promise<void>}
257
+ */
258
+ export function initLogging(logger, filter) {
259
+ var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
260
+ var len0 = WASM_VECTOR_LEN;
261
+ const ret = wasm.initLogging(logger, ptr0, len0);
262
+ return ret;
263
+ }
216
264
 
217
265
  function takeFromExternrefTable0(idx) {
218
266
  const value = wasm.__wbindgen_export_5.get(idx);
@@ -239,34 +287,11 @@ export function defaultExternalSigner(mnemonic, passphrase, network, key_set_con
239
287
  }
240
288
 
241
289
  /**
242
- * @param {Logger} logger
243
- * @param {string | null} [filter]
244
- * @returns {Promise<void>}
245
- */
246
- export function initLogging(logger, filter) {
247
- var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
248
- var len0 = WASM_VECTOR_LEN;
249
- const ret = wasm.initLogging(logger, ptr0, len0);
250
- return ret;
251
- }
252
-
253
- /**
254
- * @param {Network} network
255
- * @returns {Config}
256
- */
257
- export function defaultConfig(network) {
258
- const ret = wasm.defaultConfig(network);
259
- return ret;
260
- }
261
-
262
- /**
263
- * Creates a default external signer from a mnemonic phrase.
264
- *
265
- * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
266
- * @returns {Promise<SparkStatus>}
290
+ * @param {ConnectRequest} request
291
+ * @returns {Promise<BreezSdk>}
267
292
  */
268
- export function getSparkStatus() {
269
- const ret = wasm.getSparkStatus();
293
+ export function connect(request) {
294
+ const ret = wasm.connect(request);
270
295
  return ret;
271
296
  }
272
297
 
@@ -283,15 +308,6 @@ export function connectWithSigner(config, signer, storage_dir) {
283
308
  return ret;
284
309
  }
285
310
 
286
- /**
287
- * @param {ConnectRequest} request
288
- * @returns {Promise<BreezSdk>}
289
- */
290
- export function connect(request) {
291
- const ret = wasm.connect(request);
292
- return ret;
293
- }
294
-
295
311
  function passArray8ToWasm0(arg, malloc) {
296
312
  const ptr = malloc(arg.length * 1, 1) >>> 0;
297
313
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -310,15 +326,15 @@ export function task_worker_entry_point(ptr) {
310
326
  }
311
327
 
312
328
  function __wbg_adapter_64(arg0, arg1) {
313
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4867a1ac48fc7b64(arg0, arg1);
329
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2ac8515d28de5817(arg0, arg1);
314
330
  }
315
331
 
316
332
  function __wbg_adapter_67(arg0, arg1, arg2) {
317
- wasm.closure1081_externref_shim(arg0, arg1, arg2);
333
+ wasm.closure1068_externref_shim(arg0, arg1, arg2);
318
334
  }
319
335
 
320
- function __wbg_adapter_285(arg0, arg1, arg2, arg3) {
321
- wasm.closure666_externref_shim(arg0, arg1, arg2, arg3);
336
+ function __wbg_adapter_301(arg0, arg1, arg2, arg3) {
337
+ wasm.closure651_externref_shim(arg0, arg1, arg2, arg3);
322
338
  }
323
339
 
324
340
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -373,6 +389,14 @@ export class BreezSdk {
373
389
  const ret = wasm.breezsdk_lnurlAuth(this.__wbg_ptr, request_data);
374
390
  return ret;
375
391
  }
392
+ /**
393
+ * @param {AddContactRequest} request
394
+ * @returns {Promise<Contact>}
395
+ */
396
+ addContact(request) {
397
+ const ret = wasm.breezsdk_addContact(this.__wbg_ptr, request);
398
+ return ret;
399
+ }
376
400
  /**
377
401
  * @param {BuyBitcoinRequest} request
378
402
  * @returns {Promise<BuyBitcoinResponse>}
@@ -429,6 +453,14 @@ export class BreezSdk {
429
453
  const ret = wasm.breezsdk_claimDeposit(this.__wbg_ptr, request);
430
454
  return ret;
431
455
  }
456
+ /**
457
+ * @param {ListContactsRequest} request
458
+ * @returns {Promise<Contact[]>}
459
+ */
460
+ listContacts(request) {
461
+ const ret = wasm.breezsdk_listContacts(this.__wbg_ptr, request);
462
+ return ret;
463
+ }
432
464
  /**
433
465
  * @param {ListPaymentsRequest} request
434
466
  * @returns {Promise<ListPaymentsResponse>}
@@ -437,6 +469,16 @@ export class BreezSdk {
437
469
  const ret = wasm.breezsdk_listPayments(this.__wbg_ptr, request);
438
470
  return ret;
439
471
  }
472
+ /**
473
+ * @param {string} id
474
+ * @returns {Promise<void>}
475
+ */
476
+ deleteContact(id) {
477
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ const ret = wasm.breezsdk_deleteContact(this.__wbg_ptr, ptr0, len0);
480
+ return ret;
481
+ }
440
482
  /**
441
483
  * @param {LnurlWithdrawRequest} request
442
484
  * @returns {Promise<LnurlWithdrawResponse>}
@@ -453,6 +495,14 @@ export class BreezSdk {
453
495
  const ret = wasm.breezsdk_refundDeposit(this.__wbg_ptr, request);
454
496
  return ret;
455
497
  }
498
+ /**
499
+ * @param {UpdateContactRequest} request
500
+ * @returns {Promise<Contact>}
501
+ */
502
+ updateContact(request) {
503
+ const ret = wasm.breezsdk_updateContact(this.__wbg_ptr, request);
504
+ return ret;
505
+ }
456
506
  /**
457
507
  * @returns {Promise<ListFiatRatesResponse>}
458
508
  */
@@ -1092,6 +1142,15 @@ export class SdkBuilder {
1092
1142
  const ret = wasm.sdkbuilder_withPaymentObserver(ptr, payment_observer);
1093
1143
  return SdkBuilder.__wrap(ret);
1094
1144
  }
1145
+ /**
1146
+ * @param {PostgresStorageConfig} config
1147
+ * @returns {SdkBuilder}
1148
+ */
1149
+ withPostgresStorage(config) {
1150
+ const ptr = this.__destroy_into_raw();
1151
+ const ret = wasm.sdkbuilder_withPostgresStorage(ptr, config);
1152
+ return SdkBuilder.__wrap(ret);
1153
+ }
1095
1154
  /**
1096
1155
  * @param {string} url
1097
1156
  * @param {ChainApiType} api_type
@@ -1355,6 +1414,10 @@ function __wbg_get_imports() {
1355
1414
  const ret = createDefaultStorage(getStringFromWasm0(arg0, arg1), arg2);
1356
1415
  return ret;
1357
1416
  }, arguments) };
1417
+ imports.wbg.__wbg_createPostgresStorage_46770cbf8e947f9e = function() { return handleError(function (arg0, arg1) {
1418
+ const ret = createPostgresStorage(arg0, arg1);
1419
+ return ret;
1420
+ }, arguments) };
1358
1421
  imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
1359
1422
  const ret = arg0.crypto;
1360
1423
  return ret;
@@ -1371,6 +1434,18 @@ function __wbg_get_imports() {
1371
1434
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1372
1435
  }
1373
1436
  }, arguments) };
1437
+ imports.wbg.__wbg_deleteContact_04d635b32c469d83 = function() { return handleError(function (arg0, arg1, arg2) {
1438
+ let deferred0_0;
1439
+ let deferred0_1;
1440
+ try {
1441
+ deferred0_0 = arg1;
1442
+ deferred0_1 = arg2;
1443
+ const ret = arg0.deleteContact(getStringFromWasm0(arg1, arg2));
1444
+ return ret;
1445
+ } finally {
1446
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1447
+ }
1448
+ }, arguments) };
1374
1449
  imports.wbg.__wbg_deleteDeposit_72ec826e7c3c3ccf = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1375
1450
  let deferred0_0;
1376
1451
  let deferred0_1;
@@ -1514,6 +1589,18 @@ function __wbg_get_imports() {
1514
1589
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1515
1590
  }
1516
1591
  }, arguments) };
1592
+ imports.wbg.__wbg_getContact_b7300737e5dee01b = function() { return handleError(function (arg0, arg1, arg2) {
1593
+ let deferred0_0;
1594
+ let deferred0_1;
1595
+ try {
1596
+ deferred0_0 = arg1;
1597
+ deferred0_1 = arg2;
1598
+ const ret = arg0.getContact(getStringFromWasm0(arg1, arg2));
1599
+ return ret;
1600
+ } finally {
1601
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1602
+ }
1603
+ }, arguments) };
1517
1604
  imports.wbg.__wbg_getPaymentById_c23144bfc404b2fc = function() { return handleError(function (arg0, arg1, arg2) {
1518
1605
  let deferred0_0;
1519
1606
  let deferred0_1;
@@ -1656,6 +1743,10 @@ function __wbg_get_imports() {
1656
1743
  const ret = arg0.identityPublicKey();
1657
1744
  return ret;
1658
1745
  }, arguments) };
1746
+ imports.wbg.__wbg_insertContact_33c214012213409d = function() { return handleError(function (arg0, arg1) {
1747
+ const ret = arg0.insertContact(arg1);
1748
+ return ret;
1749
+ }, arguments) };
1659
1750
  imports.wbg.__wbg_insertPaymentMetadata_0c4ebdcde694d29b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1660
1751
  let deferred0_0;
1661
1752
  let deferred0_1;
@@ -1762,11 +1853,15 @@ function __wbg_get_imports() {
1762
1853
  const ret = arg0.length;
1763
1854
  return ret;
1764
1855
  };
1856
+ imports.wbg.__wbg_listContacts_5b4d38a57743b713 = function() { return handleError(function (arg0, arg1) {
1857
+ const ret = arg0.listContacts(arg1);
1858
+ return ret;
1859
+ }, arguments) };
1765
1860
  imports.wbg.__wbg_listDeposits_7ca6e22afc06d560 = function() { return handleError(function (arg0) {
1766
1861
  const ret = arg0.listDeposits();
1767
1862
  return ret;
1768
1863
  }, arguments) };
1769
- imports.wbg.__wbg_listPayments_3b9302bf121fdc4d = function() { return handleError(function (arg0, arg1) {
1864
+ imports.wbg.__wbg_listPayments_d8c53ab09ffc756b = function() { return handleError(function (arg0, arg1) {
1770
1865
  const ret = arg0.listPayments(arg1);
1771
1866
  return ret;
1772
1867
  }, arguments) };
@@ -1810,7 +1905,7 @@ function __wbg_get_imports() {
1810
1905
  const a = state0.a;
1811
1906
  state0.a = 0;
1812
1907
  try {
1813
- return __wbg_adapter_285(a, state0.b, arg0, arg1);
1908
+ return __wbg_adapter_301(a, state0.b, arg0, arg1);
1814
1909
  } finally {
1815
1910
  state0.a = a;
1816
1911
  }
@@ -2242,12 +2337,12 @@ function __wbg_get_imports() {
2242
2337
  const ret = false;
2243
2338
  return ret;
2244
2339
  };
2245
- imports.wbg.__wbindgen_closure_wrapper11908 = function(arg0, arg1, arg2) {
2246
- const ret = makeMutClosure(arg0, arg1, 844, __wbg_adapter_64);
2340
+ imports.wbg.__wbindgen_closure_wrapper11838 = function(arg0, arg1, arg2) {
2341
+ const ret = makeMutClosure(arg0, arg1, 828, __wbg_adapter_64);
2247
2342
  return ret;
2248
2343
  };
2249
- imports.wbg.__wbindgen_closure_wrapper13858 = function(arg0, arg1, arg2) {
2250
- const ret = makeMutClosure(arg0, arg1, 1082, __wbg_adapter_67);
2344
+ imports.wbg.__wbindgen_closure_wrapper13801 = function(arg0, arg1, arg2) {
2345
+ const ret = makeMutClosure(arg0, arg1, 1069, __wbg_adapter_67);
2251
2346
  return ret;
2252
2347
  };
2253
2348
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -5,6 +5,7 @@ export const __wbg_breezsdk_free: (a: number, b: number) => void;
5
5
  export const __wbg_defaultsigner_free: (a: number, b: number) => void;
6
6
  export const __wbg_sdkbuilder_free: (a: number, b: number) => void;
7
7
  export const __wbg_tokenissuer_free: (a: number, b: number) => void;
8
+ export const breezsdk_addContact: (a: number, b: any) => any;
8
9
  export const breezsdk_addEventListener: (a: number, b: any) => any;
9
10
  export const breezsdk_buyBitcoin: (a: number, b: any) => any;
10
11
  export const breezsdk_cancelLeafOptimization: (a: number) => any;
@@ -12,6 +13,7 @@ export const breezsdk_checkLightningAddressAvailable: (a: number, b: any) => any
12
13
  export const breezsdk_checkMessage: (a: number, b: any) => any;
13
14
  export const breezsdk_claimDeposit: (a: number, b: any) => any;
14
15
  export const breezsdk_claimHtlcPayment: (a: number, b: any) => any;
16
+ export const breezsdk_deleteContact: (a: number, b: number, c: number) => any;
15
17
  export const breezsdk_deleteLightningAddress: (a: number) => any;
16
18
  export const breezsdk_disconnect: (a: number) => any;
17
19
  export const breezsdk_fetchConversionLimits: (a: number, b: any) => any;
@@ -22,6 +24,7 @@ export const breezsdk_getPayment: (a: number, b: any) => any;
22
24
  export const breezsdk_getTokenIssuer: (a: number) => number;
23
25
  export const breezsdk_getTokensMetadata: (a: number, b: any) => any;
24
26
  export const breezsdk_getUserSettings: (a: number) => any;
27
+ export const breezsdk_listContacts: (a: number, b: any) => any;
25
28
  export const breezsdk_listFiatCurrencies: (a: number) => any;
26
29
  export const breezsdk_listFiatRates: (a: number) => any;
27
30
  export const breezsdk_listPayments: (a: number, b: any) => any;
@@ -41,11 +44,13 @@ export const breezsdk_sendPayment: (a: number, b: any) => any;
41
44
  export const breezsdk_signMessage: (a: number, b: any) => any;
42
45
  export const breezsdk_startLeafOptimization: (a: number) => void;
43
46
  export const breezsdk_syncWallet: (a: number, b: any) => any;
47
+ export const breezsdk_updateContact: (a: number, b: any) => any;
44
48
  export const breezsdk_updateUserSettings: (a: number, b: any) => any;
45
49
  export const connect: (a: any) => any;
46
50
  export const connectWithSigner: (a: any, b: any, c: number, d: number) => any;
47
51
  export const defaultConfig: (a: any) => any;
48
52
  export const defaultExternalSigner: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number, number];
53
+ export const defaultPostgresStorageConfig: (a: number, b: number) => any;
49
54
  export const defaultsigner_aggregateFrost: (a: number, b: any) => any;
50
55
  export const defaultsigner_decryptEcies: (a: number, b: number, c: number, d: number, e: number) => any;
51
56
  export const defaultsigner_derivePublicKey: (a: number, b: number, c: number) => any;
@@ -77,6 +82,7 @@ export const sdkbuilder_withFiatService: (a: number, b: any) => number;
77
82
  export const sdkbuilder_withKeySet: (a: number, b: any) => number;
78
83
  export const sdkbuilder_withLnurlClient: (a: number, b: any) => number;
79
84
  export const sdkbuilder_withPaymentObserver: (a: number, b: any) => number;
85
+ export const sdkbuilder_withPostgresStorage: (a: number, b: any) => number;
80
86
  export const sdkbuilder_withRestChainService: (a: number, b: number, c: number, d: any, e: number) => number;
81
87
  export const sdkbuilder_withStorage: (a: number, b: any) => number;
82
88
  export const tokenissuer_burnIssuerToken: (a: number, b: any) => any;
@@ -113,7 +119,7 @@ export const __wbindgen_export_5: WebAssembly.Table;
113
119
  export const __externref_drop_slice: (a: number, b: number) => void;
114
120
  export const __wbindgen_export_7: WebAssembly.Table;
115
121
  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;
122
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2ac8515d28de5817: (a: number, b: number) => void;
123
+ export const closure1068_externref_shim: (a: number, b: number, c: any) => void;
124
+ export const closure651_externref_shim: (a: number, b: number, c: any, d: any) => void;
119
125
  export const __wbindgen_start: () => void;