lwk_node 0.11.0 → 0.12.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/README.md +56 -1
- package/lwk_wasm.d.ts +720 -63
- package/lwk_wasm.js +771 -136
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/lwk_wasm.js
CHANGED
|
@@ -207,18 +207,18 @@ function debugString(val) {
|
|
|
207
207
|
return className;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
function takeFromExternrefTable0(idx) {
|
|
211
|
-
const value = wasm.__wbindgen_export_4.get(idx);
|
|
212
|
-
wasm.__externref_table_dealloc(idx);
|
|
213
|
-
return value;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
210
|
function _assertClass(instance, klass) {
|
|
217
211
|
if (!(instance instanceof klass)) {
|
|
218
212
|
throw new Error(`expected instance of ${klass.name}`);
|
|
219
213
|
}
|
|
220
214
|
}
|
|
221
215
|
|
|
216
|
+
function takeFromExternrefTable0(idx) {
|
|
217
|
+
const value = wasm.__wbindgen_export_4.get(idx);
|
|
218
|
+
wasm.__externref_table_dealloc(idx);
|
|
219
|
+
return value;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
222
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
223
223
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
224
224
|
for (let i = 0; i < array.length; i++) {
|
|
@@ -228,6 +228,24 @@ function passArrayJsValueToWasm0(array, malloc) {
|
|
|
228
228
|
WASM_VECTOR_LEN = array.length;
|
|
229
229
|
return ptr;
|
|
230
230
|
}
|
|
231
|
+
|
|
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
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
244
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
245
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
246
|
+
WASM_VECTOR_LEN = arg.length;
|
|
247
|
+
return ptr;
|
|
248
|
+
}
|
|
231
249
|
/**
|
|
232
250
|
* @returns {Promise<HIDDevice>}
|
|
233
251
|
*/
|
|
@@ -252,38 +270,20 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
252
270
|
return ptr;
|
|
253
271
|
}
|
|
254
272
|
|
|
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 passArray8ToWasm0(arg, malloc) {
|
|
267
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
268
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
269
|
-
WASM_VECTOR_LEN = arg.length;
|
|
270
|
-
return ptr;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
273
|
function getArrayU32FromWasm0(ptr, len) {
|
|
274
274
|
ptr = ptr >>> 0;
|
|
275
275
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
wasm.
|
|
277
|
+
function __wbg_adapter_34(arg0, arg1, arg2) {
|
|
278
|
+
wasm.closure696_externref_shim(arg0, arg1, arg2);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
function
|
|
282
|
-
wasm.
|
|
281
|
+
function __wbg_adapter_41(arg0, arg1, arg2) {
|
|
282
|
+
wasm.closure1367_externref_shim(arg0, arg1, arg2);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
function
|
|
286
|
-
wasm.
|
|
285
|
+
function __wbg_adapter_543(arg0, arg1, arg2, arg3) {
|
|
286
|
+
wasm.closure2127_externref_shim(arg0, arg1, arg2, arg3);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
@@ -312,7 +312,7 @@ const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
312
312
|
? { register: () => {}, unregister: () => {} }
|
|
313
313
|
: new FinalizationRegistry(ptr => wasm.__wbg_address_free(ptr >>> 0, 1));
|
|
314
314
|
/**
|
|
315
|
-
*
|
|
315
|
+
* An Elements (Liquid) address
|
|
316
316
|
*/
|
|
317
317
|
class Address {
|
|
318
318
|
|
|
@@ -338,7 +338,7 @@ class Address {
|
|
|
338
338
|
/**
|
|
339
339
|
* Creates an `Address`
|
|
340
340
|
*
|
|
341
|
-
* If you know the network, you can use
|
|
341
|
+
* If you know the network, you can use `parse()` to validate that the network is consistent.
|
|
342
342
|
* @param {string} s
|
|
343
343
|
*/
|
|
344
344
|
constructor(s) {
|
|
@@ -369,6 +369,7 @@ class Address {
|
|
|
369
369
|
return Address.__wrap(ret[0]);
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
372
|
+
* Return the script pubkey of the address.
|
|
372
373
|
* @returns {Script}
|
|
373
374
|
*/
|
|
374
375
|
scriptPubkey() {
|
|
@@ -376,6 +377,7 @@ class Address {
|
|
|
376
377
|
return Script.__wrap(ret);
|
|
377
378
|
}
|
|
378
379
|
/**
|
|
380
|
+
* Return true if the address is blinded, in other words, if it has a blinding key.
|
|
379
381
|
* @returns {boolean}
|
|
380
382
|
*/
|
|
381
383
|
isBlinded() {
|
|
@@ -383,6 +385,7 @@ class Address {
|
|
|
383
385
|
return ret !== 0;
|
|
384
386
|
}
|
|
385
387
|
/**
|
|
388
|
+
* Return true if the address is for mainnet.
|
|
386
389
|
* @returns {boolean}
|
|
387
390
|
*/
|
|
388
391
|
isMainnet() {
|
|
@@ -390,6 +393,7 @@ class Address {
|
|
|
390
393
|
return ret !== 0;
|
|
391
394
|
}
|
|
392
395
|
/**
|
|
396
|
+
* Return the unconfidential address, in other words, the address without the blinding key.
|
|
393
397
|
* @returns {Address}
|
|
394
398
|
*/
|
|
395
399
|
toUnconfidential() {
|
|
@@ -397,6 +401,8 @@ class Address {
|
|
|
397
401
|
return Address.__wrap(ret);
|
|
398
402
|
}
|
|
399
403
|
/**
|
|
404
|
+
* Return the string representation of the address.
|
|
405
|
+
* This representation can be used to recreate the address via `new()`
|
|
400
406
|
* @returns {string}
|
|
401
407
|
*/
|
|
402
408
|
toString() {
|
|
@@ -469,7 +475,9 @@ const AddressResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
469
475
|
? { register: () => {}, unregister: () => {} }
|
|
470
476
|
: new FinalizationRegistry(ptr => wasm.__wbg_addressresult_free(ptr >>> 0, 1));
|
|
471
477
|
/**
|
|
472
|
-
*
|
|
478
|
+
* Value returned from asking an address to the wallet.
|
|
479
|
+
* Containing the confidential address and its
|
|
480
|
+
* derivation index (the last element in the derivation path)
|
|
473
481
|
*/
|
|
474
482
|
class AddressResult {
|
|
475
483
|
|
|
@@ -493,6 +501,7 @@ class AddressResult {
|
|
|
493
501
|
wasm.__wbg_addressresult_free(ptr, 0);
|
|
494
502
|
}
|
|
495
503
|
/**
|
|
504
|
+
* Return the address.
|
|
496
505
|
* @returns {Address}
|
|
497
506
|
*/
|
|
498
507
|
address() {
|
|
@@ -500,6 +509,7 @@ class AddressResult {
|
|
|
500
509
|
return Address.__wrap(ret);
|
|
501
510
|
}
|
|
502
511
|
/**
|
|
512
|
+
* Return the derivation index of the address.
|
|
503
513
|
* @returns {number}
|
|
504
514
|
*/
|
|
505
515
|
index() {
|
|
@@ -513,7 +523,26 @@ const Amp0Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
513
523
|
? { register: () => {}, unregister: () => {} }
|
|
514
524
|
: new FinalizationRegistry(ptr => wasm.__wbg_amp0_free(ptr >>> 0, 1));
|
|
515
525
|
/**
|
|
516
|
-
*
|
|
526
|
+
* Context for actions related to an AMP0 (sub)account
|
|
527
|
+
*
|
|
528
|
+
* <div class="warning">
|
|
529
|
+
* <b>WARNING:</b>
|
|
530
|
+
*
|
|
531
|
+
* AMP0 is based on a legacy system, and some things do not fit precisely the way LWK allows to do
|
|
532
|
+
* things.
|
|
533
|
+
*
|
|
534
|
+
* Callers must be careful with the following:
|
|
535
|
+
* * <b>Addresses: </b>
|
|
536
|
+
* to get addresses use [`Amp0::address()`]. This ensures
|
|
537
|
+
* that all addresses used are correctly monitored by the AMP0 server.
|
|
538
|
+
* * <b>Syncing: </b>
|
|
539
|
+
* to sync the AMP0 [`crate::Wollet`], use [`Amp0::last_index()`] and [`crate::clients::blocking::BlockchainBackend::full_scan_to_index()`]. This ensures that all utxos are synced, even if there are gaps between higher than the GAP LIMIT.
|
|
540
|
+
*
|
|
541
|
+
* <i>
|
|
542
|
+
* Failing to do the above might lead to inconsistent states, where funds are not shown or they
|
|
543
|
+
* cannot be spent!
|
|
544
|
+
* </i>
|
|
545
|
+
* </div>
|
|
517
546
|
*/
|
|
518
547
|
class Amp0 {
|
|
519
548
|
|
|
@@ -546,14 +575,13 @@ class Amp0 {
|
|
|
546
575
|
*/
|
|
547
576
|
static newWithNetwork(network, username, password, amp_id) {
|
|
548
577
|
_assertClass(network, Network);
|
|
549
|
-
|
|
550
|
-
const
|
|
578
|
+
const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
579
|
+
const len0 = WASM_VECTOR_LEN;
|
|
580
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
551
581
|
const len1 = WASM_VECTOR_LEN;
|
|
552
|
-
const ptr2 = passStringToWasm0(
|
|
582
|
+
const ptr2 = passStringToWasm0(amp_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
553
583
|
const len2 = WASM_VECTOR_LEN;
|
|
554
|
-
const
|
|
555
|
-
const len3 = WASM_VECTOR_LEN;
|
|
556
|
-
const ret = wasm.amp0_newWithNetwork(ptr0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
584
|
+
const ret = wasm.amp0_newWithNetwork(network.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
557
585
|
return ret;
|
|
558
586
|
}
|
|
559
587
|
/**
|
|
@@ -563,14 +591,14 @@ class Amp0 {
|
|
|
563
591
|
* @param {string} amp_id
|
|
564
592
|
* @returns {Promise<Amp0>}
|
|
565
593
|
*/
|
|
566
|
-
static
|
|
594
|
+
static newTestnet(username, password, amp_id) {
|
|
567
595
|
const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
568
596
|
const len0 = WASM_VECTOR_LEN;
|
|
569
597
|
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
570
598
|
const len1 = WASM_VECTOR_LEN;
|
|
571
599
|
const ptr2 = passStringToWasm0(amp_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
572
600
|
const len2 = WASM_VECTOR_LEN;
|
|
573
|
-
const ret = wasm.
|
|
601
|
+
const ret = wasm.amp0_newTestnet(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
574
602
|
return ret;
|
|
575
603
|
}
|
|
576
604
|
/**
|
|
@@ -651,11 +679,168 @@ class Amp0 {
|
|
|
651
679
|
}
|
|
652
680
|
module.exports.Amp0 = Amp0;
|
|
653
681
|
|
|
682
|
+
const Amp0ConnectedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
683
|
+
? { register: () => {}, unregister: () => {} }
|
|
684
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp0connected_free(ptr >>> 0, 1));
|
|
685
|
+
/**
|
|
686
|
+
* Session connecting to AMP0
|
|
687
|
+
*/
|
|
688
|
+
class Amp0Connected {
|
|
689
|
+
|
|
690
|
+
static __wrap(ptr) {
|
|
691
|
+
ptr = ptr >>> 0;
|
|
692
|
+
const obj = Object.create(Amp0Connected.prototype);
|
|
693
|
+
obj.__wbg_ptr = ptr;
|
|
694
|
+
Amp0ConnectedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
695
|
+
return obj;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
__destroy_into_raw() {
|
|
699
|
+
const ptr = this.__wbg_ptr;
|
|
700
|
+
this.__wbg_ptr = 0;
|
|
701
|
+
Amp0ConnectedFinalization.unregister(this);
|
|
702
|
+
return ptr;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
free() {
|
|
706
|
+
const ptr = this.__destroy_into_raw();
|
|
707
|
+
wasm.__wbg_amp0connected_free(ptr, 0);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Connect and register to AMP0
|
|
711
|
+
* @param {Network} network
|
|
712
|
+
* @param {Amp0SignerData} signer_data
|
|
713
|
+
*/
|
|
714
|
+
constructor(network, signer_data) {
|
|
715
|
+
_assertClass(network, Network);
|
|
716
|
+
_assertClass(signer_data, Amp0SignerData);
|
|
717
|
+
const ret = wasm.amp0connected_new(network.__wbg_ptr, signer_data.__wbg_ptr);
|
|
718
|
+
return ret;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Obtain a login challenge
|
|
722
|
+
*
|
|
723
|
+
* This must be signed with [`amp0_sign_challenge()`].
|
|
724
|
+
* @returns {Promise<string>}
|
|
725
|
+
*/
|
|
726
|
+
get_challenge() {
|
|
727
|
+
const ret = wasm.amp0connected_get_challenge(this.__wbg_ptr);
|
|
728
|
+
return ret;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Log in
|
|
732
|
+
*
|
|
733
|
+
* `sig` must be obtained from [`amp0_sign_challenge()`] called with the value returned
|
|
734
|
+
* by [`Amp0Connected::get_challenge()`]
|
|
735
|
+
* @param {string} sig
|
|
736
|
+
* @returns {Promise<Amp0LoggedIn>}
|
|
737
|
+
*/
|
|
738
|
+
login(sig) {
|
|
739
|
+
const ptr = this.__destroy_into_raw();
|
|
740
|
+
const ptr0 = passStringToWasm0(sig, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
741
|
+
const len0 = WASM_VECTOR_LEN;
|
|
742
|
+
const ret = wasm.amp0connected_login(ptr, ptr0, len0);
|
|
743
|
+
return ret;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
module.exports.Amp0Connected = Amp0Connected;
|
|
747
|
+
|
|
748
|
+
const Amp0LoggedInFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
749
|
+
? { register: () => {}, unregister: () => {} }
|
|
750
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp0loggedin_free(ptr >>> 0, 1));
|
|
751
|
+
/**
|
|
752
|
+
* Session logged in AMP0
|
|
753
|
+
*/
|
|
754
|
+
class Amp0LoggedIn {
|
|
755
|
+
|
|
756
|
+
static __wrap(ptr) {
|
|
757
|
+
ptr = ptr >>> 0;
|
|
758
|
+
const obj = Object.create(Amp0LoggedIn.prototype);
|
|
759
|
+
obj.__wbg_ptr = ptr;
|
|
760
|
+
Amp0LoggedInFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
761
|
+
return obj;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
__destroy_into_raw() {
|
|
765
|
+
const ptr = this.__wbg_ptr;
|
|
766
|
+
this.__wbg_ptr = 0;
|
|
767
|
+
Amp0LoggedInFinalization.unregister(this);
|
|
768
|
+
return ptr;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
free() {
|
|
772
|
+
const ptr = this.__destroy_into_raw();
|
|
773
|
+
wasm.__wbg_amp0loggedin_free(ptr, 0);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* List of AMP IDs.
|
|
777
|
+
* @returns {string[]}
|
|
778
|
+
*/
|
|
779
|
+
get_amp_ids() {
|
|
780
|
+
const ret = wasm.amp0loggedin_get_amp_ids(this.__wbg_ptr);
|
|
781
|
+
if (ret[3]) {
|
|
782
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
783
|
+
}
|
|
784
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
785
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
786
|
+
return v1;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Get the next account for AMP0 account creation
|
|
790
|
+
*
|
|
791
|
+
* This must be given to [`amp0_account_xpub()`] to obtain the xpub to pass to
|
|
792
|
+
* [`Amp0LoggedIn::create_amp0_account()`]
|
|
793
|
+
* @returns {number}
|
|
794
|
+
*/
|
|
795
|
+
next_account() {
|
|
796
|
+
const ret = wasm.amp0loggedin_next_account(this.__wbg_ptr);
|
|
797
|
+
if (ret[2]) {
|
|
798
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
799
|
+
}
|
|
800
|
+
return ret[0] >>> 0;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Create a new AMP0 account
|
|
804
|
+
*
|
|
805
|
+
* `account_xpub` must be obtained from [`amp0_account_xpub()`] called with the value obtained from
|
|
806
|
+
* [`Amp0LoggedIn::next_account()`]
|
|
807
|
+
* @param {number} pointer
|
|
808
|
+
* @param {string} account_xpub
|
|
809
|
+
* @returns {Promise<string>}
|
|
810
|
+
*/
|
|
811
|
+
create_amp0_account(pointer, account_xpub) {
|
|
812
|
+
const ptr0 = passStringToWasm0(account_xpub, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
813
|
+
const len0 = WASM_VECTOR_LEN;
|
|
814
|
+
const ret = wasm.amp0loggedin_create_amp0_account(this.__wbg_ptr, pointer, ptr0, len0);
|
|
815
|
+
return ret;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Create a new Watch-Only entry for this wallet
|
|
819
|
+
* @param {string} username
|
|
820
|
+
* @param {string} password
|
|
821
|
+
* @returns {Promise<void>}
|
|
822
|
+
*/
|
|
823
|
+
create_watch_only(username, password) {
|
|
824
|
+
const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
825
|
+
const len0 = WASM_VECTOR_LEN;
|
|
826
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
827
|
+
const len1 = WASM_VECTOR_LEN;
|
|
828
|
+
const ret = wasm.amp0loggedin_create_watch_only(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
829
|
+
return ret;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
module.exports.Amp0LoggedIn = Amp0LoggedIn;
|
|
833
|
+
|
|
654
834
|
const Amp0PsetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
655
835
|
? { register: () => {}, unregister: () => {} }
|
|
656
836
|
: new FinalizationRegistry(ptr => wasm.__wbg_amp0pset_free(ptr >>> 0, 1));
|
|
657
837
|
/**
|
|
658
|
-
*
|
|
838
|
+
* A PSET to use with AMP0
|
|
839
|
+
*
|
|
840
|
+
* When asking AMP0 to cosign, the caller must pass some extra data that does not belong to the
|
|
841
|
+
* PSET. This struct holds and manage the necessary data.
|
|
842
|
+
*
|
|
843
|
+
* If you're not dealing with AMP0, do not use this struct.
|
|
659
844
|
*/
|
|
660
845
|
class Amp0Pset {
|
|
661
846
|
|
|
@@ -717,11 +902,39 @@ class Amp0Pset {
|
|
|
717
902
|
}
|
|
718
903
|
module.exports.Amp0Pset = Amp0Pset;
|
|
719
904
|
|
|
905
|
+
const Amp0SignerDataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
906
|
+
? { register: () => {}, unregister: () => {} }
|
|
907
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp0signerdata_free(ptr >>> 0, 1));
|
|
908
|
+
|
|
909
|
+
class Amp0SignerData {
|
|
910
|
+
|
|
911
|
+
static __wrap(ptr) {
|
|
912
|
+
ptr = ptr >>> 0;
|
|
913
|
+
const obj = Object.create(Amp0SignerData.prototype);
|
|
914
|
+
obj.__wbg_ptr = ptr;
|
|
915
|
+
Amp0SignerDataFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
916
|
+
return obj;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
__destroy_into_raw() {
|
|
920
|
+
const ptr = this.__wbg_ptr;
|
|
921
|
+
this.__wbg_ptr = 0;
|
|
922
|
+
Amp0SignerDataFinalization.unregister(this);
|
|
923
|
+
return ptr;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
free() {
|
|
927
|
+
const ptr = this.__destroy_into_raw();
|
|
928
|
+
wasm.__wbg_amp0signerdata_free(ptr, 0);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
module.exports.Amp0SignerData = Amp0SignerData;
|
|
932
|
+
|
|
720
933
|
const Amp2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
721
934
|
? { register: () => {}, unregister: () => {} }
|
|
722
935
|
: new FinalizationRegistry(ptr => wasm.__wbg_amp2_free(ptr >>> 0, 1));
|
|
723
936
|
/**
|
|
724
|
-
*
|
|
937
|
+
* Context for actions interacting with Asset Management Platform version 2
|
|
725
938
|
*/
|
|
726
939
|
class Amp2 {
|
|
727
940
|
|
|
@@ -745,26 +958,29 @@ class Amp2 {
|
|
|
745
958
|
wasm.__wbg_amp2_free(ptr, 0);
|
|
746
959
|
}
|
|
747
960
|
/**
|
|
961
|
+
* Create a new AMP2 client with the default url and server key for the testnet network.
|
|
748
962
|
* @returns {Amp2}
|
|
749
963
|
*/
|
|
750
|
-
static
|
|
751
|
-
const ret = wasm.
|
|
964
|
+
static newTestnet() {
|
|
965
|
+
const ret = wasm.amp2_newTestnet();
|
|
752
966
|
return Amp2.__wrap(ret);
|
|
753
967
|
}
|
|
754
968
|
/**
|
|
969
|
+
* Get an AMP2 wallet descriptor from the keyorigin xpub string obtained from a signer
|
|
755
970
|
* @param {string} keyorigin_xpub
|
|
756
971
|
* @returns {Amp2Descriptor}
|
|
757
972
|
*/
|
|
758
|
-
|
|
973
|
+
descriptorFromStr(keyorigin_xpub) {
|
|
759
974
|
const ptr0 = passStringToWasm0(keyorigin_xpub, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
760
975
|
const len0 = WASM_VECTOR_LEN;
|
|
761
|
-
const ret = wasm.
|
|
976
|
+
const ret = wasm.amp2_descriptorFromStr(this.__wbg_ptr, ptr0, len0);
|
|
762
977
|
if (ret[2]) {
|
|
763
978
|
throw takeFromExternrefTable0(ret[1]);
|
|
764
979
|
}
|
|
765
980
|
return Amp2Descriptor.__wrap(ret[0]);
|
|
766
981
|
}
|
|
767
982
|
/**
|
|
983
|
+
* Register an AMP2 wallet with the AMP2 server
|
|
768
984
|
* @param {Amp2Descriptor} desc
|
|
769
985
|
* @returns {Promise<string>}
|
|
770
986
|
*/
|
|
@@ -774,6 +990,7 @@ class Amp2 {
|
|
|
774
990
|
return ret;
|
|
775
991
|
}
|
|
776
992
|
/**
|
|
993
|
+
* Ask the AMP2 server to cosign a PSET
|
|
777
994
|
* @param {Pset} pset
|
|
778
995
|
* @returns {Promise<Pset>}
|
|
779
996
|
*/
|
|
@@ -789,7 +1006,7 @@ const Amp2DescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
789
1006
|
? { register: () => {}, unregister: () => {} }
|
|
790
1007
|
: new FinalizationRegistry(ptr => wasm.__wbg_amp2descriptor_free(ptr >>> 0, 1));
|
|
791
1008
|
/**
|
|
792
|
-
*
|
|
1009
|
+
* An Asset Management Platform version 2 descriptor
|
|
793
1010
|
*/
|
|
794
1011
|
class Amp2Descriptor {
|
|
795
1012
|
|
|
@@ -813,6 +1030,7 @@ class Amp2Descriptor {
|
|
|
813
1030
|
wasm.__wbg_amp2descriptor_free(ptr, 0);
|
|
814
1031
|
}
|
|
815
1032
|
/**
|
|
1033
|
+
* Return the descriptor as a `WolletDescriptor`
|
|
816
1034
|
* @returns {WolletDescriptor}
|
|
817
1035
|
*/
|
|
818
1036
|
descriptor() {
|
|
@@ -820,6 +1038,7 @@ class Amp2Descriptor {
|
|
|
820
1038
|
return WolletDescriptor.__wrap(ret);
|
|
821
1039
|
}
|
|
822
1040
|
/**
|
|
1041
|
+
* Return the string representation of the descriptor.
|
|
823
1042
|
* @returns {string}
|
|
824
1043
|
*/
|
|
825
1044
|
toString() {
|
|
@@ -841,7 +1060,7 @@ const AssetAmountFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
841
1060
|
? { register: () => {}, unregister: () => {} }
|
|
842
1061
|
: new FinalizationRegistry(ptr => wasm.__wbg_assetamount_free(ptr >>> 0, 1));
|
|
843
1062
|
/**
|
|
844
|
-
*
|
|
1063
|
+
* An asset identifier and an amount in satoshi units
|
|
845
1064
|
*/
|
|
846
1065
|
class AssetAmount {
|
|
847
1066
|
|
|
@@ -885,7 +1104,7 @@ const AssetIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
885
1104
|
? { register: () => {}, unregister: () => {} }
|
|
886
1105
|
: new FinalizationRegistry(ptr => wasm.__wbg_assetid_free(ptr >>> 0, 1));
|
|
887
1106
|
/**
|
|
888
|
-
* A valid asset identifier.
|
|
1107
|
+
* A valid asset identifier.
|
|
889
1108
|
*
|
|
890
1109
|
* 32 bytes encoded as hex string.
|
|
891
1110
|
*/
|
|
@@ -926,6 +1145,8 @@ class AssetId {
|
|
|
926
1145
|
return this;
|
|
927
1146
|
}
|
|
928
1147
|
/**
|
|
1148
|
+
* Return the string representation of the asset identifier (64 hex characters).
|
|
1149
|
+
* This representation can be used to recreate the asset identifier via `new()`
|
|
929
1150
|
* @returns {string}
|
|
930
1151
|
*/
|
|
931
1152
|
toString() {
|
|
@@ -947,7 +1168,7 @@ const AssetIdsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
947
1168
|
? { register: () => {}, unregister: () => {} }
|
|
948
1169
|
: new FinalizationRegistry(ptr => wasm.__wbg_assetids_free(ptr >>> 0, 1));
|
|
949
1170
|
/**
|
|
950
|
-
*
|
|
1171
|
+
* An ordered collection of asset identifiers.
|
|
951
1172
|
*/
|
|
952
1173
|
class AssetIds {
|
|
953
1174
|
|
|
@@ -971,6 +1192,7 @@ class AssetIds {
|
|
|
971
1192
|
wasm.__wbg_assetids_free(ptr, 0);
|
|
972
1193
|
}
|
|
973
1194
|
/**
|
|
1195
|
+
* Return an empty list of asset identifiers.
|
|
974
1196
|
* @returns {AssetIds}
|
|
975
1197
|
*/
|
|
976
1198
|
static empty() {
|
|
@@ -981,6 +1203,7 @@ class AssetIds {
|
|
|
981
1203
|
return AssetIds.__wrap(ret[0]);
|
|
982
1204
|
}
|
|
983
1205
|
/**
|
|
1206
|
+
* Return the string representation of this list of asset identifiers.
|
|
984
1207
|
* @returns {string}
|
|
985
1208
|
*/
|
|
986
1209
|
toString() {
|
|
@@ -1001,7 +1224,11 @@ module.exports.AssetIds = AssetIds;
|
|
|
1001
1224
|
const AssetMetaFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1002
1225
|
? { register: () => {}, unregister: () => {} }
|
|
1003
1226
|
: new FinalizationRegistry(ptr => wasm.__wbg_assetmeta_free(ptr >>> 0, 1));
|
|
1004
|
-
|
|
1227
|
+
/**
|
|
1228
|
+
* Data related to an asset in the registry:
|
|
1229
|
+
* - contract: the contract of the asset
|
|
1230
|
+
* - tx: the issuance transaction of the asset
|
|
1231
|
+
*/
|
|
1005
1232
|
class AssetMeta {
|
|
1006
1233
|
|
|
1007
1234
|
static __wrap(ptr) {
|
|
@@ -1024,6 +1251,7 @@ class AssetMeta {
|
|
|
1024
1251
|
wasm.__wbg_assetmeta_free(ptr, 0);
|
|
1025
1252
|
}
|
|
1026
1253
|
/**
|
|
1254
|
+
* Return the contract of the asset.
|
|
1027
1255
|
* @returns {Contract}
|
|
1028
1256
|
*/
|
|
1029
1257
|
contract() {
|
|
@@ -1031,6 +1259,7 @@ class AssetMeta {
|
|
|
1031
1259
|
return Contract.__wrap(ret);
|
|
1032
1260
|
}
|
|
1033
1261
|
/**
|
|
1262
|
+
* Return the issuance transaction of the asset.
|
|
1034
1263
|
* @returns {Transaction}
|
|
1035
1264
|
*/
|
|
1036
1265
|
tx() {
|
|
@@ -1040,11 +1269,83 @@ class AssetMeta {
|
|
|
1040
1269
|
}
|
|
1041
1270
|
module.exports.AssetMeta = AssetMeta;
|
|
1042
1271
|
|
|
1272
|
+
const BalanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1273
|
+
? { register: () => {}, unregister: () => {} }
|
|
1274
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_balance_free(ptr >>> 0, 1));
|
|
1275
|
+
/**
|
|
1276
|
+
* A signed balance of assets, to represent a balance with negative values such
|
|
1277
|
+
* as the results of a transaction from the perspective of a wallet.
|
|
1278
|
+
*/
|
|
1279
|
+
class Balance {
|
|
1280
|
+
|
|
1281
|
+
static __wrap(ptr) {
|
|
1282
|
+
ptr = ptr >>> 0;
|
|
1283
|
+
const obj = Object.create(Balance.prototype);
|
|
1284
|
+
obj.__wbg_ptr = ptr;
|
|
1285
|
+
BalanceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1286
|
+
return obj;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
__destroy_into_raw() {
|
|
1290
|
+
const ptr = this.__wbg_ptr;
|
|
1291
|
+
this.__wbg_ptr = 0;
|
|
1292
|
+
BalanceFinalization.unregister(this);
|
|
1293
|
+
return ptr;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
free() {
|
|
1297
|
+
const ptr = this.__destroy_into_raw();
|
|
1298
|
+
wasm.__wbg_balance_free(ptr, 0);
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Convert the balance to a JsValue for serialization
|
|
1302
|
+
*
|
|
1303
|
+
* Note: the amounts are strings since `JSON.stringify` cannot handle `BigInt`s.
|
|
1304
|
+
* Use `entries()` to get the raw data.
|
|
1305
|
+
* @returns {any}
|
|
1306
|
+
*/
|
|
1307
|
+
toJSON() {
|
|
1308
|
+
const ret = wasm.balance_toJSON(this.__wbg_ptr);
|
|
1309
|
+
if (ret[2]) {
|
|
1310
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1311
|
+
}
|
|
1312
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Returns the balance as an array of [key, value] pairs.
|
|
1316
|
+
* @returns {any}
|
|
1317
|
+
*/
|
|
1318
|
+
entries() {
|
|
1319
|
+
const ret = wasm.balance_entries(this.__wbg_ptr);
|
|
1320
|
+
if (ret[2]) {
|
|
1321
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1322
|
+
}
|
|
1323
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Return the string representation of the balance.
|
|
1327
|
+
* @returns {string}
|
|
1328
|
+
*/
|
|
1329
|
+
toString() {
|
|
1330
|
+
let deferred1_0;
|
|
1331
|
+
let deferred1_1;
|
|
1332
|
+
try {
|
|
1333
|
+
const ret = wasm.balance_toString(this.__wbg_ptr);
|
|
1334
|
+
deferred1_0 = ret[0];
|
|
1335
|
+
deferred1_1 = ret[1];
|
|
1336
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1337
|
+
} finally {
|
|
1338
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
module.exports.Balance = Balance;
|
|
1343
|
+
|
|
1043
1344
|
const BipFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1044
1345
|
? { register: () => {}, unregister: () => {} }
|
|
1045
1346
|
: new FinalizationRegistry(ptr => wasm.__wbg_bip_free(ptr >>> 0, 1));
|
|
1046
1347
|
/**
|
|
1047
|
-
*
|
|
1348
|
+
* The bip variant for a descriptor like specified in the bips (49, 84, 87)
|
|
1048
1349
|
*/
|
|
1049
1350
|
class Bip {
|
|
1050
1351
|
|
|
@@ -1092,6 +1393,7 @@ class Bip {
|
|
|
1092
1393
|
return Bip.__wrap(ret);
|
|
1093
1394
|
}
|
|
1094
1395
|
/**
|
|
1396
|
+
* Return the string representation of the bip variant, such as "bip49", "bip84" or "bip87"
|
|
1095
1397
|
* @returns {string}
|
|
1096
1398
|
*/
|
|
1097
1399
|
toString() {
|
|
@@ -1113,7 +1415,7 @@ const ContractFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1113
1415
|
? { register: () => {}, unregister: () => {} }
|
|
1114
1416
|
: new FinalizationRegistry(ptr => wasm.__wbg_contract_free(ptr >>> 0, 1));
|
|
1115
1417
|
/**
|
|
1116
|
-
*
|
|
1418
|
+
* A contract defining metadata of an asset such the name and the ticker
|
|
1117
1419
|
*/
|
|
1118
1420
|
class Contract {
|
|
1119
1421
|
|
|
@@ -1163,6 +1465,7 @@ class Contract {
|
|
|
1163
1465
|
return this;
|
|
1164
1466
|
}
|
|
1165
1467
|
/**
|
|
1468
|
+
* Return the string representation of the contract.
|
|
1166
1469
|
* @returns {string}
|
|
1167
1470
|
*/
|
|
1168
1471
|
toString() {
|
|
@@ -1178,6 +1481,7 @@ class Contract {
|
|
|
1178
1481
|
}
|
|
1179
1482
|
}
|
|
1180
1483
|
/**
|
|
1484
|
+
* Return the domain of the issuer of the contract.
|
|
1181
1485
|
* @returns {string}
|
|
1182
1486
|
*/
|
|
1183
1487
|
domain() {
|
|
@@ -1193,6 +1497,10 @@ class Contract {
|
|
|
1193
1497
|
}
|
|
1194
1498
|
}
|
|
1195
1499
|
/**
|
|
1500
|
+
* Make a copy of the contract.
|
|
1501
|
+
*
|
|
1502
|
+
* This is needed to pass it to a function that requires a `Contract` (without borrowing)
|
|
1503
|
+
* but you need the same contract after that call.
|
|
1196
1504
|
* @returns {Contract}
|
|
1197
1505
|
*/
|
|
1198
1506
|
clone() {
|
|
@@ -1206,7 +1514,10 @@ const EsploraClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1206
1514
|
? { register: () => {}, unregister: () => {} }
|
|
1207
1515
|
: new FinalizationRegistry(ptr => wasm.__wbg_esploraclient_free(ptr >>> 0, 1));
|
|
1208
1516
|
/**
|
|
1209
|
-
*
|
|
1517
|
+
* A blockchain backend implementation based on the
|
|
1518
|
+
* [esplora HTTP API](https://github.com/blockstream/esplora/blob/master/API.md).
|
|
1519
|
+
* But can also use the [waterfalls](https://github.com/RCasatta/waterfalls)
|
|
1520
|
+
* endpoint to speed up the scan if supported by the server.
|
|
1210
1521
|
*/
|
|
1211
1522
|
class EsploraClient {
|
|
1212
1523
|
|
|
@@ -1230,7 +1541,7 @@ class EsploraClient {
|
|
|
1230
1541
|
wasm.__wbg_esploraclient_free(ptr, 0);
|
|
1231
1542
|
}
|
|
1232
1543
|
/**
|
|
1233
|
-
* Creates
|
|
1544
|
+
* Creates an Esplora client with the given options
|
|
1234
1545
|
* @param {Network} network
|
|
1235
1546
|
* @param {string} url
|
|
1236
1547
|
* @param {boolean} waterfalls
|
|
@@ -1250,6 +1561,16 @@ class EsploraClient {
|
|
|
1250
1561
|
return this;
|
|
1251
1562
|
}
|
|
1252
1563
|
/**
|
|
1564
|
+
* Scan the blockchain for the scripts generated by a watch-only wallet
|
|
1565
|
+
*
|
|
1566
|
+
* This method scans both external and internal address chains, stopping after finding
|
|
1567
|
+
* 20 consecutive unused addresses (the gap limit) as recommended by
|
|
1568
|
+
* [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#address-gap-limit).
|
|
1569
|
+
*
|
|
1570
|
+
* Returns `Some(Update)` if any changes were found during scanning, or `None` if no changes
|
|
1571
|
+
* were detected.
|
|
1572
|
+
*
|
|
1573
|
+
* To scan beyond the gap limit use `full_scan_to_index()` instead.
|
|
1253
1574
|
* @param {Wollet} wollet
|
|
1254
1575
|
* @returns {Promise<Update | undefined>}
|
|
1255
1576
|
*/
|
|
@@ -1260,6 +1581,19 @@ class EsploraClient {
|
|
|
1260
1581
|
}
|
|
1261
1582
|
/**
|
|
1262
1583
|
* Scan the blockchain for the scripts generated by a watch-only wallet up to a specified derivation index
|
|
1584
|
+
*
|
|
1585
|
+
* While `full_scan()` stops after finding 20 consecutive unused addresses (the gap limit),
|
|
1586
|
+
* this method will scan at least up to the given derivation index. This is useful to prevent
|
|
1587
|
+
* missing funds in cases where outputs exist beyond the gap limit.
|
|
1588
|
+
*
|
|
1589
|
+
* Will scan both external and internal address chains up to the given index for maximum safety,
|
|
1590
|
+
* even though internal addresses may not need such deep scanning.
|
|
1591
|
+
*
|
|
1592
|
+
* If transactions are found beyond the gap limit during this scan, subsequent calls to
|
|
1593
|
+
* `full_scan()` will automatically scan up to the highest used index, preventing any
|
|
1594
|
+
* previously-found transactions from being missed.
|
|
1595
|
+
*
|
|
1596
|
+
* See `full_scan_to_index()` for a blocking version of this method.
|
|
1263
1597
|
* @param {Wollet} wollet
|
|
1264
1598
|
* @param {number} index
|
|
1265
1599
|
* @returns {Promise<Update | undefined>}
|
|
@@ -1270,6 +1604,7 @@ class EsploraClient {
|
|
|
1270
1604
|
return ret;
|
|
1271
1605
|
}
|
|
1272
1606
|
/**
|
|
1607
|
+
* Broadcast a transaction to the network so that a miner can include it in a block.
|
|
1273
1608
|
* @param {Transaction} tx
|
|
1274
1609
|
* @returns {Promise<Txid>}
|
|
1275
1610
|
*/
|
|
@@ -1279,6 +1614,7 @@ class EsploraClient {
|
|
|
1279
1614
|
return ret;
|
|
1280
1615
|
}
|
|
1281
1616
|
/**
|
|
1617
|
+
* Broadcast a PSET by extracting the transaction from the PSET and broadcasting it.
|
|
1282
1618
|
* @param {Pset} pset
|
|
1283
1619
|
* @returns {Promise<Txid>}
|
|
1284
1620
|
*/
|
|
@@ -1288,13 +1624,14 @@ class EsploraClient {
|
|
|
1288
1624
|
return ret;
|
|
1289
1625
|
}
|
|
1290
1626
|
/**
|
|
1627
|
+
* Set the waterfalls server recipient key. This is used to encrypt the descriptor when calling the waterfalls endpoint.
|
|
1291
1628
|
* @param {string} recipient
|
|
1292
1629
|
* @returns {Promise<void>}
|
|
1293
1630
|
*/
|
|
1294
|
-
|
|
1631
|
+
setWaterfallsServerRecipient(recipient) {
|
|
1295
1632
|
const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1296
1633
|
const len0 = WASM_VECTOR_LEN;
|
|
1297
|
-
const ret = wasm.
|
|
1634
|
+
const ret = wasm.esploraclient_setWaterfallsServerRecipient(this.__wbg_ptr, ptr0, len0);
|
|
1298
1635
|
return ret;
|
|
1299
1636
|
}
|
|
1300
1637
|
}
|
|
@@ -1304,7 +1641,7 @@ const IssuanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1304
1641
|
? { register: () => {}, unregister: () => {} }
|
|
1305
1642
|
: new FinalizationRegistry(ptr => wasm.__wbg_issuance_free(ptr >>> 0, 1));
|
|
1306
1643
|
/**
|
|
1307
|
-
*
|
|
1644
|
+
* The details of an issuance or reissuance.
|
|
1308
1645
|
*/
|
|
1309
1646
|
class Issuance {
|
|
1310
1647
|
|
|
@@ -1328,6 +1665,7 @@ class Issuance {
|
|
|
1328
1665
|
wasm.__wbg_issuance_free(ptr, 0);
|
|
1329
1666
|
}
|
|
1330
1667
|
/**
|
|
1668
|
+
* Return the asset id or None if it's a null issuance
|
|
1331
1669
|
* @returns {AssetId | undefined}
|
|
1332
1670
|
*/
|
|
1333
1671
|
asset() {
|
|
@@ -1335,6 +1673,7 @@ class Issuance {
|
|
|
1335
1673
|
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
1336
1674
|
}
|
|
1337
1675
|
/**
|
|
1676
|
+
* Return the token id or None if it's a null issuance
|
|
1338
1677
|
* @returns {AssetId | undefined}
|
|
1339
1678
|
*/
|
|
1340
1679
|
token() {
|
|
@@ -1342,6 +1681,7 @@ class Issuance {
|
|
|
1342
1681
|
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
1343
1682
|
}
|
|
1344
1683
|
/**
|
|
1684
|
+
* Return the previous output index or None if it's a null issuance
|
|
1345
1685
|
* @returns {number | undefined}
|
|
1346
1686
|
*/
|
|
1347
1687
|
prevVout() {
|
|
@@ -1349,6 +1689,7 @@ class Issuance {
|
|
|
1349
1689
|
return ret === 0x100000001 ? undefined : ret;
|
|
1350
1690
|
}
|
|
1351
1691
|
/**
|
|
1692
|
+
* Return the previous transaction id or None if it's a null issuance
|
|
1352
1693
|
* @returns {Txid | undefined}
|
|
1353
1694
|
*/
|
|
1354
1695
|
prevTxid() {
|
|
@@ -1356,6 +1697,7 @@ class Issuance {
|
|
|
1356
1697
|
return ret === 0 ? undefined : Txid.__wrap(ret);
|
|
1357
1698
|
}
|
|
1358
1699
|
/**
|
|
1700
|
+
* Return true if this is effectively an issuance
|
|
1359
1701
|
* @returns {boolean}
|
|
1360
1702
|
*/
|
|
1361
1703
|
isIssuance() {
|
|
@@ -1363,6 +1705,7 @@ class Issuance {
|
|
|
1363
1705
|
return ret !== 0;
|
|
1364
1706
|
}
|
|
1365
1707
|
/**
|
|
1708
|
+
* Return true if this is effectively a reissuance
|
|
1366
1709
|
* @returns {boolean}
|
|
1367
1710
|
*/
|
|
1368
1711
|
isReissuance() {
|
|
@@ -1376,7 +1719,7 @@ const JadeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1376
1719
|
? { register: () => {}, unregister: () => {} }
|
|
1377
1720
|
: new FinalizationRegistry(ptr => wasm.__wbg_jade_free(ptr >>> 0, 1));
|
|
1378
1721
|
/**
|
|
1379
|
-
*
|
|
1722
|
+
* A Jade hardware wallet usable via Web Serial
|
|
1380
1723
|
*/
|
|
1381
1724
|
class Jade {
|
|
1382
1725
|
|
|
@@ -1529,7 +1872,7 @@ const JadeWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1529
1872
|
? { register: () => {}, unregister: () => {} }
|
|
1530
1873
|
: new FinalizationRegistry(ptr => wasm.__wbg_jadewebsocket_free(ptr >>> 0, 1));
|
|
1531
1874
|
/**
|
|
1532
|
-
* WebSocket-based
|
|
1875
|
+
* WebSocket-based `Jade` useful for testing in the browser with the Jade emulator.
|
|
1533
1876
|
*/
|
|
1534
1877
|
class JadeWebSocket {
|
|
1535
1878
|
|
|
@@ -1774,7 +2117,9 @@ const MnemonicFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1774
2117
|
? { register: () => {}, unregister: () => {} }
|
|
1775
2118
|
: new FinalizationRegistry(ptr => wasm.__wbg_mnemonic_free(ptr >>> 0, 1));
|
|
1776
2119
|
/**
|
|
1777
|
-
*
|
|
2120
|
+
* A mnemonic secret code used as a master secret for a bip39 wallet.
|
|
2121
|
+
*
|
|
2122
|
+
* Supported number of words are 12, 15, 18, 21, and 24.
|
|
1778
2123
|
*/
|
|
1779
2124
|
class Mnemonic {
|
|
1780
2125
|
|
|
@@ -1813,6 +2158,10 @@ class Mnemonic {
|
|
|
1813
2158
|
return this;
|
|
1814
2159
|
}
|
|
1815
2160
|
/**
|
|
2161
|
+
* Return the string representation of the Mnemonic.
|
|
2162
|
+
* This representation can be used to recreate the Mnemonic via `new()`
|
|
2163
|
+
*
|
|
2164
|
+
* Note this is secret information, do not log it.
|
|
1816
2165
|
* @returns {string}
|
|
1817
2166
|
*/
|
|
1818
2167
|
toString() {
|
|
@@ -1860,7 +2209,7 @@ const NetworkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1860
2209
|
? { register: () => {}, unregister: () => {} }
|
|
1861
2210
|
: new FinalizationRegistry(ptr => wasm.__wbg_network_free(ptr >>> 0, 1));
|
|
1862
2211
|
/**
|
|
1863
|
-
*
|
|
2212
|
+
* The network of the elements blockchain such as mainnet, testnet or regtest.
|
|
1864
2213
|
*/
|
|
1865
2214
|
class Network {
|
|
1866
2215
|
|
|
@@ -1918,6 +2267,7 @@ class Network {
|
|
|
1918
2267
|
return Network.__wrap(ret);
|
|
1919
2268
|
}
|
|
1920
2269
|
/**
|
|
2270
|
+
* Return the default esplora client for this network
|
|
1921
2271
|
* @returns {EsploraClient}
|
|
1922
2272
|
*/
|
|
1923
2273
|
defaultEsploraClient() {
|
|
@@ -1925,6 +2275,7 @@ class Network {
|
|
|
1925
2275
|
return EsploraClient.__wrap(ret);
|
|
1926
2276
|
}
|
|
1927
2277
|
/**
|
|
2278
|
+
* Return true if the network is a mainnet network
|
|
1928
2279
|
* @returns {boolean}
|
|
1929
2280
|
*/
|
|
1930
2281
|
isMainnet() {
|
|
@@ -1932,6 +2283,7 @@ class Network {
|
|
|
1932
2283
|
return ret !== 0;
|
|
1933
2284
|
}
|
|
1934
2285
|
/**
|
|
2286
|
+
* Return true if the network is a testnet network
|
|
1935
2287
|
* @returns {boolean}
|
|
1936
2288
|
*/
|
|
1937
2289
|
isTestnet() {
|
|
@@ -1939,6 +2291,7 @@ class Network {
|
|
|
1939
2291
|
return ret !== 0;
|
|
1940
2292
|
}
|
|
1941
2293
|
/**
|
|
2294
|
+
* Return true if the network is a regtest network
|
|
1942
2295
|
* @returns {boolean}
|
|
1943
2296
|
*/
|
|
1944
2297
|
isRegtest() {
|
|
@@ -1946,6 +2299,7 @@ class Network {
|
|
|
1946
2299
|
return ret !== 0;
|
|
1947
2300
|
}
|
|
1948
2301
|
/**
|
|
2302
|
+
* Return a string representation of the network, like "liquid", "liquid-testnet" or "liquid-regtest"
|
|
1949
2303
|
* @returns {string}
|
|
1950
2304
|
*/
|
|
1951
2305
|
toString() {
|
|
@@ -1961,6 +2315,7 @@ class Network {
|
|
|
1961
2315
|
}
|
|
1962
2316
|
}
|
|
1963
2317
|
/**
|
|
2318
|
+
* Return the policy asset for this network
|
|
1964
2319
|
* @returns {AssetId}
|
|
1965
2320
|
*/
|
|
1966
2321
|
policyAsset() {
|
|
@@ -1968,6 +2323,7 @@ class Network {
|
|
|
1968
2323
|
return AssetId.__wrap(ret);
|
|
1969
2324
|
}
|
|
1970
2325
|
/**
|
|
2326
|
+
* Return the transaction builder for this network
|
|
1971
2327
|
* @returns {TxBuilder}
|
|
1972
2328
|
*/
|
|
1973
2329
|
txBuilder() {
|
|
@@ -1975,6 +2331,7 @@ class Network {
|
|
|
1975
2331
|
return TxBuilder.__wrap(ret);
|
|
1976
2332
|
}
|
|
1977
2333
|
/**
|
|
2334
|
+
* Return the default explorer URL for this network
|
|
1978
2335
|
* @returns {string}
|
|
1979
2336
|
*/
|
|
1980
2337
|
defaultExplorerUrl() {
|
|
@@ -2021,6 +2378,7 @@ class OptionWalletTxOut {
|
|
|
2021
2378
|
wasm.__wbg_optionwallettxout_free(ptr, 0);
|
|
2022
2379
|
}
|
|
2023
2380
|
/**
|
|
2381
|
+
* Return a copy of the WalletTxOut if it exists, otherwise None
|
|
2024
2382
|
* @returns {WalletTxOut | undefined}
|
|
2025
2383
|
*/
|
|
2026
2384
|
get() {
|
|
@@ -2034,7 +2392,7 @@ const OutPointFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2034
2392
|
? { register: () => {}, unregister: () => {} }
|
|
2035
2393
|
: new FinalizationRegistry(ptr => wasm.__wbg_outpoint_free(ptr >>> 0, 1));
|
|
2036
2394
|
/**
|
|
2037
|
-
*
|
|
2395
|
+
* A reference to a transaction output
|
|
2038
2396
|
*/
|
|
2039
2397
|
class OutPoint {
|
|
2040
2398
|
|
|
@@ -2080,6 +2438,7 @@ class OutPoint {
|
|
|
2080
2438
|
return this;
|
|
2081
2439
|
}
|
|
2082
2440
|
/**
|
|
2441
|
+
* Return the transaction identifier.
|
|
2083
2442
|
* @returns {Txid}
|
|
2084
2443
|
*/
|
|
2085
2444
|
txid() {
|
|
@@ -2087,6 +2446,7 @@ class OutPoint {
|
|
|
2087
2446
|
return Txid.__wrap(ret);
|
|
2088
2447
|
}
|
|
2089
2448
|
/**
|
|
2449
|
+
* Return the output index.
|
|
2090
2450
|
* @returns {number}
|
|
2091
2451
|
*/
|
|
2092
2452
|
vout() {
|
|
@@ -2100,7 +2460,9 @@ const PrecisionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2100
2460
|
? { register: () => {}, unregister: () => {} }
|
|
2101
2461
|
: new FinalizationRegistry(ptr => wasm.__wbg_precision_free(ptr >>> 0, 1));
|
|
2102
2462
|
/**
|
|
2103
|
-
*
|
|
2463
|
+
* Helper to convert satoshi values of an asset to the value with the given precision and viceversa.
|
|
2464
|
+
*
|
|
2465
|
+
* For example 100 satoshi with precision 2 is "1.00"
|
|
2104
2466
|
*/
|
|
2105
2467
|
class Precision {
|
|
2106
2468
|
|
|
@@ -2116,7 +2478,8 @@ class Precision {
|
|
|
2116
2478
|
wasm.__wbg_precision_free(ptr, 0);
|
|
2117
2479
|
}
|
|
2118
2480
|
/**
|
|
2119
|
-
*
|
|
2481
|
+
* Create a new Precision, useful to encode e decode values for assets with precision.
|
|
2482
|
+
* erroring if the given precision is greater than the allowed maximum (8)
|
|
2120
2483
|
* @param {number} precision
|
|
2121
2484
|
*/
|
|
2122
2485
|
constructor(precision) {
|
|
@@ -2129,6 +2492,9 @@ class Precision {
|
|
|
2129
2492
|
return this;
|
|
2130
2493
|
}
|
|
2131
2494
|
/**
|
|
2495
|
+
* Convert the given satoshi value to the formatted value according to our precision
|
|
2496
|
+
*
|
|
2497
|
+
* For example 100 satoshi with precision 2 is "1.00"
|
|
2132
2498
|
* @param {bigint} sats
|
|
2133
2499
|
* @returns {string}
|
|
2134
2500
|
*/
|
|
@@ -2145,6 +2511,9 @@ class Precision {
|
|
|
2145
2511
|
}
|
|
2146
2512
|
}
|
|
2147
2513
|
/**
|
|
2514
|
+
* Convert the given string with precision to satoshi units.
|
|
2515
|
+
*
|
|
2516
|
+
* For example the string "1.00" of an asset with precision 2 is 100 satoshi.
|
|
2148
2517
|
* @param {string} sats
|
|
2149
2518
|
* @returns {bigint}
|
|
2150
2519
|
*/
|
|
@@ -2164,7 +2533,7 @@ const PsetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2164
2533
|
? { register: () => {}, unregister: () => {} }
|
|
2165
2534
|
: new FinalizationRegistry(ptr => wasm.__wbg_pset_free(ptr >>> 0, 1));
|
|
2166
2535
|
/**
|
|
2167
|
-
* Partially Signed Elements Transaction
|
|
2536
|
+
* Partially Signed Elements Transaction
|
|
2168
2537
|
*/
|
|
2169
2538
|
class Pset {
|
|
2170
2539
|
|
|
@@ -2188,7 +2557,7 @@ class Pset {
|
|
|
2188
2557
|
wasm.__wbg_pset_free(ptr, 0);
|
|
2189
2558
|
}
|
|
2190
2559
|
/**
|
|
2191
|
-
* Creates a `Pset`
|
|
2560
|
+
* Creates a `Pset` from its base64 string representation.
|
|
2192
2561
|
* @param {string} base64
|
|
2193
2562
|
*/
|
|
2194
2563
|
constructor(base64) {
|
|
@@ -2203,6 +2572,8 @@ class Pset {
|
|
|
2203
2572
|
return this;
|
|
2204
2573
|
}
|
|
2205
2574
|
/**
|
|
2575
|
+
* Return a base64 string representation of the Pset.
|
|
2576
|
+
* The string can be used to re-create the Pset via `new()`
|
|
2206
2577
|
* @returns {string}
|
|
2207
2578
|
*/
|
|
2208
2579
|
toString() {
|
|
@@ -2218,6 +2589,8 @@ class Pset {
|
|
|
2218
2589
|
}
|
|
2219
2590
|
}
|
|
2220
2591
|
/**
|
|
2592
|
+
* Extract the Transaction from a Pset by filling in
|
|
2593
|
+
* the available signature information in place.
|
|
2221
2594
|
* @returns {Transaction}
|
|
2222
2595
|
*/
|
|
2223
2596
|
extractTx() {
|
|
@@ -2228,6 +2601,7 @@ class Pset {
|
|
|
2228
2601
|
return Transaction.__wrap(ret[0]);
|
|
2229
2602
|
}
|
|
2230
2603
|
/**
|
|
2604
|
+
* Attempt to merge with another `Pset`.
|
|
2231
2605
|
* @param {Pset} other
|
|
2232
2606
|
*/
|
|
2233
2607
|
combine(other) {
|
|
@@ -2239,6 +2613,7 @@ class Pset {
|
|
|
2239
2613
|
}
|
|
2240
2614
|
}
|
|
2241
2615
|
/**
|
|
2616
|
+
* Return a copy of the inputs of this PSET
|
|
2242
2617
|
* @returns {PsetInput[]}
|
|
2243
2618
|
*/
|
|
2244
2619
|
inputs() {
|
|
@@ -2248,6 +2623,7 @@ class Pset {
|
|
|
2248
2623
|
return v1;
|
|
2249
2624
|
}
|
|
2250
2625
|
/**
|
|
2626
|
+
* Return a copy of the outputs of this PSET
|
|
2251
2627
|
* @returns {PsetOutput[]}
|
|
2252
2628
|
*/
|
|
2253
2629
|
outputs() {
|
|
@@ -2263,7 +2639,11 @@ const PsetBalanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2263
2639
|
? { register: () => {}, unregister: () => {} }
|
|
2264
2640
|
: new FinalizationRegistry(ptr => wasm.__wbg_psetbalance_free(ptr >>> 0, 1));
|
|
2265
2641
|
/**
|
|
2266
|
-
*
|
|
2642
|
+
* The details regarding balance and amounts in a PSET:
|
|
2643
|
+
*
|
|
2644
|
+
* - The fee of the transaction in the PSET
|
|
2645
|
+
* - The net balance of the assets in the PSET from the point of view of the wallet
|
|
2646
|
+
* - The outputs going out of the wallet
|
|
2267
2647
|
*/
|
|
2268
2648
|
class PsetBalance {
|
|
2269
2649
|
|
|
@@ -2295,14 +2675,11 @@ class PsetBalance {
|
|
|
2295
2675
|
}
|
|
2296
2676
|
/**
|
|
2297
2677
|
* The net balance for every asset with respect of the wallet asking the pset details
|
|
2298
|
-
* @returns {
|
|
2678
|
+
* @returns {Balance}
|
|
2299
2679
|
*/
|
|
2300
2680
|
balances() {
|
|
2301
2681
|
const ret = wasm.psetbalance_balances(this.__wbg_ptr);
|
|
2302
|
-
|
|
2303
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
2304
|
-
}
|
|
2305
|
-
return takeFromExternrefTable0(ret[0]);
|
|
2682
|
+
return Balance.__wrap(ret);
|
|
2306
2683
|
}
|
|
2307
2684
|
/**
|
|
2308
2685
|
* @returns {Recipient[]}
|
|
@@ -2320,7 +2697,11 @@ const PsetDetailsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2320
2697
|
? { register: () => {}, unregister: () => {} }
|
|
2321
2698
|
: new FinalizationRegistry(ptr => wasm.__wbg_psetdetails_free(ptr >>> 0, 1));
|
|
2322
2699
|
/**
|
|
2323
|
-
*
|
|
2700
|
+
* The details of a Partially Signed Elements Transaction:
|
|
2701
|
+
*
|
|
2702
|
+
* - the net balance from the point of view of the wallet
|
|
2703
|
+
* - the available and missing signatures for each input
|
|
2704
|
+
* - for issuances and reissuances transactions contains the issuance or reissuance details
|
|
2324
2705
|
*/
|
|
2325
2706
|
class PsetDetails {
|
|
2326
2707
|
|
|
@@ -2344,6 +2725,8 @@ class PsetDetails {
|
|
|
2344
2725
|
wasm.__wbg_psetdetails_free(ptr, 0);
|
|
2345
2726
|
}
|
|
2346
2727
|
/**
|
|
2728
|
+
* Return the balance of the PSET from the point of view of the wallet
|
|
2729
|
+
* that generated this via `psetDetails()`
|
|
2347
2730
|
* @returns {PsetBalance}
|
|
2348
2731
|
*/
|
|
2349
2732
|
balance() {
|
|
@@ -2361,6 +2744,7 @@ class PsetDetails {
|
|
|
2361
2744
|
return v1;
|
|
2362
2745
|
}
|
|
2363
2746
|
/**
|
|
2747
|
+
* Set of fingerprints for which the PSET is missing a signature
|
|
2364
2748
|
* @returns {string[]}
|
|
2365
2749
|
*/
|
|
2366
2750
|
fingerprintsMissing() {
|
|
@@ -2370,6 +2754,7 @@ class PsetDetails {
|
|
|
2370
2754
|
return v1;
|
|
2371
2755
|
}
|
|
2372
2756
|
/**
|
|
2757
|
+
* List of fingerprints for which the PSET has a signature
|
|
2373
2758
|
* @returns {string[]}
|
|
2374
2759
|
*/
|
|
2375
2760
|
fingerprintsHas() {
|
|
@@ -2422,16 +2807,16 @@ class PsetInput {
|
|
|
2422
2807
|
* Prevout TXID of the input
|
|
2423
2808
|
* @returns {Txid}
|
|
2424
2809
|
*/
|
|
2425
|
-
|
|
2426
|
-
const ret = wasm.
|
|
2810
|
+
previousTxid() {
|
|
2811
|
+
const ret = wasm.psetinput_previousTxid(this.__wbg_ptr);
|
|
2427
2812
|
return Txid.__wrap(ret);
|
|
2428
2813
|
}
|
|
2429
2814
|
/**
|
|
2430
2815
|
* Prevout vout of the input
|
|
2431
2816
|
* @returns {number}
|
|
2432
2817
|
*/
|
|
2433
|
-
|
|
2434
|
-
const ret = wasm.
|
|
2818
|
+
previousVout() {
|
|
2819
|
+
const ret = wasm.psetinput_previousVout(this.__wbg_ptr);
|
|
2435
2820
|
return ret >>> 0;
|
|
2436
2821
|
}
|
|
2437
2822
|
/**
|
|
@@ -2483,8 +2868,8 @@ class PsetOutput {
|
|
|
2483
2868
|
/**
|
|
2484
2869
|
* @returns {Script}
|
|
2485
2870
|
*/
|
|
2486
|
-
|
|
2487
|
-
const ret = wasm.
|
|
2871
|
+
scriptPubkey() {
|
|
2872
|
+
const ret = wasm.psetoutput_scriptPubkey(this.__wbg_ptr);
|
|
2488
2873
|
return Script.__wrap(ret);
|
|
2489
2874
|
}
|
|
2490
2875
|
}
|
|
@@ -2494,7 +2879,7 @@ const PsetSignaturesFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2494
2879
|
? { register: () => {}, unregister: () => {} }
|
|
2495
2880
|
: new FinalizationRegistry(ptr => wasm.__wbg_psetsignatures_free(ptr >>> 0, 1));
|
|
2496
2881
|
/**
|
|
2497
|
-
*
|
|
2882
|
+
* The details of the signatures in a PSET, divided in available and missing signatures.
|
|
2498
2883
|
*/
|
|
2499
2884
|
class PsetSignatures {
|
|
2500
2885
|
|
|
@@ -2596,7 +2981,9 @@ module.exports.Recipient = Recipient;
|
|
|
2596
2981
|
const RegistryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2597
2982
|
? { register: () => {}, unregister: () => {} }
|
|
2598
2983
|
: new FinalizationRegistry(ptr => wasm.__wbg_registry_free(ptr >>> 0, 1));
|
|
2599
|
-
|
|
2984
|
+
/**
|
|
2985
|
+
* A Registry, a repository to store and retrieve asset metadata, like the name or the ticker of an asset.
|
|
2986
|
+
*/
|
|
2600
2987
|
class Registry {
|
|
2601
2988
|
|
|
2602
2989
|
static __wrap(ptr) {
|
|
@@ -2619,6 +3006,9 @@ class Registry {
|
|
|
2619
3006
|
wasm.__wbg_registry_free(ptr, 0);
|
|
2620
3007
|
}
|
|
2621
3008
|
/**
|
|
3009
|
+
* Create a new registry cache specifying the URL of the registry,
|
|
3010
|
+
* fetch the assets metadata identified by the given asset ids and cache them for later local retrieval.
|
|
3011
|
+
* Use `default_for_network()` to get the default registry for the given network.
|
|
2622
3012
|
* @param {string} url
|
|
2623
3013
|
* @param {AssetIds} asset_ids
|
|
2624
3014
|
* @returns {Promise<Registry>}
|
|
@@ -2631,6 +3021,9 @@ class Registry {
|
|
|
2631
3021
|
return ret;
|
|
2632
3022
|
}
|
|
2633
3023
|
/**
|
|
3024
|
+
* Return the default registry for the given network,
|
|
3025
|
+
* fetch the assets metadata identified by the given asset ids and cache them for later local retrieval.
|
|
3026
|
+
* Use `new()` to specify a custom URL
|
|
2634
3027
|
* @param {Network} network
|
|
2635
3028
|
* @param {AssetIds} asset_ids
|
|
2636
3029
|
* @returns {Promise<Registry>}
|
|
@@ -2642,6 +3035,9 @@ class Registry {
|
|
|
2642
3035
|
return ret;
|
|
2643
3036
|
}
|
|
2644
3037
|
/**
|
|
3038
|
+
* Create a new registry cache, using only the hardcoded assets.
|
|
3039
|
+
*
|
|
3040
|
+
* Hardcoded assets are the policy assets (LBTC, tLBTC, rLBTC) and the USDT asset on mainnet.
|
|
2645
3041
|
* @param {Network} network
|
|
2646
3042
|
* @returns {Registry}
|
|
2647
3043
|
*/
|
|
@@ -2654,6 +3050,7 @@ class Registry {
|
|
|
2654
3050
|
return Registry.__wrap(ret[0]);
|
|
2655
3051
|
}
|
|
2656
3052
|
/**
|
|
3053
|
+
* Fetch the contract and the issuance transaction of the given asset id from the registry
|
|
2657
3054
|
* @param {AssetId} asset_id
|
|
2658
3055
|
* @param {EsploraClient} client
|
|
2659
3056
|
* @returns {Promise<AssetMeta>}
|
|
@@ -2665,6 +3062,7 @@ class Registry {
|
|
|
2665
3062
|
return ret;
|
|
2666
3063
|
}
|
|
2667
3064
|
/**
|
|
3065
|
+
* Post a contract to the registry for registration.
|
|
2668
3066
|
* @param {RegistryPost} data
|
|
2669
3067
|
* @returns {Promise<void>}
|
|
2670
3068
|
*/
|
|
@@ -2674,6 +3072,7 @@ class Registry {
|
|
|
2674
3072
|
return ret;
|
|
2675
3073
|
}
|
|
2676
3074
|
/**
|
|
3075
|
+
* Return the asset metadata related to the given asset id if it exists in this registry.
|
|
2677
3076
|
* @param {AssetId} asset_id
|
|
2678
3077
|
* @returns {RegistryData | undefined}
|
|
2679
3078
|
*/
|
|
@@ -2683,6 +3082,8 @@ class Registry {
|
|
|
2683
3082
|
return ret === 0 ? undefined : RegistryData.__wrap(ret);
|
|
2684
3083
|
}
|
|
2685
3084
|
/**
|
|
3085
|
+
* Return the asset metadata related to the given token id,
|
|
3086
|
+
* in other words `token_id` is the reissuance token of the returned asset
|
|
2686
3087
|
* @param {AssetId} token_id
|
|
2687
3088
|
* @returns {RegistryData | undefined}
|
|
2688
3089
|
*/
|
|
@@ -2692,6 +3093,10 @@ class Registry {
|
|
|
2692
3093
|
return ret === 0 ? undefined : RegistryData.__wrap(ret);
|
|
2693
3094
|
}
|
|
2694
3095
|
/**
|
|
3096
|
+
* Add the contracts information of the assets used in the Pset
|
|
3097
|
+
* if available in this registry.
|
|
3098
|
+
* Without the contract information, the partially signed transaction
|
|
3099
|
+
* is valid but will not show asset information when signed with an hardware wallet.
|
|
2695
3100
|
* @param {Pset} pset
|
|
2696
3101
|
* @returns {Pset}
|
|
2697
3102
|
*/
|
|
@@ -2790,7 +3195,9 @@ module.exports.RegistryData = RegistryData;
|
|
|
2790
3195
|
const RegistryPostFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2791
3196
|
? { register: () => {}, unregister: () => {} }
|
|
2792
3197
|
: new FinalizationRegistry(ptr => wasm.__wbg_registrypost_free(ptr >>> 0, 1));
|
|
2793
|
-
|
|
3198
|
+
/**
|
|
3199
|
+
* The data to post to the registry to publish a contract for an asset id
|
|
3200
|
+
*/
|
|
2794
3201
|
class RegistryPost {
|
|
2795
3202
|
|
|
2796
3203
|
__destroy_into_raw() {
|
|
@@ -2805,6 +3212,7 @@ class RegistryPost {
|
|
|
2805
3212
|
wasm.__wbg_registrypost_free(ptr, 0);
|
|
2806
3213
|
}
|
|
2807
3214
|
/**
|
|
3215
|
+
* Create a new registry post object to be used to publish a contract for an asset id in the registry.
|
|
2808
3216
|
* @param {Contract} contract
|
|
2809
3217
|
* @param {AssetId} asset_id
|
|
2810
3218
|
*/
|
|
@@ -2819,6 +3227,7 @@ class RegistryPost {
|
|
|
2819
3227
|
return this;
|
|
2820
3228
|
}
|
|
2821
3229
|
/**
|
|
3230
|
+
* Return a string representation of the registry post (mostly for debugging).
|
|
2822
3231
|
* @returns {string}
|
|
2823
3232
|
*/
|
|
2824
3233
|
toString() {
|
|
@@ -2840,7 +3249,7 @@ const ScriptFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2840
3249
|
? { register: () => {}, unregister: () => {} }
|
|
2841
3250
|
: new FinalizationRegistry(ptr => wasm.__wbg_script_free(ptr >>> 0, 1));
|
|
2842
3251
|
/**
|
|
2843
|
-
*
|
|
3252
|
+
* An Elements (Liquid) script
|
|
2844
3253
|
*/
|
|
2845
3254
|
class Script {
|
|
2846
3255
|
|
|
@@ -2864,7 +3273,7 @@ class Script {
|
|
|
2864
3273
|
wasm.__wbg_script_free(ptr, 0);
|
|
2865
3274
|
}
|
|
2866
3275
|
/**
|
|
2867
|
-
* Creates a `Script`
|
|
3276
|
+
* Creates a `Script` from its hex string representation.
|
|
2868
3277
|
* @param {string} s
|
|
2869
3278
|
*/
|
|
2870
3279
|
constructor(s) {
|
|
@@ -2879,6 +3288,7 @@ class Script {
|
|
|
2879
3288
|
return this;
|
|
2880
3289
|
}
|
|
2881
3290
|
/**
|
|
3291
|
+
* Return the consensus encoded bytes of the script.
|
|
2882
3292
|
* @returns {Uint8Array}
|
|
2883
3293
|
*/
|
|
2884
3294
|
bytes() {
|
|
@@ -2888,6 +3298,9 @@ class Script {
|
|
|
2888
3298
|
return v1;
|
|
2889
3299
|
}
|
|
2890
3300
|
/**
|
|
3301
|
+
* Return the string of the script showing op codes and their arguments.
|
|
3302
|
+
*
|
|
3303
|
+
* For example: "OP_DUP OP_HASH160 OP_PUSHBYTES_20 088ac47276d105b91cf9aa27a00112421dd5f23c OP_EQUALVERIFY OP_CHECKSIG"
|
|
2891
3304
|
* @returns {string}
|
|
2892
3305
|
*/
|
|
2893
3306
|
asm() {
|
|
@@ -2903,6 +3316,8 @@ class Script {
|
|
|
2903
3316
|
}
|
|
2904
3317
|
}
|
|
2905
3318
|
/**
|
|
3319
|
+
* Return the string representation of the script (hex encoding of its consensus encoded bytes).
|
|
3320
|
+
* This representation can be used to recreate the script via `new()`
|
|
2906
3321
|
* @returns {string}
|
|
2907
3322
|
*/
|
|
2908
3323
|
toString() {
|
|
@@ -2924,7 +3339,7 @@ const SignerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2924
3339
|
? { register: () => {}, unregister: () => {} }
|
|
2925
3340
|
: new FinalizationRegistry(ptr => wasm.__wbg_signer_free(ptr >>> 0, 1));
|
|
2926
3341
|
/**
|
|
2927
|
-
* A Software signer
|
|
3342
|
+
* A Software signer.
|
|
2928
3343
|
*/
|
|
2929
3344
|
class Signer {
|
|
2930
3345
|
|
|
@@ -2939,6 +3354,65 @@ class Signer {
|
|
|
2939
3354
|
const ptr = this.__destroy_into_raw();
|
|
2940
3355
|
wasm.__wbg_signer_free(ptr, 0);
|
|
2941
3356
|
}
|
|
3357
|
+
/**
|
|
3358
|
+
* AMP0 signer data for login
|
|
3359
|
+
* @returns {Amp0SignerData}
|
|
3360
|
+
*/
|
|
3361
|
+
amp0SignerData() {
|
|
3362
|
+
const ret = wasm.signer_amp0SignerData(this.__wbg_ptr);
|
|
3363
|
+
if (ret[2]) {
|
|
3364
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3365
|
+
}
|
|
3366
|
+
return Amp0SignerData.__wrap(ret[0]);
|
|
3367
|
+
}
|
|
3368
|
+
/**
|
|
3369
|
+
* AMP0 sign login challenge
|
|
3370
|
+
* @param {string} challenge
|
|
3371
|
+
* @returns {string}
|
|
3372
|
+
*/
|
|
3373
|
+
amp0SignChallenge(challenge) {
|
|
3374
|
+
let deferred3_0;
|
|
3375
|
+
let deferred3_1;
|
|
3376
|
+
try {
|
|
3377
|
+
const ptr0 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3379
|
+
const ret = wasm.signer_amp0SignChallenge(this.__wbg_ptr, ptr0, len0);
|
|
3380
|
+
var ptr2 = ret[0];
|
|
3381
|
+
var len2 = ret[1];
|
|
3382
|
+
if (ret[3]) {
|
|
3383
|
+
ptr2 = 0; len2 = 0;
|
|
3384
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3385
|
+
}
|
|
3386
|
+
deferred3_0 = ptr2;
|
|
3387
|
+
deferred3_1 = len2;
|
|
3388
|
+
return getStringFromWasm0(ptr2, len2);
|
|
3389
|
+
} finally {
|
|
3390
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* AMP0 account xpub
|
|
3395
|
+
* @param {number} account
|
|
3396
|
+
* @returns {string}
|
|
3397
|
+
*/
|
|
3398
|
+
amp0AccountXpub(account) {
|
|
3399
|
+
let deferred2_0;
|
|
3400
|
+
let deferred2_1;
|
|
3401
|
+
try {
|
|
3402
|
+
const ret = wasm.signer_amp0AccountXpub(this.__wbg_ptr, account);
|
|
3403
|
+
var ptr1 = ret[0];
|
|
3404
|
+
var len1 = ret[1];
|
|
3405
|
+
if (ret[3]) {
|
|
3406
|
+
ptr1 = 0; len1 = 0;
|
|
3407
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3408
|
+
}
|
|
3409
|
+
deferred2_0 = ptr1;
|
|
3410
|
+
deferred2_1 = len1;
|
|
3411
|
+
return getStringFromWasm0(ptr1, len1);
|
|
3412
|
+
} finally {
|
|
3413
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
2942
3416
|
/**
|
|
2943
3417
|
* Creates a `Signer`
|
|
2944
3418
|
* @param {Mnemonic} mnemonic
|
|
@@ -2995,6 +3469,7 @@ class Signer {
|
|
|
2995
3469
|
}
|
|
2996
3470
|
}
|
|
2997
3471
|
/**
|
|
3472
|
+
* Return the witness public key hash, slip77 descriptor of this signer
|
|
2998
3473
|
* @returns {WolletDescriptor}
|
|
2999
3474
|
*/
|
|
3000
3475
|
wpkhSlip77Descriptor() {
|
|
@@ -3005,6 +3480,7 @@ class Signer {
|
|
|
3005
3480
|
return WolletDescriptor.__wrap(ret[0]);
|
|
3006
3481
|
}
|
|
3007
3482
|
/**
|
|
3483
|
+
* Return the extended public key of the signer
|
|
3008
3484
|
* @returns {Xpub}
|
|
3009
3485
|
*/
|
|
3010
3486
|
getMasterXpub() {
|
|
@@ -3015,6 +3491,7 @@ class Signer {
|
|
|
3015
3491
|
return Xpub.__wrap(ret[0]);
|
|
3016
3492
|
}
|
|
3017
3493
|
/**
|
|
3494
|
+
* Return keyorigin and xpub, like "[73c5da0a/84h/1h/0h]tpub..."
|
|
3018
3495
|
* @param {Bip} bip
|
|
3019
3496
|
* @returns {string}
|
|
3020
3497
|
*/
|
|
@@ -3038,6 +3515,7 @@ class Signer {
|
|
|
3038
3515
|
}
|
|
3039
3516
|
}
|
|
3040
3517
|
/**
|
|
3518
|
+
* Return the mnemonic of the signer
|
|
3041
3519
|
* @returns {Mnemonic}
|
|
3042
3520
|
*/
|
|
3043
3521
|
mnemonic() {
|
|
@@ -3092,7 +3570,7 @@ const TipFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3092
3570
|
? { register: () => {}, unregister: () => {} }
|
|
3093
3571
|
: new FinalizationRegistry(ptr => wasm.__wbg_tip_free(ptr >>> 0, 1));
|
|
3094
3572
|
/**
|
|
3095
|
-
*
|
|
3573
|
+
* Blockchain tip, the highest valid block in the blockchain
|
|
3096
3574
|
*/
|
|
3097
3575
|
class Tip {
|
|
3098
3576
|
|
|
@@ -3151,9 +3629,9 @@ const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3151
3629
|
? { register: () => {}, unregister: () => {} }
|
|
3152
3630
|
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
|
3153
3631
|
/**
|
|
3154
|
-
* A Liquid transaction
|
|
3632
|
+
* A Liquid transaction
|
|
3155
3633
|
*
|
|
3156
|
-
* See
|
|
3634
|
+
* See `WalletTx` for the transaction as seen from the perspective of the wallet
|
|
3157
3635
|
* where you can actually see unblinded amounts and tx net-balance.
|
|
3158
3636
|
*/
|
|
3159
3637
|
class Transaction {
|
|
@@ -3193,6 +3671,7 @@ class Transaction {
|
|
|
3193
3671
|
return this;
|
|
3194
3672
|
}
|
|
3195
3673
|
/**
|
|
3674
|
+
* Return the transaction identifier.
|
|
3196
3675
|
* @returns {Txid}
|
|
3197
3676
|
*/
|
|
3198
3677
|
txid() {
|
|
@@ -3200,6 +3679,7 @@ class Transaction {
|
|
|
3200
3679
|
return Txid.__wrap(ret);
|
|
3201
3680
|
}
|
|
3202
3681
|
/**
|
|
3682
|
+
* Return the consensus encoded bytes of the transaction.
|
|
3203
3683
|
* @returns {Uint8Array}
|
|
3204
3684
|
*/
|
|
3205
3685
|
bytes() {
|
|
@@ -3209,6 +3689,8 @@ class Transaction {
|
|
|
3209
3689
|
return v1;
|
|
3210
3690
|
}
|
|
3211
3691
|
/**
|
|
3692
|
+
* Return the fee of the transaction in the given asset.
|
|
3693
|
+
* At the moment the only asset that can be used as fee is the policy asset (LBTC for mainnet).
|
|
3212
3694
|
* @param {AssetId} policy_asset
|
|
3213
3695
|
* @returns {bigint}
|
|
3214
3696
|
*/
|
|
@@ -3218,6 +3700,7 @@ class Transaction {
|
|
|
3218
3700
|
return BigInt.asUintN(64, ret);
|
|
3219
3701
|
}
|
|
3220
3702
|
/**
|
|
3703
|
+
* Return the hex representation of the transaction. More precisely, they are the consensus encoded bytes of the transaction converted in hex.
|
|
3221
3704
|
* @returns {string}
|
|
3222
3705
|
*/
|
|
3223
3706
|
toString() {
|
|
@@ -3239,7 +3722,7 @@ const TxBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3239
3722
|
? { register: () => {}, unregister: () => {} }
|
|
3240
3723
|
: new FinalizationRegistry(ptr => wasm.__wbg_txbuilder_free(ptr >>> 0, 1));
|
|
3241
3724
|
/**
|
|
3242
|
-
*
|
|
3725
|
+
* A transaction builder
|
|
3243
3726
|
*/
|
|
3244
3727
|
class TxBuilder {
|
|
3245
3728
|
|
|
@@ -3399,7 +3882,18 @@ class TxBuilder {
|
|
|
3399
3882
|
return TxBuilder.__wrap(ret[0]);
|
|
3400
3883
|
}
|
|
3401
3884
|
/**
|
|
3402
|
-
* Issue an asset
|
|
3885
|
+
* Issue an asset
|
|
3886
|
+
*
|
|
3887
|
+
* There will be `asset_sats` units of this asset that will be received by
|
|
3888
|
+
* `asset_receiver` if it's set, otherwise to an address of the wallet generating the issuance.
|
|
3889
|
+
*
|
|
3890
|
+
* There will be `token_sats` reissuance tokens that allow token holder to reissue the created
|
|
3891
|
+
* asset. Reissuance token will be received by `token_receiver` if it's some, or to an
|
|
3892
|
+
* address of the wallet generating the issuance if none.
|
|
3893
|
+
*
|
|
3894
|
+
* If a `contract` is provided, it's metadata will be committed in the generated asset id.
|
|
3895
|
+
*
|
|
3896
|
+
* Can't be used if `reissue_asset` has been called
|
|
3403
3897
|
* @param {bigint} asset_sats
|
|
3404
3898
|
* @param {Address | null | undefined} asset_receiver
|
|
3405
3899
|
* @param {bigint} token_sats
|
|
@@ -3431,7 +3925,17 @@ class TxBuilder {
|
|
|
3431
3925
|
return TxBuilder.__wrap(ret[0]);
|
|
3432
3926
|
}
|
|
3433
3927
|
/**
|
|
3434
|
-
* Reissue an asset
|
|
3928
|
+
* Reissue an asset
|
|
3929
|
+
*
|
|
3930
|
+
* reissue the asset defined by `asset_to_reissue`, provided the reissuance token is owned
|
|
3931
|
+
* by the wallet generating te reissuance.
|
|
3932
|
+
*
|
|
3933
|
+
* Generated transaction will create `satoshi_to_reissue` new asset units, and they will be
|
|
3934
|
+
* sent to the provided `asset_receiver` address if some, or to an address from the wallet
|
|
3935
|
+
* generating the reissuance transaction if none.
|
|
3936
|
+
*
|
|
3937
|
+
* If the issuance transaction does not involve this wallet,
|
|
3938
|
+
* pass the issuance transaction in `issuance_tx`.
|
|
3435
3939
|
* @param {AssetId} asset_to_reissue
|
|
3436
3940
|
* @param {bigint} satoshi_to_reissue
|
|
3437
3941
|
* @param {Address | null} [asset_receiver]
|
|
@@ -3459,7 +3963,17 @@ class TxBuilder {
|
|
|
3459
3963
|
return TxBuilder.__wrap(ret[0]);
|
|
3460
3964
|
}
|
|
3461
3965
|
/**
|
|
3462
|
-
*
|
|
3966
|
+
* Switch to manual coin selection by giving a list of internal UTXOs to use.
|
|
3967
|
+
*
|
|
3968
|
+
* All passed UTXOs are added to the transaction.
|
|
3969
|
+
* No other wallet UTXO is added to the transaction, caller is supposed to add enough UTXOs to
|
|
3970
|
+
* cover for all recipients and fees.
|
|
3971
|
+
*
|
|
3972
|
+
* This method never fails, any error will be raised in [`TxBuilder::finish`].
|
|
3973
|
+
*
|
|
3974
|
+
* Possible errors:
|
|
3975
|
+
* * OutPoint doesn't belong to the wallet
|
|
3976
|
+
* * Insufficient funds (remember to include L-BTC utxos for fees)
|
|
3463
3977
|
* @param {OutPoint[]} outpoints
|
|
3464
3978
|
* @returns {TxBuilder}
|
|
3465
3979
|
*/
|
|
@@ -3471,6 +3985,7 @@ class TxBuilder {
|
|
|
3471
3985
|
return TxBuilder.__wrap(ret);
|
|
3472
3986
|
}
|
|
3473
3987
|
/**
|
|
3988
|
+
* Return a string representation of the transaction builder (mostly for debugging)
|
|
3474
3989
|
* @returns {string}
|
|
3475
3990
|
*/
|
|
3476
3991
|
toString() {
|
|
@@ -3486,6 +4001,8 @@ class TxBuilder {
|
|
|
3486
4001
|
}
|
|
3487
4002
|
}
|
|
3488
4003
|
/**
|
|
4004
|
+
* Set data to create a PSET from which you
|
|
4005
|
+
* can create a LiquiDEX proposal
|
|
3489
4006
|
* @param {OutPoint} utxo
|
|
3490
4007
|
* @param {Address} address
|
|
3491
4008
|
* @param {bigint} satoshi
|
|
@@ -3507,6 +4024,7 @@ class TxBuilder {
|
|
|
3507
4024
|
return TxBuilder.__wrap(ret[0]);
|
|
3508
4025
|
}
|
|
3509
4026
|
/**
|
|
4027
|
+
* Set data to take LiquiDEX proposals
|
|
3510
4028
|
* @param {ValidatedLiquidexProposal[]} proposals
|
|
3511
4029
|
* @returns {TxBuilder}
|
|
3512
4030
|
*/
|
|
@@ -3527,7 +4045,7 @@ const TxOutSecretsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3527
4045
|
? { register: () => {}, unregister: () => {} }
|
|
3528
4046
|
: new FinalizationRegistry(ptr => wasm.__wbg_txoutsecrets_free(ptr >>> 0, 1));
|
|
3529
4047
|
/**
|
|
3530
|
-
*
|
|
4048
|
+
* Contains unblinded information such as the asset and the value of a transaction output
|
|
3531
4049
|
*/
|
|
3532
4050
|
class TxOutSecrets {
|
|
3533
4051
|
|
|
@@ -3551,6 +4069,7 @@ class TxOutSecrets {
|
|
|
3551
4069
|
wasm.__wbg_txoutsecrets_free(ptr, 0);
|
|
3552
4070
|
}
|
|
3553
4071
|
/**
|
|
4072
|
+
* Return the asset of the output.
|
|
3554
4073
|
* @returns {AssetId}
|
|
3555
4074
|
*/
|
|
3556
4075
|
asset() {
|
|
@@ -3558,6 +4077,7 @@ class TxOutSecrets {
|
|
|
3558
4077
|
return AssetId.__wrap(ret);
|
|
3559
4078
|
}
|
|
3560
4079
|
/**
|
|
4080
|
+
* Return the asset blinding factor as a hex string.
|
|
3561
4081
|
* @returns {string}
|
|
3562
4082
|
*/
|
|
3563
4083
|
assetBlindingFactor() {
|
|
@@ -3573,6 +4093,7 @@ class TxOutSecrets {
|
|
|
3573
4093
|
}
|
|
3574
4094
|
}
|
|
3575
4095
|
/**
|
|
4096
|
+
* Return the value of the output.
|
|
3576
4097
|
* @returns {bigint}
|
|
3577
4098
|
*/
|
|
3578
4099
|
value() {
|
|
@@ -3580,6 +4101,7 @@ class TxOutSecrets {
|
|
|
3580
4101
|
return BigInt.asUintN(64, ret);
|
|
3581
4102
|
}
|
|
3582
4103
|
/**
|
|
4104
|
+
* Return the value blinding factor as a hex string.
|
|
3583
4105
|
* @returns {string}
|
|
3584
4106
|
*/
|
|
3585
4107
|
valueBlindingFactor() {
|
|
@@ -3595,6 +4117,7 @@ class TxOutSecrets {
|
|
|
3595
4117
|
}
|
|
3596
4118
|
}
|
|
3597
4119
|
/**
|
|
4120
|
+
* Return true if the output is explicit (no blinding factors).
|
|
3598
4121
|
* @returns {boolean}
|
|
3599
4122
|
*/
|
|
3600
4123
|
isExplicit() {
|
|
@@ -3670,7 +4193,7 @@ class Txid {
|
|
|
3670
4193
|
wasm.__wbg_txid_free(ptr, 0);
|
|
3671
4194
|
}
|
|
3672
4195
|
/**
|
|
3673
|
-
* Creates a `Txid`
|
|
4196
|
+
* Creates a `Txid` from its hex string representation (64 characters).
|
|
3674
4197
|
* @param {string} tx_id
|
|
3675
4198
|
*/
|
|
3676
4199
|
constructor(tx_id) {
|
|
@@ -3685,6 +4208,8 @@ class Txid {
|
|
|
3685
4208
|
return this;
|
|
3686
4209
|
}
|
|
3687
4210
|
/**
|
|
4211
|
+
* Return the string representation of the transaction identifier as shown in the explorer.
|
|
4212
|
+
* This representation can be used to recreate the transaction identifier via `new()`
|
|
3688
4213
|
* @returns {string}
|
|
3689
4214
|
*/
|
|
3690
4215
|
toString() {
|
|
@@ -3706,7 +4231,16 @@ const UnvalidatedLiquidexProposalFinalization = (typeof FinalizationRegistry ===
|
|
|
3706
4231
|
? { register: () => {}, unregister: () => {} }
|
|
3707
4232
|
: new FinalizationRegistry(ptr => wasm.__wbg_unvalidatedliquidexproposal_free(ptr >>> 0, 1));
|
|
3708
4233
|
/**
|
|
3709
|
-
*
|
|
4234
|
+
* LiquiDEX swap proposal
|
|
4235
|
+
*
|
|
4236
|
+
* A LiquiDEX swap proposal is a transaction with one input and one output created by the "maker".
|
|
4237
|
+
* The transaction "swaps" the input for the output, meaning that the "maker" sends the input and
|
|
4238
|
+
* receives the output.
|
|
4239
|
+
* However the transaction is incomplete (unbalanced and without a fee output), thus it cannot be
|
|
4240
|
+
* broadcast.
|
|
4241
|
+
* The "taker" can "complete" the transaction (using [`crate::TxBuilder::liquidex_take()`]) by
|
|
4242
|
+
* adding more inputs and more outputs to balance the amounts, meaning that the "taker" sends the
|
|
4243
|
+
* output and receives the input.
|
|
3710
4244
|
*/
|
|
3711
4245
|
class UnvalidatedLiquidexProposal {
|
|
3712
4246
|
|
|
@@ -3746,10 +4280,10 @@ class UnvalidatedLiquidexProposal {
|
|
|
3746
4280
|
* @param {Pset} pset
|
|
3747
4281
|
* @returns {UnvalidatedLiquidexProposal}
|
|
3748
4282
|
*/
|
|
3749
|
-
static
|
|
4283
|
+
static fromPset(pset) {
|
|
3750
4284
|
_assertClass(pset, Pset);
|
|
3751
4285
|
var ptr0 = pset.__destroy_into_raw();
|
|
3752
|
-
const ret = wasm.
|
|
4286
|
+
const ret = wasm.unvalidatedliquidexproposal_fromPset(ptr0);
|
|
3753
4287
|
if (ret[2]) {
|
|
3754
4288
|
throw takeFromExternrefTable0(ret[1]);
|
|
3755
4289
|
}
|
|
@@ -3758,9 +4292,9 @@ class UnvalidatedLiquidexProposal {
|
|
|
3758
4292
|
/**
|
|
3759
4293
|
* @returns {ValidatedLiquidexProposal}
|
|
3760
4294
|
*/
|
|
3761
|
-
|
|
4295
|
+
insecureValidate() {
|
|
3762
4296
|
const ptr = this.__destroy_into_raw();
|
|
3763
|
-
const ret = wasm.
|
|
4297
|
+
const ret = wasm.unvalidatedliquidexproposal_insecureValidate(ptr);
|
|
3764
4298
|
if (ret[2]) {
|
|
3765
4299
|
throw takeFromExternrefTable0(ret[1]);
|
|
3766
4300
|
}
|
|
@@ -3802,7 +4336,8 @@ const UpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3802
4336
|
? { register: () => {}, unregister: () => {} }
|
|
3803
4337
|
: new FinalizationRegistry(ptr => wasm.__wbg_update_free(ptr >>> 0, 1));
|
|
3804
4338
|
/**
|
|
3805
|
-
*
|
|
4339
|
+
* An Update contains the delta of information to be applied to the wallet to reach the latest status.
|
|
4340
|
+
* It's created passing a reference to the wallet to the blockchain client
|
|
3806
4341
|
*/
|
|
3807
4342
|
class Update {
|
|
3808
4343
|
|
|
@@ -3841,6 +4376,7 @@ class Update {
|
|
|
3841
4376
|
return this;
|
|
3842
4377
|
}
|
|
3843
4378
|
/**
|
|
4379
|
+
* Serialize an update to a byte array
|
|
3844
4380
|
* @returns {Uint8Array}
|
|
3845
4381
|
*/
|
|
3846
4382
|
serialize() {
|
|
@@ -3853,6 +4389,9 @@ class Update {
|
|
|
3853
4389
|
return v1;
|
|
3854
4390
|
}
|
|
3855
4391
|
/**
|
|
4392
|
+
* Serialize an update to a base64 encoded string,
|
|
4393
|
+
* encrypted with a key derived from the descriptor.
|
|
4394
|
+
* Decrypt using `deserialize_decrypted_base64()`
|
|
3856
4395
|
* @param {WolletDescriptor} desc
|
|
3857
4396
|
* @returns {string}
|
|
3858
4397
|
*/
|
|
@@ -3876,6 +4415,9 @@ class Update {
|
|
|
3876
4415
|
}
|
|
3877
4416
|
}
|
|
3878
4417
|
/**
|
|
4418
|
+
* Deserialize an update from a base64 encoded string,
|
|
4419
|
+
* decrypted with a key derived from the descriptor.
|
|
4420
|
+
* Create the base64 using `serialize_encrypted_base64()`
|
|
3879
4421
|
* @param {string} base64
|
|
3880
4422
|
* @param {WolletDescriptor} desc
|
|
3881
4423
|
* @returns {Update}
|
|
@@ -3891,6 +4433,7 @@ class Update {
|
|
|
3891
4433
|
return Update.__wrap(ret[0]);
|
|
3892
4434
|
}
|
|
3893
4435
|
/**
|
|
4436
|
+
* Whether this update only changes the tip
|
|
3894
4437
|
* @returns {boolean}
|
|
3895
4438
|
*/
|
|
3896
4439
|
onlyTip() {
|
|
@@ -3898,6 +4441,7 @@ class Update {
|
|
|
3898
4441
|
return ret !== 0;
|
|
3899
4442
|
}
|
|
3900
4443
|
/**
|
|
4444
|
+
* Prune the update, removing unneeded data from transactions.
|
|
3901
4445
|
* @param {Wollet} wollet
|
|
3902
4446
|
*/
|
|
3903
4447
|
prune(wollet) {
|
|
@@ -3911,7 +4455,7 @@ const ValidatedLiquidexProposalFinalization = (typeof FinalizationRegistry === '
|
|
|
3911
4455
|
? { register: () => {}, unregister: () => {} }
|
|
3912
4456
|
: new FinalizationRegistry(ptr => wasm.__wbg_validatedliquidexproposal_free(ptr >>> 0, 1));
|
|
3913
4457
|
/**
|
|
3914
|
-
*
|
|
4458
|
+
* Created by validating `UnvalidatedLiquidexProposal` via `validate()` or `insecure_validate()`
|
|
3915
4459
|
*/
|
|
3916
4460
|
class ValidatedLiquidexProposal {
|
|
3917
4461
|
|
|
@@ -3977,7 +4521,9 @@ const WalletTxFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3977
4521
|
? { register: () => {}, unregister: () => {} }
|
|
3978
4522
|
: new FinalizationRegistry(ptr => wasm.__wbg_wallettx_free(ptr >>> 0, 1));
|
|
3979
4523
|
/**
|
|
3980
|
-
*
|
|
4524
|
+
* Value returned by asking transactions to the wallet. Contains details about a transaction
|
|
4525
|
+
* from the perspective of the wallet, for example the net-balance of the transaction for the
|
|
4526
|
+
* wallet.
|
|
3981
4527
|
*/
|
|
3982
4528
|
class WalletTx {
|
|
3983
4529
|
|
|
@@ -4001,6 +4547,7 @@ class WalletTx {
|
|
|
4001
4547
|
wasm.__wbg_wallettx_free(ptr, 0);
|
|
4002
4548
|
}
|
|
4003
4549
|
/**
|
|
4550
|
+
* Return a copy of the transaction.
|
|
4004
4551
|
* @returns {Transaction}
|
|
4005
4552
|
*/
|
|
4006
4553
|
tx() {
|
|
@@ -4008,6 +4555,7 @@ class WalletTx {
|
|
|
4008
4555
|
return Transaction.__wrap(ret);
|
|
4009
4556
|
}
|
|
4010
4557
|
/**
|
|
4558
|
+
* Return the height of the block containing the transaction if it's confirmed.
|
|
4011
4559
|
* @returns {number | undefined}
|
|
4012
4560
|
*/
|
|
4013
4561
|
height() {
|
|
@@ -4015,16 +4563,15 @@ class WalletTx {
|
|
|
4015
4563
|
return ret === 0x100000001 ? undefined : ret;
|
|
4016
4564
|
}
|
|
4017
4565
|
/**
|
|
4018
|
-
*
|
|
4566
|
+
* Return the net balance of the transaction for the wallet.
|
|
4567
|
+
* @returns {Balance}
|
|
4019
4568
|
*/
|
|
4020
4569
|
balance() {
|
|
4021
4570
|
const ret = wasm.wallettx_balance(this.__wbg_ptr);
|
|
4022
|
-
|
|
4023
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4024
|
-
}
|
|
4025
|
-
return takeFromExternrefTable0(ret[0]);
|
|
4571
|
+
return Balance.__wrap(ret);
|
|
4026
4572
|
}
|
|
4027
4573
|
/**
|
|
4574
|
+
* Return the transaction identifier.
|
|
4028
4575
|
* @returns {Txid}
|
|
4029
4576
|
*/
|
|
4030
4577
|
txid() {
|
|
@@ -4032,6 +4579,7 @@ class WalletTx {
|
|
|
4032
4579
|
return Txid.__wrap(ret);
|
|
4033
4580
|
}
|
|
4034
4581
|
/**
|
|
4582
|
+
* Return the fee of the transaction.
|
|
4035
4583
|
* @returns {bigint}
|
|
4036
4584
|
*/
|
|
4037
4585
|
fee() {
|
|
@@ -4039,6 +4587,7 @@ class WalletTx {
|
|
|
4039
4587
|
return BigInt.asUintN(64, ret);
|
|
4040
4588
|
}
|
|
4041
4589
|
/**
|
|
4590
|
+
* Return the type of the transaction. Can be "issuance", "reissuance", "burn", "redeposit", "incoming", "outgoing" or "unknown".
|
|
4042
4591
|
* @returns {string}
|
|
4043
4592
|
*/
|
|
4044
4593
|
txType() {
|
|
@@ -4054,6 +4603,7 @@ class WalletTx {
|
|
|
4054
4603
|
}
|
|
4055
4604
|
}
|
|
4056
4605
|
/**
|
|
4606
|
+
* Return the timestamp of the block containing the transaction if it's confirmed.
|
|
4057
4607
|
* @returns {number | undefined}
|
|
4058
4608
|
*/
|
|
4059
4609
|
timestamp() {
|
|
@@ -4061,6 +4611,9 @@ class WalletTx {
|
|
|
4061
4611
|
return ret === 0x100000001 ? undefined : ret;
|
|
4062
4612
|
}
|
|
4063
4613
|
/**
|
|
4614
|
+
* Return a list with the same number of elements as the inputs of the transaction.
|
|
4615
|
+
* The element in the list is a `WalletTxOut` (the output spent to create the input)
|
|
4616
|
+
* if it belongs to the wallet, while it is None for inputs owned by others
|
|
4064
4617
|
* @returns {OptionWalletTxOut[]}
|
|
4065
4618
|
*/
|
|
4066
4619
|
inputs() {
|
|
@@ -4070,6 +4623,9 @@ class WalletTx {
|
|
|
4070
4623
|
return v1;
|
|
4071
4624
|
}
|
|
4072
4625
|
/**
|
|
4626
|
+
* Return a list with the same number of elements as the outputs of the transaction.
|
|
4627
|
+
* The element in the list is a `WalletTxOut` if it belongs to the wallet,
|
|
4628
|
+
* while it is None for inputs owned by others
|
|
4073
4629
|
* @returns {OptionWalletTxOut[]}
|
|
4074
4630
|
*/
|
|
4075
4631
|
outputs() {
|
|
@@ -4079,6 +4635,8 @@ class WalletTx {
|
|
|
4079
4635
|
return v1;
|
|
4080
4636
|
}
|
|
4081
4637
|
/**
|
|
4638
|
+
* Return the URL to the transaction on the given explorer including the information
|
|
4639
|
+
* needed to unblind the transaction in the explorer UI.
|
|
4082
4640
|
* @param {string} explorer_url
|
|
4083
4641
|
* @returns {string}
|
|
4084
4642
|
*/
|
|
@@ -4103,7 +4661,7 @@ const WalletTxOutFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
4103
4661
|
? { register: () => {}, unregister: () => {} }
|
|
4104
4662
|
: new FinalizationRegistry(ptr => wasm.__wbg_wallettxout_free(ptr >>> 0, 1));
|
|
4105
4663
|
/**
|
|
4106
|
-
*
|
|
4664
|
+
* Details of a wallet transaction output used in `WalletTx`
|
|
4107
4665
|
*/
|
|
4108
4666
|
class WalletTxOut {
|
|
4109
4667
|
|
|
@@ -4127,6 +4685,7 @@ class WalletTxOut {
|
|
|
4127
4685
|
wasm.__wbg_wallettxout_free(ptr, 0);
|
|
4128
4686
|
}
|
|
4129
4687
|
/**
|
|
4688
|
+
* Return the outpoint (txid and vout) of this `WalletTxOut`.
|
|
4130
4689
|
* @returns {OutPoint}
|
|
4131
4690
|
*/
|
|
4132
4691
|
outpoint() {
|
|
@@ -4134,6 +4693,7 @@ class WalletTxOut {
|
|
|
4134
4693
|
return OutPoint.__wrap(ret);
|
|
4135
4694
|
}
|
|
4136
4695
|
/**
|
|
4696
|
+
* Return the script pubkey of the address of this `WalletTxOut`.
|
|
4137
4697
|
* @returns {Script}
|
|
4138
4698
|
*/
|
|
4139
4699
|
scriptPubkey() {
|
|
@@ -4141,6 +4701,7 @@ class WalletTxOut {
|
|
|
4141
4701
|
return Script.__wrap(ret);
|
|
4142
4702
|
}
|
|
4143
4703
|
/**
|
|
4704
|
+
* Return the height of the block containing this output if it's confirmed.
|
|
4144
4705
|
* @returns {number | undefined}
|
|
4145
4706
|
*/
|
|
4146
4707
|
height() {
|
|
@@ -4148,6 +4709,7 @@ class WalletTxOut {
|
|
|
4148
4709
|
return ret === 0x100000001 ? undefined : ret;
|
|
4149
4710
|
}
|
|
4150
4711
|
/**
|
|
4712
|
+
* Return the unblinded values of this `WalletTxOut`.
|
|
4151
4713
|
* @returns {TxOutSecrets}
|
|
4152
4714
|
*/
|
|
4153
4715
|
unblinded() {
|
|
@@ -4155,6 +4717,7 @@ class WalletTxOut {
|
|
|
4155
4717
|
return TxOutSecrets.__wrap(ret);
|
|
4156
4718
|
}
|
|
4157
4719
|
/**
|
|
4720
|
+
* Return the wildcard index used to derive the address of this `WalletTxOut`.
|
|
4158
4721
|
* @returns {number}
|
|
4159
4722
|
*/
|
|
4160
4723
|
wildcardIndex() {
|
|
@@ -4162,6 +4725,7 @@ class WalletTxOut {
|
|
|
4162
4725
|
return ret >>> 0;
|
|
4163
4726
|
}
|
|
4164
4727
|
/**
|
|
4728
|
+
* Return the chain of this `WalletTxOut`. Can be "Chain::External" or "Chain::Internal" (change).
|
|
4165
4729
|
* @returns {Chain}
|
|
4166
4730
|
*/
|
|
4167
4731
|
extInt() {
|
|
@@ -4169,6 +4733,7 @@ class WalletTxOut {
|
|
|
4169
4733
|
return ret;
|
|
4170
4734
|
}
|
|
4171
4735
|
/**
|
|
4736
|
+
* Return the address of this `WalletTxOut`.
|
|
4172
4737
|
* @returns {Address}
|
|
4173
4738
|
*/
|
|
4174
4739
|
address() {
|
|
@@ -4182,7 +4747,7 @@ const WolletFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
4182
4747
|
? { register: () => {}, unregister: () => {} }
|
|
4183
4748
|
: new FinalizationRegistry(ptr => wasm.__wbg_wollet_free(ptr >>> 0, 1));
|
|
4184
4749
|
/**
|
|
4185
|
-
*
|
|
4750
|
+
* A watch-only wallet defined by a CT descriptor.
|
|
4186
4751
|
*/
|
|
4187
4752
|
class Wollet {
|
|
4188
4753
|
|
|
@@ -4237,6 +4802,9 @@ class Wollet {
|
|
|
4237
4802
|
return AddressResult.__wrap(ret[0]);
|
|
4238
4803
|
}
|
|
4239
4804
|
/**
|
|
4805
|
+
* Get the full derivation path for an address
|
|
4806
|
+
*
|
|
4807
|
+
* Note: will be removed once we add the full path to lwk_wollet::AddressResult
|
|
4240
4808
|
* @param {number} index
|
|
4241
4809
|
* @returns {Uint32Array}
|
|
4242
4810
|
*/
|
|
@@ -4250,6 +4818,21 @@ class Wollet {
|
|
|
4250
4818
|
return v1;
|
|
4251
4819
|
}
|
|
4252
4820
|
/**
|
|
4821
|
+
* Apply an update containing blockchain data
|
|
4822
|
+
*
|
|
4823
|
+
* To update the wallet you need to first obtain the blockchain data relevant for the wallet.
|
|
4824
|
+
* This can be done using a `full_scan()`, which
|
|
4825
|
+
* returns an `Update` that contains new transaction and other data relevant for the
|
|
4826
|
+
* wallet.
|
|
4827
|
+
* The update must then be applied to the `Wollet` so that wollet methods such as
|
|
4828
|
+
* `balance()` or `transactions()` include the new data.
|
|
4829
|
+
*
|
|
4830
|
+
* However getting blockchain data involves network calls, so between the full scan start and
|
|
4831
|
+
* when the update is applied it might elapse a significant amount of time.
|
|
4832
|
+
* In that interval, applying any update, or any transaction using `apply_transaction()`,
|
|
4833
|
+
* will cause this function to return a `Error::UpdateOnDifferentStatus`.
|
|
4834
|
+
* Callers should either avoid applying updates and transactions, or they can catch the error
|
|
4835
|
+
* and wait for a new full scan to be completed and applied.
|
|
4253
4836
|
* @param {Update} update
|
|
4254
4837
|
*/
|
|
4255
4838
|
applyUpdate(update) {
|
|
@@ -4260,26 +4843,45 @@ class Wollet {
|
|
|
4260
4843
|
}
|
|
4261
4844
|
}
|
|
4262
4845
|
/**
|
|
4846
|
+
* Apply a transaction to the wallet state
|
|
4847
|
+
*
|
|
4848
|
+
* Wallet transactions are normally obtained using a `full_scan()`
|
|
4849
|
+
* and applying the result with `apply_update()`. However a
|
|
4850
|
+
* full scan involves network calls and it can take a significant amount of time.
|
|
4851
|
+
*
|
|
4852
|
+
* If the caller does not want to wait for a full scan containing the transaction, it can
|
|
4853
|
+
* apply the transaction to the wallet state using this function.
|
|
4854
|
+
*
|
|
4855
|
+
* Note: if this transaction is *not* returned by a next full scan, after `apply_update()` it will disappear from the
|
|
4856
|
+
* transactions list, will not be included in balance computations, and by the remaining
|
|
4857
|
+
* wollet methods.
|
|
4858
|
+
*
|
|
4859
|
+
* Calling this method, might cause `apply_update()` to fail with a
|
|
4860
|
+
* `Error::UpdateOnDifferentStatus`, make sure to either avoid it or handle the error properly.
|
|
4263
4861
|
* @param {Transaction} tx
|
|
4862
|
+
* @returns {Balance}
|
|
4264
4863
|
*/
|
|
4265
4864
|
applyTransaction(tx) {
|
|
4266
4865
|
_assertClass(tx, Transaction);
|
|
4267
4866
|
const ret = wasm.wollet_applyTransaction(this.__wbg_ptr, tx.__wbg_ptr);
|
|
4268
|
-
if (ret[
|
|
4269
|
-
throw takeFromExternrefTable0(ret[
|
|
4867
|
+
if (ret[2]) {
|
|
4868
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4270
4869
|
}
|
|
4870
|
+
return Balance.__wrap(ret[0]);
|
|
4271
4871
|
}
|
|
4272
4872
|
/**
|
|
4273
|
-
*
|
|
4873
|
+
* Get the wallet balance for each assets
|
|
4874
|
+
* @returns {Balance}
|
|
4274
4875
|
*/
|
|
4275
4876
|
balance() {
|
|
4276
4877
|
const ret = wasm.wollet_balance(this.__wbg_ptr);
|
|
4277
4878
|
if (ret[2]) {
|
|
4278
4879
|
throw takeFromExternrefTable0(ret[1]);
|
|
4279
4880
|
}
|
|
4280
|
-
return
|
|
4881
|
+
return Balance.__wrap(ret[0]);
|
|
4281
4882
|
}
|
|
4282
4883
|
/**
|
|
4884
|
+
* Get the asset identifiers owned by the wallet
|
|
4283
4885
|
* @returns {AssetIds}
|
|
4284
4886
|
*/
|
|
4285
4887
|
assetsOwned() {
|
|
@@ -4290,6 +4892,7 @@ class Wollet {
|
|
|
4290
4892
|
return AssetIds.__wrap(ret[0]);
|
|
4291
4893
|
}
|
|
4292
4894
|
/**
|
|
4895
|
+
* Get the wallet transactions
|
|
4293
4896
|
* @returns {WalletTx[]}
|
|
4294
4897
|
*/
|
|
4295
4898
|
transactions() {
|
|
@@ -4342,6 +4945,7 @@ class Wollet {
|
|
|
4342
4945
|
return Pset.__wrap(ret[0]);
|
|
4343
4946
|
}
|
|
4344
4947
|
/**
|
|
4948
|
+
* Get the PSET details with respect to the wallet
|
|
4345
4949
|
* @param {Pset} pset
|
|
4346
4950
|
* @returns {PsetDetails}
|
|
4347
4951
|
*/
|
|
@@ -4354,6 +4958,7 @@ class Wollet {
|
|
|
4354
4958
|
return PsetDetails.__wrap(ret[0]);
|
|
4355
4959
|
}
|
|
4356
4960
|
/**
|
|
4961
|
+
* Get a copy of the wallet descriptor of this wallet.
|
|
4357
4962
|
* @returns {WolletDescriptor}
|
|
4358
4963
|
*/
|
|
4359
4964
|
descriptor() {
|
|
@@ -4364,6 +4969,12 @@ class Wollet {
|
|
|
4364
4969
|
return WolletDescriptor.__wrap(ret[0]);
|
|
4365
4970
|
}
|
|
4366
4971
|
/**
|
|
4972
|
+
* A deterministic value derived from the descriptor, the config and the content of this wollet,
|
|
4973
|
+
* including what's in the wallet store (transactions etc)
|
|
4974
|
+
*
|
|
4975
|
+
* In this case, we don't need cryptographic assurance guaranteed by the std default hasher (siphash)
|
|
4976
|
+
* And we can use a much faster hasher, which is used also in the rust compiler.
|
|
4977
|
+
* ([source](https://nnethercote.github.io/2021/12/08/a-brutally-effective-hash-function-in-rust.html))
|
|
4367
4978
|
* @returns {bigint}
|
|
4368
4979
|
*/
|
|
4369
4980
|
status() {
|
|
@@ -4371,6 +4982,7 @@ class Wollet {
|
|
|
4371
4982
|
return BigInt.asUintN(64, ret);
|
|
4372
4983
|
}
|
|
4373
4984
|
/**
|
|
4985
|
+
* Get the blockchain tip at the time of the last update of this wollet.
|
|
4374
4986
|
* @returns {Tip}
|
|
4375
4987
|
*/
|
|
4376
4988
|
tip() {
|
|
@@ -4378,7 +4990,7 @@ class Wollet {
|
|
|
4378
4990
|
return Tip.__wrap(ret);
|
|
4379
4991
|
}
|
|
4380
4992
|
/**
|
|
4381
|
-
*
|
|
4993
|
+
* Returns true if this wollet has never received an updated applyed to it
|
|
4382
4994
|
* @returns {boolean}
|
|
4383
4995
|
*/
|
|
4384
4996
|
neverScanned() {
|
|
@@ -4400,7 +5012,7 @@ const WolletDescriptorFinalization = (typeof FinalizationRegistry === 'undefined
|
|
|
4400
5012
|
? { register: () => {}, unregister: () => {} }
|
|
4401
5013
|
: new FinalizationRegistry(ptr => wasm.__wbg_wolletdescriptor_free(ptr >>> 0, 1));
|
|
4402
5014
|
/**
|
|
4403
|
-
*
|
|
5015
|
+
* A wrapper that contains only the subset of CT descriptors handled by wollet
|
|
4404
5016
|
*/
|
|
4405
5017
|
class WolletDescriptor {
|
|
4406
5018
|
|
|
@@ -4439,6 +5051,8 @@ class WolletDescriptor {
|
|
|
4439
5051
|
return this;
|
|
4440
5052
|
}
|
|
4441
5053
|
/**
|
|
5054
|
+
* Return the string representation of the descriptor, including the checksum.
|
|
5055
|
+
* This representation can be used to recreate the descriptor via `new()`
|
|
4442
5056
|
* @returns {string}
|
|
4443
5057
|
*/
|
|
4444
5058
|
toString() {
|
|
@@ -4454,6 +5068,9 @@ class WolletDescriptor {
|
|
|
4454
5068
|
}
|
|
4455
5069
|
}
|
|
4456
5070
|
/**
|
|
5071
|
+
* Create a new multisig descriptor, where each participant is a keyorigin_xpub and it requires at least threshold signatures to spend.
|
|
5072
|
+
* Errors if the threshold is 0 or greater than the number of participants.
|
|
5073
|
+
* Uses slip77 for the blinding key.
|
|
4457
5074
|
* @param {number} threshold
|
|
4458
5075
|
* @param {string[]} participants
|
|
4459
5076
|
* @returns {WolletDescriptor}
|
|
@@ -4468,6 +5085,7 @@ class WolletDescriptor {
|
|
|
4468
5085
|
return WolletDescriptor.__wrap(ret[0]);
|
|
4469
5086
|
}
|
|
4470
5087
|
/**
|
|
5088
|
+
* Whether the descriptor is for mainnet
|
|
4471
5089
|
* @returns {boolean}
|
|
4472
5090
|
*/
|
|
4473
5091
|
isMainnet() {
|
|
@@ -4489,7 +5107,7 @@ const XpubFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
4489
5107
|
? { register: () => {}, unregister: () => {} }
|
|
4490
5108
|
: new FinalizationRegistry(ptr => wasm.__wbg_xpub_free(ptr >>> 0, 1));
|
|
4491
5109
|
/**
|
|
4492
|
-
*
|
|
5110
|
+
* An extended public key
|
|
4493
5111
|
*/
|
|
4494
5112
|
class Xpub {
|
|
4495
5113
|
|
|
@@ -4513,7 +5131,7 @@ class Xpub {
|
|
|
4513
5131
|
wasm.__wbg_xpub_free(ptr, 0);
|
|
4514
5132
|
}
|
|
4515
5133
|
/**
|
|
4516
|
-
* Creates a
|
|
5134
|
+
* Creates a Xpub
|
|
4517
5135
|
* @param {string} s
|
|
4518
5136
|
*/
|
|
4519
5137
|
constructor(s) {
|
|
@@ -4528,6 +5146,8 @@ class Xpub {
|
|
|
4528
5146
|
return this;
|
|
4529
5147
|
}
|
|
4530
5148
|
/**
|
|
5149
|
+
* Return the string representation of the Xpub.
|
|
5150
|
+
* This representation can be used to recreate the Xpub via `new()`
|
|
4531
5151
|
* @returns {string}
|
|
4532
5152
|
*/
|
|
4533
5153
|
toString() {
|
|
@@ -4543,6 +5163,8 @@ class Xpub {
|
|
|
4543
5163
|
}
|
|
4544
5164
|
}
|
|
4545
5165
|
/**
|
|
5166
|
+
* Return the identifier of the Xpub.
|
|
5167
|
+
* This is a 40 hex characters string (20 bytes).
|
|
4546
5168
|
* @returns {string}
|
|
4547
5169
|
*/
|
|
4548
5170
|
identifier() {
|
|
@@ -4558,6 +5180,8 @@ class Xpub {
|
|
|
4558
5180
|
}
|
|
4559
5181
|
}
|
|
4560
5182
|
/**
|
|
5183
|
+
* Return the first four bytes of the identifier as hex string
|
|
5184
|
+
* This is a 8 hex characters string (4 bytes).
|
|
4561
5185
|
* @returns {string}
|
|
4562
5186
|
*/
|
|
4563
5187
|
fingerprint() {
|
|
@@ -4573,7 +5197,8 @@ class Xpub {
|
|
|
4573
5197
|
}
|
|
4574
5198
|
}
|
|
4575
5199
|
/**
|
|
4576
|
-
* Returns true if the passed string is a valid xpub with a valid keyorigin if present
|
|
5200
|
+
* Returns true if the passed string is a valid xpub with a valid keyorigin if present.
|
|
5201
|
+
* For example: "[73c5da0a/84h/1h/0h]tpub..."
|
|
4577
5202
|
* @param {string} s
|
|
4578
5203
|
* @returns {boolean}
|
|
4579
5204
|
*/
|
|
@@ -4608,6 +5233,16 @@ module.exports.__wbg_amp0_new = function(arg0) {
|
|
|
4608
5233
|
return ret;
|
|
4609
5234
|
};
|
|
4610
5235
|
|
|
5236
|
+
module.exports.__wbg_amp0connected_new = function(arg0) {
|
|
5237
|
+
const ret = Amp0Connected.__wrap(arg0);
|
|
5238
|
+
return ret;
|
|
5239
|
+
};
|
|
5240
|
+
|
|
5241
|
+
module.exports.__wbg_amp0loggedin_new = function(arg0) {
|
|
5242
|
+
const ret = Amp0LoggedIn.__wrap(arg0);
|
|
5243
|
+
return ret;
|
|
5244
|
+
};
|
|
5245
|
+
|
|
4611
5246
|
module.exports.__wbg_append_8c7dd8d641a5f01b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
4612
5247
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
4613
5248
|
}, arguments) };
|
|
@@ -4652,6 +5287,11 @@ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(fun
|
|
|
4652
5287
|
return ret;
|
|
4653
5288
|
}, arguments) };
|
|
4654
5289
|
|
|
5290
|
+
module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
5291
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
5292
|
+
return ret;
|
|
5293
|
+
}, arguments) };
|
|
5294
|
+
|
|
4655
5295
|
module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
4656
5296
|
const ret = arg0.crypto;
|
|
4657
5297
|
return ret;
|
|
@@ -4821,7 +5461,7 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
|
4821
5461
|
return ret;
|
|
4822
5462
|
};
|
|
4823
5463
|
|
|
4824
|
-
module.exports.
|
|
5464
|
+
module.exports.__wbg_log_b7d655e59d158495 = function(arg0, arg1) {
|
|
4825
5465
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
4826
5466
|
};
|
|
4827
5467
|
|
|
@@ -4852,7 +5492,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
4852
5492
|
const a = state0.a;
|
|
4853
5493
|
state0.a = 0;
|
|
4854
5494
|
try {
|
|
4855
|
-
return
|
|
5495
|
+
return __wbg_adapter_543(a, state0.b, arg0, arg1);
|
|
4856
5496
|
} finally {
|
|
4857
5497
|
state0.a = a;
|
|
4858
5498
|
}
|
|
@@ -5282,11 +5922,6 @@ module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
|
5282
5922
|
return ret;
|
|
5283
5923
|
};
|
|
5284
5924
|
|
|
5285
|
-
module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
5286
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
5287
|
-
return ret;
|
|
5288
|
-
};
|
|
5289
|
-
|
|
5290
5925
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
5291
5926
|
const obj = arg0.original;
|
|
5292
5927
|
if (obj.cnt-- == 1) {
|
|
@@ -5297,23 +5932,23 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
5297
5932
|
return ret;
|
|
5298
5933
|
};
|
|
5299
5934
|
|
|
5300
|
-
module.exports.
|
|
5301
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5935
|
+
module.exports.__wbindgen_closure_wrapper12904 = function(arg0, arg1, arg2) {
|
|
5936
|
+
const ret = makeMutClosure(arg0, arg1, 1368, __wbg_adapter_41);
|
|
5302
5937
|
return ret;
|
|
5303
5938
|
};
|
|
5304
5939
|
|
|
5305
|
-
module.exports.
|
|
5306
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5940
|
+
module.exports.__wbindgen_closure_wrapper4336 = function(arg0, arg1, arg2) {
|
|
5941
|
+
const ret = makeMutClosure(arg0, arg1, 698, __wbg_adapter_34);
|
|
5307
5942
|
return ret;
|
|
5308
5943
|
};
|
|
5309
5944
|
|
|
5310
|
-
module.exports.
|
|
5311
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5945
|
+
module.exports.__wbindgen_closure_wrapper4338 = function(arg0, arg1, arg2) {
|
|
5946
|
+
const ret = makeMutClosure(arg0, arg1, 697, __wbg_adapter_34);
|
|
5312
5947
|
return ret;
|
|
5313
5948
|
};
|
|
5314
5949
|
|
|
5315
|
-
module.exports.
|
|
5316
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5950
|
+
module.exports.__wbindgen_closure_wrapper4340 = function(arg0, arg1, arg2) {
|
|
5951
|
+
const ret = makeMutClosure(arg0, arg1, 697, __wbg_adapter_34);
|
|
5317
5952
|
return ret;
|
|
5318
5953
|
};
|
|
5319
5954
|
|