@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.
@@ -221,6 +221,54 @@ function debugString(val) {
221
221
  // TODO we could test for more things here, like `Set`s and `Map`s.
222
222
  return className;
223
223
  }
224
+ /**
225
+ * Creates a default PostgreSQL storage configuration with sensible defaults.
226
+ *
227
+ * Default values (from pg.Pool):
228
+ * - `maxPoolSize`: 10
229
+ * - `createTimeoutSecs`: 0 (no timeout)
230
+ * - `recycleTimeoutSecs`: 10 (10 seconds idle before disconnect)
231
+ * @param {string} connection_string
232
+ * @returns {PostgresStorageConfig}
233
+ */
234
+ export function defaultPostgresStorageConfig(connection_string) {
235
+ const ptr0 = passStringToWasm0(connection_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ret = wasm.defaultPostgresStorageConfig(ptr0, len0);
238
+ return ret;
239
+ }
240
+
241
+ /**
242
+ * Creates a default external signer from a mnemonic phrase.
243
+ *
244
+ * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
245
+ * @returns {Promise<SparkStatus>}
246
+ */
247
+ export function getSparkStatus() {
248
+ const ret = wasm.getSparkStatus();
249
+ return ret;
250
+ }
251
+
252
+ /**
253
+ * @param {Network} network
254
+ * @returns {Config}
255
+ */
256
+ export function defaultConfig(network) {
257
+ const ret = wasm.defaultConfig(network);
258
+ return ret;
259
+ }
260
+
261
+ /**
262
+ * @param {Logger} logger
263
+ * @param {string | null} [filter]
264
+ * @returns {Promise<void>}
265
+ */
266
+ export function initLogging(logger, filter) {
267
+ var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268
+ var len0 = WASM_VECTOR_LEN;
269
+ const ret = wasm.initLogging(logger, ptr0, len0);
270
+ return ret;
271
+ }
224
272
 
225
273
  function takeFromExternrefTable0(idx) {
226
274
  const value = wasm.__wbindgen_export_5.get(idx);
@@ -247,34 +295,11 @@ export function defaultExternalSigner(mnemonic, passphrase, network, key_set_con
247
295
  }
248
296
 
249
297
  /**
250
- * @param {Logger} logger
251
- * @param {string | null} [filter]
252
- * @returns {Promise<void>}
253
- */
254
- export function initLogging(logger, filter) {
255
- var ptr0 = isLikeNone(filter) ? 0 : passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
256
- var len0 = WASM_VECTOR_LEN;
257
- const ret = wasm.initLogging(logger, ptr0, len0);
258
- return ret;
259
- }
260
-
261
- /**
262
- * @param {Network} network
263
- * @returns {Config}
264
- */
265
- export function defaultConfig(network) {
266
- const ret = wasm.defaultConfig(network);
267
- return ret;
268
- }
269
-
270
- /**
271
- * Creates a default external signer from a mnemonic phrase.
272
- *
273
- * This creates a signer that can be used with `connectWithSigner` or `SdkBuilder.newWithSigner`.
274
- * @returns {Promise<SparkStatus>}
298
+ * @param {ConnectRequest} request
299
+ * @returns {Promise<BreezSdk>}
275
300
  */
276
- export function getSparkStatus() {
277
- const ret = wasm.getSparkStatus();
301
+ export function connect(request) {
302
+ const ret = wasm.connect(request);
278
303
  return ret;
279
304
  }
280
305
 
@@ -291,15 +316,6 @@ export function connectWithSigner(config, signer, storage_dir) {
291
316
  return ret;
292
317
  }
293
318
 
294
- /**
295
- * @param {ConnectRequest} request
296
- * @returns {Promise<BreezSdk>}
297
- */
298
- export function connect(request) {
299
- const ret = wasm.connect(request);
300
- return ret;
301
- }
302
-
303
319
  function passArray8ToWasm0(arg, malloc) {
304
320
  const ptr = malloc(arg.length * 1, 1) >>> 0;
305
321
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -318,15 +334,15 @@ export function task_worker_entry_point(ptr) {
318
334
  }
319
335
 
320
336
  function __wbg_adapter_64(arg0, arg1) {
321
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4867a1ac48fc7b64(arg0, arg1);
337
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2ac8515d28de5817(arg0, arg1);
322
338
  }
323
339
 
324
340
  function __wbg_adapter_67(arg0, arg1, arg2) {
325
- wasm.closure1081_externref_shim(arg0, arg1, arg2);
341
+ wasm.closure1068_externref_shim(arg0, arg1, arg2);
326
342
  }
327
343
 
328
- function __wbg_adapter_285(arg0, arg1, arg2, arg3) {
329
- wasm.closure666_externref_shim(arg0, arg1, arg2, arg3);
344
+ function __wbg_adapter_301(arg0, arg1, arg2, arg3) {
345
+ wasm.closure651_externref_shim(arg0, arg1, arg2, arg3);
330
346
  }
331
347
 
332
348
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
@@ -381,6 +397,14 @@ export class BreezSdk {
381
397
  const ret = wasm.breezsdk_lnurlAuth(this.__wbg_ptr, request_data);
382
398
  return ret;
383
399
  }
400
+ /**
401
+ * @param {AddContactRequest} request
402
+ * @returns {Promise<Contact>}
403
+ */
404
+ addContact(request) {
405
+ const ret = wasm.breezsdk_addContact(this.__wbg_ptr, request);
406
+ return ret;
407
+ }
384
408
  /**
385
409
  * @param {BuyBitcoinRequest} request
386
410
  * @returns {Promise<BuyBitcoinResponse>}
@@ -437,6 +461,14 @@ export class BreezSdk {
437
461
  const ret = wasm.breezsdk_claimDeposit(this.__wbg_ptr, request);
438
462
  return ret;
439
463
  }
464
+ /**
465
+ * @param {ListContactsRequest} request
466
+ * @returns {Promise<Contact[]>}
467
+ */
468
+ listContacts(request) {
469
+ const ret = wasm.breezsdk_listContacts(this.__wbg_ptr, request);
470
+ return ret;
471
+ }
440
472
  /**
441
473
  * @param {ListPaymentsRequest} request
442
474
  * @returns {Promise<ListPaymentsResponse>}
@@ -445,6 +477,16 @@ export class BreezSdk {
445
477
  const ret = wasm.breezsdk_listPayments(this.__wbg_ptr, request);
446
478
  return ret;
447
479
  }
480
+ /**
481
+ * @param {string} id
482
+ * @returns {Promise<void>}
483
+ */
484
+ deleteContact(id) {
485
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
+ const len0 = WASM_VECTOR_LEN;
487
+ const ret = wasm.breezsdk_deleteContact(this.__wbg_ptr, ptr0, len0);
488
+ return ret;
489
+ }
448
490
  /**
449
491
  * @param {LnurlWithdrawRequest} request
450
492
  * @returns {Promise<LnurlWithdrawResponse>}
@@ -461,6 +503,14 @@ export class BreezSdk {
461
503
  const ret = wasm.breezsdk_refundDeposit(this.__wbg_ptr, request);
462
504
  return ret;
463
505
  }
506
+ /**
507
+ * @param {UpdateContactRequest} request
508
+ * @returns {Promise<Contact>}
509
+ */
510
+ updateContact(request) {
511
+ const ret = wasm.breezsdk_updateContact(this.__wbg_ptr, request);
512
+ return ret;
513
+ }
464
514
  /**
465
515
  * @returns {Promise<ListFiatRatesResponse>}
466
516
  */
@@ -1100,6 +1150,15 @@ export class SdkBuilder {
1100
1150
  const ret = wasm.sdkbuilder_withPaymentObserver(ptr, payment_observer);
1101
1151
  return SdkBuilder.__wrap(ret);
1102
1152
  }
1153
+ /**
1154
+ * @param {PostgresStorageConfig} config
1155
+ * @returns {SdkBuilder}
1156
+ */
1157
+ withPostgresStorage(config) {
1158
+ const ptr = this.__destroy_into_raw();
1159
+ const ret = wasm.sdkbuilder_withPostgresStorage(ptr, config);
1160
+ return SdkBuilder.__wrap(ret);
1161
+ }
1103
1162
  /**
1104
1163
  * @param {string} url
1105
1164
  * @param {ChainApiType} api_type
@@ -1354,6 +1413,11 @@ export function __wbg_createDefaultStorage_458aa01b5eaead27() { return handleErr
1354
1413
  return ret;
1355
1414
  }, arguments) };
1356
1415
 
1416
+ export function __wbg_createPostgresStorage_46770cbf8e947f9e() { return handleError(function (arg0, arg1) {
1417
+ const ret = createPostgresStorage(arg0, arg1);
1418
+ return ret;
1419
+ }, arguments) };
1420
+
1357
1421
  export function __wbg_crypto_574e78ad8b13b65f(arg0) {
1358
1422
  const ret = arg0.crypto;
1359
1423
  return ret;
@@ -1372,6 +1436,19 @@ export function __wbg_deleteCachedItem_ff3c84380e94360b() { return handleError(f
1372
1436
  }
1373
1437
  }, arguments) };
1374
1438
 
1439
+ export function __wbg_deleteContact_04d635b32c469d83() { return handleError(function (arg0, arg1, arg2) {
1440
+ let deferred0_0;
1441
+ let deferred0_1;
1442
+ try {
1443
+ deferred0_0 = arg1;
1444
+ deferred0_1 = arg2;
1445
+ const ret = arg0.deleteContact(getStringFromWasm0(arg1, arg2));
1446
+ return ret;
1447
+ } finally {
1448
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1449
+ }
1450
+ }, arguments) };
1451
+
1375
1452
  export function __wbg_deleteDeposit_72ec826e7c3c3ccf() { return handleError(function (arg0, arg1, arg2, arg3) {
1376
1453
  let deferred0_0;
1377
1454
  let deferred0_1;
@@ -1535,6 +1612,19 @@ export function __wbg_getCachedItem_de40d6348815c7b9() { return handleError(func
1535
1612
  }
1536
1613
  }, arguments) };
1537
1614
 
1615
+ export function __wbg_getContact_b7300737e5dee01b() { return handleError(function (arg0, arg1, arg2) {
1616
+ let deferred0_0;
1617
+ let deferred0_1;
1618
+ try {
1619
+ deferred0_0 = arg1;
1620
+ deferred0_1 = arg2;
1621
+ const ret = arg0.getContact(getStringFromWasm0(arg1, arg2));
1622
+ return ret;
1623
+ } finally {
1624
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1625
+ }
1626
+ }, arguments) };
1627
+
1538
1628
  export function __wbg_getPaymentById_c23144bfc404b2fc() { return handleError(function (arg0, arg1, arg2) {
1539
1629
  let deferred0_0;
1540
1630
  let deferred0_1;
@@ -1700,6 +1790,11 @@ export function __wbg_identityPublicKey_c8b35005055a3df0() { return handleError(
1700
1790
  return ret;
1701
1791
  }, arguments) };
1702
1792
 
1793
+ export function __wbg_insertContact_33c214012213409d() { return handleError(function (arg0, arg1) {
1794
+ const ret = arg0.insertContact(arg1);
1795
+ return ret;
1796
+ }, arguments) };
1797
+
1703
1798
  export function __wbg_insertPaymentMetadata_0c4ebdcde694d29b() { return handleError(function (arg0, arg1, arg2, arg3) {
1704
1799
  let deferred0_0;
1705
1800
  let deferred0_1;
@@ -1820,12 +1915,17 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
1820
1915
  return ret;
1821
1916
  };
1822
1917
 
1918
+ export function __wbg_listContacts_5b4d38a57743b713() { return handleError(function (arg0, arg1) {
1919
+ const ret = arg0.listContacts(arg1);
1920
+ return ret;
1921
+ }, arguments) };
1922
+
1823
1923
  export function __wbg_listDeposits_7ca6e22afc06d560() { return handleError(function (arg0) {
1824
1924
  const ret = arg0.listDeposits();
1825
1925
  return ret;
1826
1926
  }, arguments) };
1827
1927
 
1828
- export function __wbg_listPayments_3b9302bf121fdc4d() { return handleError(function (arg0, arg1) {
1928
+ export function __wbg_listPayments_d8c53ab09ffc756b() { return handleError(function (arg0, arg1) {
1829
1929
  const ret = arg0.listPayments(arg1);
1830
1930
  return ret;
1831
1931
  }, arguments) };
@@ -1877,7 +1977,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1877
1977
  const a = state0.a;
1878
1978
  state0.a = 0;
1879
1979
  try {
1880
- return __wbg_adapter_285(a, state0.b, arg0, arg1);
1980
+ return __wbg_adapter_301(a, state0.b, arg0, arg1);
1881
1981
  } finally {
1882
1982
  state0.a = a;
1883
1983
  }
@@ -2402,13 +2502,13 @@ export function __wbindgen_cb_drop(arg0) {
2402
2502
  return ret;
2403
2503
  };
2404
2504
 
2405
- export function __wbindgen_closure_wrapper11908(arg0, arg1, arg2) {
2406
- const ret = makeMutClosure(arg0, arg1, 844, __wbg_adapter_64);
2505
+ export function __wbindgen_closure_wrapper11838(arg0, arg1, arg2) {
2506
+ const ret = makeMutClosure(arg0, arg1, 828, __wbg_adapter_64);
2407
2507
  return ret;
2408
2508
  };
2409
2509
 
2410
- export function __wbindgen_closure_wrapper13858(arg0, arg1, arg2) {
2411
- const ret = makeMutClosure(arg0, arg1, 1082, __wbg_adapter_67);
2510
+ export function __wbindgen_closure_wrapper13801(arg0, arg1, arg2) {
2511
+ const ret = makeMutClosure(arg0, arg1, 1069, __wbg_adapter_67);
2412
2512
  return ret;
2413
2513
  };
2414
2514
 
@@ -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;