lwk_node 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lwk_wasm.d.ts +93 -1
- package/lwk_wasm.js +392 -33
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/lwk_wasm.d.ts
CHANGED
|
@@ -59,6 +59,67 @@ export class AddressResult {
|
|
|
59
59
|
address(): Address;
|
|
60
60
|
index(): number;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Wrapper of [`lwk_wollet::amp0::Amp0`]
|
|
64
|
+
*/
|
|
65
|
+
export class Amp0 {
|
|
66
|
+
private constructor();
|
|
67
|
+
free(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Create a new AMP0 context for the specified network
|
|
70
|
+
*/
|
|
71
|
+
static newWithNetwork(network: Network, username: string, password: string, amp_id: string): Promise<Amp0>;
|
|
72
|
+
/**
|
|
73
|
+
* Create a new AMP0 context for testnet
|
|
74
|
+
*/
|
|
75
|
+
static netTestnet(username: string, password: string, amp_id: string): Promise<Amp0>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a new AMP0 context for mainnet
|
|
78
|
+
*/
|
|
79
|
+
static newMainnet(username: string, password: string, amp_id: string): Promise<Amp0>;
|
|
80
|
+
/**
|
|
81
|
+
* Index of the last returned address
|
|
82
|
+
*
|
|
83
|
+
* Use this and [`crate::EsploraClient::full_scan_to_index()`] to sync the `Wollet`
|
|
84
|
+
*/
|
|
85
|
+
lastIndex(): number;
|
|
86
|
+
/**
|
|
87
|
+
* AMP ID
|
|
88
|
+
*/
|
|
89
|
+
ampId(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Get an address
|
|
92
|
+
*
|
|
93
|
+
* If `index` is None, a new address is returned.
|
|
94
|
+
*/
|
|
95
|
+
address(index?: number | null): Promise<AddressResult>;
|
|
96
|
+
/**
|
|
97
|
+
* The LWK watch-only wallet corresponding to the AMP0 (sub)account.
|
|
98
|
+
*/
|
|
99
|
+
wollet(): Wollet;
|
|
100
|
+
/**
|
|
101
|
+
* Ask AMP0 server to cosign
|
|
102
|
+
*/
|
|
103
|
+
sign(amp0pset: Amp0Pset): Promise<Transaction>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Wrapper of [`lwk_wollet::amp0::Amp0Pset`]
|
|
107
|
+
*/
|
|
108
|
+
export class Amp0Pset {
|
|
109
|
+
free(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a `Amp0Pset`
|
|
112
|
+
*/
|
|
113
|
+
constructor(pset: Pset, blinding_nonces: string[]);
|
|
114
|
+
/**
|
|
115
|
+
* Get the PSET
|
|
116
|
+
*/
|
|
117
|
+
pset(): Pset;
|
|
118
|
+
/**
|
|
119
|
+
* Get the blinding nonces
|
|
120
|
+
*/
|
|
121
|
+
blindingNonces(): string[];
|
|
122
|
+
}
|
|
62
123
|
/**
|
|
63
124
|
* Wrapper of [`lwk_wollet::amp2::Amp2`]
|
|
64
125
|
*/
|
|
@@ -157,12 +218,13 @@ export class EsploraClient {
|
|
|
157
218
|
/**
|
|
158
219
|
* Creates a client, wrapper of [`asyncr::EsploraClient`]
|
|
159
220
|
*/
|
|
160
|
-
constructor(network: Network, url: string, waterfalls: boolean, concurrency: number);
|
|
221
|
+
constructor(network: Network, url: string, waterfalls: boolean, concurrency: number, utxo_only: boolean);
|
|
161
222
|
fullScan(wollet: Wollet): Promise<Update | undefined>;
|
|
162
223
|
/**
|
|
163
224
|
* Scan the blockchain for the scripts generated by a watch-only wallet up to a specified derivation index
|
|
164
225
|
*/
|
|
165
226
|
fullScanToIndex(wollet: Wollet, index: number): Promise<Update | undefined>;
|
|
227
|
+
broadcastTx(tx: Transaction): Promise<Txid>;
|
|
166
228
|
broadcast(pset: Pset): Promise<Txid>;
|
|
167
229
|
set_waterfalls_server_recipient(recipient: string): Promise<void>;
|
|
168
230
|
}
|
|
@@ -565,6 +627,10 @@ export class TxBuilder {
|
|
|
565
627
|
* Build the transaction
|
|
566
628
|
*/
|
|
567
629
|
finish(wollet: Wollet): Pset;
|
|
630
|
+
/**
|
|
631
|
+
* Build the transaction for AMP0
|
|
632
|
+
*/
|
|
633
|
+
finishForAmp0(wollet: Wollet): Amp0Pset;
|
|
568
634
|
/**
|
|
569
635
|
* Set the fee rate
|
|
570
636
|
*/
|
|
@@ -593,6 +659,10 @@ export class TxBuilder {
|
|
|
593
659
|
* Burn satoshi units of the given asset
|
|
594
660
|
*/
|
|
595
661
|
addBurn(satoshi: bigint, asset: AssetId): TxBuilder;
|
|
662
|
+
/**
|
|
663
|
+
* Add explicit recipient
|
|
664
|
+
*/
|
|
665
|
+
addExplicitRecipient(address: Address, satoshi: bigint, asset: AssetId): TxBuilder;
|
|
596
666
|
/**
|
|
597
667
|
* Issue an asset, wrapper of [`lwk_wollet::TxBuilder::issue_asset()`]
|
|
598
668
|
*/
|
|
@@ -619,6 +689,19 @@ export class TxOutSecrets {
|
|
|
619
689
|
assetBlindingFactor(): string;
|
|
620
690
|
value(): bigint;
|
|
621
691
|
valueBlindingFactor(): string;
|
|
692
|
+
isExplicit(): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Get the asset commitment
|
|
695
|
+
*
|
|
696
|
+
* If the output is explicit, returns the empty string
|
|
697
|
+
*/
|
|
698
|
+
assetCommitment(): string;
|
|
699
|
+
/**
|
|
700
|
+
* Get the value commitment
|
|
701
|
+
*
|
|
702
|
+
* If the output is explicit, returns the empty string
|
|
703
|
+
*/
|
|
704
|
+
valueCommitment(): string;
|
|
622
705
|
}
|
|
623
706
|
/**
|
|
624
707
|
* A valid transaction identifier.
|
|
@@ -719,6 +802,7 @@ export class Wollet {
|
|
|
719
802
|
address(index?: number | null): AddressResult;
|
|
720
803
|
addressFullPath(index: number): Uint32Array;
|
|
721
804
|
applyUpdate(update: Update): void;
|
|
805
|
+
applyTransaction(tx: Transaction): void;
|
|
722
806
|
balance(): any;
|
|
723
807
|
assetsOwned(): AssetIds;
|
|
724
808
|
transactions(): WalletTx[];
|
|
@@ -742,6 +826,10 @@ export class Wollet {
|
|
|
742
826
|
* wraps [lwk_wollet::Wollet::never_scanned()]
|
|
743
827
|
*/
|
|
744
828
|
neverScanned(): boolean;
|
|
829
|
+
/**
|
|
830
|
+
* Whether the wallet is AMP0
|
|
831
|
+
*/
|
|
832
|
+
isAmp0(): boolean;
|
|
745
833
|
}
|
|
746
834
|
/**
|
|
747
835
|
* Wrapper of [`lwk_wollet::WolletDescriptor`]
|
|
@@ -755,6 +843,10 @@ export class WolletDescriptor {
|
|
|
755
843
|
toString(): string;
|
|
756
844
|
static newMultiWshSlip77(threshold: number, participants: string[]): WolletDescriptor;
|
|
757
845
|
isMainnet(): boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Whether the descriptor is AMP0
|
|
848
|
+
*/
|
|
849
|
+
isAmp0(): boolean;
|
|
758
850
|
}
|
|
759
851
|
/**
|
|
760
852
|
* Wrapper of [`bip32::Xpub`]
|
package/lwk_wasm.js
CHANGED
|
@@ -207,11 +207,27 @@ 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
|
+
|
|
210
216
|
function _assertClass(instance, klass) {
|
|
211
217
|
if (!(instance instanceof klass)) {
|
|
212
218
|
throw new Error(`expected instance of ${klass.name}`);
|
|
213
219
|
}
|
|
214
220
|
}
|
|
221
|
+
|
|
222
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
223
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
224
|
+
for (let i = 0; i < array.length; i++) {
|
|
225
|
+
const add = addToExternrefTable0(array[i]);
|
|
226
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
227
|
+
}
|
|
228
|
+
WASM_VECTOR_LEN = array.length;
|
|
229
|
+
return ptr;
|
|
230
|
+
}
|
|
215
231
|
/**
|
|
216
232
|
* @returns {Promise<HIDDevice>}
|
|
217
233
|
*/
|
|
@@ -220,12 +236,6 @@ module.exports.searchLedgerDevice = function() {
|
|
|
220
236
|
return ret;
|
|
221
237
|
};
|
|
222
238
|
|
|
223
|
-
function takeFromExternrefTable0(idx) {
|
|
224
|
-
const value = wasm.__wbindgen_export_4.get(idx);
|
|
225
|
-
wasm.__externref_table_dealloc(idx);
|
|
226
|
-
return value;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
239
|
let cachedUint32ArrayMemory0 = null;
|
|
230
240
|
|
|
231
241
|
function getUint32ArrayMemory0() {
|
|
@@ -242,16 +252,6 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
242
252
|
return ptr;
|
|
243
253
|
}
|
|
244
254
|
|
|
245
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
246
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
247
|
-
for (let i = 0; i < array.length; i++) {
|
|
248
|
-
const add = addToExternrefTable0(array[i]);
|
|
249
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
250
|
-
}
|
|
251
|
-
WASM_VECTOR_LEN = array.length;
|
|
252
|
-
return ptr;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
255
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
256
256
|
ptr = ptr >>> 0;
|
|
257
257
|
const mem = getDataViewMemory0();
|
|
@@ -275,15 +275,15 @@ function getArrayU32FromWasm0(ptr, len) {
|
|
|
275
275
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
276
276
|
}
|
|
277
277
|
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
278
|
-
wasm.
|
|
278
|
+
wasm.closure451_externref_shim(arg0, arg1, arg2);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
function __wbg_adapter_43(arg0, arg1, arg2) {
|
|
282
|
-
wasm.
|
|
282
|
+
wasm.closure1348_externref_shim(arg0, arg1, arg2);
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
function
|
|
286
|
-
wasm.
|
|
285
|
+
function __wbg_adapter_526(arg0, arg1, arg2, arg3) {
|
|
286
|
+
wasm.closure2120_externref_shim(arg0, arg1, arg2, arg3);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
@@ -509,6 +509,214 @@ class AddressResult {
|
|
|
509
509
|
}
|
|
510
510
|
module.exports.AddressResult = AddressResult;
|
|
511
511
|
|
|
512
|
+
const Amp0Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
513
|
+
? { register: () => {}, unregister: () => {} }
|
|
514
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp0_free(ptr >>> 0, 1));
|
|
515
|
+
/**
|
|
516
|
+
* Wrapper of [`lwk_wollet::amp0::Amp0`]
|
|
517
|
+
*/
|
|
518
|
+
class Amp0 {
|
|
519
|
+
|
|
520
|
+
static __wrap(ptr) {
|
|
521
|
+
ptr = ptr >>> 0;
|
|
522
|
+
const obj = Object.create(Amp0.prototype);
|
|
523
|
+
obj.__wbg_ptr = ptr;
|
|
524
|
+
Amp0Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
525
|
+
return obj;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
__destroy_into_raw() {
|
|
529
|
+
const ptr = this.__wbg_ptr;
|
|
530
|
+
this.__wbg_ptr = 0;
|
|
531
|
+
Amp0Finalization.unregister(this);
|
|
532
|
+
return ptr;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
free() {
|
|
536
|
+
const ptr = this.__destroy_into_raw();
|
|
537
|
+
wasm.__wbg_amp0_free(ptr, 0);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Create a new AMP0 context for the specified network
|
|
541
|
+
* @param {Network} network
|
|
542
|
+
* @param {string} username
|
|
543
|
+
* @param {string} password
|
|
544
|
+
* @param {string} amp_id
|
|
545
|
+
* @returns {Promise<Amp0>}
|
|
546
|
+
*/
|
|
547
|
+
static newWithNetwork(network, username, password, amp_id) {
|
|
548
|
+
_assertClass(network, Network);
|
|
549
|
+
var ptr0 = network.__destroy_into_raw();
|
|
550
|
+
const ptr1 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
551
|
+
const len1 = WASM_VECTOR_LEN;
|
|
552
|
+
const ptr2 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
553
|
+
const len2 = WASM_VECTOR_LEN;
|
|
554
|
+
const ptr3 = passStringToWasm0(amp_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
555
|
+
const len3 = WASM_VECTOR_LEN;
|
|
556
|
+
const ret = wasm.amp0_newWithNetwork(ptr0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
557
|
+
return ret;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Create a new AMP0 context for testnet
|
|
561
|
+
* @param {string} username
|
|
562
|
+
* @param {string} password
|
|
563
|
+
* @param {string} amp_id
|
|
564
|
+
* @returns {Promise<Amp0>}
|
|
565
|
+
*/
|
|
566
|
+
static netTestnet(username, password, amp_id) {
|
|
567
|
+
const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
568
|
+
const len0 = WASM_VECTOR_LEN;
|
|
569
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
570
|
+
const len1 = WASM_VECTOR_LEN;
|
|
571
|
+
const ptr2 = passStringToWasm0(amp_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
572
|
+
const len2 = WASM_VECTOR_LEN;
|
|
573
|
+
const ret = wasm.amp0_netTestnet(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Create a new AMP0 context for mainnet
|
|
578
|
+
* @param {string} username
|
|
579
|
+
* @param {string} password
|
|
580
|
+
* @param {string} amp_id
|
|
581
|
+
* @returns {Promise<Amp0>}
|
|
582
|
+
*/
|
|
583
|
+
static newMainnet(username, password, amp_id) {
|
|
584
|
+
const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
585
|
+
const len0 = WASM_VECTOR_LEN;
|
|
586
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
587
|
+
const len1 = WASM_VECTOR_LEN;
|
|
588
|
+
const ptr2 = passStringToWasm0(amp_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
589
|
+
const len2 = WASM_VECTOR_LEN;
|
|
590
|
+
const ret = wasm.amp0_newMainnet(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
591
|
+
return ret;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Index of the last returned address
|
|
595
|
+
*
|
|
596
|
+
* Use this and [`crate::EsploraClient::full_scan_to_index()`] to sync the `Wollet`
|
|
597
|
+
* @returns {number}
|
|
598
|
+
*/
|
|
599
|
+
lastIndex() {
|
|
600
|
+
const ret = wasm.amp0_lastIndex(this.__wbg_ptr);
|
|
601
|
+
return ret >>> 0;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* AMP ID
|
|
605
|
+
* @returns {string}
|
|
606
|
+
*/
|
|
607
|
+
ampId() {
|
|
608
|
+
let deferred1_0;
|
|
609
|
+
let deferred1_1;
|
|
610
|
+
try {
|
|
611
|
+
const ret = wasm.amp0_ampId(this.__wbg_ptr);
|
|
612
|
+
deferred1_0 = ret[0];
|
|
613
|
+
deferred1_1 = ret[1];
|
|
614
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
615
|
+
} finally {
|
|
616
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Get an address
|
|
621
|
+
*
|
|
622
|
+
* If `index` is None, a new address is returned.
|
|
623
|
+
* @param {number | null} [index]
|
|
624
|
+
* @returns {Promise<AddressResult>}
|
|
625
|
+
*/
|
|
626
|
+
address(index) {
|
|
627
|
+
const ret = wasm.amp0_address(this.__wbg_ptr, isLikeNone(index) ? 0x100000001 : (index) >>> 0);
|
|
628
|
+
return ret;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* The LWK watch-only wallet corresponding to the AMP0 (sub)account.
|
|
632
|
+
* @returns {Wollet}
|
|
633
|
+
*/
|
|
634
|
+
wollet() {
|
|
635
|
+
const ret = wasm.amp0_wollet(this.__wbg_ptr);
|
|
636
|
+
if (ret[2]) {
|
|
637
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
638
|
+
}
|
|
639
|
+
return Wollet.__wrap(ret[0]);
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Ask AMP0 server to cosign
|
|
643
|
+
* @param {Amp0Pset} amp0pset
|
|
644
|
+
* @returns {Promise<Transaction>}
|
|
645
|
+
*/
|
|
646
|
+
sign(amp0pset) {
|
|
647
|
+
_assertClass(amp0pset, Amp0Pset);
|
|
648
|
+
const ret = wasm.amp0_sign(this.__wbg_ptr, amp0pset.__wbg_ptr);
|
|
649
|
+
return ret;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
module.exports.Amp0 = Amp0;
|
|
653
|
+
|
|
654
|
+
const Amp0PsetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
655
|
+
? { register: () => {}, unregister: () => {} }
|
|
656
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp0pset_free(ptr >>> 0, 1));
|
|
657
|
+
/**
|
|
658
|
+
* Wrapper of [`lwk_wollet::amp0::Amp0Pset`]
|
|
659
|
+
*/
|
|
660
|
+
class Amp0Pset {
|
|
661
|
+
|
|
662
|
+
static __wrap(ptr) {
|
|
663
|
+
ptr = ptr >>> 0;
|
|
664
|
+
const obj = Object.create(Amp0Pset.prototype);
|
|
665
|
+
obj.__wbg_ptr = ptr;
|
|
666
|
+
Amp0PsetFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
667
|
+
return obj;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
__destroy_into_raw() {
|
|
671
|
+
const ptr = this.__wbg_ptr;
|
|
672
|
+
this.__wbg_ptr = 0;
|
|
673
|
+
Amp0PsetFinalization.unregister(this);
|
|
674
|
+
return ptr;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
free() {
|
|
678
|
+
const ptr = this.__destroy_into_raw();
|
|
679
|
+
wasm.__wbg_amp0pset_free(ptr, 0);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Creates a `Amp0Pset`
|
|
683
|
+
* @param {Pset} pset
|
|
684
|
+
* @param {string[]} blinding_nonces
|
|
685
|
+
*/
|
|
686
|
+
constructor(pset, blinding_nonces) {
|
|
687
|
+
_assertClass(pset, Pset);
|
|
688
|
+
var ptr0 = pset.__destroy_into_raw();
|
|
689
|
+
const ptr1 = passArrayJsValueToWasm0(blinding_nonces, wasm.__wbindgen_malloc);
|
|
690
|
+
const len1 = WASM_VECTOR_LEN;
|
|
691
|
+
const ret = wasm.amp0pset_new(ptr0, ptr1, len1);
|
|
692
|
+
if (ret[2]) {
|
|
693
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
694
|
+
}
|
|
695
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
696
|
+
Amp0PsetFinalization.register(this, this.__wbg_ptr, this);
|
|
697
|
+
return this;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Get the PSET
|
|
701
|
+
* @returns {Pset}
|
|
702
|
+
*/
|
|
703
|
+
pset() {
|
|
704
|
+
const ret = wasm.amp0pset_pset(this.__wbg_ptr);
|
|
705
|
+
return Pset.__wrap(ret);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Get the blinding nonces
|
|
709
|
+
* @returns {string[]}
|
|
710
|
+
*/
|
|
711
|
+
blindingNonces() {
|
|
712
|
+
const ret = wasm.amp0pset_blindingNonces(this.__wbg_ptr);
|
|
713
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
714
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
715
|
+
return v1;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
module.exports.Amp0Pset = Amp0Pset;
|
|
719
|
+
|
|
512
720
|
const Amp2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
513
721
|
? { register: () => {}, unregister: () => {} }
|
|
514
722
|
: new FinalizationRegistry(ptr => wasm.__wbg_amp2_free(ptr >>> 0, 1));
|
|
@@ -1027,13 +1235,17 @@ class EsploraClient {
|
|
|
1027
1235
|
* @param {string} url
|
|
1028
1236
|
* @param {boolean} waterfalls
|
|
1029
1237
|
* @param {number} concurrency
|
|
1238
|
+
* @param {boolean} utxo_only
|
|
1030
1239
|
*/
|
|
1031
|
-
constructor(network, url, waterfalls, concurrency) {
|
|
1240
|
+
constructor(network, url, waterfalls, concurrency, utxo_only) {
|
|
1032
1241
|
_assertClass(network, Network);
|
|
1033
1242
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1034
1243
|
const len0 = WASM_VECTOR_LEN;
|
|
1035
|
-
const ret = wasm.esploraclient_new(network.__wbg_ptr, ptr0, len0, waterfalls, concurrency);
|
|
1036
|
-
|
|
1244
|
+
const ret = wasm.esploraclient_new(network.__wbg_ptr, ptr0, len0, waterfalls, concurrency, utxo_only);
|
|
1245
|
+
if (ret[2]) {
|
|
1246
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1247
|
+
}
|
|
1248
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1037
1249
|
EsploraClientFinalization.register(this, this.__wbg_ptr, this);
|
|
1038
1250
|
return this;
|
|
1039
1251
|
}
|
|
@@ -1057,6 +1269,15 @@ class EsploraClient {
|
|
|
1057
1269
|
const ret = wasm.esploraclient_fullScanToIndex(this.__wbg_ptr, wollet.__wbg_ptr, index);
|
|
1058
1270
|
return ret;
|
|
1059
1271
|
}
|
|
1272
|
+
/**
|
|
1273
|
+
* @param {Transaction} tx
|
|
1274
|
+
* @returns {Promise<Txid>}
|
|
1275
|
+
*/
|
|
1276
|
+
broadcastTx(tx) {
|
|
1277
|
+
_assertClass(tx, Transaction);
|
|
1278
|
+
const ret = wasm.esploraclient_broadcastTx(this.__wbg_ptr, tx.__wbg_ptr);
|
|
1279
|
+
return ret;
|
|
1280
|
+
}
|
|
1060
1281
|
/**
|
|
1061
1282
|
* @param {Pset} pset
|
|
1062
1283
|
* @returns {Promise<Txid>}
|
|
@@ -3066,6 +3287,20 @@ class TxBuilder {
|
|
|
3066
3287
|
}
|
|
3067
3288
|
return Pset.__wrap(ret[0]);
|
|
3068
3289
|
}
|
|
3290
|
+
/**
|
|
3291
|
+
* Build the transaction for AMP0
|
|
3292
|
+
* @param {Wollet} wollet
|
|
3293
|
+
* @returns {Amp0Pset}
|
|
3294
|
+
*/
|
|
3295
|
+
finishForAmp0(wollet) {
|
|
3296
|
+
const ptr = this.__destroy_into_raw();
|
|
3297
|
+
_assertClass(wollet, Wollet);
|
|
3298
|
+
const ret = wasm.txbuilder_finishForAmp0(ptr, wollet.__wbg_ptr);
|
|
3299
|
+
if (ret[2]) {
|
|
3300
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3301
|
+
}
|
|
3302
|
+
return Amp0Pset.__wrap(ret[0]);
|
|
3303
|
+
}
|
|
3069
3304
|
/**
|
|
3070
3305
|
* Set the fee rate
|
|
3071
3306
|
* @param {number | null} [fee_rate]
|
|
@@ -3145,6 +3380,24 @@ class TxBuilder {
|
|
|
3145
3380
|
const ret = wasm.txbuilder_addBurn(ptr, satoshi, asset.__wbg_ptr);
|
|
3146
3381
|
return TxBuilder.__wrap(ret);
|
|
3147
3382
|
}
|
|
3383
|
+
/**
|
|
3384
|
+
* Add explicit recipient
|
|
3385
|
+
* @param {Address} address
|
|
3386
|
+
* @param {bigint} satoshi
|
|
3387
|
+
* @param {AssetId} asset
|
|
3388
|
+
* @returns {TxBuilder}
|
|
3389
|
+
*/
|
|
3390
|
+
addExplicitRecipient(address, satoshi, asset) {
|
|
3391
|
+
const ptr = this.__destroy_into_raw();
|
|
3392
|
+
_assertClass(address, Address);
|
|
3393
|
+
var ptr0 = address.__destroy_into_raw();
|
|
3394
|
+
_assertClass(asset, AssetId);
|
|
3395
|
+
const ret = wasm.txbuilder_addExplicitRecipient(ptr, ptr0, satoshi, asset.__wbg_ptr);
|
|
3396
|
+
if (ret[2]) {
|
|
3397
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3398
|
+
}
|
|
3399
|
+
return TxBuilder.__wrap(ret[0]);
|
|
3400
|
+
}
|
|
3148
3401
|
/**
|
|
3149
3402
|
* Issue an asset, wrapper of [`lwk_wollet::TxBuilder::issue_asset()`]
|
|
3150
3403
|
* @param {bigint} asset_sats
|
|
@@ -3341,6 +3594,49 @@ class TxOutSecrets {
|
|
|
3341
3594
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3342
3595
|
}
|
|
3343
3596
|
}
|
|
3597
|
+
/**
|
|
3598
|
+
* @returns {boolean}
|
|
3599
|
+
*/
|
|
3600
|
+
isExplicit() {
|
|
3601
|
+
const ret = wasm.txoutsecrets_isExplicit(this.__wbg_ptr);
|
|
3602
|
+
return ret !== 0;
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* Get the asset commitment
|
|
3606
|
+
*
|
|
3607
|
+
* If the output is explicit, returns the empty string
|
|
3608
|
+
* @returns {string}
|
|
3609
|
+
*/
|
|
3610
|
+
assetCommitment() {
|
|
3611
|
+
let deferred1_0;
|
|
3612
|
+
let deferred1_1;
|
|
3613
|
+
try {
|
|
3614
|
+
const ret = wasm.txoutsecrets_assetCommitment(this.__wbg_ptr);
|
|
3615
|
+
deferred1_0 = ret[0];
|
|
3616
|
+
deferred1_1 = ret[1];
|
|
3617
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3618
|
+
} finally {
|
|
3619
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
/**
|
|
3623
|
+
* Get the value commitment
|
|
3624
|
+
*
|
|
3625
|
+
* If the output is explicit, returns the empty string
|
|
3626
|
+
* @returns {string}
|
|
3627
|
+
*/
|
|
3628
|
+
valueCommitment() {
|
|
3629
|
+
let deferred1_0;
|
|
3630
|
+
let deferred1_1;
|
|
3631
|
+
try {
|
|
3632
|
+
const ret = wasm.txoutsecrets_valueCommitment(this.__wbg_ptr);
|
|
3633
|
+
deferred1_0 = ret[0];
|
|
3634
|
+
deferred1_1 = ret[1];
|
|
3635
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3636
|
+
} finally {
|
|
3637
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3344
3640
|
}
|
|
3345
3641
|
module.exports.TxOutSecrets = TxOutSecrets;
|
|
3346
3642
|
|
|
@@ -3890,6 +4186,14 @@ const WolletFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3890
4186
|
*/
|
|
3891
4187
|
class Wollet {
|
|
3892
4188
|
|
|
4189
|
+
static __wrap(ptr) {
|
|
4190
|
+
ptr = ptr >>> 0;
|
|
4191
|
+
const obj = Object.create(Wollet.prototype);
|
|
4192
|
+
obj.__wbg_ptr = ptr;
|
|
4193
|
+
WolletFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4194
|
+
return obj;
|
|
4195
|
+
}
|
|
4196
|
+
|
|
3893
4197
|
__destroy_into_raw() {
|
|
3894
4198
|
const ptr = this.__wbg_ptr;
|
|
3895
4199
|
this.__wbg_ptr = 0;
|
|
@@ -3955,6 +4259,16 @@ class Wollet {
|
|
|
3955
4259
|
throw takeFromExternrefTable0(ret[0]);
|
|
3956
4260
|
}
|
|
3957
4261
|
}
|
|
4262
|
+
/**
|
|
4263
|
+
* @param {Transaction} tx
|
|
4264
|
+
*/
|
|
4265
|
+
applyTransaction(tx) {
|
|
4266
|
+
_assertClass(tx, Transaction);
|
|
4267
|
+
const ret = wasm.wollet_applyTransaction(this.__wbg_ptr, tx.__wbg_ptr);
|
|
4268
|
+
if (ret[1]) {
|
|
4269
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
3958
4272
|
/**
|
|
3959
4273
|
* @returns {any}
|
|
3960
4274
|
*/
|
|
@@ -4071,6 +4385,14 @@ class Wollet {
|
|
|
4071
4385
|
const ret = wasm.wollet_neverScanned(this.__wbg_ptr);
|
|
4072
4386
|
return ret !== 0;
|
|
4073
4387
|
}
|
|
4388
|
+
/**
|
|
4389
|
+
* Whether the wallet is AMP0
|
|
4390
|
+
* @returns {boolean}
|
|
4391
|
+
*/
|
|
4392
|
+
isAmp0() {
|
|
4393
|
+
const ret = wasm.wollet_isAmp0(this.__wbg_ptr);
|
|
4394
|
+
return ret !== 0;
|
|
4395
|
+
}
|
|
4074
4396
|
}
|
|
4075
4397
|
module.exports.Wollet = Wollet;
|
|
4076
4398
|
|
|
@@ -4152,6 +4474,14 @@ class WolletDescriptor {
|
|
|
4152
4474
|
const ret = wasm.wolletdescriptor_isMainnet(this.__wbg_ptr);
|
|
4153
4475
|
return ret !== 0;
|
|
4154
4476
|
}
|
|
4477
|
+
/**
|
|
4478
|
+
* Whether the descriptor is AMP0
|
|
4479
|
+
* @returns {boolean}
|
|
4480
|
+
*/
|
|
4481
|
+
isAmp0() {
|
|
4482
|
+
const ret = wasm.wolletdescriptor_isAmp0(this.__wbg_ptr);
|
|
4483
|
+
return ret !== 0;
|
|
4484
|
+
}
|
|
4155
4485
|
}
|
|
4156
4486
|
module.exports.WolletDescriptor = WolletDescriptor;
|
|
4157
4487
|
|
|
@@ -4268,6 +4598,16 @@ module.exports.__wbg_abort_775ef1d17fc65868 = function(arg0) {
|
|
|
4268
4598
|
arg0.abort();
|
|
4269
4599
|
};
|
|
4270
4600
|
|
|
4601
|
+
module.exports.__wbg_addressresult_new = function(arg0) {
|
|
4602
|
+
const ret = AddressResult.__wrap(arg0);
|
|
4603
|
+
return ret;
|
|
4604
|
+
};
|
|
4605
|
+
|
|
4606
|
+
module.exports.__wbg_amp0_new = function(arg0) {
|
|
4607
|
+
const ret = Amp0.__wrap(arg0);
|
|
4608
|
+
return ret;
|
|
4609
|
+
};
|
|
4610
|
+
|
|
4271
4611
|
module.exports.__wbg_append_8c7dd8d641a5f01b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
4272
4612
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
4273
4613
|
}, arguments) };
|
|
@@ -4481,7 +4821,7 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
|
4481
4821
|
return ret;
|
|
4482
4822
|
};
|
|
4483
4823
|
|
|
4484
|
-
module.exports.
|
|
4824
|
+
module.exports.__wbg_log_1c0673da475f4734 = function(arg0, arg1) {
|
|
4485
4825
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
4486
4826
|
};
|
|
4487
4827
|
|
|
@@ -4512,7 +4852,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
4512
4852
|
const a = state0.a;
|
|
4513
4853
|
state0.a = 0;
|
|
4514
4854
|
try {
|
|
4515
|
-
return
|
|
4855
|
+
return __wbg_adapter_526(a, state0.b, arg0, arg1);
|
|
4516
4856
|
} finally {
|
|
4517
4857
|
state0.a = a;
|
|
4518
4858
|
}
|
|
@@ -4574,6 +4914,11 @@ module.exports.__wbg_newwithstrandinit_06c535e0a867c635 = function() { return ha
|
|
|
4574
4914
|
return ret;
|
|
4575
4915
|
}, arguments) };
|
|
4576
4916
|
|
|
4917
|
+
module.exports.__wbg_newwithstrsequence_6e9d6479e1cf978d = function() { return handleError(function (arg0, arg1, arg2) {
|
|
4918
|
+
const ret = new WebSocket(getStringFromWasm0(arg0, arg1), arg2);
|
|
4919
|
+
return ret;
|
|
4920
|
+
}, arguments) };
|
|
4921
|
+
|
|
4577
4922
|
module.exports.__wbg_next_25feadfc0913fea9 = function(arg0) {
|
|
4578
4923
|
const ret = arg0.next;
|
|
4579
4924
|
return ret;
|
|
@@ -4654,6 +4999,11 @@ module.exports.__wbg_psetsignatures_new = function(arg0) {
|
|
|
4654
4999
|
return ret;
|
|
4655
5000
|
};
|
|
4656
5001
|
|
|
5002
|
+
module.exports.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
5003
|
+
const ret = arg0.push(arg1);
|
|
5004
|
+
return ret;
|
|
5005
|
+
};
|
|
5006
|
+
|
|
4657
5007
|
module.exports.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
|
|
4658
5008
|
queueMicrotask(arg0);
|
|
4659
5009
|
};
|
|
@@ -4717,6 +5067,10 @@ module.exports.__wbg_sendReport_4d1024566077f413 = function() { return handleErr
|
|
|
4717
5067
|
return ret;
|
|
4718
5068
|
}, arguments) };
|
|
4719
5069
|
|
|
5070
|
+
module.exports.__wbg_send_0293179ba074ffb4 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
5071
|
+
arg0.send(getStringFromWasm0(arg1, arg2));
|
|
5072
|
+
}, arguments) };
|
|
5073
|
+
|
|
4720
5074
|
module.exports.__wbg_send_7c4769e24cf1d784 = function() { return handleError(function (arg0, arg1) {
|
|
4721
5075
|
arg0.send(arg1);
|
|
4722
5076
|
}, arguments) };
|
|
@@ -4855,6 +5209,11 @@ module.exports.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
|
|
|
4855
5209
|
return ret;
|
|
4856
5210
|
};
|
|
4857
5211
|
|
|
5212
|
+
module.exports.__wbg_transaction_new = function(arg0) {
|
|
5213
|
+
const ret = Transaction.__wrap(arg0);
|
|
5214
|
+
return ret;
|
|
5215
|
+
};
|
|
5216
|
+
|
|
4858
5217
|
module.exports.__wbg_txid_new = function(arg0) {
|
|
4859
5218
|
const ret = Txid.__wrap(arg0);
|
|
4860
5219
|
return ret;
|
|
@@ -4938,23 +5297,23 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
4938
5297
|
return ret;
|
|
4939
5298
|
};
|
|
4940
5299
|
|
|
4941
|
-
module.exports.
|
|
4942
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5300
|
+
module.exports.__wbindgen_closure_wrapper12419 = function(arg0, arg1, arg2) {
|
|
5301
|
+
const ret = makeMutClosure(arg0, arg1, 1349, __wbg_adapter_43);
|
|
4943
5302
|
return ret;
|
|
4944
5303
|
};
|
|
4945
5304
|
|
|
4946
|
-
module.exports.
|
|
4947
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5305
|
+
module.exports.__wbindgen_closure_wrapper4731 = function(arg0, arg1, arg2) {
|
|
5306
|
+
const ret = makeMutClosure(arg0, arg1, 452, __wbg_adapter_36);
|
|
4948
5307
|
return ret;
|
|
4949
5308
|
};
|
|
4950
5309
|
|
|
4951
|
-
module.exports.
|
|
4952
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5310
|
+
module.exports.__wbindgen_closure_wrapper4733 = function(arg0, arg1, arg2) {
|
|
5311
|
+
const ret = makeMutClosure(arg0, arg1, 453, __wbg_adapter_36);
|
|
4953
5312
|
return ret;
|
|
4954
5313
|
};
|
|
4955
5314
|
|
|
4956
|
-
module.exports.
|
|
4957
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
5315
|
+
module.exports.__wbindgen_closure_wrapper4735 = function(arg0, arg1, arg2) {
|
|
5316
|
+
const ret = makeMutClosure(arg0, arg1, 452, __wbg_adapter_36);
|
|
4958
5317
|
return ret;
|
|
4959
5318
|
};
|
|
4960
5319
|
|
package/lwk_wasm_bg.wasm
CHANGED
|
Binary file
|