lwk_node 0.17.1 → 0.18.0

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.
package/lwk_wasm.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function searchLedgerDevice(): Promise<HIDDevice>;
4
3
  /**
5
4
  * Convert the given string to a QR code image uri
6
5
  *
@@ -10,6 +9,7 @@ export function searchLedgerDevice(): Promise<HIDDevice>;
10
9
  * for example in html: `style="image-rendering: pixelated; border: 20px solid white;"`
11
10
  */
12
11
  export function stringToQr(str: string, pixel_per_module?: number | null): string;
12
+ export function searchLedgerDevice(): Promise<HIDDevice>;
13
13
  /**
14
14
  * Wallet chain
15
15
  */
@@ -286,6 +286,14 @@ export class Amp2Descriptor {
286
286
  * Return the string representation of the descriptor.
287
287
  */
288
288
  toString(): string;
289
+ /**
290
+ * Create an `Amp2Descriptor` using any `WolletDescriptor`
291
+ *
292
+ * Warning: AMP2 server only supports a limited subset of descriptors.
293
+ * To make sure this AMP2 descriptor can be used safely,
294
+ * register this with AMP2 as soon as possible.
295
+ */
296
+ static newWithCustomDescriptor(desc: WolletDescriptor): Amp2Descriptor;
289
297
  }
290
298
  /**
291
299
  * An asset identifier and an amount in satoshi units
@@ -411,7 +419,7 @@ export class Balance {
411
419
  */
412
420
  toJSON(): any;
413
421
  /**
414
- * Returns the balance as an array of [key, value] pairs.
422
+ * Returns the balance as a JavaScript `Map` of asset id to amount.
415
423
  */
416
424
  entries(): any;
417
425
  /**
@@ -458,6 +466,10 @@ export class BoltzSession {
458
466
  * Prepare a lightning invoice payment
459
467
  */
460
468
  preparePay(lightning_payment: LightningPayment, refund_address: Address): Promise<PreparePayResponse>;
469
+ /**
470
+ * Fetch a BOLT12 invoice without creating or starting a swap
471
+ */
472
+ fetchBolt12Invoice(lightning_payment: LightningPayment): Promise<Invoice>;
461
473
  /**
462
474
  * Create a lightning invoice for receiving payment
463
475
  */
@@ -522,6 +534,18 @@ export class BoltzSessionBuilder {
522
534
  * Set the referral id for the BoltzSession
523
535
  */
524
536
  referralId(referral_id: string): BoltzSessionBuilder;
537
+ /**
538
+ * Set the Boltz API base URL
539
+ *
540
+ * The caller is responsible for ensuring the provider behind this URL matches the session
541
+ * network passed to the builder.
542
+ *
543
+ * If this is used together with a persistent store on the Rust side, the caller must use a
544
+ * different store per provider. Persisted swap data is not namespaced by provider, so
545
+ * reusing the same store across different `apiUrl` values can mix swaps from different
546
+ * providers.
547
+ */
548
+ apiUrl(api_url: string): BoltzSessionBuilder;
525
549
  /**
526
550
  * Set the url of the bitcoin electrum client
527
551
  */
@@ -684,6 +708,59 @@ export class ExternalUtxo {
684
708
  */
685
709
  constructor(vout: number, tx: Transaction, unblinded: TxOutSecrets, max_weight_to_satisfy: number, is_segwit: boolean);
686
710
  }
711
+ /**
712
+ * The total fee paid by the transaction for each asset type.
713
+ */
714
+ export class Fees {
715
+ private constructor();
716
+ free(): void;
717
+ [Symbol.dispose](): void;
718
+ /**
719
+ * Returns the fees as a JavaScript `Map` of asset id to amount.
720
+ */
721
+ entries(): any;
722
+ /**
723
+ * Note: the amounts are strings since `JSON.stringify` cannot handle `BigInt`s.
724
+ * Use `entries()` to get the raw data.
725
+ */
726
+ toJSON(): any;
727
+ /**
728
+ * Return the string representation of the fee.
729
+ */
730
+ toString(): string;
731
+ }
732
+ /**
733
+ * Wrapper over [`lwk_boltz::Invoice`]
734
+ */
735
+ export class Invoice {
736
+ private constructor();
737
+ free(): void;
738
+ [Symbol.dispose](): void;
739
+ /**
740
+ * Return a string representation of the invoice
741
+ */
742
+ toString(): string;
743
+ /**
744
+ * Return the invoice amount in whole satoshis
745
+ */
746
+ amountSats(): bigint;
747
+ /**
748
+ * Return true if this is a BOLT11 invoice
749
+ */
750
+ isBolt11(): boolean;
751
+ /**
752
+ * Return true if this is a BOLT12 invoice
753
+ */
754
+ isBolt12(): boolean;
755
+ /**
756
+ * Return the BOLT11 invoice string if this is a BOLT11 invoice
757
+ */
758
+ bolt11Invoice(): string | undefined;
759
+ /**
760
+ * Return the BOLT12 invoice string if this is a BOLT12 invoice
761
+ */
762
+ bolt12Invoice(): string | undefined;
763
+ }
687
764
  /**
688
765
  * Wrapper over [`lwk_boltz::InvoiceResponse`]
689
766
  */
@@ -1239,7 +1316,22 @@ export class PsetBalance {
1239
1316
  private constructor();
1240
1317
  free(): void;
1241
1318
  [Symbol.dispose](): void;
1319
+ /**
1320
+ * Fee paid by this transaction.
1321
+ *
1322
+ * Warning: if there are multiple assets paying fees this function can return an incorrect value.
1323
+ *
1324
+ * Deprecated: use `feesIn(assetId)` or `fees()` instead.
1325
+ */
1242
1326
  fee(): bigint;
1327
+ /**
1328
+ * Fees paid by this transaction.
1329
+ */
1330
+ fees(): Fees;
1331
+ /**
1332
+ * The amount of fee with given asset id
1333
+ */
1334
+ feesIn(asset: AssetId): bigint;
1243
1335
  /**
1244
1336
  * The net balance for every asset with respect of the wallet asking the pset details
1245
1337
  */
@@ -1772,6 +1864,10 @@ export class TxDetails {
1772
1864
  * Net balance from the `Wollet` perspective
1773
1865
  */
1774
1866
  balance(): Balance;
1867
+ /**
1868
+ * Fees paid by this transaction.
1869
+ */
1870
+ fees(): Fees;
1775
1871
  /**
1776
1872
  * Asset fees
1777
1873
  */
@@ -2112,22 +2208,6 @@ export class WalletTxOut {
2112
2208
  export class Wollet {
2113
2209
  free(): void;
2114
2210
  [Symbol.dispose](): void;
2115
- /**
2116
- * Get the transaction list
2117
- *
2118
- * **Experimental**: This API may change without notice.
2119
- */
2120
- txs(opt: TxsOpt): TxDetails[];
2121
- /**
2122
- * Number of transactions
2123
- */
2124
- numTxs(): number;
2125
- /**
2126
- * Get the details of a transaction
2127
- *
2128
- * **Experimental**: This API may change without notice.
2129
- */
2130
- txDetails(txid: Txid, opt: TxOpt): TxDetails | undefined;
2131
2211
  /**
2132
2212
  * Create a `Wollet`
2133
2213
  */
@@ -2242,6 +2322,22 @@ export class Wollet {
2242
2322
  * Whether the wallet is AMP0
2243
2323
  */
2244
2324
  isAmp0(): boolean;
2325
+ /**
2326
+ * Get the transaction list
2327
+ *
2328
+ * **Experimental**: This API may change without notice.
2329
+ */
2330
+ txs(opt: TxsOpt): TxDetails[];
2331
+ /**
2332
+ * Number of transactions
2333
+ */
2334
+ numTxs(): number;
2335
+ /**
2336
+ * Get the details of a transaction
2337
+ *
2338
+ * **Experimental**: This API may change without notice.
2339
+ */
2340
+ txDetails(txid: Txid, opt: TxOpt): TxDetails | undefined;
2245
2341
  }
2246
2342
  /**
2247
2343
  * A builder for constructing [`Wollet`] instances.
package/lwk_wasm.js CHANGED
@@ -228,13 +228,16 @@ function takeFromExternrefTable0(idx) {
228
228
  wasm.__externref_table_dealloc(idx);
229
229
  return value;
230
230
  }
231
- /**
232
- * @returns {Promise<HIDDevice>}
233
- */
234
- exports.searchLedgerDevice = function() {
235
- const ret = wasm.searchLedgerDevice();
236
- return ret;
237
- };
231
+
232
+ function passArrayJsValueToWasm0(array, malloc) {
233
+ const ptr = malloc(array.length * 4, 4) >>> 0;
234
+ for (let i = 0; i < array.length; i++) {
235
+ const add = addToExternrefTable0(array[i]);
236
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
237
+ }
238
+ WASM_VECTOR_LEN = array.length;
239
+ return ptr;
240
+ }
238
241
 
239
242
  function getArrayJsValueFromWasm0(ptr, len) {
240
243
  ptr = ptr >>> 0;
@@ -256,11 +259,9 @@ function getUint32ArrayMemory0() {
256
259
  return cachedUint32ArrayMemory0;
257
260
  }
258
261
 
259
- function passArray32ToWasm0(arg, malloc) {
260
- const ptr = malloc(arg.length * 4, 4) >>> 0;
261
- getUint32ArrayMemory0().set(arg, ptr / 4);
262
- WASM_VECTOR_LEN = arg.length;
263
- return ptr;
262
+ function getArrayU32FromWasm0(ptr, len) {
263
+ ptr = ptr >>> 0;
264
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
264
265
  }
265
266
  /**
266
267
  * Convert the given string to a QR code image uri
@@ -294,42 +295,42 @@ exports.stringToQr = function(str, pixel_per_module) {
294
295
  }
295
296
  };
296
297
 
297
- function passArrayJsValueToWasm0(array, malloc) {
298
- const ptr = malloc(array.length * 4, 4) >>> 0;
299
- for (let i = 0; i < array.length; i++) {
300
- const add = addToExternrefTable0(array[i]);
301
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
302
- }
303
- WASM_VECTOR_LEN = array.length;
298
+ function passArray32ToWasm0(arg, malloc) {
299
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
300
+ getUint32ArrayMemory0().set(arg, ptr / 4);
301
+ WASM_VECTOR_LEN = arg.length;
304
302
  return ptr;
305
303
  }
304
+ /**
305
+ * @returns {Promise<HIDDevice>}
306
+ */
307
+ exports.searchLedgerDevice = function() {
308
+ const ret = wasm.searchLedgerDevice();
309
+ return ret;
310
+ };
306
311
 
307
- function getArrayU32FromWasm0(ptr, len) {
308
- ptr = ptr >>> 0;
309
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
310
- }
311
312
  function __wbg_adapter_6(arg0, arg1, arg2) {
312
- wasm.closure1312_externref_shim(arg0, arg1, arg2);
313
+ wasm.closure749_externref_shim(arg0, arg1, arg2);
313
314
  }
314
315
 
315
- function __wbg_adapter_9(arg0, arg1) {
316
- wasm.wasm_bindgen__convert__closures_____invoke__h94f351489121fb87(arg0, arg1);
316
+ function __wbg_adapter_11(arg0, arg1, arg2) {
317
+ wasm.closure1290_externref_shim(arg0, arg1, arg2);
317
318
  }
318
319
 
319
- function __wbg_adapter_12(arg0, arg1, arg2) {
320
- wasm.closure465_externref_shim(arg0, arg1, arg2);
320
+ function __wbg_adapter_18(arg0, arg1) {
321
+ wasm.wasm_bindgen__convert__closures_____invoke__hd7369d44ef864bc9(arg0, arg1);
321
322
  }
322
323
 
323
- function __wbg_adapter_15(arg0, arg1, arg2) {
324
- wasm.closure2091_externref_shim(arg0, arg1, arg2);
324
+ function __wbg_adapter_27(arg0, arg1, arg2) {
325
+ wasm.closure2146_externref_shim(arg0, arg1, arg2);
325
326
  }
326
327
 
327
- function __wbg_adapter_28(arg0, arg1) {
328
- wasm.wasm_bindgen__convert__closures_____invoke__h912986096667d3cb(arg0, arg1);
328
+ function __wbg_adapter_32(arg0, arg1) {
329
+ wasm.wasm_bindgen__convert__closures_____invoke__ha062033b5f676b2f(arg0, arg1);
329
330
  }
330
331
 
331
- function __wbg_adapter_736(arg0, arg1, arg2, arg3) {
332
- wasm.closure2878_externref_shim(arg0, arg1, arg2, arg3);
332
+ function __wbg_adapter_753(arg0, arg1, arg2, arg3) {
333
+ wasm.closure2942_externref_shim(arg0, arg1, arg2, arg3);
333
334
  }
334
335
 
335
336
  /**
@@ -1157,6 +1158,20 @@ class Amp2Descriptor {
1157
1158
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1158
1159
  }
1159
1160
  }
1161
+ /**
1162
+ * Create an `Amp2Descriptor` using any `WolletDescriptor`
1163
+ *
1164
+ * Warning: AMP2 server only supports a limited subset of descriptors.
1165
+ * To make sure this AMP2 descriptor can be used safely,
1166
+ * register this with AMP2 as soon as possible.
1167
+ * @param {WolletDescriptor} desc
1168
+ * @returns {Amp2Descriptor}
1169
+ */
1170
+ static newWithCustomDescriptor(desc) {
1171
+ _assertClass(desc, WolletDescriptor);
1172
+ const ret = wasm.amp2descriptor_newWithCustomDescriptor(desc.__wbg_ptr);
1173
+ return Amp2Descriptor.__wrap(ret);
1174
+ }
1160
1175
  }
1161
1176
  if (Symbol.dispose) Amp2Descriptor.prototype[Symbol.dispose] = Amp2Descriptor.prototype.free;
1162
1177
 
@@ -1564,7 +1579,7 @@ class Balance {
1564
1579
  return takeFromExternrefTable0(ret[0]);
1565
1580
  }
1566
1581
  /**
1567
- * Returns the balance as an array of [key, value] pairs.
1582
+ * Returns the balance as a JavaScript `Map` of asset id to amount.
1568
1583
  * @returns {any}
1569
1584
  */
1570
1585
  entries() {
@@ -1728,6 +1743,16 @@ class BoltzSession {
1728
1743
  const ret = wasm.boltzsession_preparePay(this.__wbg_ptr, lightning_payment.__wbg_ptr, refund_address.__wbg_ptr);
1729
1744
  return ret;
1730
1745
  }
1746
+ /**
1747
+ * Fetch a BOLT12 invoice without creating or starting a swap
1748
+ * @param {LightningPayment} lightning_payment
1749
+ * @returns {Promise<Invoice>}
1750
+ */
1751
+ fetchBolt12Invoice(lightning_payment) {
1752
+ _assertClass(lightning_payment, LightningPayment);
1753
+ const ret = wasm.boltzsession_fetchBolt12Invoice(this.__wbg_ptr, lightning_payment.__wbg_ptr);
1754
+ return ret;
1755
+ }
1731
1756
  /**
1732
1757
  * Create a lightning invoice for receiving payment
1733
1758
  * @param {bigint} amount
@@ -1892,6 +1917,26 @@ class BoltzSessionBuilder {
1892
1917
  const ret = wasm.boltzsessionbuilder_referralId(ptr, ptr0, len0);
1893
1918
  return BoltzSessionBuilder.__wrap(ret);
1894
1919
  }
1920
+ /**
1921
+ * Set the Boltz API base URL
1922
+ *
1923
+ * The caller is responsible for ensuring the provider behind this URL matches the session
1924
+ * network passed to the builder.
1925
+ *
1926
+ * If this is used together with a persistent store on the Rust side, the caller must use a
1927
+ * different store per provider. Persisted swap data is not namespaced by provider, so
1928
+ * reusing the same store across different `apiUrl` values can mix swaps from different
1929
+ * providers.
1930
+ * @param {string} api_url
1931
+ * @returns {BoltzSessionBuilder}
1932
+ */
1933
+ apiUrl(api_url) {
1934
+ const ptr = this.__destroy_into_raw();
1935
+ const ptr0 = passStringToWasm0(api_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1936
+ const len0 = WASM_VECTOR_LEN;
1937
+ const ret = wasm.boltzsessionbuilder_apiUrl(ptr, ptr0, len0);
1938
+ return BoltzSessionBuilder.__wrap(ret);
1939
+ }
1895
1940
  /**
1896
1941
  * Set the url of the bitcoin electrum client
1897
1942
  * @param {string} bitcoin_electrum_client
@@ -2396,6 +2441,178 @@ if (Symbol.dispose) ExternalUtxo.prototype[Symbol.dispose] = ExternalUtxo.protot
2396
2441
 
2397
2442
  exports.ExternalUtxo = ExternalUtxo;
2398
2443
 
2444
+ const FeesFinalization = (typeof FinalizationRegistry === 'undefined')
2445
+ ? { register: () => {}, unregister: () => {} }
2446
+ : new FinalizationRegistry(ptr => wasm.__wbg_fees_free(ptr >>> 0, 1));
2447
+ /**
2448
+ * The total fee paid by the transaction for each asset type.
2449
+ */
2450
+ class Fees {
2451
+
2452
+ static __wrap(ptr) {
2453
+ ptr = ptr >>> 0;
2454
+ const obj = Object.create(Fees.prototype);
2455
+ obj.__wbg_ptr = ptr;
2456
+ FeesFinalization.register(obj, obj.__wbg_ptr, obj);
2457
+ return obj;
2458
+ }
2459
+
2460
+ __destroy_into_raw() {
2461
+ const ptr = this.__wbg_ptr;
2462
+ this.__wbg_ptr = 0;
2463
+ FeesFinalization.unregister(this);
2464
+ return ptr;
2465
+ }
2466
+
2467
+ free() {
2468
+ const ptr = this.__destroy_into_raw();
2469
+ wasm.__wbg_fees_free(ptr, 0);
2470
+ }
2471
+ /**
2472
+ * Returns the fees as a JavaScript `Map` of asset id to amount.
2473
+ * @returns {any}
2474
+ */
2475
+ entries() {
2476
+ const ret = wasm.fees_entries(this.__wbg_ptr);
2477
+ if (ret[2]) {
2478
+ throw takeFromExternrefTable0(ret[1]);
2479
+ }
2480
+ return takeFromExternrefTable0(ret[0]);
2481
+ }
2482
+ /**
2483
+ * Note: the amounts are strings since `JSON.stringify` cannot handle `BigInt`s.
2484
+ * Use `entries()` to get the raw data.
2485
+ * @returns {any}
2486
+ */
2487
+ toJSON() {
2488
+ const ret = wasm.fees_toJSON(this.__wbg_ptr);
2489
+ if (ret[2]) {
2490
+ throw takeFromExternrefTable0(ret[1]);
2491
+ }
2492
+ return takeFromExternrefTable0(ret[0]);
2493
+ }
2494
+ /**
2495
+ * Return the string representation of the fee.
2496
+ * @returns {string}
2497
+ */
2498
+ toString() {
2499
+ let deferred1_0;
2500
+ let deferred1_1;
2501
+ try {
2502
+ const ret = wasm.fees_toString(this.__wbg_ptr);
2503
+ deferred1_0 = ret[0];
2504
+ deferred1_1 = ret[1];
2505
+ return getStringFromWasm0(ret[0], ret[1]);
2506
+ } finally {
2507
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2508
+ }
2509
+ }
2510
+ }
2511
+ if (Symbol.dispose) Fees.prototype[Symbol.dispose] = Fees.prototype.free;
2512
+
2513
+ exports.Fees = Fees;
2514
+
2515
+ const InvoiceFinalization = (typeof FinalizationRegistry === 'undefined')
2516
+ ? { register: () => {}, unregister: () => {} }
2517
+ : new FinalizationRegistry(ptr => wasm.__wbg_invoice_free(ptr >>> 0, 1));
2518
+ /**
2519
+ * Wrapper over [`lwk_boltz::Invoice`]
2520
+ */
2521
+ class Invoice {
2522
+
2523
+ static __wrap(ptr) {
2524
+ ptr = ptr >>> 0;
2525
+ const obj = Object.create(Invoice.prototype);
2526
+ obj.__wbg_ptr = ptr;
2527
+ InvoiceFinalization.register(obj, obj.__wbg_ptr, obj);
2528
+ return obj;
2529
+ }
2530
+
2531
+ __destroy_into_raw() {
2532
+ const ptr = this.__wbg_ptr;
2533
+ this.__wbg_ptr = 0;
2534
+ InvoiceFinalization.unregister(this);
2535
+ return ptr;
2536
+ }
2537
+
2538
+ free() {
2539
+ const ptr = this.__destroy_into_raw();
2540
+ wasm.__wbg_invoice_free(ptr, 0);
2541
+ }
2542
+ /**
2543
+ * Return a string representation of the invoice
2544
+ * @returns {string}
2545
+ */
2546
+ toString() {
2547
+ let deferred1_0;
2548
+ let deferred1_1;
2549
+ try {
2550
+ const ret = wasm.invoice_toString(this.__wbg_ptr);
2551
+ deferred1_0 = ret[0];
2552
+ deferred1_1 = ret[1];
2553
+ return getStringFromWasm0(ret[0], ret[1]);
2554
+ } finally {
2555
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2556
+ }
2557
+ }
2558
+ /**
2559
+ * Return the invoice amount in whole satoshis
2560
+ * @returns {bigint}
2561
+ */
2562
+ amountSats() {
2563
+ const ret = wasm.invoice_amountSats(this.__wbg_ptr);
2564
+ if (ret[2]) {
2565
+ throw takeFromExternrefTable0(ret[1]);
2566
+ }
2567
+ return BigInt.asUintN(64, ret[0]);
2568
+ }
2569
+ /**
2570
+ * Return true if this is a BOLT11 invoice
2571
+ * @returns {boolean}
2572
+ */
2573
+ isBolt11() {
2574
+ const ret = wasm.invoice_isBolt11(this.__wbg_ptr);
2575
+ return ret !== 0;
2576
+ }
2577
+ /**
2578
+ * Return true if this is a BOLT12 invoice
2579
+ * @returns {boolean}
2580
+ */
2581
+ isBolt12() {
2582
+ const ret = wasm.invoice_isBolt12(this.__wbg_ptr);
2583
+ return ret !== 0;
2584
+ }
2585
+ /**
2586
+ * Return the BOLT11 invoice string if this is a BOLT11 invoice
2587
+ * @returns {string | undefined}
2588
+ */
2589
+ bolt11Invoice() {
2590
+ const ret = wasm.invoice_bolt11Invoice(this.__wbg_ptr);
2591
+ let v1;
2592
+ if (ret[0] !== 0) {
2593
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2594
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2595
+ }
2596
+ return v1;
2597
+ }
2598
+ /**
2599
+ * Return the BOLT12 invoice string if this is a BOLT12 invoice
2600
+ * @returns {string | undefined}
2601
+ */
2602
+ bolt12Invoice() {
2603
+ const ret = wasm.invoice_bolt12Invoice(this.__wbg_ptr);
2604
+ let v1;
2605
+ if (ret[0] !== 0) {
2606
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2607
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2608
+ }
2609
+ return v1;
2610
+ }
2611
+ }
2612
+ if (Symbol.dispose) Invoice.prototype[Symbol.dispose] = Invoice.prototype.free;
2613
+
2614
+ exports.Invoice = Invoice;
2615
+
2399
2616
  const InvoiceResponseFinalization = (typeof FinalizationRegistry === 'undefined')
2400
2617
  ? { register: () => {}, unregister: () => {} }
2401
2618
  : new FinalizationRegistry(ptr => wasm.__wbg_invoiceresponse_free(ptr >>> 0, 1));
@@ -4307,12 +4524,36 @@ class PsetBalance {
4307
4524
  wasm.__wbg_psetbalance_free(ptr, 0);
4308
4525
  }
4309
4526
  /**
4527
+ * Fee paid by this transaction.
4528
+ *
4529
+ * Warning: if there are multiple assets paying fees this function can return an incorrect value.
4530
+ *
4531
+ * Deprecated: use `feesIn(assetId)` or `fees()` instead.
4310
4532
  * @returns {bigint}
4311
4533
  */
4312
4534
  fee() {
4313
4535
  const ret = wasm.psetbalance_fee(this.__wbg_ptr);
4314
4536
  return BigInt.asUintN(64, ret);
4315
4537
  }
4538
+ /**
4539
+ * Fees paid by this transaction.
4540
+ * @returns {Fees}
4541
+ */
4542
+ fees() {
4543
+ const ret = wasm.psetbalance_fees(this.__wbg_ptr);
4544
+ return Fees.__wrap(ret);
4545
+ }
4546
+ /**
4547
+ * The amount of fee with given asset id
4548
+ * @param {AssetId} asset
4549
+ * @returns {bigint}
4550
+ */
4551
+ feesIn(asset) {
4552
+ _assertClass(asset, AssetId);
4553
+ var ptr0 = asset.__destroy_into_raw();
4554
+ const ret = wasm.psetbalance_feesIn(this.__wbg_ptr, ptr0);
4555
+ return BigInt.asUintN(64, ret);
4556
+ }
4316
4557
  /**
4317
4558
  * The net balance for every asset with respect of the wallet asking the pset details
4318
4559
  * @returns {Balance}
@@ -6022,6 +6263,14 @@ class TxDetails {
6022
6263
  const ret = wasm.txdetails_balance(this.__wbg_ptr);
6023
6264
  return Balance.__wrap(ret);
6024
6265
  }
6266
+ /**
6267
+ * Fees paid by this transaction.
6268
+ * @returns {Fees}
6269
+ */
6270
+ fees() {
6271
+ const ret = wasm.txdetails_fees(this.__wbg_ptr);
6272
+ return Fees.__wrap(ret);
6273
+ }
6025
6274
  /**
6026
6275
  * Asset fees
6027
6276
  * @param {AssetId} asset
@@ -7095,51 +7344,6 @@ class Wollet {
7095
7344
  const ptr = this.__destroy_into_raw();
7096
7345
  wasm.__wbg_wollet_free(ptr, 0);
7097
7346
  }
7098
- /**
7099
- * Get the transaction list
7100
- *
7101
- * **Experimental**: This API may change without notice.
7102
- * @param {TxsOpt} opt
7103
- * @returns {TxDetails[]}
7104
- */
7105
- txs(opt) {
7106
- _assertClass(opt, TxsOpt);
7107
- const ret = wasm.wollet_txs(this.__wbg_ptr, opt.__wbg_ptr);
7108
- if (ret[3]) {
7109
- throw takeFromExternrefTable0(ret[2]);
7110
- }
7111
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
7112
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
7113
- return v1;
7114
- }
7115
- /**
7116
- * Number of transactions
7117
- * @returns {number}
7118
- */
7119
- numTxs() {
7120
- const ret = wasm.wollet_numTxs(this.__wbg_ptr);
7121
- if (ret[2]) {
7122
- throw takeFromExternrefTable0(ret[1]);
7123
- }
7124
- return ret[0] >>> 0;
7125
- }
7126
- /**
7127
- * Get the details of a transaction
7128
- *
7129
- * **Experimental**: This API may change without notice.
7130
- * @param {Txid} txid
7131
- * @param {TxOpt} opt
7132
- * @returns {TxDetails | undefined}
7133
- */
7134
- txDetails(txid, opt) {
7135
- _assertClass(txid, Txid);
7136
- _assertClass(opt, TxOpt);
7137
- const ret = wasm.wollet_txDetails(this.__wbg_ptr, txid.__wbg_ptr, opt.__wbg_ptr);
7138
- if (ret[2]) {
7139
- throw takeFromExternrefTable0(ret[1]);
7140
- }
7141
- return ret[0] === 0 ? undefined : TxDetails.__wrap(ret[0]);
7142
- }
7143
7347
  /**
7144
7348
  * Create a `Wollet`
7145
7349
  * @param {Network} network
@@ -7412,6 +7616,51 @@ class Wollet {
7412
7616
  const ret = wasm.wollet_isAmp0(this.__wbg_ptr);
7413
7617
  return ret !== 0;
7414
7618
  }
7619
+ /**
7620
+ * Get the transaction list
7621
+ *
7622
+ * **Experimental**: This API may change without notice.
7623
+ * @param {TxsOpt} opt
7624
+ * @returns {TxDetails[]}
7625
+ */
7626
+ txs(opt) {
7627
+ _assertClass(opt, TxsOpt);
7628
+ const ret = wasm.wollet_txs(this.__wbg_ptr, opt.__wbg_ptr);
7629
+ if (ret[3]) {
7630
+ throw takeFromExternrefTable0(ret[2]);
7631
+ }
7632
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
7633
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
7634
+ return v1;
7635
+ }
7636
+ /**
7637
+ * Number of transactions
7638
+ * @returns {number}
7639
+ */
7640
+ numTxs() {
7641
+ const ret = wasm.wollet_numTxs(this.__wbg_ptr);
7642
+ if (ret[2]) {
7643
+ throw takeFromExternrefTable0(ret[1]);
7644
+ }
7645
+ return ret[0] >>> 0;
7646
+ }
7647
+ /**
7648
+ * Get the details of a transaction
7649
+ *
7650
+ * **Experimental**: This API may change without notice.
7651
+ * @param {Txid} txid
7652
+ * @param {TxOpt} opt
7653
+ * @returns {TxDetails | undefined}
7654
+ */
7655
+ txDetails(txid, opt) {
7656
+ _assertClass(txid, Txid);
7657
+ _assertClass(opt, TxOpt);
7658
+ const ret = wasm.wollet_txDetails(this.__wbg_ptr, txid.__wbg_ptr, opt.__wbg_ptr);
7659
+ if (ret[2]) {
7660
+ throw takeFromExternrefTable0(ret[1]);
7661
+ }
7662
+ return ret[0] === 0 ? undefined : TxDetails.__wrap(ret[0]);
7663
+ }
7415
7664
  }
7416
7665
  if (Symbol.dispose) Wollet.prototype[Symbol.dispose] = Wollet.prototype.free;
7417
7666
 
@@ -7934,12 +8183,7 @@ exports.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
7934
8183
  return ret;
7935
8184
  };
7936
8185
 
7937
- exports.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
7938
- const ret = Reflect.get(arg0, arg1);
7939
- return ret;
7940
- }, arguments) };
7941
-
7942
- exports.__wbg_get_ea60a3bcdaa2b333 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
8186
+ exports.__wbg_get_2bb361e6f1bdde50 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
7943
8187
  const ret = arg1.get(getStringFromWasm0(arg2, arg3));
7944
8188
  var ptr1 = isLikeNone(ret) ? 0 : passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
7945
8189
  var len1 = WASM_VECTOR_LEN;
@@ -7947,6 +8191,11 @@ exports.__wbg_get_ea60a3bcdaa2b333 = function() { return handleError(function (a
7947
8191
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
7948
8192
  }, arguments) };
7949
8193
 
8194
+ exports.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
8195
+ const ret = Reflect.get(arg0, arg1);
8196
+ return ret;
8197
+ }, arguments) };
8198
+
7950
8199
  exports.__wbg_has_b89e451f638123e3 = function() { return handleError(function (arg0, arg1) {
7951
8200
  const ret = Reflect.has(arg0, arg1);
7952
8201
  return ret;
@@ -8028,6 +8277,11 @@ exports.__wbg_instanceof_Window_12d20d558ef92592 = function(arg0) {
8028
8277
  return ret;
8029
8278
  };
8030
8279
 
8280
+ exports.__wbg_invoice_new = function(arg0) {
8281
+ const ret = Invoice.__wrap(arg0);
8282
+ return ret;
8283
+ };
8284
+
8031
8285
  exports.__wbg_invoiceresponse_new = function(arg0) {
8032
8286
  const ret = InvoiceResponse.__wrap(arg0);
8033
8287
  return ret;
@@ -8038,7 +8292,7 @@ exports.__wbg_isArray_030cce220591fb41 = function(arg0) {
8038
8292
  return ret;
8039
8293
  };
8040
8294
 
8041
- exports.__wbg_isPersisted_a0739c119cc2a965 = function() { return handleError(function (arg0) {
8295
+ exports.__wbg_isPersisted_354c6f4a4e0f19cb = function() { return handleError(function (arg0) {
8042
8296
  const ret = arg0.isPersisted();
8043
8297
  return ret;
8044
8298
  }, arguments) };
@@ -8078,7 +8332,7 @@ exports.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
8078
8332
  return ret;
8079
8333
  };
8080
8334
 
8081
- exports.__wbg_log_f2e572499b94f3fc = function(arg0, arg1) {
8335
+ exports.__wbg_log_0bf9a59e21c21d51 = function(arg0, arg1) {
8082
8336
  console.log(getStringFromWasm0(arg0, arg1));
8083
8337
  };
8084
8338
 
@@ -8114,7 +8368,7 @@ exports.__wbg_new_2e3c58a15f39f5f9 = function(arg0, arg1) {
8114
8368
  const a = state0.a;
8115
8369
  state0.a = 0;
8116
8370
  try {
8117
- return __wbg_adapter_736(a, state0.b, arg0, arg1);
8371
+ return __wbg_adapter_753(a, state0.b, arg0, arg1);
8118
8372
  } finally {
8119
8373
  state0.a = a;
8120
8374
  }
@@ -8285,7 +8539,7 @@ exports.__wbg_push_330b2eb93e4e1212 = function(arg0, arg1) {
8285
8539
  return ret;
8286
8540
  };
8287
8541
 
8288
- exports.__wbg_put_e16c8bb664081030 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
8542
+ exports.__wbg_put_9fbd837e976dd910 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
8289
8543
  arg0.put(getStringFromWasm0(arg1, arg2), getArrayU8FromWasm0(arg3, arg4));
8290
8544
  }, arguments) };
8291
8545
 
@@ -8335,7 +8589,7 @@ exports.__wbg_registry_new = function(arg0) {
8335
8589
  return ret;
8336
8590
  };
8337
8591
 
8338
- exports.__wbg_remove_2f18c0eff31e188a = function() { return handleError(function (arg0, arg1, arg2) {
8592
+ exports.__wbg_remove_a94bdea90b3fa4b7 = function() { return handleError(function (arg0, arg1, arg2) {
8339
8593
  arg0.remove(getStringFromWasm0(arg1, arg2));
8340
8594
  }, arguments) };
8341
8595
 
@@ -8676,27 +8930,27 @@ exports.__wbg_xpub_new = function(arg0) {
8676
8930
  return ret;
8677
8931
  };
8678
8932
 
8679
- exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
8680
- // Cast intrinsic for `Ref(String) -> Externref`.
8681
- const ret = getStringFromWasm0(arg0, arg1);
8933
+ exports.__wbindgen_cast_10433792c4de85b6 = function(arg0, arg1) {
8934
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2097, function: Function { arguments: [], shim_idx: 2098, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8935
+ const ret = makeMutClosure(arg0, arg1, 2097, __wbg_adapter_18);
8682
8936
  return ret;
8683
8937
  };
8684
8938
 
8685
- exports.__wbindgen_cast_392cad8582d6e5e7 = function(arg0, arg1) {
8686
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1231, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8687
- const ret = makeMutClosure(arg0, arg1, 1231, __wbg_adapter_6);
8939
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
8940
+ // Cast intrinsic for `Ref(String) -> Externref`.
8941
+ const ret = getStringFromWasm0(arg0, arg1);
8688
8942
  return ret;
8689
8943
  };
8690
8944
 
8691
- exports.__wbindgen_cast_39f378bbfc1f694f = function(arg0, arg1) {
8692
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1231, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8693
- const ret = makeMutClosure(arg0, arg1, 1231, __wbg_adapter_6);
8945
+ exports.__wbindgen_cast_2406b334705670ec = function(arg0, arg1) {
8946
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1289, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1290, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8947
+ const ret = makeMutClosure(arg0, arg1, 1289, __wbg_adapter_11);
8694
8948
  return ret;
8695
8949
  };
8696
8950
 
8697
- exports.__wbindgen_cast_3ec117c47760f617 = function(arg0, arg1) {
8698
- // Cast intrinsic for `Closure(Closure { dtor_idx: 464, function: Function { arguments: [NamedExternref("HIDInputReportEvent")], shim_idx: 465, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8699
- const ret = makeMutClosure(arg0, arg1, 464, __wbg_adapter_12);
8951
+ exports.__wbindgen_cast_430e53ba7781a4ba = function(arg0, arg1) {
8952
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1289, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1290, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8953
+ const ret = makeMutClosure(arg0, arg1, 1289, __wbg_adapter_11);
8700
8954
  return ret;
8701
8955
  };
8702
8956
 
@@ -8706,33 +8960,39 @@ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
8706
8960
  return ret;
8707
8961
  };
8708
8962
 
8709
- exports.__wbindgen_cast_64e682fa407cc89a = function(arg0, arg1) {
8710
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1524, function: Function { arguments: [], shim_idx: 1525, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8711
- const ret = makeMutClosure(arg0, arg1, 1524, __wbg_adapter_28);
8963
+ exports.__wbindgen_cast_7bdf3d0e751324a8 = function(arg0, arg1) {
8964
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2135, function: Function { arguments: [Externref], shim_idx: 2146, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8965
+ const ret = makeMutClosure(arg0, arg1, 2135, __wbg_adapter_27);
8966
+ return ret;
8967
+ };
8968
+
8969
+ exports.__wbindgen_cast_7d42252357483c45 = function(arg0, arg1) {
8970
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1289, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1290, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8971
+ const ret = makeMutClosure(arg0, arg1, 1289, __wbg_adapter_11);
8712
8972
  return ret;
8713
8973
  };
8714
8974
 
8715
- exports.__wbindgen_cast_6a4a8b8a96ccc6bc = function(arg0, arg1) {
8716
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1231, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8717
- const ret = makeMutClosure(arg0, arg1, 1231, __wbg_adapter_6);
8975
+ exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
8976
+ // Cast intrinsic for `I64 -> Externref`.
8977
+ const ret = arg0;
8718
8978
  return ret;
8719
8979
  };
8720
8980
 
8721
- exports.__wbindgen_cast_93bc83e3a76266b4 = function(arg0, arg1) {
8722
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1231, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8723
- const ret = makeMutClosure(arg0, arg1, 1231, __wbg_adapter_6);
8981
+ exports.__wbindgen_cast_ae6191adf0494af7 = function(arg0, arg1) {
8982
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1289, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1290, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8983
+ const ret = makeMutClosure(arg0, arg1, 1289, __wbg_adapter_11);
8724
8984
  return ret;
8725
8985
  };
8726
8986
 
8727
- exports.__wbindgen_cast_9a974cdf9f42f656 = function(arg0, arg1) {
8728
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2080, function: Function { arguments: [Externref], shim_idx: 2091, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8729
- const ret = makeMutClosure(arg0, arg1, 2080, __wbg_adapter_15);
8987
+ exports.__wbindgen_cast_ba8a1026d15ff35e = function(arg0, arg1) {
8988
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1551, function: Function { arguments: [], shim_idx: 1552, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8989
+ const ret = makeMutClosure(arg0, arg1, 1551, __wbg_adapter_32);
8730
8990
  return ret;
8731
8991
  };
8732
8992
 
8733
- exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
8734
- // Cast intrinsic for `I64 -> Externref`.
8735
- const ret = arg0;
8993
+ exports.__wbindgen_cast_be4323188b2517d9 = function(arg0, arg1) {
8994
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 748, function: Function { arguments: [NamedExternref("HIDInputReportEvent")], shim_idx: 749, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8995
+ const ret = makeMutClosure(arg0, arg1, 748, __wbg_adapter_6);
8736
8996
  return ret;
8737
8997
  };
8738
8998
 
@@ -8748,12 +9008,6 @@ exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
8748
9008
  return ret;
8749
9009
  };
8750
9010
 
8751
- exports.__wbindgen_cast_f02f4a8c093fe3f0 = function(arg0, arg1) {
8752
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2045, function: Function { arguments: [], shim_idx: 2046, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
8753
- const ret = makeMutClosure(arg0, arg1, 2045, __wbg_adapter_9);
8754
- return ret;
8755
- };
8756
-
8757
9011
  exports.__wbindgen_init_externref_table = function() {
8758
9012
  const table = wasm.__wbindgen_export_4;
8759
9013
  const offset = table.grow(4);
package/lwk_wasm_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lwk_node",
3
3
  "description": "Liquid Wallet Kit - WASM",
4
- "version": "0.17.1",
4
+ "version": "0.18.0",
5
5
  "license": "MIT OR BSD-2-Clause",
6
6
  "files": [
7
7
  "lwk_wasm_bg.wasm",