lwk_node 0.9.1 → 0.9.3

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
@@ -22,8 +22,14 @@ export class Address {
22
22
  free(): void;
23
23
  /**
24
24
  * Creates an `Address`
25
+ *
26
+ * If you know the network, you can use [`Address::parse()`] to validate that the network is consistent.
25
27
  */
26
28
  constructor(s: string);
29
+ /**
30
+ * Parses an `Address` ensuring is for the right network
31
+ */
32
+ static parse(s: string, network: Network): Address;
27
33
  scriptPubkey(): Script;
28
34
  isBlinded(): boolean;
29
35
  isMainnet(): boolean;
@@ -73,6 +79,15 @@ export class Amp2Descriptor {
73
79
  descriptor(): WolletDescriptor;
74
80
  toString(): string;
75
81
  }
82
+ /**
83
+ * Wrapper of [`lwk_wollet::AssetAmount`]
84
+ */
85
+ export class AssetAmount {
86
+ private constructor();
87
+ free(): void;
88
+ amount(): bigint;
89
+ asset(): AssetId;
90
+ }
76
91
  /**
77
92
  * A valid asset identifier. wrapper of [`elements::AssetId`]
78
93
  *
@@ -133,7 +148,7 @@ export class EsploraClient {
133
148
  /**
134
149
  * Creates a client, wrapper of [`asyncr::EsploraClient`]
135
150
  */
136
- constructor(network: Network, url: string, waterfalls: boolean);
151
+ constructor(network: Network, url: string, waterfalls: boolean, concurrency: number);
137
152
  fullScan(wollet: Wollet): Promise<Update | undefined>;
138
153
  /**
139
154
  * Scan the blockchain for the scripts generated by a watch-only wallet up to a specified derivation index
@@ -193,6 +208,43 @@ export class Jade {
193
208
  keyoriginXpub(bip: Bip): Promise<string>;
194
209
  registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
195
210
  }
211
+ /**
212
+ * WebSocket-based Wrapper of [`asyncr::Jade`]
213
+ */
214
+ export class JadeWebSocket {
215
+ free(): void;
216
+ /**
217
+ * Creates a Jade from WebSocket for the given network
218
+ *
219
+ * The url should point to your WebSocket bridge that connects to the Docker Jade emulator
220
+ */
221
+ constructor(network: Network, url: string);
222
+ getVersion(): Promise<any>;
223
+ getMasterXpub(): Promise<Xpub>;
224
+ /**
225
+ * Return a single sig address with the given `variant` and `path` derivation
226
+ */
227
+ getReceiveAddressSingle(variant: Singlesig, path: Uint32Array): Promise<string>;
228
+ /**
229
+ * Return a multisig address of a registered `multisig_name` wallet
230
+ *
231
+ * This method accept `path` and `path_n` in place of a single `Vec<Vec<u32>>` because the
232
+ * latter is not supported by wasm_bindgen (and neither `(u32, Vec<u32>)`). `path` and `path_n`
233
+ * are converted internally to a `Vec<Vec<u32>>` with the caveat all the paths are the same,
234
+ * which is almost always the case.
235
+ */
236
+ getReceiveAddressMulti(multisig_name: string, path: Uint32Array): Promise<string>;
237
+ /**
238
+ * Sign and consume the given PSET, returning the signed one
239
+ */
240
+ sign(pset: Pset): Promise<Pset>;
241
+ wpkh(): Promise<WolletDescriptor>;
242
+ shWpkh(): Promise<WolletDescriptor>;
243
+ multi(name: string): Promise<WolletDescriptor>;
244
+ getRegisteredMultisigs(): Promise<any>;
245
+ keyoriginXpub(bip: Bip): Promise<string>;
246
+ registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
247
+ }
196
248
  export class LedgerWeb {
197
249
  free(): void;
198
250
  /**
@@ -312,6 +364,7 @@ export class Pset {
312
364
  extractTx(): Transaction;
313
365
  combine(other: Pset): void;
314
366
  inputs(): PsetInput[];
367
+ outputs(): PsetOutput[];
315
368
  }
316
369
  /**
317
370
  * PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetBalance`]
@@ -367,6 +420,14 @@ export class PsetInput {
367
420
  */
368
421
  issuanceToken(): AssetId | undefined;
369
422
  }
423
+ /**
424
+ * PSET output
425
+ */
426
+ export class PsetOutput {
427
+ private constructor();
428
+ free(): void;
429
+ script_pubkey(): Script;
430
+ }
370
431
  /**
371
432
  * PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetSignatures`]
372
433
  */
@@ -524,6 +585,8 @@ export class TxBuilder {
524
585
  */
525
586
  setWalletUtxos(outpoints: OutPoint[]): TxBuilder;
526
587
  toString(): string;
588
+ liquidexMake(utxo: OutPoint, address: Address, satoshi: bigint, asset_id: AssetId): TxBuilder;
589
+ liquidexTake(proposals: ValidatedLiquidexProposal[]): TxBuilder;
527
590
  }
528
591
  /**
529
592
  * Wrapper of [`elements::TxOutSecrets`]
@@ -549,6 +612,18 @@ export class Txid {
549
612
  constructor(tx_id: string);
550
613
  toString(): string;
551
614
  }
615
+ /**
616
+ * Wrapper of [`lwk_wollet::LiquidexProposal<Unvalidated>`]
617
+ */
618
+ export class UnvalidatedLiquidexProposal {
619
+ private constructor();
620
+ free(): void;
621
+ static new(s: string): UnvalidatedLiquidexProposal;
622
+ static from_pset(pset: Pset): UnvalidatedLiquidexProposal;
623
+ insecure_validate(): ValidatedLiquidexProposal;
624
+ validate(tx: Transaction): ValidatedLiquidexProposal;
625
+ toString(): string;
626
+ }
552
627
  /**
553
628
  * Wrapper of [`lwk_wollet::Update`]
554
629
  */
@@ -564,6 +639,16 @@ export class Update {
564
639
  onlyTip(): boolean;
565
640
  prune(wollet: Wollet): void;
566
641
  }
642
+ /**
643
+ * Wrapper of [`lwk_wollet::LiquidexProposal<Validated>`]
644
+ */
645
+ export class ValidatedLiquidexProposal {
646
+ private constructor();
647
+ free(): void;
648
+ input(): AssetAmount;
649
+ output(): AssetAmount;
650
+ toString(): string;
651
+ }
567
652
  /**
568
653
  * Wrapper of [`lwk_wollet::WalletTx`]
569
654
  */
package/lwk_wasm.js CHANGED
@@ -219,6 +219,13 @@ function _assertClass(instance, klass) {
219
219
  }
220
220
  }
221
221
 
222
+ function passArray8ToWasm0(arg, malloc) {
223
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
224
+ getUint8ArrayMemory0().set(arg, ptr / 1);
225
+ WASM_VECTOR_LEN = arg.length;
226
+ return ptr;
227
+ }
228
+
222
229
  function passArrayJsValueToWasm0(array, malloc) {
223
230
  const ptr = malloc(array.length * 4, 4) >>> 0;
224
231
  for (let i = 0; i < array.length; i++) {
@@ -229,17 +236,6 @@ function passArrayJsValueToWasm0(array, malloc) {
229
236
  return ptr;
230
237
  }
231
238
 
232
- function getArrayJsValueFromWasm0(ptr, len) {
233
- ptr = ptr >>> 0;
234
- const mem = getDataViewMemory0();
235
- const result = [];
236
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
237
- result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
238
- }
239
- wasm.__externref_drop_slice(ptr, len);
240
- return result;
241
- }
242
-
243
239
  let cachedUint32ArrayMemory0 = null;
244
240
 
245
241
  function getUint32ArrayMemory0() {
@@ -249,24 +245,28 @@ function getUint32ArrayMemory0() {
249
245
  return cachedUint32ArrayMemory0;
250
246
  }
251
247
 
252
- function getArrayU32FromWasm0(ptr, len) {
253
- ptr = ptr >>> 0;
254
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
255
- }
256
-
257
- function passArray8ToWasm0(arg, malloc) {
258
- const ptr = malloc(arg.length * 1, 1) >>> 0;
259
- getUint8ArrayMemory0().set(arg, ptr / 1);
260
- WASM_VECTOR_LEN = arg.length;
261
- return ptr;
262
- }
263
-
264
248
  function passArray32ToWasm0(arg, malloc) {
265
249
  const ptr = malloc(arg.length * 4, 4) >>> 0;
266
250
  getUint32ArrayMemory0().set(arg, ptr / 4);
267
251
  WASM_VECTOR_LEN = arg.length;
268
252
  return ptr;
269
253
  }
254
+
255
+ function getArrayJsValueFromWasm0(ptr, len) {
256
+ ptr = ptr >>> 0;
257
+ const mem = getDataViewMemory0();
258
+ const result = [];
259
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
260
+ result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
261
+ }
262
+ wasm.__externref_drop_slice(ptr, len);
263
+ return result;
264
+ }
265
+
266
+ function getArrayU32FromWasm0(ptr, len) {
267
+ ptr = ptr >>> 0;
268
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
269
+ }
270
270
  /**
271
271
  * @returns {Promise<HIDDevice>}
272
272
  */
@@ -276,15 +276,15 @@ module.exports.searchLedgerDevice = function() {
276
276
  };
277
277
 
278
278
  function __wbg_adapter_36(arg0, arg1, arg2) {
279
- wasm.closure225_externref_shim(arg0, arg1, arg2);
279
+ wasm.closure285_externref_shim(arg0, arg1, arg2);
280
280
  }
281
281
 
282
- function __wbg_adapter_39(arg0, arg1, arg2) {
283
- wasm.closure1079_externref_shim(arg0, arg1, arg2);
282
+ function __wbg_adapter_43(arg0, arg1, arg2) {
283
+ wasm.closure1166_externref_shim(arg0, arg1, arg2);
284
284
  }
285
285
 
286
- function __wbg_adapter_430(arg0, arg1, arg2, arg3) {
287
- wasm.closure1817_externref_shim(arg0, arg1, arg2, arg3);
286
+ function __wbg_adapter_481(arg0, arg1, arg2, arg3) {
287
+ wasm.closure1915_externref_shim(arg0, arg1, arg2, arg3);
288
288
  }
289
289
 
290
290
  /**
@@ -303,6 +303,8 @@ module.exports.Chain = Object.freeze({
303
303
  Internal: 1, "1": "Internal",
304
304
  });
305
305
 
306
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
307
+
306
308
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
307
309
 
308
310
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
@@ -336,6 +338,8 @@ class Address {
336
338
  }
337
339
  /**
338
340
  * Creates an `Address`
341
+ *
342
+ * If you know the network, you can use [`Address::parse()`] to validate that the network is consistent.
339
343
  * @param {string} s
340
344
  */
341
345
  constructor(s) {
@@ -349,6 +353,22 @@ class Address {
349
353
  AddressFinalization.register(this, this.__wbg_ptr, this);
350
354
  return this;
351
355
  }
356
+ /**
357
+ * Parses an `Address` ensuring is for the right network
358
+ * @param {string} s
359
+ * @param {Network} network
360
+ * @returns {Address}
361
+ */
362
+ static parse(s, network) {
363
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
364
+ const len0 = WASM_VECTOR_LEN;
365
+ _assertClass(network, Network);
366
+ const ret = wasm.address_parse(ptr0, len0, network.__wbg_ptr);
367
+ if (ret[2]) {
368
+ throw takeFromExternrefTable0(ret[1]);
369
+ }
370
+ return Address.__wrap(ret[0]);
371
+ }
352
372
  /**
353
373
  * @returns {Script}
354
374
  */
@@ -610,6 +630,50 @@ class Amp2Descriptor {
610
630
  }
611
631
  module.exports.Amp2Descriptor = Amp2Descriptor;
612
632
 
633
+ const AssetAmountFinalization = (typeof FinalizationRegistry === 'undefined')
634
+ ? { register: () => {}, unregister: () => {} }
635
+ : new FinalizationRegistry(ptr => wasm.__wbg_assetamount_free(ptr >>> 0, 1));
636
+ /**
637
+ * Wrapper of [`lwk_wollet::AssetAmount`]
638
+ */
639
+ class AssetAmount {
640
+
641
+ static __wrap(ptr) {
642
+ ptr = ptr >>> 0;
643
+ const obj = Object.create(AssetAmount.prototype);
644
+ obj.__wbg_ptr = ptr;
645
+ AssetAmountFinalization.register(obj, obj.__wbg_ptr, obj);
646
+ return obj;
647
+ }
648
+
649
+ __destroy_into_raw() {
650
+ const ptr = this.__wbg_ptr;
651
+ this.__wbg_ptr = 0;
652
+ AssetAmountFinalization.unregister(this);
653
+ return ptr;
654
+ }
655
+
656
+ free() {
657
+ const ptr = this.__destroy_into_raw();
658
+ wasm.__wbg_assetamount_free(ptr, 0);
659
+ }
660
+ /**
661
+ * @returns {bigint}
662
+ */
663
+ amount() {
664
+ const ret = wasm.assetamount_amount(this.__wbg_ptr);
665
+ return BigInt.asUintN(64, ret);
666
+ }
667
+ /**
668
+ * @returns {AssetId}
669
+ */
670
+ asset() {
671
+ const ret = wasm.assetamount_asset(this.__wbg_ptr);
672
+ return AssetId.__wrap(ret);
673
+ }
674
+ }
675
+ module.exports.AssetAmount = AssetAmount;
676
+
613
677
  const AssetIdFinalization = (typeof FinalizationRegistry === 'undefined')
614
678
  ? { register: () => {}, unregister: () => {} }
615
679
  : new FinalizationRegistry(ptr => wasm.__wbg_assetid_free(ptr >>> 0, 1));
@@ -908,12 +972,13 @@ class EsploraClient {
908
972
  * @param {Network} network
909
973
  * @param {string} url
910
974
  * @param {boolean} waterfalls
975
+ * @param {number} concurrency
911
976
  */
912
- constructor(network, url, waterfalls) {
977
+ constructor(network, url, waterfalls, concurrency) {
913
978
  _assertClass(network, Network);
914
979
  const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
915
980
  const len0 = WASM_VECTOR_LEN;
916
- const ret = wasm.esploraclient_new(network.__wbg_ptr, ptr0, len0, waterfalls);
981
+ const ret = wasm.esploraclient_new(network.__wbg_ptr, ptr0, len0, waterfalls, concurrency);
917
982
  this.__wbg_ptr = ret >>> 0;
918
983
  EsploraClientFinalization.register(this, this.__wbg_ptr, this);
919
984
  return this;
@@ -1185,6 +1250,160 @@ class Jade {
1185
1250
  }
1186
1251
  module.exports.Jade = Jade;
1187
1252
 
1253
+ const JadeWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
1254
+ ? { register: () => {}, unregister: () => {} }
1255
+ : new FinalizationRegistry(ptr => wasm.__wbg_jadewebsocket_free(ptr >>> 0, 1));
1256
+ /**
1257
+ * WebSocket-based Wrapper of [`asyncr::Jade`]
1258
+ */
1259
+ class JadeWebSocket {
1260
+
1261
+ static __wrap(ptr) {
1262
+ ptr = ptr >>> 0;
1263
+ const obj = Object.create(JadeWebSocket.prototype);
1264
+ obj.__wbg_ptr = ptr;
1265
+ JadeWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
1266
+ return obj;
1267
+ }
1268
+
1269
+ __destroy_into_raw() {
1270
+ const ptr = this.__wbg_ptr;
1271
+ this.__wbg_ptr = 0;
1272
+ JadeWebSocketFinalization.unregister(this);
1273
+ return ptr;
1274
+ }
1275
+
1276
+ free() {
1277
+ const ptr = this.__destroy_into_raw();
1278
+ wasm.__wbg_jadewebsocket_free(ptr, 0);
1279
+ }
1280
+ /**
1281
+ * Creates a Jade from WebSocket for the given network
1282
+ *
1283
+ * The url should point to your WebSocket bridge that connects to the Docker Jade emulator
1284
+ * @param {Network} network
1285
+ * @param {string} url
1286
+ */
1287
+ constructor(network, url) {
1288
+ _assertClass(network, Network);
1289
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1290
+ const len0 = WASM_VECTOR_LEN;
1291
+ const ret = wasm.jadewebsocket_from_websocket(network.__wbg_ptr, ptr0, len0);
1292
+ return ret;
1293
+ }
1294
+ /**
1295
+ * @returns {Promise<any>}
1296
+ */
1297
+ getVersion() {
1298
+ const ret = wasm.jadewebsocket_getVersion(this.__wbg_ptr);
1299
+ return ret;
1300
+ }
1301
+ /**
1302
+ * @returns {Promise<Xpub>}
1303
+ */
1304
+ getMasterXpub() {
1305
+ const ret = wasm.jadewebsocket_getMasterXpub(this.__wbg_ptr);
1306
+ return ret;
1307
+ }
1308
+ /**
1309
+ * Return a single sig address with the given `variant` and `path` derivation
1310
+ * @param {Singlesig} variant
1311
+ * @param {Uint32Array} path
1312
+ * @returns {Promise<string>}
1313
+ */
1314
+ getReceiveAddressSingle(variant, path) {
1315
+ _assertClass(variant, Singlesig);
1316
+ var ptr0 = variant.__destroy_into_raw();
1317
+ const ptr1 = passArray32ToWasm0(path, wasm.__wbindgen_malloc);
1318
+ const len1 = WASM_VECTOR_LEN;
1319
+ const ret = wasm.jadewebsocket_getReceiveAddressSingle(this.__wbg_ptr, ptr0, ptr1, len1);
1320
+ return ret;
1321
+ }
1322
+ /**
1323
+ * Return a multisig address of a registered `multisig_name` wallet
1324
+ *
1325
+ * This method accept `path` and `path_n` in place of a single `Vec<Vec<u32>>` because the
1326
+ * latter is not supported by wasm_bindgen (and neither `(u32, Vec<u32>)`). `path` and `path_n`
1327
+ * are converted internally to a `Vec<Vec<u32>>` with the caveat all the paths are the same,
1328
+ * which is almost always the case.
1329
+ * @param {string} multisig_name
1330
+ * @param {Uint32Array} path
1331
+ * @returns {Promise<string>}
1332
+ */
1333
+ getReceiveAddressMulti(multisig_name, path) {
1334
+ const ptr0 = passStringToWasm0(multisig_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1335
+ const len0 = WASM_VECTOR_LEN;
1336
+ const ptr1 = passArray32ToWasm0(path, wasm.__wbindgen_malloc);
1337
+ const len1 = WASM_VECTOR_LEN;
1338
+ const ret = wasm.jadewebsocket_getReceiveAddressMulti(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1339
+ return ret;
1340
+ }
1341
+ /**
1342
+ * Sign and consume the given PSET, returning the signed one
1343
+ * @param {Pset} pset
1344
+ * @returns {Promise<Pset>}
1345
+ */
1346
+ sign(pset) {
1347
+ _assertClass(pset, Pset);
1348
+ var ptr0 = pset.__destroy_into_raw();
1349
+ const ret = wasm.jadewebsocket_sign(this.__wbg_ptr, ptr0);
1350
+ return ret;
1351
+ }
1352
+ /**
1353
+ * @returns {Promise<WolletDescriptor>}
1354
+ */
1355
+ wpkh() {
1356
+ const ret = wasm.jadewebsocket_wpkh(this.__wbg_ptr);
1357
+ return ret;
1358
+ }
1359
+ /**
1360
+ * @returns {Promise<WolletDescriptor>}
1361
+ */
1362
+ shWpkh() {
1363
+ const ret = wasm.jadewebsocket_shWpkh(this.__wbg_ptr);
1364
+ return ret;
1365
+ }
1366
+ /**
1367
+ * @param {string} name
1368
+ * @returns {Promise<WolletDescriptor>}
1369
+ */
1370
+ multi(name) {
1371
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1372
+ const len0 = WASM_VECTOR_LEN;
1373
+ const ret = wasm.jadewebsocket_multi(this.__wbg_ptr, ptr0, len0);
1374
+ return ret;
1375
+ }
1376
+ /**
1377
+ * @returns {Promise<any>}
1378
+ */
1379
+ getRegisteredMultisigs() {
1380
+ const ret = wasm.jadewebsocket_getRegisteredMultisigs(this.__wbg_ptr);
1381
+ return ret;
1382
+ }
1383
+ /**
1384
+ * @param {Bip} bip
1385
+ * @returns {Promise<string>}
1386
+ */
1387
+ keyoriginXpub(bip) {
1388
+ _assertClass(bip, Bip);
1389
+ const ret = wasm.jadewebsocket_keyoriginXpub(this.__wbg_ptr, bip.__wbg_ptr);
1390
+ return ret;
1391
+ }
1392
+ /**
1393
+ * @param {string} name
1394
+ * @param {WolletDescriptor} desc
1395
+ * @returns {Promise<boolean>}
1396
+ */
1397
+ registerDescriptor(name, desc) {
1398
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1399
+ const len0 = WASM_VECTOR_LEN;
1400
+ _assertClass(desc, WolletDescriptor);
1401
+ const ret = wasm.jadewebsocket_registerDescriptor(this.__wbg_ptr, ptr0, len0, desc.__wbg_ptr);
1402
+ return ret;
1403
+ }
1404
+ }
1405
+ module.exports.JadeWebSocket = JadeWebSocket;
1406
+
1188
1407
  const LedgerWebFinalization = (typeof FinalizationRegistry === 'undefined')
1189
1408
  ? { register: () => {}, unregister: () => {} }
1190
1409
  : new FinalizationRegistry(ptr => wasm.__wbg_ledgerweb_free(ptr >>> 0, 1));
@@ -1753,6 +1972,15 @@ class Pset {
1753
1972
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1754
1973
  return v1;
1755
1974
  }
1975
+ /**
1976
+ * @returns {PsetOutput[]}
1977
+ */
1978
+ outputs() {
1979
+ const ret = wasm.pset_outputs(this.__wbg_ptr);
1980
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1981
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1982
+ return v1;
1983
+ }
1756
1984
  }
1757
1985
  module.exports.Pset = Pset;
1758
1986
 
@@ -1950,6 +2178,43 @@ class PsetInput {
1950
2178
  }
1951
2179
  module.exports.PsetInput = PsetInput;
1952
2180
 
2181
+ const PsetOutputFinalization = (typeof FinalizationRegistry === 'undefined')
2182
+ ? { register: () => {}, unregister: () => {} }
2183
+ : new FinalizationRegistry(ptr => wasm.__wbg_psetoutput_free(ptr >>> 0, 1));
2184
+ /**
2185
+ * PSET output
2186
+ */
2187
+ class PsetOutput {
2188
+
2189
+ static __wrap(ptr) {
2190
+ ptr = ptr >>> 0;
2191
+ const obj = Object.create(PsetOutput.prototype);
2192
+ obj.__wbg_ptr = ptr;
2193
+ PsetOutputFinalization.register(obj, obj.__wbg_ptr, obj);
2194
+ return obj;
2195
+ }
2196
+
2197
+ __destroy_into_raw() {
2198
+ const ptr = this.__wbg_ptr;
2199
+ this.__wbg_ptr = 0;
2200
+ PsetOutputFinalization.unregister(this);
2201
+ return ptr;
2202
+ }
2203
+
2204
+ free() {
2205
+ const ptr = this.__destroy_into_raw();
2206
+ wasm.__wbg_psetoutput_free(ptr, 0);
2207
+ }
2208
+ /**
2209
+ * @returns {Script}
2210
+ */
2211
+ script_pubkey() {
2212
+ const ret = wasm.psetoutput_script_pubkey(this.__wbg_ptr);
2213
+ return Script.__wrap(ret);
2214
+ }
2215
+ }
2216
+ module.exports.PsetOutput = PsetOutput;
2217
+
1953
2218
  const PsetSignaturesFinalization = (typeof FinalizationRegistry === 'undefined')
1954
2219
  ? { register: () => {}, unregister: () => {} }
1955
2220
  : new FinalizationRegistry(ptr => wasm.__wbg_psetsignatures_free(ptr >>> 0, 1));
@@ -2792,6 +3057,41 @@ class TxBuilder {
2792
3057
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2793
3058
  }
2794
3059
  }
3060
+ /**
3061
+ * @param {OutPoint} utxo
3062
+ * @param {Address} address
3063
+ * @param {bigint} satoshi
3064
+ * @param {AssetId} asset_id
3065
+ * @returns {TxBuilder}
3066
+ */
3067
+ liquidexMake(utxo, address, satoshi, asset_id) {
3068
+ const ptr = this.__destroy_into_raw();
3069
+ _assertClass(utxo, OutPoint);
3070
+ var ptr0 = utxo.__destroy_into_raw();
3071
+ _assertClass(address, Address);
3072
+ var ptr1 = address.__destroy_into_raw();
3073
+ _assertClass(asset_id, AssetId);
3074
+ var ptr2 = asset_id.__destroy_into_raw();
3075
+ const ret = wasm.txbuilder_liquidexMake(ptr, ptr0, ptr1, satoshi, ptr2);
3076
+ if (ret[2]) {
3077
+ throw takeFromExternrefTable0(ret[1]);
3078
+ }
3079
+ return TxBuilder.__wrap(ret[0]);
3080
+ }
3081
+ /**
3082
+ * @param {ValidatedLiquidexProposal[]} proposals
3083
+ * @returns {TxBuilder}
3084
+ */
3085
+ liquidexTake(proposals) {
3086
+ const ptr = this.__destroy_into_raw();
3087
+ const ptr0 = passArrayJsValueToWasm0(proposals, wasm.__wbindgen_malloc);
3088
+ const len0 = WASM_VECTOR_LEN;
3089
+ const ret = wasm.txbuilder_liquidexTake(ptr, ptr0, len0);
3090
+ if (ret[2]) {
3091
+ throw takeFromExternrefTable0(ret[1]);
3092
+ }
3093
+ return TxBuilder.__wrap(ret[0]);
3094
+ }
2795
3095
  }
2796
3096
  module.exports.TxBuilder = TxBuilder;
2797
3097
 
@@ -2931,6 +3231,102 @@ class Txid {
2931
3231
  }
2932
3232
  module.exports.Txid = Txid;
2933
3233
 
3234
+ const UnvalidatedLiquidexProposalFinalization = (typeof FinalizationRegistry === 'undefined')
3235
+ ? { register: () => {}, unregister: () => {} }
3236
+ : new FinalizationRegistry(ptr => wasm.__wbg_unvalidatedliquidexproposal_free(ptr >>> 0, 1));
3237
+ /**
3238
+ * Wrapper of [`lwk_wollet::LiquidexProposal<Unvalidated>`]
3239
+ */
3240
+ class UnvalidatedLiquidexProposal {
3241
+
3242
+ static __wrap(ptr) {
3243
+ ptr = ptr >>> 0;
3244
+ const obj = Object.create(UnvalidatedLiquidexProposal.prototype);
3245
+ obj.__wbg_ptr = ptr;
3246
+ UnvalidatedLiquidexProposalFinalization.register(obj, obj.__wbg_ptr, obj);
3247
+ return obj;
3248
+ }
3249
+
3250
+ __destroy_into_raw() {
3251
+ const ptr = this.__wbg_ptr;
3252
+ this.__wbg_ptr = 0;
3253
+ UnvalidatedLiquidexProposalFinalization.unregister(this);
3254
+ return ptr;
3255
+ }
3256
+
3257
+ free() {
3258
+ const ptr = this.__destroy_into_raw();
3259
+ wasm.__wbg_unvalidatedliquidexproposal_free(ptr, 0);
3260
+ }
3261
+ /**
3262
+ * @param {string} s
3263
+ * @returns {UnvalidatedLiquidexProposal}
3264
+ */
3265
+ static new(s) {
3266
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3267
+ const len0 = WASM_VECTOR_LEN;
3268
+ const ret = wasm.unvalidatedliquidexproposal_new(ptr0, len0);
3269
+ if (ret[2]) {
3270
+ throw takeFromExternrefTable0(ret[1]);
3271
+ }
3272
+ return UnvalidatedLiquidexProposal.__wrap(ret[0]);
3273
+ }
3274
+ /**
3275
+ * @param {Pset} pset
3276
+ * @returns {UnvalidatedLiquidexProposal}
3277
+ */
3278
+ static from_pset(pset) {
3279
+ _assertClass(pset, Pset);
3280
+ var ptr0 = pset.__destroy_into_raw();
3281
+ const ret = wasm.unvalidatedliquidexproposal_from_pset(ptr0);
3282
+ if (ret[2]) {
3283
+ throw takeFromExternrefTable0(ret[1]);
3284
+ }
3285
+ return UnvalidatedLiquidexProposal.__wrap(ret[0]);
3286
+ }
3287
+ /**
3288
+ * @returns {ValidatedLiquidexProposal}
3289
+ */
3290
+ insecure_validate() {
3291
+ const ptr = this.__destroy_into_raw();
3292
+ const ret = wasm.unvalidatedliquidexproposal_insecure_validate(ptr);
3293
+ if (ret[2]) {
3294
+ throw takeFromExternrefTable0(ret[1]);
3295
+ }
3296
+ return ValidatedLiquidexProposal.__wrap(ret[0]);
3297
+ }
3298
+ /**
3299
+ * @param {Transaction} tx
3300
+ * @returns {ValidatedLiquidexProposal}
3301
+ */
3302
+ validate(tx) {
3303
+ const ptr = this.__destroy_into_raw();
3304
+ _assertClass(tx, Transaction);
3305
+ var ptr0 = tx.__destroy_into_raw();
3306
+ const ret = wasm.unvalidatedliquidexproposal_validate(ptr, ptr0);
3307
+ if (ret[2]) {
3308
+ throw takeFromExternrefTable0(ret[1]);
3309
+ }
3310
+ return ValidatedLiquidexProposal.__wrap(ret[0]);
3311
+ }
3312
+ /**
3313
+ * @returns {string}
3314
+ */
3315
+ toString() {
3316
+ let deferred1_0;
3317
+ let deferred1_1;
3318
+ try {
3319
+ const ret = wasm.unvalidatedliquidexproposal_toString(this.__wbg_ptr);
3320
+ deferred1_0 = ret[0];
3321
+ deferred1_1 = ret[1];
3322
+ return getStringFromWasm0(ret[0], ret[1]);
3323
+ } finally {
3324
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3325
+ }
3326
+ }
3327
+ }
3328
+ module.exports.UnvalidatedLiquidexProposal = UnvalidatedLiquidexProposal;
3329
+
2934
3330
  const UpdateFinalization = (typeof FinalizationRegistry === 'undefined')
2935
3331
  ? { register: () => {}, unregister: () => {} }
2936
3332
  : new FinalizationRegistry(ptr => wasm.__wbg_update_free(ptr >>> 0, 1));
@@ -3040,6 +3436,72 @@ class Update {
3040
3436
  }
3041
3437
  module.exports.Update = Update;
3042
3438
 
3439
+ const ValidatedLiquidexProposalFinalization = (typeof FinalizationRegistry === 'undefined')
3440
+ ? { register: () => {}, unregister: () => {} }
3441
+ : new FinalizationRegistry(ptr => wasm.__wbg_validatedliquidexproposal_free(ptr >>> 0, 1));
3442
+ /**
3443
+ * Wrapper of [`lwk_wollet::LiquidexProposal<Validated>`]
3444
+ */
3445
+ class ValidatedLiquidexProposal {
3446
+
3447
+ static __wrap(ptr) {
3448
+ ptr = ptr >>> 0;
3449
+ const obj = Object.create(ValidatedLiquidexProposal.prototype);
3450
+ obj.__wbg_ptr = ptr;
3451
+ ValidatedLiquidexProposalFinalization.register(obj, obj.__wbg_ptr, obj);
3452
+ return obj;
3453
+ }
3454
+
3455
+ static __unwrap(jsValue) {
3456
+ if (!(jsValue instanceof ValidatedLiquidexProposal)) {
3457
+ return 0;
3458
+ }
3459
+ return jsValue.__destroy_into_raw();
3460
+ }
3461
+
3462
+ __destroy_into_raw() {
3463
+ const ptr = this.__wbg_ptr;
3464
+ this.__wbg_ptr = 0;
3465
+ ValidatedLiquidexProposalFinalization.unregister(this);
3466
+ return ptr;
3467
+ }
3468
+
3469
+ free() {
3470
+ const ptr = this.__destroy_into_raw();
3471
+ wasm.__wbg_validatedliquidexproposal_free(ptr, 0);
3472
+ }
3473
+ /**
3474
+ * @returns {AssetAmount}
3475
+ */
3476
+ input() {
3477
+ const ret = wasm.validatedliquidexproposal_input(this.__wbg_ptr);
3478
+ return AssetAmount.__wrap(ret);
3479
+ }
3480
+ /**
3481
+ * @returns {AssetAmount}
3482
+ */
3483
+ output() {
3484
+ const ret = wasm.validatedliquidexproposal_output(this.__wbg_ptr);
3485
+ return AssetAmount.__wrap(ret);
3486
+ }
3487
+ /**
3488
+ * @returns {string}
3489
+ */
3490
+ toString() {
3491
+ let deferred1_0;
3492
+ let deferred1_1;
3493
+ try {
3494
+ const ret = wasm.validatedliquidexproposal_toString(this.__wbg_ptr);
3495
+ deferred1_0 = ret[0];
3496
+ deferred1_1 = ret[1];
3497
+ return getStringFromWasm0(ret[0], ret[1]);
3498
+ } finally {
3499
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3500
+ }
3501
+ }
3502
+ }
3503
+ module.exports.ValidatedLiquidexProposal = ValidatedLiquidexProposal;
3504
+
3043
3505
  const WalletTxFinalization = (typeof FinalizationRegistry === 'undefined')
3044
3506
  ? { register: () => {}, unregister: () => {} }
3045
3507
  : new FinalizationRegistry(ptr => wasm.__wbg_wallettx_free(ptr >>> 0, 1));
@@ -3635,6 +4097,11 @@ module.exports.__wbg_assetmeta_new = function(arg0) {
3635
4097
  return ret;
3636
4098
  };
3637
4099
 
4100
+ module.exports.__wbg_buffer_09165b52af8c5237 = function(arg0) {
4101
+ const ret = arg0.buffer;
4102
+ return ret;
4103
+ };
4104
+
3638
4105
  module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
3639
4106
  const ret = arg0.buffer;
3640
4107
  return ret;
@@ -3665,6 +4132,11 @@ module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
3665
4132
  return ret;
3666
4133
  };
3667
4134
 
4135
+ module.exports.__wbg_data_432d9c3df2630942 = function(arg0) {
4136
+ const ret = arg0.data;
4137
+ return ret;
4138
+ };
4139
+
3668
4140
  module.exports.__wbg_data_abeb242764125124 = function(arg0) {
3669
4141
  const ret = arg0.data;
3670
4142
  return ret;
@@ -3734,6 +4206,17 @@ module.exports.__wbg_hid_890a1b64f4c510a6 = function(arg0) {
3734
4206
  return ret;
3735
4207
  };
3736
4208
 
4209
+ module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
4210
+ let result;
4211
+ try {
4212
+ result = arg0 instanceof ArrayBuffer;
4213
+ } catch (_) {
4214
+ result = false;
4215
+ }
4216
+ const ret = result;
4217
+ return ret;
4218
+ };
4219
+
3737
4220
  module.exports.__wbg_instanceof_HidDevice_281d00db95a533c6 = function(arg0) {
3738
4221
  let result;
3739
4222
  try {
@@ -3798,6 +4281,11 @@ module.exports.__wbg_jade_new = function(arg0) {
3798
4281
  return ret;
3799
4282
  };
3800
4283
 
4284
+ module.exports.__wbg_jadewebsocket_new = function(arg0) {
4285
+ const ret = JadeWebSocket.__wrap(arg0);
4286
+ return ret;
4287
+ };
4288
+
3801
4289
  module.exports.__wbg_length_a446193dc22c12f8 = function(arg0) {
3802
4290
  const ret = arg0.length;
3803
4291
  return ret;
@@ -3808,7 +4296,7 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
3808
4296
  return ret;
3809
4297
  };
3810
4298
 
3811
- module.exports.__wbg_log_308ae9d710557e53 = function(arg0, arg1) {
4299
+ module.exports.__wbg_log_a059746199e3a950 = function(arg0, arg1) {
3812
4300
  console.log(getStringFromWasm0(arg0, arg1));
3813
4301
  };
3814
4302
 
@@ -3839,7 +4327,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
3839
4327
  const a = state0.a;
3840
4328
  state0.a = 0;
3841
4329
  try {
3842
- return __wbg_adapter_430(a, state0.b, arg0, arg1);
4330
+ return __wbg_adapter_481(a, state0.b, arg0, arg1);
3843
4331
  } finally {
3844
4332
  state0.a = a;
3845
4333
  }
@@ -3866,6 +4354,11 @@ module.exports.__wbg_new_78feb108b6472713 = function() {
3866
4354
  return ret;
3867
4355
  };
3868
4356
 
4357
+ module.exports.__wbg_new_92c54fc74574ef55 = function() { return handleError(function (arg0, arg1) {
4358
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
4359
+ return ret;
4360
+ }, arguments) };
4361
+
3869
4362
  module.exports.__wbg_new_a12002a7f91c75be = function(arg0) {
3870
4363
  const ret = new Uint8Array(arg0);
3871
4364
  return ret;
@@ -3966,6 +4459,11 @@ module.exports.__wbg_psetinput_new = function(arg0) {
3966
4459
  return ret;
3967
4460
  };
3968
4461
 
4462
+ module.exports.__wbg_psetoutput_new = function(arg0) {
4463
+ const ret = PsetOutput.__wrap(arg0);
4464
+ return ret;
4465
+ };
4466
+
3969
4467
  module.exports.__wbg_psetsignatures_new = function(arg0) {
3970
4468
  const ret = PsetSignatures.__wrap(arg0);
3971
4469
  return ret;
@@ -4029,6 +4527,10 @@ module.exports.__wbg_sendReport_4d1024566077f413 = function() { return handleErr
4029
4527
  return ret;
4030
4528
  }, arguments) };
4031
4529
 
4530
+ module.exports.__wbg_send_7c4769e24cf1d784 = function() { return handleError(function (arg0, arg1) {
4531
+ arg0.send(arg1);
4532
+ }, arguments) };
4533
+
4032
4534
  module.exports.__wbg_serial_a5487140b2fdb38f = function(arg0) {
4033
4535
  const ret = arg0.serial;
4034
4536
  return ret;
@@ -4060,6 +4562,10 @@ module.exports.__wbg_setbaudrate_fe58f64af51588e8 = function(arg0, arg1) {
4060
4562
  arg0.baudRate = arg1 >>> 0;
4061
4563
  };
4062
4564
 
4565
+ module.exports.__wbg_setbinaryType_92fa1ffd873b327c = function(arg0, arg1) {
4566
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
4567
+ };
4568
+
4063
4569
  module.exports.__wbg_setbody_5923b78a95eedf29 = function(arg0, arg1) {
4064
4570
  arg0.body = arg1;
4065
4571
  };
@@ -4092,6 +4598,14 @@ module.exports.__wbg_setoninputreport_de1916af49f98e5f = function(arg0, arg1) {
4092
4598
  arg0.oninputreport = arg1;
4093
4599
  };
4094
4600
 
4601
+ module.exports.__wbg_setonmessage_6eccab530a8fb4c7 = function(arg0, arg1) {
4602
+ arg0.onmessage = arg1;
4603
+ };
4604
+
4605
+ module.exports.__wbg_setonopen_2da654e1f39745d5 = function(arg0, arg1) {
4606
+ arg0.onopen = arg1;
4607
+ };
4608
+
4095
4609
  module.exports.__wbg_setsignal_75b21ef3a81de905 = function(arg0, arg1) {
4096
4610
  arg0.signal = arg1;
4097
4611
  };
@@ -4169,6 +4683,11 @@ module.exports.__wbg_url_ae10c34ca209681d = function(arg0, arg1) {
4169
4683
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4170
4684
  };
4171
4685
 
4686
+ module.exports.__wbg_validatedliquidexproposal_unwrap = function(arg0) {
4687
+ const ret = ValidatedLiquidexProposal.__unwrap(arg0);
4688
+ return ret;
4689
+ };
4690
+
4172
4691
  module.exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
4173
4692
  const ret = arg0.value;
4174
4693
  return ret;
@@ -4229,13 +4748,23 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
4229
4748
  return ret;
4230
4749
  };
4231
4750
 
4232
- module.exports.__wbindgen_closure_wrapper2294 = function(arg0, arg1, arg2) {
4233
- const ret = makeMutClosure(arg0, arg1, 226, __wbg_adapter_36);
4751
+ module.exports.__wbindgen_closure_wrapper10168 = function(arg0, arg1, arg2) {
4752
+ const ret = makeMutClosure(arg0, arg1, 1167, __wbg_adapter_43);
4753
+ return ret;
4754
+ };
4755
+
4756
+ module.exports.__wbindgen_closure_wrapper5011 = function(arg0, arg1, arg2) {
4757
+ const ret = makeMutClosure(arg0, arg1, 287, __wbg_adapter_36);
4758
+ return ret;
4759
+ };
4760
+
4761
+ module.exports.__wbindgen_closure_wrapper5013 = function(arg0, arg1, arg2) {
4762
+ const ret = makeMutClosure(arg0, arg1, 286, __wbg_adapter_36);
4234
4763
  return ret;
4235
4764
  };
4236
4765
 
4237
- module.exports.__wbindgen_closure_wrapper9576 = function(arg0, arg1, arg2) {
4238
- const ret = makeMutClosure(arg0, arg1, 1080, __wbg_adapter_39);
4766
+ module.exports.__wbindgen_closure_wrapper5015 = function(arg0, arg1, arg2) {
4767
+ const ret = makeMutClosure(arg0, arg1, 287, __wbg_adapter_36);
4239
4768
  return ret;
4240
4769
  };
4241
4770
 
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.9.1",
4
+ "version": "0.9.3",
5
5
  "license": "MIT OR BSD-2-Clause",
6
6
  "files": [
7
7
  "lwk_wasm_bg.wasm",