lwk_node 0.8.5 → 0.8.6
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 +13 -0
- package/lwk_wasm.d.ts +5 -6
- package/lwk_wasm.js +58 -116
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -90,3 +90,16 @@ With [twiggy](https://github.com/rustwasm/twiggy) is then possible to analyze th
|
|
|
90
90
|
```shell
|
|
91
91
|
twiggy top -n 10 pkg/lwk_wasm_bg.wasm
|
|
92
92
|
```
|
|
93
|
+
|
|
94
|
+
### Build for nodejs
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
$ cd lwk_wasm
|
|
98
|
+
$ RUSTFLAGS="--cfg=web_sys_unstable_apis" CARGO_PROFILE_RELEASE_OPT_LEVEL=z wasm-pack build --target nodejs --out-dir pkg_node -- --features serial
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Rename the package to `lwk_node` so that we can publish it to npm.
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
sed -i 's/"lwk_wasm"/"lwk_node"/g' pkg_node/package.json
|
|
105
|
+
```
|
package/lwk_wasm.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function search_ledger_device(): Promise<HIDDevice>;
|
|
4
3
|
/**
|
|
5
4
|
* Wallet chain
|
|
6
5
|
*/
|
|
@@ -181,11 +180,6 @@ export class Jade {
|
|
|
181
180
|
keyoriginXpub(bip: Bip): Promise<string>;
|
|
182
181
|
registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
|
|
183
182
|
}
|
|
184
|
-
export class LedgerWeb {
|
|
185
|
-
free(): void;
|
|
186
|
-
constructor(hid_device: HIDDevice);
|
|
187
|
-
get_version(): Promise<string>;
|
|
188
|
-
}
|
|
189
183
|
/**
|
|
190
184
|
* Wrapper of [`bip39::Mnemonic`]
|
|
191
185
|
*/
|
|
@@ -540,6 +534,7 @@ export class WalletTxOut {
|
|
|
540
534
|
unblinded(): TxOutSecrets;
|
|
541
535
|
wildcardIndex(): number;
|
|
542
536
|
extInt(): Chain;
|
|
537
|
+
address(): Address;
|
|
543
538
|
}
|
|
544
539
|
/**
|
|
545
540
|
* Wrapper of [`lwk_wollet::Wollet`]
|
|
@@ -561,6 +556,10 @@ export class Wollet {
|
|
|
561
556
|
applyUpdate(update: Update): void;
|
|
562
557
|
balance(): any;
|
|
563
558
|
transactions(): (WalletTx)[];
|
|
559
|
+
/**
|
|
560
|
+
* Get the unspent transaction outputs of the wallet
|
|
561
|
+
*/
|
|
562
|
+
utxos(): (WalletTxOut)[];
|
|
564
563
|
/**
|
|
565
564
|
* Finalize and consume the given PSET, returning the finalized one
|
|
566
565
|
*/
|
package/lwk_wasm.js
CHANGED
|
@@ -102,11 +102,6 @@ function handleError(f, args) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
106
|
-
ptr = ptr >>> 0;
|
|
107
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
105
|
function isLikeNone(x) {
|
|
111
106
|
return x === undefined || x === null;
|
|
112
107
|
}
|
|
@@ -219,6 +214,22 @@ function _assertClass(instance, klass) {
|
|
|
219
214
|
}
|
|
220
215
|
}
|
|
221
216
|
|
|
217
|
+
let cachedUint32ArrayMemory0 = null;
|
|
218
|
+
|
|
219
|
+
function getUint32ArrayMemory0() {
|
|
220
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
221
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
222
|
+
}
|
|
223
|
+
return cachedUint32ArrayMemory0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
227
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
228
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
229
|
+
WASM_VECTOR_LEN = arg.length;
|
|
230
|
+
return ptr;
|
|
231
|
+
}
|
|
232
|
+
|
|
222
233
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
223
234
|
ptr = ptr >>> 0;
|
|
224
235
|
const mem = getDataViewMemory0();
|
|
@@ -230,14 +241,9 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
230
241
|
return result;
|
|
231
242
|
}
|
|
232
243
|
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
for (let i = 0; i < array.length; i++) {
|
|
237
|
-
mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
|
|
238
|
-
}
|
|
239
|
-
WASM_VECTOR_LEN = array.length;
|
|
240
|
-
return ptr;
|
|
244
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
245
|
+
ptr = ptr >>> 0;
|
|
246
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -247,40 +253,26 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
247
253
|
return ptr;
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
let cachedUint32ArrayMemory0 = null;
|
|
251
|
-
|
|
252
|
-
function getUint32ArrayMemory0() {
|
|
253
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
254
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
255
|
-
}
|
|
256
|
-
return cachedUint32ArrayMemory0;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
256
|
function getArrayU32FromWasm0(ptr, len) {
|
|
260
257
|
ptr = ptr >>> 0;
|
|
261
258
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
262
259
|
}
|
|
263
260
|
|
|
264
|
-
function
|
|
265
|
-
const ptr = malloc(
|
|
266
|
-
|
|
267
|
-
|
|
261
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
262
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
263
|
+
const mem = getDataViewMemory0();
|
|
264
|
+
for (let i = 0; i < array.length; i++) {
|
|
265
|
+
mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
|
|
266
|
+
}
|
|
267
|
+
WASM_VECTOR_LEN = array.length;
|
|
268
268
|
return ptr;
|
|
269
269
|
}
|
|
270
|
-
/**
|
|
271
|
-
* @returns {Promise<HIDDevice>}
|
|
272
|
-
*/
|
|
273
|
-
module.exports.search_ledger_device = function() {
|
|
274
|
-
const ret = wasm.search_ledger_device();
|
|
275
|
-
return ret;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
270
|
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
279
|
-
wasm.
|
|
271
|
+
wasm.closure952_externref_shim(arg0, arg1, arg2);
|
|
280
272
|
}
|
|
281
273
|
|
|
282
|
-
function
|
|
283
|
-
wasm.
|
|
274
|
+
function __wbg_adapter_366(arg0, arg1, arg2, arg3) {
|
|
275
|
+
wasm.closure1654_externref_shim(arg0, arg1, arg2, arg3);
|
|
284
276
|
}
|
|
285
277
|
|
|
286
278
|
/**
|
|
@@ -1099,42 +1091,6 @@ class Jade {
|
|
|
1099
1091
|
}
|
|
1100
1092
|
module.exports.Jade = Jade;
|
|
1101
1093
|
|
|
1102
|
-
const LedgerWebFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1103
|
-
? { register: () => {}, unregister: () => {} }
|
|
1104
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_ledgerweb_free(ptr >>> 0, 1));
|
|
1105
|
-
|
|
1106
|
-
class LedgerWeb {
|
|
1107
|
-
|
|
1108
|
-
__destroy_into_raw() {
|
|
1109
|
-
const ptr = this.__wbg_ptr;
|
|
1110
|
-
this.__wbg_ptr = 0;
|
|
1111
|
-
LedgerWebFinalization.unregister(this);
|
|
1112
|
-
return ptr;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
free() {
|
|
1116
|
-
const ptr = this.__destroy_into_raw();
|
|
1117
|
-
wasm.__wbg_ledgerweb_free(ptr, 0);
|
|
1118
|
-
}
|
|
1119
|
-
/**
|
|
1120
|
-
* @param {HIDDevice} hid_device
|
|
1121
|
-
*/
|
|
1122
|
-
constructor(hid_device) {
|
|
1123
|
-
const ret = wasm.ledgerweb_new(hid_device);
|
|
1124
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1125
|
-
LedgerWebFinalization.register(this, this.__wbg_ptr, this);
|
|
1126
|
-
return this;
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* @returns {Promise<string>}
|
|
1130
|
-
*/
|
|
1131
|
-
get_version() {
|
|
1132
|
-
const ret = wasm.ledgerweb_get_version(this.__wbg_ptr);
|
|
1133
|
-
return ret;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
module.exports.LedgerWeb = LedgerWeb;
|
|
1137
|
-
|
|
1138
1094
|
const MnemonicFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1139
1095
|
? { register: () => {}, unregister: () => {} }
|
|
1140
1096
|
: new FinalizationRegistry(ptr => wasm.__wbg_mnemonic_free(ptr >>> 0, 1));
|
|
@@ -2915,6 +2871,13 @@ class WalletTxOut {
|
|
|
2915
2871
|
const ret = wasm.wallettxout_extInt(this.__wbg_ptr);
|
|
2916
2872
|
return ret;
|
|
2917
2873
|
}
|
|
2874
|
+
/**
|
|
2875
|
+
* @returns {Address}
|
|
2876
|
+
*/
|
|
2877
|
+
address() {
|
|
2878
|
+
const ret = wasm.wallettxout_address(this.__wbg_ptr);
|
|
2879
|
+
return Address.__wrap(ret);
|
|
2880
|
+
}
|
|
2918
2881
|
}
|
|
2919
2882
|
module.exports.WalletTxOut = WalletTxOut;
|
|
2920
2883
|
|
|
@@ -3013,6 +2976,19 @@ class Wollet {
|
|
|
3013
2976
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3014
2977
|
return v1;
|
|
3015
2978
|
}
|
|
2979
|
+
/**
|
|
2980
|
+
* Get the unspent transaction outputs of the wallet
|
|
2981
|
+
* @returns {(WalletTxOut)[]}
|
|
2982
|
+
*/
|
|
2983
|
+
utxos() {
|
|
2984
|
+
const ret = wasm.wollet_utxos(this.__wbg_ptr);
|
|
2985
|
+
if (ret[3]) {
|
|
2986
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2987
|
+
}
|
|
2988
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
2989
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2990
|
+
return v1;
|
|
2991
|
+
}
|
|
3016
2992
|
/**
|
|
3017
2993
|
* Finalize and consume the given PSET, returning the finalized one
|
|
3018
2994
|
* @param {Pset} pset
|
|
@@ -3307,16 +3283,11 @@ module.exports.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) {
|
|
|
3307
3283
|
return ret;
|
|
3308
3284
|
};
|
|
3309
3285
|
|
|
3310
|
-
module.exports.
|
|
3286
|
+
module.exports.__wbg_fetch_4465c2b10f21a927 = function(arg0) {
|
|
3311
3287
|
const ret = fetch(arg0);
|
|
3312
3288
|
return ret;
|
|
3313
3289
|
};
|
|
3314
3290
|
|
|
3315
|
-
module.exports.__wbg_getDevices_e3b981f8ab3f64ca = function(arg0) {
|
|
3316
|
-
const ret = arg0.getDevices();
|
|
3317
|
-
return ret;
|
|
3318
|
-
};
|
|
3319
|
-
|
|
3320
3291
|
module.exports.__wbg_getPorts_bcbc416782ca640e = function(arg0) {
|
|
3321
3292
|
const ret = arg0.getPorts();
|
|
3322
3293
|
return ret;
|
|
@@ -3351,22 +3322,6 @@ module.exports.__wbg_headers_24e3e19fe3f187c0 = function(arg0) {
|
|
|
3351
3322
|
return ret;
|
|
3352
3323
|
};
|
|
3353
3324
|
|
|
3354
|
-
module.exports.__wbg_hid_94d3748076cc70a5 = function(arg0) {
|
|
3355
|
-
const ret = arg0.hid;
|
|
3356
|
-
return ret;
|
|
3357
|
-
};
|
|
3358
|
-
|
|
3359
|
-
module.exports.__wbg_instanceof_HidDevice_7985a551d7ddb50b = function(arg0) {
|
|
3360
|
-
let result;
|
|
3361
|
-
try {
|
|
3362
|
-
result = arg0 instanceof HIDDevice;
|
|
3363
|
-
} catch (_) {
|
|
3364
|
-
result = false;
|
|
3365
|
-
}
|
|
3366
|
-
const ret = result;
|
|
3367
|
-
return ret;
|
|
3368
|
-
};
|
|
3369
|
-
|
|
3370
3325
|
module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) {
|
|
3371
3326
|
let result;
|
|
3372
3327
|
try {
|
|
@@ -3430,10 +3385,6 @@ module.exports.__wbg_length_d65cf0786bfc5739 = function(arg0) {
|
|
|
3430
3385
|
return ret;
|
|
3431
3386
|
};
|
|
3432
3387
|
|
|
3433
|
-
module.exports.__wbg_log_5f82480ac7a101b6 = function(arg0, arg1) {
|
|
3434
|
-
console.log(arg0, arg1);
|
|
3435
|
-
};
|
|
3436
|
-
|
|
3437
3388
|
module.exports.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
3438
3389
|
const ret = arg0.msCrypto;
|
|
3439
3390
|
return ret;
|
|
@@ -3466,7 +3417,7 @@ module.exports.__wbg_new_3d446df9155128ef = function(arg0, arg1) {
|
|
|
3466
3417
|
const a = state0.a;
|
|
3467
3418
|
state0.a = 0;
|
|
3468
3419
|
try {
|
|
3469
|
-
return
|
|
3420
|
+
return __wbg_adapter_366(a, state0.b, arg0, arg1);
|
|
3470
3421
|
} finally {
|
|
3471
3422
|
state0.a = a;
|
|
3472
3423
|
}
|
|
@@ -3596,11 +3547,6 @@ module.exports.__wbg_recipient_new = function(arg0) {
|
|
|
3596
3547
|
return ret;
|
|
3597
3548
|
};
|
|
3598
3549
|
|
|
3599
|
-
module.exports.__wbg_requestDevice_80cf95954319a779 = function(arg0, arg1) {
|
|
3600
|
-
const ret = arg0.requestDevice(arg1);
|
|
3601
|
-
return ret;
|
|
3602
|
-
};
|
|
3603
|
-
|
|
3604
3550
|
module.exports.__wbg_requestPort_4017b10c6ed80bc9 = function(arg0, arg1) {
|
|
3605
3551
|
const ret = arg0.requestPort(arg1);
|
|
3606
3552
|
return ret;
|
|
@@ -3621,11 +3567,6 @@ module.exports.__wbg_resolve_0bf7c44d641804f9 = function(arg0) {
|
|
|
3621
3567
|
return ret;
|
|
3622
3568
|
};
|
|
3623
3569
|
|
|
3624
|
-
module.exports.__wbg_sendReport_ebe68f3fc9930b4d = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3625
|
-
const ret = arg0.sendReport(arg1, getArrayU8FromWasm0(arg2, arg3));
|
|
3626
|
-
return ret;
|
|
3627
|
-
}, arguments) };
|
|
3628
|
-
|
|
3629
3570
|
module.exports.__wbg_serial_af8521e375ee4947 = function(arg0) {
|
|
3630
3571
|
const ret = arg0.serial;
|
|
3631
3572
|
return ret;
|
|
@@ -3665,10 +3606,6 @@ module.exports.__wbg_setcredentials_cfc15e48e3a3a535 = function(arg0, arg1) {
|
|
|
3665
3606
|
arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
|
|
3666
3607
|
};
|
|
3667
3608
|
|
|
3668
|
-
module.exports.__wbg_setfilters_51bbf67999aa61d4 = function(arg0, arg1) {
|
|
3669
|
-
arg0.filters = arg1;
|
|
3670
|
-
};
|
|
3671
|
-
|
|
3672
3609
|
module.exports.__wbg_setfilters_6826706298fde705 = function(arg0, arg1) {
|
|
3673
3610
|
arg0.filters = arg1;
|
|
3674
3611
|
};
|
|
@@ -3777,6 +3714,11 @@ module.exports.__wbg_wallettx_new = function(arg0) {
|
|
|
3777
3714
|
return ret;
|
|
3778
3715
|
};
|
|
3779
3716
|
|
|
3717
|
+
module.exports.__wbg_wallettxout_new = function(arg0) {
|
|
3718
|
+
const ret = WalletTxOut.__wrap(arg0);
|
|
3719
|
+
return ret;
|
|
3720
|
+
};
|
|
3721
|
+
|
|
3780
3722
|
module.exports.__wbg_wolletdescriptor_new = function(arg0) {
|
|
3781
3723
|
const ret = WolletDescriptor.__wrap(arg0);
|
|
3782
3724
|
return ret;
|
|
@@ -3817,8 +3759,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
3817
3759
|
return ret;
|
|
3818
3760
|
};
|
|
3819
3761
|
|
|
3820
|
-
module.exports.
|
|
3821
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3762
|
+
module.exports.__wbindgen_closure_wrapper8715 = function(arg0, arg1, arg2) {
|
|
3763
|
+
const ret = makeMutClosure(arg0, arg1, 953, __wbg_adapter_36);
|
|
3822
3764
|
return ret;
|
|
3823
3765
|
};
|
|
3824
3766
|
|
package/lwk_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lwk_node",
|
|
3
3
|
"description": "Liquid Wallet Kit - WASM",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.6",
|
|
5
5
|
"license": "MIT OR BSD-2-Clause",
|
|
6
6
|
"files": [
|
|
7
7
|
"lwk_wasm_bg.wasm",
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
],
|
|
11
11
|
"main": "lwk_wasm.js",
|
|
12
12
|
"types": "lwk_wasm.d.ts"
|
|
13
|
-
}
|
|
13
|
+
}
|