lwk_node 0.8.5
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 +92 -0
- package/lwk_wasm.d.ts +606 -0
- package/lwk_wasm.js +3907 -0
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +13 -0
package/lwk_wasm.js
ADDED
|
@@ -0,0 +1,3907 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
+
let wasm;
|
|
5
|
+
const { TextEncoder, TextDecoder } = require(`util`);
|
|
6
|
+
|
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
|
8
|
+
|
|
9
|
+
let cachedUint8ArrayMemory0 = null;
|
|
10
|
+
|
|
11
|
+
function getUint8ArrayMemory0() {
|
|
12
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
13
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
+
}
|
|
15
|
+
return cachedUint8ArrayMemory0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
19
|
+
|
|
20
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
21
|
+
? function (arg, view) {
|
|
22
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
23
|
+
}
|
|
24
|
+
: function (arg, view) {
|
|
25
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
26
|
+
view.set(buf);
|
|
27
|
+
return {
|
|
28
|
+
read: arg.length,
|
|
29
|
+
written: buf.length
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
34
|
+
|
|
35
|
+
if (realloc === undefined) {
|
|
36
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
37
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
38
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
39
|
+
WASM_VECTOR_LEN = buf.length;
|
|
40
|
+
return ptr;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let len = arg.length;
|
|
44
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
45
|
+
|
|
46
|
+
const mem = getUint8ArrayMemory0();
|
|
47
|
+
|
|
48
|
+
let offset = 0;
|
|
49
|
+
|
|
50
|
+
for (; offset < len; offset++) {
|
|
51
|
+
const code = arg.charCodeAt(offset);
|
|
52
|
+
if (code > 0x7F) break;
|
|
53
|
+
mem[ptr + offset] = code;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (offset !== len) {
|
|
57
|
+
if (offset !== 0) {
|
|
58
|
+
arg = arg.slice(offset);
|
|
59
|
+
}
|
|
60
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
61
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
62
|
+
const ret = encodeString(arg, view);
|
|
63
|
+
|
|
64
|
+
offset += ret.written;
|
|
65
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
WASM_VECTOR_LEN = offset;
|
|
69
|
+
return ptr;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let cachedDataViewMemory0 = null;
|
|
73
|
+
|
|
74
|
+
function getDataViewMemory0() {
|
|
75
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
76
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
77
|
+
}
|
|
78
|
+
return cachedDataViewMemory0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
82
|
+
|
|
83
|
+
cachedTextDecoder.decode();
|
|
84
|
+
|
|
85
|
+
function getStringFromWasm0(ptr, len) {
|
|
86
|
+
ptr = ptr >>> 0;
|
|
87
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function addToExternrefTable0(obj) {
|
|
91
|
+
const idx = wasm.__externref_table_alloc();
|
|
92
|
+
wasm.__wbindgen_export_4.set(idx, obj);
|
|
93
|
+
return idx;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function handleError(f, args) {
|
|
97
|
+
try {
|
|
98
|
+
return f.apply(this, args);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
const idx = addToExternrefTable0(e);
|
|
101
|
+
wasm.__wbindgen_exn_store(idx);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
106
|
+
ptr = ptr >>> 0;
|
|
107
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isLikeNone(x) {
|
|
111
|
+
return x === undefined || x === null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
115
|
+
? { register: () => {}, unregister: () => {} }
|
|
116
|
+
: new FinalizationRegistry(state => {
|
|
117
|
+
wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b)
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
121
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
122
|
+
const real = (...args) => {
|
|
123
|
+
// First up with a closure we increment the internal reference
|
|
124
|
+
// count. This ensures that the Rust closure environment won't
|
|
125
|
+
// be deallocated while we're invoking it.
|
|
126
|
+
state.cnt++;
|
|
127
|
+
const a = state.a;
|
|
128
|
+
state.a = 0;
|
|
129
|
+
try {
|
|
130
|
+
return f(a, state.b, ...args);
|
|
131
|
+
} finally {
|
|
132
|
+
if (--state.cnt === 0) {
|
|
133
|
+
wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
|
|
134
|
+
CLOSURE_DTORS.unregister(state);
|
|
135
|
+
} else {
|
|
136
|
+
state.a = a;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
real.original = state;
|
|
141
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
142
|
+
return real;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function debugString(val) {
|
|
146
|
+
// primitive types
|
|
147
|
+
const type = typeof val;
|
|
148
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
149
|
+
return `${val}`;
|
|
150
|
+
}
|
|
151
|
+
if (type == 'string') {
|
|
152
|
+
return `"${val}"`;
|
|
153
|
+
}
|
|
154
|
+
if (type == 'symbol') {
|
|
155
|
+
const description = val.description;
|
|
156
|
+
if (description == null) {
|
|
157
|
+
return 'Symbol';
|
|
158
|
+
} else {
|
|
159
|
+
return `Symbol(${description})`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (type == 'function') {
|
|
163
|
+
const name = val.name;
|
|
164
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
165
|
+
return `Function(${name})`;
|
|
166
|
+
} else {
|
|
167
|
+
return 'Function';
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// objects
|
|
171
|
+
if (Array.isArray(val)) {
|
|
172
|
+
const length = val.length;
|
|
173
|
+
let debug = '[';
|
|
174
|
+
if (length > 0) {
|
|
175
|
+
debug += debugString(val[0]);
|
|
176
|
+
}
|
|
177
|
+
for(let i = 1; i < length; i++) {
|
|
178
|
+
debug += ', ' + debugString(val[i]);
|
|
179
|
+
}
|
|
180
|
+
debug += ']';
|
|
181
|
+
return debug;
|
|
182
|
+
}
|
|
183
|
+
// Test for built-in
|
|
184
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
185
|
+
let className;
|
|
186
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
187
|
+
className = builtInMatches[1];
|
|
188
|
+
} else {
|
|
189
|
+
// Failed to match the standard '[object ClassName]'
|
|
190
|
+
return toString.call(val);
|
|
191
|
+
}
|
|
192
|
+
if (className == 'Object') {
|
|
193
|
+
// we're a user defined class or Object
|
|
194
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
195
|
+
// easier than looping through ownProperties of `val`.
|
|
196
|
+
try {
|
|
197
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
198
|
+
} catch (_) {
|
|
199
|
+
return 'Object';
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// errors
|
|
203
|
+
if (val instanceof Error) {
|
|
204
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
205
|
+
}
|
|
206
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
207
|
+
return className;
|
|
208
|
+
}
|
|
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
|
+
function _assertClass(instance, klass) {
|
|
217
|
+
if (!(instance instanceof klass)) {
|
|
218
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
223
|
+
ptr = ptr >>> 0;
|
|
224
|
+
const mem = getDataViewMemory0();
|
|
225
|
+
const result = [];
|
|
226
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
227
|
+
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
228
|
+
}
|
|
229
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
234
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
235
|
+
const mem = getDataViewMemory0();
|
|
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;
|
|
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
|
+
}
|
|
249
|
+
|
|
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
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
260
|
+
ptr = ptr >>> 0;
|
|
261
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
265
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
266
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
267
|
+
WASM_VECTOR_LEN = arg.length;
|
|
268
|
+
return ptr;
|
|
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
|
+
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
279
|
+
wasm.closure965_externref_shim(arg0, arg1, arg2);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function __wbg_adapter_379(arg0, arg1, arg2, arg3) {
|
|
283
|
+
wasm.closure1667_externref_shim(arg0, arg1, arg2, arg3);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Wallet chain
|
|
288
|
+
* @enum {0 | 1}
|
|
289
|
+
*/
|
|
290
|
+
module.exports.Chain = Object.freeze({
|
|
291
|
+
/**
|
|
292
|
+
* External address, shown when asked for a payment.
|
|
293
|
+
* Wallet having a single descriptor are considered External
|
|
294
|
+
*/
|
|
295
|
+
External: 0, "0": "External",
|
|
296
|
+
/**
|
|
297
|
+
* Internal address, used for the change
|
|
298
|
+
*/
|
|
299
|
+
Internal: 1, "1": "Internal",
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
303
|
+
|
|
304
|
+
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
305
|
+
|
|
306
|
+
const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
307
|
+
? { register: () => {}, unregister: () => {} }
|
|
308
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_address_free(ptr >>> 0, 1));
|
|
309
|
+
/**
|
|
310
|
+
* Wrapper of [`elements::Address`]
|
|
311
|
+
*/
|
|
312
|
+
class Address {
|
|
313
|
+
|
|
314
|
+
static __wrap(ptr) {
|
|
315
|
+
ptr = ptr >>> 0;
|
|
316
|
+
const obj = Object.create(Address.prototype);
|
|
317
|
+
obj.__wbg_ptr = ptr;
|
|
318
|
+
AddressFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
319
|
+
return obj;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
__destroy_into_raw() {
|
|
323
|
+
const ptr = this.__wbg_ptr;
|
|
324
|
+
this.__wbg_ptr = 0;
|
|
325
|
+
AddressFinalization.unregister(this);
|
|
326
|
+
return ptr;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
free() {
|
|
330
|
+
const ptr = this.__destroy_into_raw();
|
|
331
|
+
wasm.__wbg_address_free(ptr, 0);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Creates an `Address`
|
|
335
|
+
* @param {string} s
|
|
336
|
+
*/
|
|
337
|
+
constructor(s) {
|
|
338
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ret = wasm.address_new(ptr0, len0);
|
|
341
|
+
if (ret[2]) {
|
|
342
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
343
|
+
}
|
|
344
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
345
|
+
AddressFinalization.register(this, this.__wbg_ptr, this);
|
|
346
|
+
return this;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* @returns {Script}
|
|
350
|
+
*/
|
|
351
|
+
scriptPubkey() {
|
|
352
|
+
const ret = wasm.address_scriptPubkey(this.__wbg_ptr);
|
|
353
|
+
return Script.__wrap(ret);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* @returns {boolean}
|
|
357
|
+
*/
|
|
358
|
+
isBlinded() {
|
|
359
|
+
const ret = wasm.address_isBlinded(this.__wbg_ptr);
|
|
360
|
+
return ret !== 0;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @returns {boolean}
|
|
364
|
+
*/
|
|
365
|
+
isMainnet() {
|
|
366
|
+
const ret = wasm.address_isMainnet(this.__wbg_ptr);
|
|
367
|
+
return ret !== 0;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @returns {Address}
|
|
371
|
+
*/
|
|
372
|
+
toUnconfidential() {
|
|
373
|
+
const ret = wasm.address_toUnconfidential(this.__wbg_ptr);
|
|
374
|
+
return Address.__wrap(ret);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @returns {string}
|
|
378
|
+
*/
|
|
379
|
+
toString() {
|
|
380
|
+
let deferred1_0;
|
|
381
|
+
let deferred1_1;
|
|
382
|
+
try {
|
|
383
|
+
const ret = wasm.address_toString(this.__wbg_ptr);
|
|
384
|
+
deferred1_0 = ret[0];
|
|
385
|
+
deferred1_1 = ret[1];
|
|
386
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
387
|
+
} finally {
|
|
388
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Returns a string encoding an image in a uri
|
|
393
|
+
*
|
|
394
|
+
* The string can be open in the browser or be used as `src` field in `img` in HTML
|
|
395
|
+
*
|
|
396
|
+
* For max efficiency we suggest to pass `None` to `pixel_per_module`, get a very small image
|
|
397
|
+
* and use styling to scale up the image in the browser. eg
|
|
398
|
+
* `style="image-rendering: pixelated; border: 20px solid white;"`
|
|
399
|
+
* @param {number | undefined} [pixel_per_module]
|
|
400
|
+
* @returns {string}
|
|
401
|
+
*/
|
|
402
|
+
QRCodeUri(pixel_per_module) {
|
|
403
|
+
let deferred2_0;
|
|
404
|
+
let deferred2_1;
|
|
405
|
+
try {
|
|
406
|
+
const ret = wasm.address_QRCodeUri(this.__wbg_ptr, isLikeNone(pixel_per_module) ? 0xFFFFFF : pixel_per_module);
|
|
407
|
+
var ptr1 = ret[0];
|
|
408
|
+
var len1 = ret[1];
|
|
409
|
+
if (ret[3]) {
|
|
410
|
+
ptr1 = 0; len1 = 0;
|
|
411
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
412
|
+
}
|
|
413
|
+
deferred2_0 = ptr1;
|
|
414
|
+
deferred2_1 = len1;
|
|
415
|
+
return getStringFromWasm0(ptr1, len1);
|
|
416
|
+
} finally {
|
|
417
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Returns a string of the QR code printable in a terminal environment
|
|
422
|
+
* @returns {string}
|
|
423
|
+
*/
|
|
424
|
+
QRCodeText() {
|
|
425
|
+
let deferred2_0;
|
|
426
|
+
let deferred2_1;
|
|
427
|
+
try {
|
|
428
|
+
const ret = wasm.address_QRCodeText(this.__wbg_ptr);
|
|
429
|
+
var ptr1 = ret[0];
|
|
430
|
+
var len1 = ret[1];
|
|
431
|
+
if (ret[3]) {
|
|
432
|
+
ptr1 = 0; len1 = 0;
|
|
433
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
434
|
+
}
|
|
435
|
+
deferred2_0 = ptr1;
|
|
436
|
+
deferred2_1 = len1;
|
|
437
|
+
return getStringFromWasm0(ptr1, len1);
|
|
438
|
+
} finally {
|
|
439
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
module.exports.Address = Address;
|
|
444
|
+
|
|
445
|
+
const AddressResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
446
|
+
? { register: () => {}, unregister: () => {} }
|
|
447
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_addressresult_free(ptr >>> 0, 1));
|
|
448
|
+
/**
|
|
449
|
+
* Wrapper of [`lwk_wollet::AddressResult`]
|
|
450
|
+
*/
|
|
451
|
+
class AddressResult {
|
|
452
|
+
|
|
453
|
+
static __wrap(ptr) {
|
|
454
|
+
ptr = ptr >>> 0;
|
|
455
|
+
const obj = Object.create(AddressResult.prototype);
|
|
456
|
+
obj.__wbg_ptr = ptr;
|
|
457
|
+
AddressResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
458
|
+
return obj;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
__destroy_into_raw() {
|
|
462
|
+
const ptr = this.__wbg_ptr;
|
|
463
|
+
this.__wbg_ptr = 0;
|
|
464
|
+
AddressResultFinalization.unregister(this);
|
|
465
|
+
return ptr;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
free() {
|
|
469
|
+
const ptr = this.__destroy_into_raw();
|
|
470
|
+
wasm.__wbg_addressresult_free(ptr, 0);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* @returns {Address}
|
|
474
|
+
*/
|
|
475
|
+
address() {
|
|
476
|
+
const ret = wasm.addressresult_address(this.__wbg_ptr);
|
|
477
|
+
return Address.__wrap(ret);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* @returns {number}
|
|
481
|
+
*/
|
|
482
|
+
index() {
|
|
483
|
+
const ret = wasm.addressresult_index(this.__wbg_ptr);
|
|
484
|
+
return ret >>> 0;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
module.exports.AddressResult = AddressResult;
|
|
488
|
+
|
|
489
|
+
const Amp2Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
490
|
+
? { register: () => {}, unregister: () => {} }
|
|
491
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp2_free(ptr >>> 0, 1));
|
|
492
|
+
/**
|
|
493
|
+
* Wrapper of [`lwk_wollet::amp2::Amp2`]
|
|
494
|
+
*/
|
|
495
|
+
class Amp2 {
|
|
496
|
+
|
|
497
|
+
static __wrap(ptr) {
|
|
498
|
+
ptr = ptr >>> 0;
|
|
499
|
+
const obj = Object.create(Amp2.prototype);
|
|
500
|
+
obj.__wbg_ptr = ptr;
|
|
501
|
+
Amp2Finalization.register(obj, obj.__wbg_ptr, obj);
|
|
502
|
+
return obj;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
__destroy_into_raw() {
|
|
506
|
+
const ptr = this.__wbg_ptr;
|
|
507
|
+
this.__wbg_ptr = 0;
|
|
508
|
+
Amp2Finalization.unregister(this);
|
|
509
|
+
return ptr;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
free() {
|
|
513
|
+
const ptr = this.__destroy_into_raw();
|
|
514
|
+
wasm.__wbg_amp2_free(ptr, 0);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* @returns {Amp2}
|
|
518
|
+
*/
|
|
519
|
+
static new_testnet() {
|
|
520
|
+
const ret = wasm.amp2_new_testnet();
|
|
521
|
+
return Amp2.__wrap(ret);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* @param {string} keyorigin_xpub
|
|
525
|
+
* @returns {Amp2Descriptor}
|
|
526
|
+
*/
|
|
527
|
+
descriptor_from_str(keyorigin_xpub) {
|
|
528
|
+
const ptr0 = passStringToWasm0(keyorigin_xpub, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
const ret = wasm.amp2_descriptor_from_str(this.__wbg_ptr, ptr0, len0);
|
|
531
|
+
if (ret[2]) {
|
|
532
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
533
|
+
}
|
|
534
|
+
return Amp2Descriptor.__wrap(ret[0]);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* @param {Amp2Descriptor} desc
|
|
538
|
+
* @returns {Promise<string>}
|
|
539
|
+
*/
|
|
540
|
+
register(desc) {
|
|
541
|
+
_assertClass(desc, Amp2Descriptor);
|
|
542
|
+
const ret = wasm.amp2_register(this.__wbg_ptr, desc.__wbg_ptr);
|
|
543
|
+
return ret;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* @param {Pset} pset
|
|
547
|
+
* @returns {Promise<Pset>}
|
|
548
|
+
*/
|
|
549
|
+
cosign(pset) {
|
|
550
|
+
_assertClass(pset, Pset);
|
|
551
|
+
const ret = wasm.amp2_cosign(this.__wbg_ptr, pset.__wbg_ptr);
|
|
552
|
+
return ret;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
module.exports.Amp2 = Amp2;
|
|
556
|
+
|
|
557
|
+
const Amp2DescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
558
|
+
? { register: () => {}, unregister: () => {} }
|
|
559
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_amp2descriptor_free(ptr >>> 0, 1));
|
|
560
|
+
/**
|
|
561
|
+
* Wrapper of [`lwk_wollet::amp2::Amp2Descriptor`]
|
|
562
|
+
*/
|
|
563
|
+
class Amp2Descriptor {
|
|
564
|
+
|
|
565
|
+
static __wrap(ptr) {
|
|
566
|
+
ptr = ptr >>> 0;
|
|
567
|
+
const obj = Object.create(Amp2Descriptor.prototype);
|
|
568
|
+
obj.__wbg_ptr = ptr;
|
|
569
|
+
Amp2DescriptorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
570
|
+
return obj;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
__destroy_into_raw() {
|
|
574
|
+
const ptr = this.__wbg_ptr;
|
|
575
|
+
this.__wbg_ptr = 0;
|
|
576
|
+
Amp2DescriptorFinalization.unregister(this);
|
|
577
|
+
return ptr;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
free() {
|
|
581
|
+
const ptr = this.__destroy_into_raw();
|
|
582
|
+
wasm.__wbg_amp2descriptor_free(ptr, 0);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* @returns {WolletDescriptor}
|
|
586
|
+
*/
|
|
587
|
+
descriptor() {
|
|
588
|
+
const ret = wasm.amp2descriptor_descriptor(this.__wbg_ptr);
|
|
589
|
+
return WolletDescriptor.__wrap(ret);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* @returns {string}
|
|
593
|
+
*/
|
|
594
|
+
toString() {
|
|
595
|
+
let deferred1_0;
|
|
596
|
+
let deferred1_1;
|
|
597
|
+
try {
|
|
598
|
+
const ret = wasm.amp2descriptor_toString(this.__wbg_ptr);
|
|
599
|
+
deferred1_0 = ret[0];
|
|
600
|
+
deferred1_1 = ret[1];
|
|
601
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
602
|
+
} finally {
|
|
603
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
module.exports.Amp2Descriptor = Amp2Descriptor;
|
|
608
|
+
|
|
609
|
+
const AssetIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
610
|
+
? { register: () => {}, unregister: () => {} }
|
|
611
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_assetid_free(ptr >>> 0, 1));
|
|
612
|
+
/**
|
|
613
|
+
* A valid asset identifier. wrapper of [`elements::AssetId`]
|
|
614
|
+
*
|
|
615
|
+
* 32 bytes encoded as hex string.
|
|
616
|
+
*/
|
|
617
|
+
class AssetId {
|
|
618
|
+
|
|
619
|
+
static __wrap(ptr) {
|
|
620
|
+
ptr = ptr >>> 0;
|
|
621
|
+
const obj = Object.create(AssetId.prototype);
|
|
622
|
+
obj.__wbg_ptr = ptr;
|
|
623
|
+
AssetIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
624
|
+
return obj;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
__destroy_into_raw() {
|
|
628
|
+
const ptr = this.__wbg_ptr;
|
|
629
|
+
this.__wbg_ptr = 0;
|
|
630
|
+
AssetIdFinalization.unregister(this);
|
|
631
|
+
return ptr;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
free() {
|
|
635
|
+
const ptr = this.__destroy_into_raw();
|
|
636
|
+
wasm.__wbg_assetid_free(ptr, 0);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Creates an `AssetId`
|
|
640
|
+
* @param {string} asset_id
|
|
641
|
+
*/
|
|
642
|
+
constructor(asset_id) {
|
|
643
|
+
const ptr0 = passStringToWasm0(asset_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
644
|
+
const len0 = WASM_VECTOR_LEN;
|
|
645
|
+
const ret = wasm.assetid_new(ptr0, len0);
|
|
646
|
+
if (ret[2]) {
|
|
647
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
648
|
+
}
|
|
649
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
650
|
+
AssetIdFinalization.register(this, this.__wbg_ptr, this);
|
|
651
|
+
return this;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* @returns {string}
|
|
655
|
+
*/
|
|
656
|
+
toString() {
|
|
657
|
+
let deferred1_0;
|
|
658
|
+
let deferred1_1;
|
|
659
|
+
try {
|
|
660
|
+
const ret = wasm.assetid_toString(this.__wbg_ptr);
|
|
661
|
+
deferred1_0 = ret[0];
|
|
662
|
+
deferred1_1 = ret[1];
|
|
663
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
664
|
+
} finally {
|
|
665
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
module.exports.AssetId = AssetId;
|
|
670
|
+
|
|
671
|
+
const BipFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
672
|
+
? { register: () => {}, unregister: () => {} }
|
|
673
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_bip_free(ptr >>> 0, 1));
|
|
674
|
+
/**
|
|
675
|
+
* wrapper over [`lwk_common::Bip`]
|
|
676
|
+
*/
|
|
677
|
+
class Bip {
|
|
678
|
+
|
|
679
|
+
static __wrap(ptr) {
|
|
680
|
+
ptr = ptr >>> 0;
|
|
681
|
+
const obj = Object.create(Bip.prototype);
|
|
682
|
+
obj.__wbg_ptr = ptr;
|
|
683
|
+
BipFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
684
|
+
return obj;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
__destroy_into_raw() {
|
|
688
|
+
const ptr = this.__wbg_ptr;
|
|
689
|
+
this.__wbg_ptr = 0;
|
|
690
|
+
BipFinalization.unregister(this);
|
|
691
|
+
return ptr;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
free() {
|
|
695
|
+
const ptr = this.__destroy_into_raw();
|
|
696
|
+
wasm.__wbg_bip_free(ptr, 0);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Creates a bip49 variant
|
|
700
|
+
* @returns {Bip}
|
|
701
|
+
*/
|
|
702
|
+
static bip49() {
|
|
703
|
+
const ret = wasm.bip_bip49();
|
|
704
|
+
return Bip.__wrap(ret);
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Creates a bip84 variant
|
|
708
|
+
* @returns {Bip}
|
|
709
|
+
*/
|
|
710
|
+
static bip84() {
|
|
711
|
+
const ret = wasm.bip_bip84();
|
|
712
|
+
return Bip.__wrap(ret);
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Creates a bip87 variant
|
|
716
|
+
* @returns {Bip}
|
|
717
|
+
*/
|
|
718
|
+
static bip87() {
|
|
719
|
+
const ret = wasm.bip_bip87();
|
|
720
|
+
return Bip.__wrap(ret);
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* @returns {string}
|
|
724
|
+
*/
|
|
725
|
+
toString() {
|
|
726
|
+
let deferred1_0;
|
|
727
|
+
let deferred1_1;
|
|
728
|
+
try {
|
|
729
|
+
const ret = wasm.bip_toString(this.__wbg_ptr);
|
|
730
|
+
deferred1_0 = ret[0];
|
|
731
|
+
deferred1_1 = ret[1];
|
|
732
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
733
|
+
} finally {
|
|
734
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
module.exports.Bip = Bip;
|
|
739
|
+
|
|
740
|
+
const ContractFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
741
|
+
? { register: () => {}, unregister: () => {} }
|
|
742
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_contract_free(ptr >>> 0, 1));
|
|
743
|
+
/**
|
|
744
|
+
* Wrapper of [`lwk_wollet::Contract`]
|
|
745
|
+
*/
|
|
746
|
+
class Contract {
|
|
747
|
+
|
|
748
|
+
__destroy_into_raw() {
|
|
749
|
+
const ptr = this.__wbg_ptr;
|
|
750
|
+
this.__wbg_ptr = 0;
|
|
751
|
+
ContractFinalization.unregister(this);
|
|
752
|
+
return ptr;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
free() {
|
|
756
|
+
const ptr = this.__destroy_into_raw();
|
|
757
|
+
wasm.__wbg_contract_free(ptr, 0);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Creates a `Contract`
|
|
761
|
+
* @param {string} domain
|
|
762
|
+
* @param {string} issuer_pubkey
|
|
763
|
+
* @param {string} name
|
|
764
|
+
* @param {number} precision
|
|
765
|
+
* @param {string} ticker
|
|
766
|
+
* @param {number} version
|
|
767
|
+
*/
|
|
768
|
+
constructor(domain, issuer_pubkey, name, precision, ticker, version) {
|
|
769
|
+
const ptr0 = passStringToWasm0(domain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
770
|
+
const len0 = WASM_VECTOR_LEN;
|
|
771
|
+
const ptr1 = passStringToWasm0(issuer_pubkey, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
772
|
+
const len1 = WASM_VECTOR_LEN;
|
|
773
|
+
const ptr2 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
774
|
+
const len2 = WASM_VECTOR_LEN;
|
|
775
|
+
const ptr3 = passStringToWasm0(ticker, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
776
|
+
const len3 = WASM_VECTOR_LEN;
|
|
777
|
+
const ret = wasm.contract_new(ptr0, len0, ptr1, len1, ptr2, len2, precision, ptr3, len3, version);
|
|
778
|
+
if (ret[2]) {
|
|
779
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
780
|
+
}
|
|
781
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
782
|
+
ContractFinalization.register(this, this.__wbg_ptr, this);
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* @returns {string}
|
|
787
|
+
*/
|
|
788
|
+
toString() {
|
|
789
|
+
let deferred1_0;
|
|
790
|
+
let deferred1_1;
|
|
791
|
+
try {
|
|
792
|
+
const ret = wasm.contract_toString(this.__wbg_ptr);
|
|
793
|
+
deferred1_0 = ret[0];
|
|
794
|
+
deferred1_1 = ret[1];
|
|
795
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
796
|
+
} finally {
|
|
797
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
module.exports.Contract = Contract;
|
|
802
|
+
|
|
803
|
+
const EsploraClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
804
|
+
? { register: () => {}, unregister: () => {} }
|
|
805
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_esploraclient_free(ptr >>> 0, 1));
|
|
806
|
+
/**
|
|
807
|
+
* Wrapper of [`asyncr::EsploraClient`]
|
|
808
|
+
*/
|
|
809
|
+
class EsploraClient {
|
|
810
|
+
|
|
811
|
+
static __wrap(ptr) {
|
|
812
|
+
ptr = ptr >>> 0;
|
|
813
|
+
const obj = Object.create(EsploraClient.prototype);
|
|
814
|
+
obj.__wbg_ptr = ptr;
|
|
815
|
+
EsploraClientFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
816
|
+
return obj;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
__destroy_into_raw() {
|
|
820
|
+
const ptr = this.__wbg_ptr;
|
|
821
|
+
this.__wbg_ptr = 0;
|
|
822
|
+
EsploraClientFinalization.unregister(this);
|
|
823
|
+
return ptr;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
free() {
|
|
827
|
+
const ptr = this.__destroy_into_raw();
|
|
828
|
+
wasm.__wbg_esploraclient_free(ptr, 0);
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Creates a client, wrapper of [`asyncr::EsploraClient`]
|
|
832
|
+
* @param {Network} network
|
|
833
|
+
* @param {string} url
|
|
834
|
+
* @param {boolean} waterfalls
|
|
835
|
+
*/
|
|
836
|
+
constructor(network, url, waterfalls) {
|
|
837
|
+
_assertClass(network, Network);
|
|
838
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
839
|
+
const len0 = WASM_VECTOR_LEN;
|
|
840
|
+
const ret = wasm.esploraclient_new(network.__wbg_ptr, ptr0, len0, waterfalls);
|
|
841
|
+
this.__wbg_ptr = ret >>> 0;
|
|
842
|
+
EsploraClientFinalization.register(this, this.__wbg_ptr, this);
|
|
843
|
+
return this;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* @param {Wollet} wollet
|
|
847
|
+
* @returns {Promise<Update | undefined>}
|
|
848
|
+
*/
|
|
849
|
+
fullScan(wollet) {
|
|
850
|
+
_assertClass(wollet, Wollet);
|
|
851
|
+
const ret = wasm.esploraclient_fullScan(this.__wbg_ptr, wollet.__wbg_ptr);
|
|
852
|
+
return ret;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* @param {Pset} pset
|
|
856
|
+
* @returns {Promise<Txid>}
|
|
857
|
+
*/
|
|
858
|
+
broadcast(pset) {
|
|
859
|
+
_assertClass(pset, Pset);
|
|
860
|
+
const ret = wasm.esploraclient_broadcast(this.__wbg_ptr, pset.__wbg_ptr);
|
|
861
|
+
return ret;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* @param {string} recipient
|
|
865
|
+
* @returns {Promise<void>}
|
|
866
|
+
*/
|
|
867
|
+
set_waterfalls_server_recipient(recipient) {
|
|
868
|
+
const ptr0 = passStringToWasm0(recipient, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
869
|
+
const len0 = WASM_VECTOR_LEN;
|
|
870
|
+
const ret = wasm.esploraclient_set_waterfalls_server_recipient(this.__wbg_ptr, ptr0, len0);
|
|
871
|
+
return ret;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
module.exports.EsploraClient = EsploraClient;
|
|
875
|
+
|
|
876
|
+
const IssuanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
877
|
+
? { register: () => {}, unregister: () => {} }
|
|
878
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_issuance_free(ptr >>> 0, 1));
|
|
879
|
+
/**
|
|
880
|
+
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::Issuance`]
|
|
881
|
+
*/
|
|
882
|
+
class Issuance {
|
|
883
|
+
|
|
884
|
+
static __wrap(ptr) {
|
|
885
|
+
ptr = ptr >>> 0;
|
|
886
|
+
const obj = Object.create(Issuance.prototype);
|
|
887
|
+
obj.__wbg_ptr = ptr;
|
|
888
|
+
IssuanceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
889
|
+
return obj;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
__destroy_into_raw() {
|
|
893
|
+
const ptr = this.__wbg_ptr;
|
|
894
|
+
this.__wbg_ptr = 0;
|
|
895
|
+
IssuanceFinalization.unregister(this);
|
|
896
|
+
return ptr;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
free() {
|
|
900
|
+
const ptr = this.__destroy_into_raw();
|
|
901
|
+
wasm.__wbg_issuance_free(ptr, 0);
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* @returns {AssetId | undefined}
|
|
905
|
+
*/
|
|
906
|
+
asset() {
|
|
907
|
+
const ret = wasm.issuance_asset(this.__wbg_ptr);
|
|
908
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* @returns {AssetId | undefined}
|
|
912
|
+
*/
|
|
913
|
+
token() {
|
|
914
|
+
const ret = wasm.issuance_token(this.__wbg_ptr);
|
|
915
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* @returns {number | undefined}
|
|
919
|
+
*/
|
|
920
|
+
prevVout() {
|
|
921
|
+
const ret = wasm.issuance_prevVout(this.__wbg_ptr);
|
|
922
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* @returns {Txid | undefined}
|
|
926
|
+
*/
|
|
927
|
+
prevTxid() {
|
|
928
|
+
const ret = wasm.issuance_prevTxid(this.__wbg_ptr);
|
|
929
|
+
return ret === 0 ? undefined : Txid.__wrap(ret);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* @returns {boolean}
|
|
933
|
+
*/
|
|
934
|
+
isIssuance() {
|
|
935
|
+
const ret = wasm.issuance_isIssuance(this.__wbg_ptr);
|
|
936
|
+
return ret !== 0;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* @returns {boolean}
|
|
940
|
+
*/
|
|
941
|
+
isReissuance() {
|
|
942
|
+
const ret = wasm.issuance_isReissuance(this.__wbg_ptr);
|
|
943
|
+
return ret !== 0;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
module.exports.Issuance = Issuance;
|
|
947
|
+
|
|
948
|
+
const JadeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
949
|
+
? { register: () => {}, unregister: () => {} }
|
|
950
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jade_free(ptr >>> 0, 1));
|
|
951
|
+
/**
|
|
952
|
+
* Wrapper of [`asyncr::Jade`]
|
|
953
|
+
*/
|
|
954
|
+
class Jade {
|
|
955
|
+
|
|
956
|
+
static __wrap(ptr) {
|
|
957
|
+
ptr = ptr >>> 0;
|
|
958
|
+
const obj = Object.create(Jade.prototype);
|
|
959
|
+
obj.__wbg_ptr = ptr;
|
|
960
|
+
JadeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
961
|
+
return obj;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
__destroy_into_raw() {
|
|
965
|
+
const ptr = this.__wbg_ptr;
|
|
966
|
+
this.__wbg_ptr = 0;
|
|
967
|
+
JadeFinalization.unregister(this);
|
|
968
|
+
return ptr;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
free() {
|
|
972
|
+
const ptr = this.__destroy_into_raw();
|
|
973
|
+
wasm.__wbg_jade_free(ptr, 0);
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Creates a Jade from Web Serial for the given network
|
|
977
|
+
*
|
|
978
|
+
* When filter is true, it will filter available serial with Blockstream released chips, use
|
|
979
|
+
* false if you don't see your DYI jade
|
|
980
|
+
* @param {Network} network
|
|
981
|
+
* @param {boolean} filter
|
|
982
|
+
*/
|
|
983
|
+
constructor(network, filter) {
|
|
984
|
+
_assertClass(network, Network);
|
|
985
|
+
const ret = wasm.jade_from_serial(network.__wbg_ptr, filter);
|
|
986
|
+
return ret;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* @returns {Promise<any>}
|
|
990
|
+
*/
|
|
991
|
+
getVersion() {
|
|
992
|
+
const ret = wasm.jade_getVersion(this.__wbg_ptr);
|
|
993
|
+
return ret;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* @returns {Promise<Xpub>}
|
|
997
|
+
*/
|
|
998
|
+
getMasterXpub() {
|
|
999
|
+
const ret = wasm.jade_getMasterXpub(this.__wbg_ptr);
|
|
1000
|
+
return ret;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Return a single sig address with the given `variant` and `path` derivation
|
|
1004
|
+
* @param {Singlesig} variant
|
|
1005
|
+
* @param {Uint32Array} path
|
|
1006
|
+
* @returns {Promise<string>}
|
|
1007
|
+
*/
|
|
1008
|
+
getReceiveAddressSingle(variant, path) {
|
|
1009
|
+
_assertClass(variant, Singlesig);
|
|
1010
|
+
var ptr0 = variant.__destroy_into_raw();
|
|
1011
|
+
const ptr1 = passArray32ToWasm0(path, wasm.__wbindgen_malloc);
|
|
1012
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1013
|
+
const ret = wasm.jade_getReceiveAddressSingle(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
1014
|
+
return ret;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Return a multisig address of a registered `multisig_name` wallet
|
|
1018
|
+
*
|
|
1019
|
+
* This method accept `path` and `path_n` in place of a single `Vec<Vec<u32>>` because the
|
|
1020
|
+
* latter is not supported by wasm_bindgen (and neither `(u32, Vec<u32>)`). `path` and `path_n`
|
|
1021
|
+
* are converted internally to a `Vec<Vec<u32>>` with the caveat all the paths are the same,
|
|
1022
|
+
* which is almost always the case.
|
|
1023
|
+
* @param {string} multisig_name
|
|
1024
|
+
* @param {Uint32Array} path
|
|
1025
|
+
* @returns {Promise<string>}
|
|
1026
|
+
*/
|
|
1027
|
+
getReceiveAddressMulti(multisig_name, path) {
|
|
1028
|
+
const ptr0 = passStringToWasm0(multisig_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1029
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1030
|
+
const ptr1 = passArray32ToWasm0(path, wasm.__wbindgen_malloc);
|
|
1031
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1032
|
+
const ret = wasm.jade_getReceiveAddressMulti(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1033
|
+
return ret;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Sign and consume the given PSET, returning the signed one
|
|
1037
|
+
* @param {Pset} pset
|
|
1038
|
+
* @returns {Promise<Pset>}
|
|
1039
|
+
*/
|
|
1040
|
+
sign(pset) {
|
|
1041
|
+
_assertClass(pset, Pset);
|
|
1042
|
+
var ptr0 = pset.__destroy_into_raw();
|
|
1043
|
+
const ret = wasm.jade_sign(this.__wbg_ptr, ptr0);
|
|
1044
|
+
return ret;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* @returns {Promise<WolletDescriptor>}
|
|
1048
|
+
*/
|
|
1049
|
+
wpkh() {
|
|
1050
|
+
const ret = wasm.jade_wpkh(this.__wbg_ptr);
|
|
1051
|
+
return ret;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* @returns {Promise<WolletDescriptor>}
|
|
1055
|
+
*/
|
|
1056
|
+
shWpkh() {
|
|
1057
|
+
const ret = wasm.jade_shWpkh(this.__wbg_ptr);
|
|
1058
|
+
return ret;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* @param {string} name
|
|
1062
|
+
* @returns {Promise<WolletDescriptor>}
|
|
1063
|
+
*/
|
|
1064
|
+
multi(name) {
|
|
1065
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1066
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1067
|
+
const ret = wasm.jade_multi(this.__wbg_ptr, ptr0, len0);
|
|
1068
|
+
return ret;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* @returns {Promise<any>}
|
|
1072
|
+
*/
|
|
1073
|
+
getRegisteredMultisigs() {
|
|
1074
|
+
const ret = wasm.jade_getRegisteredMultisigs(this.__wbg_ptr);
|
|
1075
|
+
return ret;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* @param {Bip} bip
|
|
1079
|
+
* @returns {Promise<string>}
|
|
1080
|
+
*/
|
|
1081
|
+
keyoriginXpub(bip) {
|
|
1082
|
+
_assertClass(bip, Bip);
|
|
1083
|
+
var ptr0 = bip.__destroy_into_raw();
|
|
1084
|
+
const ret = wasm.jade_keyoriginXpub(this.__wbg_ptr, ptr0);
|
|
1085
|
+
return ret;
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* @param {string} name
|
|
1089
|
+
* @param {WolletDescriptor} desc
|
|
1090
|
+
* @returns {Promise<boolean>}
|
|
1091
|
+
*/
|
|
1092
|
+
registerDescriptor(name, desc) {
|
|
1093
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1094
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1095
|
+
_assertClass(desc, WolletDescriptor);
|
|
1096
|
+
const ret = wasm.jade_registerDescriptor(this.__wbg_ptr, ptr0, len0, desc.__wbg_ptr);
|
|
1097
|
+
return ret;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
module.exports.Jade = Jade;
|
|
1101
|
+
|
|
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
|
+
const MnemonicFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1139
|
+
? { register: () => {}, unregister: () => {} }
|
|
1140
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_mnemonic_free(ptr >>> 0, 1));
|
|
1141
|
+
/**
|
|
1142
|
+
* Wrapper of [`bip39::Mnemonic`]
|
|
1143
|
+
*/
|
|
1144
|
+
class Mnemonic {
|
|
1145
|
+
|
|
1146
|
+
static __wrap(ptr) {
|
|
1147
|
+
ptr = ptr >>> 0;
|
|
1148
|
+
const obj = Object.create(Mnemonic.prototype);
|
|
1149
|
+
obj.__wbg_ptr = ptr;
|
|
1150
|
+
MnemonicFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1151
|
+
return obj;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
__destroy_into_raw() {
|
|
1155
|
+
const ptr = this.__wbg_ptr;
|
|
1156
|
+
this.__wbg_ptr = 0;
|
|
1157
|
+
MnemonicFinalization.unregister(this);
|
|
1158
|
+
return ptr;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
free() {
|
|
1162
|
+
const ptr = this.__destroy_into_raw();
|
|
1163
|
+
wasm.__wbg_mnemonic_free(ptr, 0);
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Creates a Mnemonic
|
|
1167
|
+
* @param {string} s
|
|
1168
|
+
*/
|
|
1169
|
+
constructor(s) {
|
|
1170
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1171
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1172
|
+
const ret = wasm.mnemonic_new(ptr0, len0);
|
|
1173
|
+
if (ret[2]) {
|
|
1174
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1175
|
+
}
|
|
1176
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1177
|
+
MnemonicFinalization.register(this, this.__wbg_ptr, this);
|
|
1178
|
+
return this;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* @returns {string}
|
|
1182
|
+
*/
|
|
1183
|
+
toString() {
|
|
1184
|
+
let deferred1_0;
|
|
1185
|
+
let deferred1_1;
|
|
1186
|
+
try {
|
|
1187
|
+
const ret = wasm.mnemonic_toString(this.__wbg_ptr);
|
|
1188
|
+
deferred1_0 = ret[0];
|
|
1189
|
+
deferred1_1 = ret[1];
|
|
1190
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1191
|
+
} finally {
|
|
1192
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Creates a Mnemonic from entropy, at least 16 bytes are needed.
|
|
1197
|
+
* @param {Uint8Array} b
|
|
1198
|
+
* @returns {Mnemonic}
|
|
1199
|
+
*/
|
|
1200
|
+
static fromEntropy(b) {
|
|
1201
|
+
const ptr0 = passArray8ToWasm0(b, wasm.__wbindgen_malloc);
|
|
1202
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1203
|
+
const ret = wasm.mnemonic_fromEntropy(ptr0, len0);
|
|
1204
|
+
if (ret[2]) {
|
|
1205
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1206
|
+
}
|
|
1207
|
+
return Mnemonic.__wrap(ret[0]);
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Creates a random Mnemonic of given words (12,15,18,21,24)
|
|
1211
|
+
* @param {number} word_count
|
|
1212
|
+
* @returns {Mnemonic}
|
|
1213
|
+
*/
|
|
1214
|
+
static fromRandom(word_count) {
|
|
1215
|
+
const ret = wasm.mnemonic_fromRandom(word_count);
|
|
1216
|
+
if (ret[2]) {
|
|
1217
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1218
|
+
}
|
|
1219
|
+
return Mnemonic.__wrap(ret[0]);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
module.exports.Mnemonic = Mnemonic;
|
|
1223
|
+
|
|
1224
|
+
const NetworkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1225
|
+
? { register: () => {}, unregister: () => {} }
|
|
1226
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_network_free(ptr >>> 0, 1));
|
|
1227
|
+
/**
|
|
1228
|
+
* Wrapper of [`lwk_wollet::ElementsNetwork`]
|
|
1229
|
+
*/
|
|
1230
|
+
class Network {
|
|
1231
|
+
|
|
1232
|
+
static __wrap(ptr) {
|
|
1233
|
+
ptr = ptr >>> 0;
|
|
1234
|
+
const obj = Object.create(Network.prototype);
|
|
1235
|
+
obj.__wbg_ptr = ptr;
|
|
1236
|
+
NetworkFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1237
|
+
return obj;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
__destroy_into_raw() {
|
|
1241
|
+
const ptr = this.__wbg_ptr;
|
|
1242
|
+
this.__wbg_ptr = 0;
|
|
1243
|
+
NetworkFinalization.unregister(this);
|
|
1244
|
+
return ptr;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
free() {
|
|
1248
|
+
const ptr = this.__destroy_into_raw();
|
|
1249
|
+
wasm.__wbg_network_free(ptr, 0);
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Creates a mainnet `Network``
|
|
1253
|
+
* @returns {Network}
|
|
1254
|
+
*/
|
|
1255
|
+
static mainnet() {
|
|
1256
|
+
const ret = wasm.network_mainnet();
|
|
1257
|
+
return Network.__wrap(ret);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Creates a testnet `Network``
|
|
1261
|
+
* @returns {Network}
|
|
1262
|
+
*/
|
|
1263
|
+
static testnet() {
|
|
1264
|
+
const ret = wasm.network_testnet();
|
|
1265
|
+
return Network.__wrap(ret);
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Creates a regtest `Network``
|
|
1269
|
+
* @param {AssetId} policy_asset
|
|
1270
|
+
* @returns {Network}
|
|
1271
|
+
*/
|
|
1272
|
+
static regtest(policy_asset) {
|
|
1273
|
+
_assertClass(policy_asset, AssetId);
|
|
1274
|
+
const ret = wasm.network_regtest(policy_asset.__wbg_ptr);
|
|
1275
|
+
return Network.__wrap(ret);
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Creates the default regtest `Network`
|
|
1279
|
+
* @returns {Network}
|
|
1280
|
+
*/
|
|
1281
|
+
static regtestDefault() {
|
|
1282
|
+
const ret = wasm.network_regtestDefault();
|
|
1283
|
+
return Network.__wrap(ret);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* @returns {EsploraClient}
|
|
1287
|
+
*/
|
|
1288
|
+
defaultEsploraClient() {
|
|
1289
|
+
const ret = wasm.network_defaultEsploraClient(this.__wbg_ptr);
|
|
1290
|
+
return EsploraClient.__wrap(ret);
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* @returns {boolean}
|
|
1294
|
+
*/
|
|
1295
|
+
isMainnet() {
|
|
1296
|
+
const ret = wasm.network_isMainnet(this.__wbg_ptr);
|
|
1297
|
+
return ret !== 0;
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* @returns {string}
|
|
1301
|
+
*/
|
|
1302
|
+
toString() {
|
|
1303
|
+
let deferred1_0;
|
|
1304
|
+
let deferred1_1;
|
|
1305
|
+
try {
|
|
1306
|
+
const ret = wasm.network_toString(this.__wbg_ptr);
|
|
1307
|
+
deferred1_0 = ret[0];
|
|
1308
|
+
deferred1_1 = ret[1];
|
|
1309
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1310
|
+
} finally {
|
|
1311
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* @returns {AssetId}
|
|
1316
|
+
*/
|
|
1317
|
+
policyAsset() {
|
|
1318
|
+
const ret = wasm.network_policyAsset(this.__wbg_ptr);
|
|
1319
|
+
return AssetId.__wrap(ret);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* @returns {TxBuilder}
|
|
1323
|
+
*/
|
|
1324
|
+
txBuilder() {
|
|
1325
|
+
const ret = wasm.network_txBuilder(this.__wbg_ptr);
|
|
1326
|
+
return TxBuilder.__wrap(ret);
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* @returns {string}
|
|
1330
|
+
*/
|
|
1331
|
+
defaultExplorerUrl() {
|
|
1332
|
+
let deferred1_0;
|
|
1333
|
+
let deferred1_1;
|
|
1334
|
+
try {
|
|
1335
|
+
const ret = wasm.network_defaultExplorerUrl(this.__wbg_ptr);
|
|
1336
|
+
deferred1_0 = ret[0];
|
|
1337
|
+
deferred1_1 = ret[1];
|
|
1338
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1339
|
+
} finally {
|
|
1340
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
module.exports.Network = Network;
|
|
1345
|
+
|
|
1346
|
+
const OptionWalletTxOutFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1347
|
+
? { register: () => {}, unregister: () => {} }
|
|
1348
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_optionwallettxout_free(ptr >>> 0, 1));
|
|
1349
|
+
/**
|
|
1350
|
+
* An optional wallet transaction output. Could be None when it's not possible to unblind.
|
|
1351
|
+
* It seems required by wasm_bindgen because we can't return `Vec<Option<WalletTxOut>>`
|
|
1352
|
+
*/
|
|
1353
|
+
class OptionWalletTxOut {
|
|
1354
|
+
|
|
1355
|
+
static __wrap(ptr) {
|
|
1356
|
+
ptr = ptr >>> 0;
|
|
1357
|
+
const obj = Object.create(OptionWalletTxOut.prototype);
|
|
1358
|
+
obj.__wbg_ptr = ptr;
|
|
1359
|
+
OptionWalletTxOutFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1360
|
+
return obj;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
__destroy_into_raw() {
|
|
1364
|
+
const ptr = this.__wbg_ptr;
|
|
1365
|
+
this.__wbg_ptr = 0;
|
|
1366
|
+
OptionWalletTxOutFinalization.unregister(this);
|
|
1367
|
+
return ptr;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
free() {
|
|
1371
|
+
const ptr = this.__destroy_into_raw();
|
|
1372
|
+
wasm.__wbg_optionwallettxout_free(ptr, 0);
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* @returns {WalletTxOut | undefined}
|
|
1376
|
+
*/
|
|
1377
|
+
get() {
|
|
1378
|
+
const ret = wasm.optionwallettxout_get(this.__wbg_ptr);
|
|
1379
|
+
return ret === 0 ? undefined : WalletTxOut.__wrap(ret);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
module.exports.OptionWalletTxOut = OptionWalletTxOut;
|
|
1383
|
+
|
|
1384
|
+
const OutPointFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1385
|
+
? { register: () => {}, unregister: () => {} }
|
|
1386
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_outpoint_free(ptr >>> 0, 1));
|
|
1387
|
+
/**
|
|
1388
|
+
* Wrapper of [`elements::OutPoint`]
|
|
1389
|
+
*/
|
|
1390
|
+
class OutPoint {
|
|
1391
|
+
|
|
1392
|
+
static __wrap(ptr) {
|
|
1393
|
+
ptr = ptr >>> 0;
|
|
1394
|
+
const obj = Object.create(OutPoint.prototype);
|
|
1395
|
+
obj.__wbg_ptr = ptr;
|
|
1396
|
+
OutPointFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1397
|
+
return obj;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
__destroy_into_raw() {
|
|
1401
|
+
const ptr = this.__wbg_ptr;
|
|
1402
|
+
this.__wbg_ptr = 0;
|
|
1403
|
+
OutPointFinalization.unregister(this);
|
|
1404
|
+
return ptr;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
free() {
|
|
1408
|
+
const ptr = this.__destroy_into_raw();
|
|
1409
|
+
wasm.__wbg_outpoint_free(ptr, 0);
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Creates an `OutPoint`
|
|
1413
|
+
* @param {string} s
|
|
1414
|
+
*/
|
|
1415
|
+
constructor(s) {
|
|
1416
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1417
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1418
|
+
const ret = wasm.outpoint_new(ptr0, len0);
|
|
1419
|
+
if (ret[2]) {
|
|
1420
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1421
|
+
}
|
|
1422
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1423
|
+
OutPointFinalization.register(this, this.__wbg_ptr, this);
|
|
1424
|
+
return this;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* @returns {Txid}
|
|
1428
|
+
*/
|
|
1429
|
+
txid() {
|
|
1430
|
+
const ret = wasm.outpoint_txid(this.__wbg_ptr);
|
|
1431
|
+
return Txid.__wrap(ret);
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* @returns {number}
|
|
1435
|
+
*/
|
|
1436
|
+
vout() {
|
|
1437
|
+
const ret = wasm.outpoint_vout(this.__wbg_ptr);
|
|
1438
|
+
return ret >>> 0;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
module.exports.OutPoint = OutPoint;
|
|
1442
|
+
|
|
1443
|
+
const PrecisionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1444
|
+
? { register: () => {}, unregister: () => {} }
|
|
1445
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_precision_free(ptr >>> 0, 1));
|
|
1446
|
+
/**
|
|
1447
|
+
* Wrapper of [`lwk_common::precision::Precision`]
|
|
1448
|
+
*/
|
|
1449
|
+
class Precision {
|
|
1450
|
+
|
|
1451
|
+
__destroy_into_raw() {
|
|
1452
|
+
const ptr = this.__wbg_ptr;
|
|
1453
|
+
this.__wbg_ptr = 0;
|
|
1454
|
+
PrecisionFinalization.unregister(this);
|
|
1455
|
+
return ptr;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
free() {
|
|
1459
|
+
const ptr = this.__destroy_into_raw();
|
|
1460
|
+
wasm.__wbg_precision_free(ptr, 0);
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Creates a Precision
|
|
1464
|
+
* @param {number} precision
|
|
1465
|
+
*/
|
|
1466
|
+
constructor(precision) {
|
|
1467
|
+
const ret = wasm.precision_new(precision);
|
|
1468
|
+
if (ret[2]) {
|
|
1469
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1470
|
+
}
|
|
1471
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1472
|
+
PrecisionFinalization.register(this, this.__wbg_ptr, this);
|
|
1473
|
+
return this;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* @param {bigint} sats
|
|
1477
|
+
* @returns {string}
|
|
1478
|
+
*/
|
|
1479
|
+
satsToString(sats) {
|
|
1480
|
+
let deferred1_0;
|
|
1481
|
+
let deferred1_1;
|
|
1482
|
+
try {
|
|
1483
|
+
const ret = wasm.precision_satsToString(this.__wbg_ptr, sats);
|
|
1484
|
+
deferred1_0 = ret[0];
|
|
1485
|
+
deferred1_1 = ret[1];
|
|
1486
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1487
|
+
} finally {
|
|
1488
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* @param {string} sats
|
|
1493
|
+
* @returns {bigint}
|
|
1494
|
+
*/
|
|
1495
|
+
stringToSats(sats) {
|
|
1496
|
+
const ptr0 = passStringToWasm0(sats, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1497
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1498
|
+
const ret = wasm.precision_stringToSats(this.__wbg_ptr, ptr0, len0);
|
|
1499
|
+
if (ret[2]) {
|
|
1500
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1501
|
+
}
|
|
1502
|
+
return ret[0];
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
module.exports.Precision = Precision;
|
|
1506
|
+
|
|
1507
|
+
const PsetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1508
|
+
? { register: () => {}, unregister: () => {} }
|
|
1509
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pset_free(ptr >>> 0, 1));
|
|
1510
|
+
/**
|
|
1511
|
+
* Partially Signed Elements Transaction, wrapper of [`PartiallySignedTransaction`]
|
|
1512
|
+
*/
|
|
1513
|
+
class Pset {
|
|
1514
|
+
|
|
1515
|
+
static __wrap(ptr) {
|
|
1516
|
+
ptr = ptr >>> 0;
|
|
1517
|
+
const obj = Object.create(Pset.prototype);
|
|
1518
|
+
obj.__wbg_ptr = ptr;
|
|
1519
|
+
PsetFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1520
|
+
return obj;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
__destroy_into_raw() {
|
|
1524
|
+
const ptr = this.__wbg_ptr;
|
|
1525
|
+
this.__wbg_ptr = 0;
|
|
1526
|
+
PsetFinalization.unregister(this);
|
|
1527
|
+
return ptr;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
free() {
|
|
1531
|
+
const ptr = this.__destroy_into_raw();
|
|
1532
|
+
wasm.__wbg_pset_free(ptr, 0);
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Creates a `Pset`
|
|
1536
|
+
* @param {string} base64
|
|
1537
|
+
*/
|
|
1538
|
+
constructor(base64) {
|
|
1539
|
+
const ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1540
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1541
|
+
const ret = wasm.pset_new(ptr0, len0);
|
|
1542
|
+
if (ret[2]) {
|
|
1543
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1544
|
+
}
|
|
1545
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1546
|
+
PsetFinalization.register(this, this.__wbg_ptr, this);
|
|
1547
|
+
return this;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* @returns {string}
|
|
1551
|
+
*/
|
|
1552
|
+
toString() {
|
|
1553
|
+
let deferred1_0;
|
|
1554
|
+
let deferred1_1;
|
|
1555
|
+
try {
|
|
1556
|
+
const ret = wasm.pset_toString(this.__wbg_ptr);
|
|
1557
|
+
deferred1_0 = ret[0];
|
|
1558
|
+
deferred1_1 = ret[1];
|
|
1559
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1560
|
+
} finally {
|
|
1561
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* @returns {Transaction}
|
|
1566
|
+
*/
|
|
1567
|
+
extractTx() {
|
|
1568
|
+
const ret = wasm.pset_extractTx(this.__wbg_ptr);
|
|
1569
|
+
if (ret[2]) {
|
|
1570
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1571
|
+
}
|
|
1572
|
+
return Transaction.__wrap(ret[0]);
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* @param {Pset} other
|
|
1576
|
+
*/
|
|
1577
|
+
combine(other) {
|
|
1578
|
+
_assertClass(other, Pset);
|
|
1579
|
+
var ptr0 = other.__destroy_into_raw();
|
|
1580
|
+
const ret = wasm.pset_combine(this.__wbg_ptr, ptr0);
|
|
1581
|
+
if (ret[1]) {
|
|
1582
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* @returns {(PsetInput)[]}
|
|
1587
|
+
*/
|
|
1588
|
+
inputs() {
|
|
1589
|
+
const ret = wasm.pset_inputs(this.__wbg_ptr);
|
|
1590
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1591
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1592
|
+
return v1;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
module.exports.Pset = Pset;
|
|
1596
|
+
|
|
1597
|
+
const PsetBalanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1598
|
+
? { register: () => {}, unregister: () => {} }
|
|
1599
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_psetbalance_free(ptr >>> 0, 1));
|
|
1600
|
+
/**
|
|
1601
|
+
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetBalance`]
|
|
1602
|
+
*/
|
|
1603
|
+
class PsetBalance {
|
|
1604
|
+
|
|
1605
|
+
static __wrap(ptr) {
|
|
1606
|
+
ptr = ptr >>> 0;
|
|
1607
|
+
const obj = Object.create(PsetBalance.prototype);
|
|
1608
|
+
obj.__wbg_ptr = ptr;
|
|
1609
|
+
PsetBalanceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1610
|
+
return obj;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
__destroy_into_raw() {
|
|
1614
|
+
const ptr = this.__wbg_ptr;
|
|
1615
|
+
this.__wbg_ptr = 0;
|
|
1616
|
+
PsetBalanceFinalization.unregister(this);
|
|
1617
|
+
return ptr;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
free() {
|
|
1621
|
+
const ptr = this.__destroy_into_raw();
|
|
1622
|
+
wasm.__wbg_psetbalance_free(ptr, 0);
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* @returns {bigint}
|
|
1626
|
+
*/
|
|
1627
|
+
fee() {
|
|
1628
|
+
const ret = wasm.psetbalance_fee(this.__wbg_ptr);
|
|
1629
|
+
return BigInt.asUintN(64, ret);
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* The net balance for every asset with respect of the wallet asking the pset details
|
|
1633
|
+
* @returns {any}
|
|
1634
|
+
*/
|
|
1635
|
+
balances() {
|
|
1636
|
+
const ret = wasm.psetbalance_balances(this.__wbg_ptr);
|
|
1637
|
+
if (ret[2]) {
|
|
1638
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1639
|
+
}
|
|
1640
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* @returns {(Recipient)[]}
|
|
1644
|
+
*/
|
|
1645
|
+
recipients() {
|
|
1646
|
+
const ret = wasm.psetbalance_recipients(this.__wbg_ptr);
|
|
1647
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1648
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1649
|
+
return v1;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
module.exports.PsetBalance = PsetBalance;
|
|
1653
|
+
|
|
1654
|
+
const PsetDetailsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1655
|
+
? { register: () => {}, unregister: () => {} }
|
|
1656
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_psetdetails_free(ptr >>> 0, 1));
|
|
1657
|
+
/**
|
|
1658
|
+
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetDetails`]
|
|
1659
|
+
*/
|
|
1660
|
+
class PsetDetails {
|
|
1661
|
+
|
|
1662
|
+
static __wrap(ptr) {
|
|
1663
|
+
ptr = ptr >>> 0;
|
|
1664
|
+
const obj = Object.create(PsetDetails.prototype);
|
|
1665
|
+
obj.__wbg_ptr = ptr;
|
|
1666
|
+
PsetDetailsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1667
|
+
return obj;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
__destroy_into_raw() {
|
|
1671
|
+
const ptr = this.__wbg_ptr;
|
|
1672
|
+
this.__wbg_ptr = 0;
|
|
1673
|
+
PsetDetailsFinalization.unregister(this);
|
|
1674
|
+
return ptr;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
free() {
|
|
1678
|
+
const ptr = this.__destroy_into_raw();
|
|
1679
|
+
wasm.__wbg_psetdetails_free(ptr, 0);
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* @returns {PsetBalance}
|
|
1683
|
+
*/
|
|
1684
|
+
balance() {
|
|
1685
|
+
const ret = wasm.psetdetails_balance(this.__wbg_ptr);
|
|
1686
|
+
return PsetBalance.__wrap(ret);
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* For each input existing or missing signatures
|
|
1690
|
+
* @returns {(PsetSignatures)[]}
|
|
1691
|
+
*/
|
|
1692
|
+
signatures() {
|
|
1693
|
+
const ret = wasm.psetdetails_signatures(this.__wbg_ptr);
|
|
1694
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1695
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1696
|
+
return v1;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* @returns {(string)[]}
|
|
1700
|
+
*/
|
|
1701
|
+
fingerprintsMissing() {
|
|
1702
|
+
const ret = wasm.psetdetails_fingerprintsMissing(this.__wbg_ptr);
|
|
1703
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1704
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1705
|
+
return v1;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* @returns {(string)[]}
|
|
1709
|
+
*/
|
|
1710
|
+
fingerprintsHas() {
|
|
1711
|
+
const ret = wasm.psetdetails_fingerprintsHas(this.__wbg_ptr);
|
|
1712
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1713
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1714
|
+
return v1;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Return an element for every input that could possibly be a issuance or a reissuance
|
|
1718
|
+
* @returns {(Issuance)[]}
|
|
1719
|
+
*/
|
|
1720
|
+
inputsIssuances() {
|
|
1721
|
+
const ret = wasm.psetdetails_inputsIssuances(this.__wbg_ptr);
|
|
1722
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1723
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1724
|
+
return v1;
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
module.exports.PsetDetails = PsetDetails;
|
|
1728
|
+
|
|
1729
|
+
const PsetInputFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1730
|
+
? { register: () => {}, unregister: () => {} }
|
|
1731
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_psetinput_free(ptr >>> 0, 1));
|
|
1732
|
+
/**
|
|
1733
|
+
* PSET input
|
|
1734
|
+
*/
|
|
1735
|
+
class PsetInput {
|
|
1736
|
+
|
|
1737
|
+
static __wrap(ptr) {
|
|
1738
|
+
ptr = ptr >>> 0;
|
|
1739
|
+
const obj = Object.create(PsetInput.prototype);
|
|
1740
|
+
obj.__wbg_ptr = ptr;
|
|
1741
|
+
PsetInputFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1742
|
+
return obj;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
__destroy_into_raw() {
|
|
1746
|
+
const ptr = this.__wbg_ptr;
|
|
1747
|
+
this.__wbg_ptr = 0;
|
|
1748
|
+
PsetInputFinalization.unregister(this);
|
|
1749
|
+
return ptr;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
free() {
|
|
1753
|
+
const ptr = this.__destroy_into_raw();
|
|
1754
|
+
wasm.__wbg_psetinput_free(ptr, 0);
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Prevout TXID of the input
|
|
1758
|
+
* @returns {Txid}
|
|
1759
|
+
*/
|
|
1760
|
+
previous_txid() {
|
|
1761
|
+
const ret = wasm.psetinput_previous_txid(this.__wbg_ptr);
|
|
1762
|
+
return Txid.__wrap(ret);
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Prevout vout of the input
|
|
1766
|
+
* @returns {number}
|
|
1767
|
+
*/
|
|
1768
|
+
previous_vout() {
|
|
1769
|
+
const ret = wasm.psetinput_previous_vout(this.__wbg_ptr);
|
|
1770
|
+
return ret >>> 0;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* If the input has an issuance, the asset id
|
|
1774
|
+
* @returns {AssetId | undefined}
|
|
1775
|
+
*/
|
|
1776
|
+
issuanceAsset() {
|
|
1777
|
+
const ret = wasm.psetinput_issuanceAsset(this.__wbg_ptr);
|
|
1778
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* If the input has an issuance, the token id
|
|
1782
|
+
* @returns {AssetId | undefined}
|
|
1783
|
+
*/
|
|
1784
|
+
issuanceToken() {
|
|
1785
|
+
const ret = wasm.psetinput_issuanceToken(this.__wbg_ptr);
|
|
1786
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
module.exports.PsetInput = PsetInput;
|
|
1790
|
+
|
|
1791
|
+
const PsetSignaturesFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1792
|
+
? { register: () => {}, unregister: () => {} }
|
|
1793
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_psetsignatures_free(ptr >>> 0, 1));
|
|
1794
|
+
/**
|
|
1795
|
+
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetSignatures`]
|
|
1796
|
+
*/
|
|
1797
|
+
class PsetSignatures {
|
|
1798
|
+
|
|
1799
|
+
static __wrap(ptr) {
|
|
1800
|
+
ptr = ptr >>> 0;
|
|
1801
|
+
const obj = Object.create(PsetSignatures.prototype);
|
|
1802
|
+
obj.__wbg_ptr = ptr;
|
|
1803
|
+
PsetSignaturesFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1804
|
+
return obj;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
__destroy_into_raw() {
|
|
1808
|
+
const ptr = this.__wbg_ptr;
|
|
1809
|
+
this.__wbg_ptr = 0;
|
|
1810
|
+
PsetSignaturesFinalization.unregister(this);
|
|
1811
|
+
return ptr;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
free() {
|
|
1815
|
+
const ptr = this.__destroy_into_raw();
|
|
1816
|
+
wasm.__wbg_psetsignatures_free(ptr, 0);
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Returns `Vec<(PublicKey, KeySource)>`
|
|
1820
|
+
* @returns {any}
|
|
1821
|
+
*/
|
|
1822
|
+
hasSignature() {
|
|
1823
|
+
const ret = wasm.psetsignatures_hasSignature(this.__wbg_ptr);
|
|
1824
|
+
return ret;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* @returns {any}
|
|
1828
|
+
*/
|
|
1829
|
+
missingSignature() {
|
|
1830
|
+
const ret = wasm.psetsignatures_missingSignature(this.__wbg_ptr);
|
|
1831
|
+
return ret;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
module.exports.PsetSignatures = PsetSignatures;
|
|
1835
|
+
|
|
1836
|
+
const RecipientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1837
|
+
? { register: () => {}, unregister: () => {} }
|
|
1838
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_recipient_free(ptr >>> 0, 1));
|
|
1839
|
+
/**
|
|
1840
|
+
* Recipient of a PSET, in other words outputs that doesn't belong to the wallet
|
|
1841
|
+
*/
|
|
1842
|
+
class Recipient {
|
|
1843
|
+
|
|
1844
|
+
static __wrap(ptr) {
|
|
1845
|
+
ptr = ptr >>> 0;
|
|
1846
|
+
const obj = Object.create(Recipient.prototype);
|
|
1847
|
+
obj.__wbg_ptr = ptr;
|
|
1848
|
+
RecipientFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1849
|
+
return obj;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
__destroy_into_raw() {
|
|
1853
|
+
const ptr = this.__wbg_ptr;
|
|
1854
|
+
this.__wbg_ptr = 0;
|
|
1855
|
+
RecipientFinalization.unregister(this);
|
|
1856
|
+
return ptr;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
free() {
|
|
1860
|
+
const ptr = this.__destroy_into_raw();
|
|
1861
|
+
wasm.__wbg_recipient_free(ptr, 0);
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* @returns {AssetId | undefined}
|
|
1865
|
+
*/
|
|
1866
|
+
asset() {
|
|
1867
|
+
const ret = wasm.recipient_asset(this.__wbg_ptr);
|
|
1868
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* @returns {bigint | undefined}
|
|
1872
|
+
*/
|
|
1873
|
+
value() {
|
|
1874
|
+
const ret = wasm.recipient_value(this.__wbg_ptr);
|
|
1875
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* @returns {Address | undefined}
|
|
1879
|
+
*/
|
|
1880
|
+
address() {
|
|
1881
|
+
const ret = wasm.recipient_address(this.__wbg_ptr);
|
|
1882
|
+
return ret === 0 ? undefined : Address.__wrap(ret);
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* @returns {number}
|
|
1886
|
+
*/
|
|
1887
|
+
vout() {
|
|
1888
|
+
const ret = wasm.recipient_vout(this.__wbg_ptr);
|
|
1889
|
+
return ret >>> 0;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
module.exports.Recipient = Recipient;
|
|
1893
|
+
|
|
1894
|
+
const ScriptFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1895
|
+
? { register: () => {}, unregister: () => {} }
|
|
1896
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_script_free(ptr >>> 0, 1));
|
|
1897
|
+
/**
|
|
1898
|
+
* Wrapper of [`elements::Script`]
|
|
1899
|
+
*/
|
|
1900
|
+
class Script {
|
|
1901
|
+
|
|
1902
|
+
static __wrap(ptr) {
|
|
1903
|
+
ptr = ptr >>> 0;
|
|
1904
|
+
const obj = Object.create(Script.prototype);
|
|
1905
|
+
obj.__wbg_ptr = ptr;
|
|
1906
|
+
ScriptFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1907
|
+
return obj;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
__destroy_into_raw() {
|
|
1911
|
+
const ptr = this.__wbg_ptr;
|
|
1912
|
+
this.__wbg_ptr = 0;
|
|
1913
|
+
ScriptFinalization.unregister(this);
|
|
1914
|
+
return ptr;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
free() {
|
|
1918
|
+
const ptr = this.__destroy_into_raw();
|
|
1919
|
+
wasm.__wbg_script_free(ptr, 0);
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Creates a `Script`
|
|
1923
|
+
* @param {string} s
|
|
1924
|
+
*/
|
|
1925
|
+
constructor(s) {
|
|
1926
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1927
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1928
|
+
const ret = wasm.script_new(ptr0, len0);
|
|
1929
|
+
if (ret[2]) {
|
|
1930
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1931
|
+
}
|
|
1932
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1933
|
+
ScriptFinalization.register(this, this.__wbg_ptr, this);
|
|
1934
|
+
return this;
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* @returns {Uint8Array}
|
|
1938
|
+
*/
|
|
1939
|
+
bytes() {
|
|
1940
|
+
const ret = wasm.script_bytes(this.__wbg_ptr);
|
|
1941
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1942
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1943
|
+
return v1;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* @returns {string}
|
|
1947
|
+
*/
|
|
1948
|
+
asm() {
|
|
1949
|
+
let deferred1_0;
|
|
1950
|
+
let deferred1_1;
|
|
1951
|
+
try {
|
|
1952
|
+
const ret = wasm.script_asm(this.__wbg_ptr);
|
|
1953
|
+
deferred1_0 = ret[0];
|
|
1954
|
+
deferred1_1 = ret[1];
|
|
1955
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1956
|
+
} finally {
|
|
1957
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* @returns {string}
|
|
1962
|
+
*/
|
|
1963
|
+
toString() {
|
|
1964
|
+
let deferred1_0;
|
|
1965
|
+
let deferred1_1;
|
|
1966
|
+
try {
|
|
1967
|
+
const ret = wasm.script_toString(this.__wbg_ptr);
|
|
1968
|
+
deferred1_0 = ret[0];
|
|
1969
|
+
deferred1_1 = ret[1];
|
|
1970
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1971
|
+
} finally {
|
|
1972
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
module.exports.Script = Script;
|
|
1977
|
+
|
|
1978
|
+
const SignerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1979
|
+
? { register: () => {}, unregister: () => {} }
|
|
1980
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_signer_free(ptr >>> 0, 1));
|
|
1981
|
+
/**
|
|
1982
|
+
* A Software signer, wrapper of [`lwk_signer::SwSigner`]
|
|
1983
|
+
*/
|
|
1984
|
+
class Signer {
|
|
1985
|
+
|
|
1986
|
+
__destroy_into_raw() {
|
|
1987
|
+
const ptr = this.__wbg_ptr;
|
|
1988
|
+
this.__wbg_ptr = 0;
|
|
1989
|
+
SignerFinalization.unregister(this);
|
|
1990
|
+
return ptr;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
free() {
|
|
1994
|
+
const ptr = this.__destroy_into_raw();
|
|
1995
|
+
wasm.__wbg_signer_free(ptr, 0);
|
|
1996
|
+
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Creates a `Signer`
|
|
1999
|
+
* @param {Mnemonic} mnemonic
|
|
2000
|
+
* @param {Network} network
|
|
2001
|
+
*/
|
|
2002
|
+
constructor(mnemonic, network) {
|
|
2003
|
+
_assertClass(mnemonic, Mnemonic);
|
|
2004
|
+
_assertClass(network, Network);
|
|
2005
|
+
const ret = wasm.signer_new(mnemonic.__wbg_ptr, network.__wbg_ptr);
|
|
2006
|
+
if (ret[2]) {
|
|
2007
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2008
|
+
}
|
|
2009
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2010
|
+
SignerFinalization.register(this, this.__wbg_ptr, this);
|
|
2011
|
+
return this;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Sign and consume the given PSET, returning the signed one
|
|
2015
|
+
* @param {Pset} pset
|
|
2016
|
+
* @returns {Pset}
|
|
2017
|
+
*/
|
|
2018
|
+
sign(pset) {
|
|
2019
|
+
_assertClass(pset, Pset);
|
|
2020
|
+
var ptr0 = pset.__destroy_into_raw();
|
|
2021
|
+
const ret = wasm.signer_sign(this.__wbg_ptr, ptr0);
|
|
2022
|
+
if (ret[2]) {
|
|
2023
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2024
|
+
}
|
|
2025
|
+
return Pset.__wrap(ret[0]);
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* @returns {WolletDescriptor}
|
|
2029
|
+
*/
|
|
2030
|
+
wpkhSlip77Descriptor() {
|
|
2031
|
+
const ret = wasm.signer_wpkhSlip77Descriptor(this.__wbg_ptr);
|
|
2032
|
+
if (ret[2]) {
|
|
2033
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2034
|
+
}
|
|
2035
|
+
return WolletDescriptor.__wrap(ret[0]);
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* @returns {Xpub}
|
|
2039
|
+
*/
|
|
2040
|
+
getMasterXpub() {
|
|
2041
|
+
const ret = wasm.signer_getMasterXpub(this.__wbg_ptr);
|
|
2042
|
+
if (ret[2]) {
|
|
2043
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2044
|
+
}
|
|
2045
|
+
return Xpub.__wrap(ret[0]);
|
|
2046
|
+
}
|
|
2047
|
+
/**
|
|
2048
|
+
* @param {Bip} bip
|
|
2049
|
+
* @returns {string}
|
|
2050
|
+
*/
|
|
2051
|
+
keyoriginXpub(bip) {
|
|
2052
|
+
let deferred3_0;
|
|
2053
|
+
let deferred3_1;
|
|
2054
|
+
try {
|
|
2055
|
+
_assertClass(bip, Bip);
|
|
2056
|
+
var ptr0 = bip.__destroy_into_raw();
|
|
2057
|
+
const ret = wasm.signer_keyoriginXpub(this.__wbg_ptr, ptr0);
|
|
2058
|
+
var ptr2 = ret[0];
|
|
2059
|
+
var len2 = ret[1];
|
|
2060
|
+
if (ret[3]) {
|
|
2061
|
+
ptr2 = 0; len2 = 0;
|
|
2062
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2063
|
+
}
|
|
2064
|
+
deferred3_0 = ptr2;
|
|
2065
|
+
deferred3_1 = len2;
|
|
2066
|
+
return getStringFromWasm0(ptr2, len2);
|
|
2067
|
+
} finally {
|
|
2068
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* @returns {Mnemonic}
|
|
2073
|
+
*/
|
|
2074
|
+
mnemonic() {
|
|
2075
|
+
const ret = wasm.signer_mnemonic(this.__wbg_ptr);
|
|
2076
|
+
return Mnemonic.__wrap(ret);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
module.exports.Signer = Signer;
|
|
2080
|
+
|
|
2081
|
+
const SinglesigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2082
|
+
? { register: () => {}, unregister: () => {} }
|
|
2083
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_singlesig_free(ptr >>> 0, 1));
|
|
2084
|
+
|
|
2085
|
+
class Singlesig {
|
|
2086
|
+
|
|
2087
|
+
static __wrap(ptr) {
|
|
2088
|
+
ptr = ptr >>> 0;
|
|
2089
|
+
const obj = Object.create(Singlesig.prototype);
|
|
2090
|
+
obj.__wbg_ptr = ptr;
|
|
2091
|
+
SinglesigFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2092
|
+
return obj;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
__destroy_into_raw() {
|
|
2096
|
+
const ptr = this.__wbg_ptr;
|
|
2097
|
+
this.__wbg_ptr = 0;
|
|
2098
|
+
SinglesigFinalization.unregister(this);
|
|
2099
|
+
return ptr;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
free() {
|
|
2103
|
+
const ptr = this.__destroy_into_raw();
|
|
2104
|
+
wasm.__wbg_singlesig_free(ptr, 0);
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* @param {string} variant
|
|
2108
|
+
* @returns {Singlesig}
|
|
2109
|
+
*/
|
|
2110
|
+
static from(variant) {
|
|
2111
|
+
const ptr0 = passStringToWasm0(variant, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2112
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2113
|
+
const ret = wasm.singlesig_from(ptr0, len0);
|
|
2114
|
+
if (ret[2]) {
|
|
2115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2116
|
+
}
|
|
2117
|
+
return Singlesig.__wrap(ret[0]);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
module.exports.Singlesig = Singlesig;
|
|
2121
|
+
|
|
2122
|
+
const TipFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2123
|
+
? { register: () => {}, unregister: () => {} }
|
|
2124
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_tip_free(ptr >>> 0, 1));
|
|
2125
|
+
/**
|
|
2126
|
+
* Wrapper of [`lwk_wollet::Tip`]
|
|
2127
|
+
*/
|
|
2128
|
+
class Tip {
|
|
2129
|
+
|
|
2130
|
+
static __wrap(ptr) {
|
|
2131
|
+
ptr = ptr >>> 0;
|
|
2132
|
+
const obj = Object.create(Tip.prototype);
|
|
2133
|
+
obj.__wbg_ptr = ptr;
|
|
2134
|
+
TipFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2135
|
+
return obj;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
__destroy_into_raw() {
|
|
2139
|
+
const ptr = this.__wbg_ptr;
|
|
2140
|
+
this.__wbg_ptr = 0;
|
|
2141
|
+
TipFinalization.unregister(this);
|
|
2142
|
+
return ptr;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
free() {
|
|
2146
|
+
const ptr = this.__destroy_into_raw();
|
|
2147
|
+
wasm.__wbg_tip_free(ptr, 0);
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* @returns {number}
|
|
2151
|
+
*/
|
|
2152
|
+
height() {
|
|
2153
|
+
const ret = wasm.tip_height(this.__wbg_ptr);
|
|
2154
|
+
return ret >>> 0;
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* @returns {string}
|
|
2158
|
+
*/
|
|
2159
|
+
hash() {
|
|
2160
|
+
let deferred1_0;
|
|
2161
|
+
let deferred1_1;
|
|
2162
|
+
try {
|
|
2163
|
+
const ret = wasm.tip_hash(this.__wbg_ptr);
|
|
2164
|
+
deferred1_0 = ret[0];
|
|
2165
|
+
deferred1_1 = ret[1];
|
|
2166
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2167
|
+
} finally {
|
|
2168
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
/**
|
|
2172
|
+
* @returns {number | undefined}
|
|
2173
|
+
*/
|
|
2174
|
+
timestamp() {
|
|
2175
|
+
const ret = wasm.tip_timestamp(this.__wbg_ptr);
|
|
2176
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
module.exports.Tip = Tip;
|
|
2180
|
+
|
|
2181
|
+
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2182
|
+
? { register: () => {}, unregister: () => {} }
|
|
2183
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
|
2184
|
+
/**
|
|
2185
|
+
* A Liquid transaction, wrapper of [`elements::Transaction`]
|
|
2186
|
+
*
|
|
2187
|
+
* See [`crate::WalletTx`] for the transaction as seen from the perspective of the wallet
|
|
2188
|
+
* where you can actually see unblinded amounts and tx net-balance.
|
|
2189
|
+
*/
|
|
2190
|
+
class Transaction {
|
|
2191
|
+
|
|
2192
|
+
static __wrap(ptr) {
|
|
2193
|
+
ptr = ptr >>> 0;
|
|
2194
|
+
const obj = Object.create(Transaction.prototype);
|
|
2195
|
+
obj.__wbg_ptr = ptr;
|
|
2196
|
+
TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2197
|
+
return obj;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
__destroy_into_raw() {
|
|
2201
|
+
const ptr = this.__wbg_ptr;
|
|
2202
|
+
this.__wbg_ptr = 0;
|
|
2203
|
+
TransactionFinalization.unregister(this);
|
|
2204
|
+
return ptr;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
free() {
|
|
2208
|
+
const ptr = this.__destroy_into_raw();
|
|
2209
|
+
wasm.__wbg_transaction_free(ptr, 0);
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* Creates a `Transaction`
|
|
2213
|
+
* @param {string} tx_hex
|
|
2214
|
+
*/
|
|
2215
|
+
constructor(tx_hex) {
|
|
2216
|
+
const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2218
|
+
const ret = wasm.transaction_new(ptr0, len0);
|
|
2219
|
+
if (ret[2]) {
|
|
2220
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2221
|
+
}
|
|
2222
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2223
|
+
TransactionFinalization.register(this, this.__wbg_ptr, this);
|
|
2224
|
+
return this;
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* @returns {Txid}
|
|
2228
|
+
*/
|
|
2229
|
+
txid() {
|
|
2230
|
+
const ret = wasm.transaction_txid(this.__wbg_ptr);
|
|
2231
|
+
return Txid.__wrap(ret);
|
|
2232
|
+
}
|
|
2233
|
+
/**
|
|
2234
|
+
* @returns {Uint8Array}
|
|
2235
|
+
*/
|
|
2236
|
+
bytes() {
|
|
2237
|
+
const ret = wasm.transaction_bytes(this.__wbg_ptr);
|
|
2238
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2239
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2240
|
+
return v1;
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* @param {AssetId} policy_asset
|
|
2244
|
+
* @returns {bigint}
|
|
2245
|
+
*/
|
|
2246
|
+
fee(policy_asset) {
|
|
2247
|
+
_assertClass(policy_asset, AssetId);
|
|
2248
|
+
const ret = wasm.transaction_fee(this.__wbg_ptr, policy_asset.__wbg_ptr);
|
|
2249
|
+
return BigInt.asUintN(64, ret);
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* @returns {string}
|
|
2253
|
+
*/
|
|
2254
|
+
toString() {
|
|
2255
|
+
let deferred1_0;
|
|
2256
|
+
let deferred1_1;
|
|
2257
|
+
try {
|
|
2258
|
+
const ret = wasm.transaction_toString(this.__wbg_ptr);
|
|
2259
|
+
deferred1_0 = ret[0];
|
|
2260
|
+
deferred1_1 = ret[1];
|
|
2261
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2262
|
+
} finally {
|
|
2263
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
module.exports.Transaction = Transaction;
|
|
2268
|
+
|
|
2269
|
+
const TxBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2270
|
+
? { register: () => {}, unregister: () => {} }
|
|
2271
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_txbuilder_free(ptr >>> 0, 1));
|
|
2272
|
+
/**
|
|
2273
|
+
* Wrapper of [`lwk_wollet::TxBuilder`]
|
|
2274
|
+
*/
|
|
2275
|
+
class TxBuilder {
|
|
2276
|
+
|
|
2277
|
+
static __wrap(ptr) {
|
|
2278
|
+
ptr = ptr >>> 0;
|
|
2279
|
+
const obj = Object.create(TxBuilder.prototype);
|
|
2280
|
+
obj.__wbg_ptr = ptr;
|
|
2281
|
+
TxBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2282
|
+
return obj;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
__destroy_into_raw() {
|
|
2286
|
+
const ptr = this.__wbg_ptr;
|
|
2287
|
+
this.__wbg_ptr = 0;
|
|
2288
|
+
TxBuilderFinalization.unregister(this);
|
|
2289
|
+
return ptr;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
free() {
|
|
2293
|
+
const ptr = this.__destroy_into_raw();
|
|
2294
|
+
wasm.__wbg_txbuilder_free(ptr, 0);
|
|
2295
|
+
}
|
|
2296
|
+
/**
|
|
2297
|
+
* Creates a transaction builder
|
|
2298
|
+
* @param {Network} network
|
|
2299
|
+
*/
|
|
2300
|
+
constructor(network) {
|
|
2301
|
+
_assertClass(network, Network);
|
|
2302
|
+
const ret = wasm.txbuilder_new(network.__wbg_ptr);
|
|
2303
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2304
|
+
TxBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
2305
|
+
return this;
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Build the transaction
|
|
2309
|
+
* @param {Wollet} wollet
|
|
2310
|
+
* @returns {Pset}
|
|
2311
|
+
*/
|
|
2312
|
+
finish(wollet) {
|
|
2313
|
+
const ptr = this.__destroy_into_raw();
|
|
2314
|
+
_assertClass(wollet, Wollet);
|
|
2315
|
+
const ret = wasm.txbuilder_finish(ptr, wollet.__wbg_ptr);
|
|
2316
|
+
if (ret[2]) {
|
|
2317
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2318
|
+
}
|
|
2319
|
+
return Pset.__wrap(ret[0]);
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Set the fee rate
|
|
2323
|
+
* @param {number | undefined} [fee_rate]
|
|
2324
|
+
* @returns {TxBuilder}
|
|
2325
|
+
*/
|
|
2326
|
+
feeRate(fee_rate) {
|
|
2327
|
+
const ptr = this.__destroy_into_raw();
|
|
2328
|
+
const ret = wasm.txbuilder_feeRate(ptr, isLikeNone(fee_rate) ? 0x100000001 : Math.fround(fee_rate));
|
|
2329
|
+
return TxBuilder.__wrap(ret);
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Select all available L-BTC inputs
|
|
2333
|
+
* @returns {TxBuilder}
|
|
2334
|
+
*/
|
|
2335
|
+
drainLbtcWallet() {
|
|
2336
|
+
const ptr = this.__destroy_into_raw();
|
|
2337
|
+
const ret = wasm.txbuilder_drainLbtcWallet(ptr);
|
|
2338
|
+
return TxBuilder.__wrap(ret);
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Sets the address to drain excess L-BTC to
|
|
2342
|
+
* @param {Address} address
|
|
2343
|
+
* @returns {TxBuilder}
|
|
2344
|
+
*/
|
|
2345
|
+
drainLbtcTo(address) {
|
|
2346
|
+
const ptr = this.__destroy_into_raw();
|
|
2347
|
+
_assertClass(address, Address);
|
|
2348
|
+
var ptr0 = address.__destroy_into_raw();
|
|
2349
|
+
const ret = wasm.txbuilder_drainLbtcTo(ptr, ptr0);
|
|
2350
|
+
return TxBuilder.__wrap(ret);
|
|
2351
|
+
}
|
|
2352
|
+
/**
|
|
2353
|
+
* Add a recipient receiving L-BTC
|
|
2354
|
+
*
|
|
2355
|
+
* Errors if address's network is incompatible
|
|
2356
|
+
* @param {Address} address
|
|
2357
|
+
* @param {bigint} satoshi
|
|
2358
|
+
* @returns {TxBuilder}
|
|
2359
|
+
*/
|
|
2360
|
+
addLbtcRecipient(address, satoshi) {
|
|
2361
|
+
const ptr = this.__destroy_into_raw();
|
|
2362
|
+
_assertClass(address, Address);
|
|
2363
|
+
const ret = wasm.txbuilder_addLbtcRecipient(ptr, address.__wbg_ptr, satoshi);
|
|
2364
|
+
if (ret[2]) {
|
|
2365
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2366
|
+
}
|
|
2367
|
+
return TxBuilder.__wrap(ret[0]);
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* Add a recipient receiving the given asset
|
|
2371
|
+
*
|
|
2372
|
+
* Errors if address's network is incompatible
|
|
2373
|
+
* @param {Address} address
|
|
2374
|
+
* @param {bigint} satoshi
|
|
2375
|
+
* @param {AssetId} asset
|
|
2376
|
+
* @returns {TxBuilder}
|
|
2377
|
+
*/
|
|
2378
|
+
addRecipient(address, satoshi, asset) {
|
|
2379
|
+
const ptr = this.__destroy_into_raw();
|
|
2380
|
+
_assertClass(address, Address);
|
|
2381
|
+
_assertClass(asset, AssetId);
|
|
2382
|
+
const ret = wasm.txbuilder_addRecipient(ptr, address.__wbg_ptr, satoshi, asset.__wbg_ptr);
|
|
2383
|
+
if (ret[2]) {
|
|
2384
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2385
|
+
}
|
|
2386
|
+
return TxBuilder.__wrap(ret[0]);
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* Burn satoshi units of the given asset
|
|
2390
|
+
* @param {bigint} satoshi
|
|
2391
|
+
* @param {AssetId} asset
|
|
2392
|
+
* @returns {TxBuilder}
|
|
2393
|
+
*/
|
|
2394
|
+
addBurn(satoshi, asset) {
|
|
2395
|
+
const ptr = this.__destroy_into_raw();
|
|
2396
|
+
_assertClass(asset, AssetId);
|
|
2397
|
+
const ret = wasm.txbuilder_addBurn(ptr, satoshi, asset.__wbg_ptr);
|
|
2398
|
+
return TxBuilder.__wrap(ret);
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Issue an asset, wrapper of [`lwk_wollet::TxBuilder::issue_asset()`]
|
|
2402
|
+
* @param {bigint} asset_sats
|
|
2403
|
+
* @param {Address | undefined} asset_receiver
|
|
2404
|
+
* @param {bigint} token_sats
|
|
2405
|
+
* @param {Address | undefined} [token_receiver]
|
|
2406
|
+
* @param {Contract | undefined} [contract]
|
|
2407
|
+
* @returns {TxBuilder}
|
|
2408
|
+
*/
|
|
2409
|
+
issueAsset(asset_sats, asset_receiver, token_sats, token_receiver, contract) {
|
|
2410
|
+
const ptr = this.__destroy_into_raw();
|
|
2411
|
+
let ptr0 = 0;
|
|
2412
|
+
if (!isLikeNone(asset_receiver)) {
|
|
2413
|
+
_assertClass(asset_receiver, Address);
|
|
2414
|
+
ptr0 = asset_receiver.__destroy_into_raw();
|
|
2415
|
+
}
|
|
2416
|
+
let ptr1 = 0;
|
|
2417
|
+
if (!isLikeNone(token_receiver)) {
|
|
2418
|
+
_assertClass(token_receiver, Address);
|
|
2419
|
+
ptr1 = token_receiver.__destroy_into_raw();
|
|
2420
|
+
}
|
|
2421
|
+
let ptr2 = 0;
|
|
2422
|
+
if (!isLikeNone(contract)) {
|
|
2423
|
+
_assertClass(contract, Contract);
|
|
2424
|
+
ptr2 = contract.__destroy_into_raw();
|
|
2425
|
+
}
|
|
2426
|
+
const ret = wasm.txbuilder_issueAsset(ptr, asset_sats, ptr0, token_sats, ptr1, ptr2);
|
|
2427
|
+
if (ret[2]) {
|
|
2428
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2429
|
+
}
|
|
2430
|
+
return TxBuilder.__wrap(ret[0]);
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Reissue an asset, wrapper of [`lwk_wollet::TxBuilder::reissue_asset()`]
|
|
2434
|
+
* @param {AssetId} asset_to_reissue
|
|
2435
|
+
* @param {bigint} satoshi_to_reissue
|
|
2436
|
+
* @param {Address | undefined} [asset_receiver]
|
|
2437
|
+
* @param {Transaction | undefined} [issuance_tx]
|
|
2438
|
+
* @returns {TxBuilder}
|
|
2439
|
+
*/
|
|
2440
|
+
reissueAsset(asset_to_reissue, satoshi_to_reissue, asset_receiver, issuance_tx) {
|
|
2441
|
+
const ptr = this.__destroy_into_raw();
|
|
2442
|
+
_assertClass(asset_to_reissue, AssetId);
|
|
2443
|
+
var ptr0 = asset_to_reissue.__destroy_into_raw();
|
|
2444
|
+
let ptr1 = 0;
|
|
2445
|
+
if (!isLikeNone(asset_receiver)) {
|
|
2446
|
+
_assertClass(asset_receiver, Address);
|
|
2447
|
+
ptr1 = asset_receiver.__destroy_into_raw();
|
|
2448
|
+
}
|
|
2449
|
+
let ptr2 = 0;
|
|
2450
|
+
if (!isLikeNone(issuance_tx)) {
|
|
2451
|
+
_assertClass(issuance_tx, Transaction);
|
|
2452
|
+
ptr2 = issuance_tx.__destroy_into_raw();
|
|
2453
|
+
}
|
|
2454
|
+
const ret = wasm.txbuilder_reissueAsset(ptr, ptr0, satoshi_to_reissue, ptr1, ptr2);
|
|
2455
|
+
if (ret[2]) {
|
|
2456
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2457
|
+
}
|
|
2458
|
+
return TxBuilder.__wrap(ret[0]);
|
|
2459
|
+
}
|
|
2460
|
+
/**
|
|
2461
|
+
* @returns {string}
|
|
2462
|
+
*/
|
|
2463
|
+
toString() {
|
|
2464
|
+
let deferred1_0;
|
|
2465
|
+
let deferred1_1;
|
|
2466
|
+
try {
|
|
2467
|
+
const ret = wasm.txbuilder_toString(this.__wbg_ptr);
|
|
2468
|
+
deferred1_0 = ret[0];
|
|
2469
|
+
deferred1_1 = ret[1];
|
|
2470
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2471
|
+
} finally {
|
|
2472
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
module.exports.TxBuilder = TxBuilder;
|
|
2477
|
+
|
|
2478
|
+
const TxOutSecretsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2479
|
+
? { register: () => {}, unregister: () => {} }
|
|
2480
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_txoutsecrets_free(ptr >>> 0, 1));
|
|
2481
|
+
/**
|
|
2482
|
+
* Wrapper of [`elements::TxOutSecrets`]
|
|
2483
|
+
*/
|
|
2484
|
+
class TxOutSecrets {
|
|
2485
|
+
|
|
2486
|
+
static __wrap(ptr) {
|
|
2487
|
+
ptr = ptr >>> 0;
|
|
2488
|
+
const obj = Object.create(TxOutSecrets.prototype);
|
|
2489
|
+
obj.__wbg_ptr = ptr;
|
|
2490
|
+
TxOutSecretsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2491
|
+
return obj;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
__destroy_into_raw() {
|
|
2495
|
+
const ptr = this.__wbg_ptr;
|
|
2496
|
+
this.__wbg_ptr = 0;
|
|
2497
|
+
TxOutSecretsFinalization.unregister(this);
|
|
2498
|
+
return ptr;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
free() {
|
|
2502
|
+
const ptr = this.__destroy_into_raw();
|
|
2503
|
+
wasm.__wbg_txoutsecrets_free(ptr, 0);
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* @returns {AssetId}
|
|
2507
|
+
*/
|
|
2508
|
+
asset() {
|
|
2509
|
+
const ret = wasm.txoutsecrets_asset(this.__wbg_ptr);
|
|
2510
|
+
return AssetId.__wrap(ret);
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2513
|
+
* @returns {string}
|
|
2514
|
+
*/
|
|
2515
|
+
assetBlindingFactor() {
|
|
2516
|
+
let deferred1_0;
|
|
2517
|
+
let deferred1_1;
|
|
2518
|
+
try {
|
|
2519
|
+
const ret = wasm.txoutsecrets_assetBlindingFactor(this.__wbg_ptr);
|
|
2520
|
+
deferred1_0 = ret[0];
|
|
2521
|
+
deferred1_1 = ret[1];
|
|
2522
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2523
|
+
} finally {
|
|
2524
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
/**
|
|
2528
|
+
* @returns {bigint}
|
|
2529
|
+
*/
|
|
2530
|
+
value() {
|
|
2531
|
+
const ret = wasm.txoutsecrets_value(this.__wbg_ptr);
|
|
2532
|
+
return BigInt.asUintN(64, ret);
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* @returns {string}
|
|
2536
|
+
*/
|
|
2537
|
+
valueBlindingFactor() {
|
|
2538
|
+
let deferred1_0;
|
|
2539
|
+
let deferred1_1;
|
|
2540
|
+
try {
|
|
2541
|
+
const ret = wasm.txoutsecrets_valueBlindingFactor(this.__wbg_ptr);
|
|
2542
|
+
deferred1_0 = ret[0];
|
|
2543
|
+
deferred1_1 = ret[1];
|
|
2544
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2545
|
+
} finally {
|
|
2546
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
module.exports.TxOutSecrets = TxOutSecrets;
|
|
2551
|
+
|
|
2552
|
+
const TxidFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2553
|
+
? { register: () => {}, unregister: () => {} }
|
|
2554
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_txid_free(ptr >>> 0, 1));
|
|
2555
|
+
/**
|
|
2556
|
+
* A valid transaction identifier.
|
|
2557
|
+
*
|
|
2558
|
+
* 32 bytes encoded as hex string.
|
|
2559
|
+
*/
|
|
2560
|
+
class Txid {
|
|
2561
|
+
|
|
2562
|
+
static __wrap(ptr) {
|
|
2563
|
+
ptr = ptr >>> 0;
|
|
2564
|
+
const obj = Object.create(Txid.prototype);
|
|
2565
|
+
obj.__wbg_ptr = ptr;
|
|
2566
|
+
TxidFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2567
|
+
return obj;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
__destroy_into_raw() {
|
|
2571
|
+
const ptr = this.__wbg_ptr;
|
|
2572
|
+
this.__wbg_ptr = 0;
|
|
2573
|
+
TxidFinalization.unregister(this);
|
|
2574
|
+
return ptr;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
free() {
|
|
2578
|
+
const ptr = this.__destroy_into_raw();
|
|
2579
|
+
wasm.__wbg_txid_free(ptr, 0);
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Creates a `Txid`
|
|
2583
|
+
* @param {string} tx_id
|
|
2584
|
+
*/
|
|
2585
|
+
constructor(tx_id) {
|
|
2586
|
+
const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2588
|
+
const ret = wasm.txid_new(ptr0, len0);
|
|
2589
|
+
if (ret[2]) {
|
|
2590
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2591
|
+
}
|
|
2592
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2593
|
+
TxidFinalization.register(this, this.__wbg_ptr, this);
|
|
2594
|
+
return this;
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* @returns {string}
|
|
2598
|
+
*/
|
|
2599
|
+
toString() {
|
|
2600
|
+
let deferred1_0;
|
|
2601
|
+
let deferred1_1;
|
|
2602
|
+
try {
|
|
2603
|
+
const ret = wasm.txid_toString(this.__wbg_ptr);
|
|
2604
|
+
deferred1_0 = ret[0];
|
|
2605
|
+
deferred1_1 = ret[1];
|
|
2606
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2607
|
+
} finally {
|
|
2608
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
module.exports.Txid = Txid;
|
|
2613
|
+
|
|
2614
|
+
const UpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2615
|
+
? { register: () => {}, unregister: () => {} }
|
|
2616
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_update_free(ptr >>> 0, 1));
|
|
2617
|
+
/**
|
|
2618
|
+
* Wrapper of [`lwk_wollet::Update`]
|
|
2619
|
+
*/
|
|
2620
|
+
class Update {
|
|
2621
|
+
|
|
2622
|
+
static __wrap(ptr) {
|
|
2623
|
+
ptr = ptr >>> 0;
|
|
2624
|
+
const obj = Object.create(Update.prototype);
|
|
2625
|
+
obj.__wbg_ptr = ptr;
|
|
2626
|
+
UpdateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2627
|
+
return obj;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
__destroy_into_raw() {
|
|
2631
|
+
const ptr = this.__wbg_ptr;
|
|
2632
|
+
this.__wbg_ptr = 0;
|
|
2633
|
+
UpdateFinalization.unregister(this);
|
|
2634
|
+
return ptr;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
free() {
|
|
2638
|
+
const ptr = this.__destroy_into_raw();
|
|
2639
|
+
wasm.__wbg_update_free(ptr, 0);
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Creates an `Update`
|
|
2643
|
+
* @param {Uint8Array} bytes
|
|
2644
|
+
*/
|
|
2645
|
+
constructor(bytes) {
|
|
2646
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
2647
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2648
|
+
const ret = wasm.update_new(ptr0, len0);
|
|
2649
|
+
if (ret[2]) {
|
|
2650
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2651
|
+
}
|
|
2652
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2653
|
+
UpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
2654
|
+
return this;
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* @returns {Uint8Array}
|
|
2658
|
+
*/
|
|
2659
|
+
serialize() {
|
|
2660
|
+
const ret = wasm.update_serialize(this.__wbg_ptr);
|
|
2661
|
+
if (ret[3]) {
|
|
2662
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2663
|
+
}
|
|
2664
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2665
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2666
|
+
return v1;
|
|
2667
|
+
}
|
|
2668
|
+
/**
|
|
2669
|
+
* @param {WolletDescriptor} desc
|
|
2670
|
+
* @returns {string}
|
|
2671
|
+
*/
|
|
2672
|
+
serializeEncryptedBase64(desc) {
|
|
2673
|
+
let deferred2_0;
|
|
2674
|
+
let deferred2_1;
|
|
2675
|
+
try {
|
|
2676
|
+
_assertClass(desc, WolletDescriptor);
|
|
2677
|
+
const ret = wasm.update_serializeEncryptedBase64(this.__wbg_ptr, desc.__wbg_ptr);
|
|
2678
|
+
var ptr1 = ret[0];
|
|
2679
|
+
var len1 = ret[1];
|
|
2680
|
+
if (ret[3]) {
|
|
2681
|
+
ptr1 = 0; len1 = 0;
|
|
2682
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2683
|
+
}
|
|
2684
|
+
deferred2_0 = ptr1;
|
|
2685
|
+
deferred2_1 = len1;
|
|
2686
|
+
return getStringFromWasm0(ptr1, len1);
|
|
2687
|
+
} finally {
|
|
2688
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* @param {string} base64
|
|
2693
|
+
* @param {WolletDescriptor} desc
|
|
2694
|
+
* @returns {Update}
|
|
2695
|
+
*/
|
|
2696
|
+
static deserializeDecryptedBase64(base64, desc) {
|
|
2697
|
+
const ptr0 = passStringToWasm0(base64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2698
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2699
|
+
_assertClass(desc, WolletDescriptor);
|
|
2700
|
+
const ret = wasm.update_deserializeDecryptedBase64(ptr0, len0, desc.__wbg_ptr);
|
|
2701
|
+
if (ret[2]) {
|
|
2702
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2703
|
+
}
|
|
2704
|
+
return Update.__wrap(ret[0]);
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* @returns {boolean}
|
|
2708
|
+
*/
|
|
2709
|
+
onlyTip() {
|
|
2710
|
+
const ret = wasm.update_onlyTip(this.__wbg_ptr);
|
|
2711
|
+
return ret !== 0;
|
|
2712
|
+
}
|
|
2713
|
+
/**
|
|
2714
|
+
* @param {Wollet} wollet
|
|
2715
|
+
*/
|
|
2716
|
+
prune(wollet) {
|
|
2717
|
+
_assertClass(wollet, Wollet);
|
|
2718
|
+
wasm.update_prune(this.__wbg_ptr, wollet.__wbg_ptr);
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
module.exports.Update = Update;
|
|
2722
|
+
|
|
2723
|
+
const WalletTxFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2724
|
+
? { register: () => {}, unregister: () => {} }
|
|
2725
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wallettx_free(ptr >>> 0, 1));
|
|
2726
|
+
/**
|
|
2727
|
+
* Wrapper of [`lwk_wollet::WalletTx`]
|
|
2728
|
+
*/
|
|
2729
|
+
class WalletTx {
|
|
2730
|
+
|
|
2731
|
+
static __wrap(ptr) {
|
|
2732
|
+
ptr = ptr >>> 0;
|
|
2733
|
+
const obj = Object.create(WalletTx.prototype);
|
|
2734
|
+
obj.__wbg_ptr = ptr;
|
|
2735
|
+
WalletTxFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2736
|
+
return obj;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
__destroy_into_raw() {
|
|
2740
|
+
const ptr = this.__wbg_ptr;
|
|
2741
|
+
this.__wbg_ptr = 0;
|
|
2742
|
+
WalletTxFinalization.unregister(this);
|
|
2743
|
+
return ptr;
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
free() {
|
|
2747
|
+
const ptr = this.__destroy_into_raw();
|
|
2748
|
+
wasm.__wbg_wallettx_free(ptr, 0);
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* @returns {Transaction}
|
|
2752
|
+
*/
|
|
2753
|
+
tx() {
|
|
2754
|
+
const ret = wasm.wallettx_tx(this.__wbg_ptr);
|
|
2755
|
+
return Transaction.__wrap(ret);
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* @returns {number | undefined}
|
|
2759
|
+
*/
|
|
2760
|
+
height() {
|
|
2761
|
+
const ret = wasm.wallettx_height(this.__wbg_ptr);
|
|
2762
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* @returns {any}
|
|
2766
|
+
*/
|
|
2767
|
+
balance() {
|
|
2768
|
+
const ret = wasm.wallettx_balance(this.__wbg_ptr);
|
|
2769
|
+
if (ret[2]) {
|
|
2770
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2771
|
+
}
|
|
2772
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* @returns {Txid}
|
|
2776
|
+
*/
|
|
2777
|
+
txid() {
|
|
2778
|
+
const ret = wasm.wallettx_txid(this.__wbg_ptr);
|
|
2779
|
+
return Txid.__wrap(ret);
|
|
2780
|
+
}
|
|
2781
|
+
/**
|
|
2782
|
+
* @returns {bigint}
|
|
2783
|
+
*/
|
|
2784
|
+
fee() {
|
|
2785
|
+
const ret = wasm.wallettx_fee(this.__wbg_ptr);
|
|
2786
|
+
return BigInt.asUintN(64, ret);
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* @returns {string}
|
|
2790
|
+
*/
|
|
2791
|
+
txType() {
|
|
2792
|
+
let deferred1_0;
|
|
2793
|
+
let deferred1_1;
|
|
2794
|
+
try {
|
|
2795
|
+
const ret = wasm.wallettx_txType(this.__wbg_ptr);
|
|
2796
|
+
deferred1_0 = ret[0];
|
|
2797
|
+
deferred1_1 = ret[1];
|
|
2798
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2799
|
+
} finally {
|
|
2800
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* @returns {number | undefined}
|
|
2805
|
+
*/
|
|
2806
|
+
timestamp() {
|
|
2807
|
+
const ret = wasm.wallettx_timestamp(this.__wbg_ptr);
|
|
2808
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
2809
|
+
}
|
|
2810
|
+
/**
|
|
2811
|
+
* @returns {(OptionWalletTxOut)[]}
|
|
2812
|
+
*/
|
|
2813
|
+
inputs() {
|
|
2814
|
+
const ret = wasm.wallettx_inputs(this.__wbg_ptr);
|
|
2815
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
2816
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2817
|
+
return v1;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* @returns {(OptionWalletTxOut)[]}
|
|
2821
|
+
*/
|
|
2822
|
+
outputs() {
|
|
2823
|
+
const ret = wasm.wallettx_outputs(this.__wbg_ptr);
|
|
2824
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
2825
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2826
|
+
return v1;
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* @param {string} explorer_url
|
|
2830
|
+
* @returns {string}
|
|
2831
|
+
*/
|
|
2832
|
+
unblindedUrl(explorer_url) {
|
|
2833
|
+
let deferred2_0;
|
|
2834
|
+
let deferred2_1;
|
|
2835
|
+
try {
|
|
2836
|
+
const ptr0 = passStringToWasm0(explorer_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2837
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2838
|
+
const ret = wasm.wallettx_unblindedUrl(this.__wbg_ptr, ptr0, len0);
|
|
2839
|
+
deferred2_0 = ret[0];
|
|
2840
|
+
deferred2_1 = ret[1];
|
|
2841
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2842
|
+
} finally {
|
|
2843
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
module.exports.WalletTx = WalletTx;
|
|
2848
|
+
|
|
2849
|
+
const WalletTxOutFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2850
|
+
? { register: () => {}, unregister: () => {} }
|
|
2851
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wallettxout_free(ptr >>> 0, 1));
|
|
2852
|
+
/**
|
|
2853
|
+
* Wrapper of [`lwk_wollet::WalletTxOut`]
|
|
2854
|
+
*/
|
|
2855
|
+
class WalletTxOut {
|
|
2856
|
+
|
|
2857
|
+
static __wrap(ptr) {
|
|
2858
|
+
ptr = ptr >>> 0;
|
|
2859
|
+
const obj = Object.create(WalletTxOut.prototype);
|
|
2860
|
+
obj.__wbg_ptr = ptr;
|
|
2861
|
+
WalletTxOutFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2862
|
+
return obj;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
__destroy_into_raw() {
|
|
2866
|
+
const ptr = this.__wbg_ptr;
|
|
2867
|
+
this.__wbg_ptr = 0;
|
|
2868
|
+
WalletTxOutFinalization.unregister(this);
|
|
2869
|
+
return ptr;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
free() {
|
|
2873
|
+
const ptr = this.__destroy_into_raw();
|
|
2874
|
+
wasm.__wbg_wallettxout_free(ptr, 0);
|
|
2875
|
+
}
|
|
2876
|
+
/**
|
|
2877
|
+
* @returns {OutPoint}
|
|
2878
|
+
*/
|
|
2879
|
+
outpoint() {
|
|
2880
|
+
const ret = wasm.wallettxout_outpoint(this.__wbg_ptr);
|
|
2881
|
+
return OutPoint.__wrap(ret);
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* @returns {Script}
|
|
2885
|
+
*/
|
|
2886
|
+
scriptPubkey() {
|
|
2887
|
+
const ret = wasm.wallettxout_scriptPubkey(this.__wbg_ptr);
|
|
2888
|
+
return Script.__wrap(ret);
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* @returns {number | undefined}
|
|
2892
|
+
*/
|
|
2893
|
+
height() {
|
|
2894
|
+
const ret = wasm.wallettxout_height(this.__wbg_ptr);
|
|
2895
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
2896
|
+
}
|
|
2897
|
+
/**
|
|
2898
|
+
* @returns {TxOutSecrets}
|
|
2899
|
+
*/
|
|
2900
|
+
unblinded() {
|
|
2901
|
+
const ret = wasm.wallettxout_unblinded(this.__wbg_ptr);
|
|
2902
|
+
return TxOutSecrets.__wrap(ret);
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* @returns {number}
|
|
2906
|
+
*/
|
|
2907
|
+
wildcardIndex() {
|
|
2908
|
+
const ret = wasm.wallettxout_wildcardIndex(this.__wbg_ptr);
|
|
2909
|
+
return ret >>> 0;
|
|
2910
|
+
}
|
|
2911
|
+
/**
|
|
2912
|
+
* @returns {Chain}
|
|
2913
|
+
*/
|
|
2914
|
+
extInt() {
|
|
2915
|
+
const ret = wasm.wallettxout_extInt(this.__wbg_ptr);
|
|
2916
|
+
return ret;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
module.exports.WalletTxOut = WalletTxOut;
|
|
2920
|
+
|
|
2921
|
+
const WolletFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2922
|
+
? { register: () => {}, unregister: () => {} }
|
|
2923
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wollet_free(ptr >>> 0, 1));
|
|
2924
|
+
/**
|
|
2925
|
+
* Wrapper of [`lwk_wollet::Wollet`]
|
|
2926
|
+
*/
|
|
2927
|
+
class Wollet {
|
|
2928
|
+
|
|
2929
|
+
__destroy_into_raw() {
|
|
2930
|
+
const ptr = this.__wbg_ptr;
|
|
2931
|
+
this.__wbg_ptr = 0;
|
|
2932
|
+
WolletFinalization.unregister(this);
|
|
2933
|
+
return ptr;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
free() {
|
|
2937
|
+
const ptr = this.__destroy_into_raw();
|
|
2938
|
+
wasm.__wbg_wollet_free(ptr, 0);
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* Create a `Wollet`
|
|
2942
|
+
* @param {Network} network
|
|
2943
|
+
* @param {WolletDescriptor} descriptor
|
|
2944
|
+
*/
|
|
2945
|
+
constructor(network, descriptor) {
|
|
2946
|
+
_assertClass(network, Network);
|
|
2947
|
+
_assertClass(descriptor, WolletDescriptor);
|
|
2948
|
+
const ret = wasm.wollet_new(network.__wbg_ptr, descriptor.__wbg_ptr);
|
|
2949
|
+
if (ret[2]) {
|
|
2950
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2951
|
+
}
|
|
2952
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2953
|
+
WolletFinalization.register(this, this.__wbg_ptr, this);
|
|
2954
|
+
return this;
|
|
2955
|
+
}
|
|
2956
|
+
/**
|
|
2957
|
+
* Get a wallet address with the correspondong derivation index
|
|
2958
|
+
*
|
|
2959
|
+
* If Some return the address at the given index,
|
|
2960
|
+
* otherwise the last unused address.
|
|
2961
|
+
* @param {number | undefined} [index]
|
|
2962
|
+
* @returns {AddressResult}
|
|
2963
|
+
*/
|
|
2964
|
+
address(index) {
|
|
2965
|
+
const ret = wasm.wollet_address(this.__wbg_ptr, isLikeNone(index) ? 0x100000001 : (index) >>> 0);
|
|
2966
|
+
if (ret[2]) {
|
|
2967
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2968
|
+
}
|
|
2969
|
+
return AddressResult.__wrap(ret[0]);
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* @param {number} index
|
|
2973
|
+
* @returns {Uint32Array}
|
|
2974
|
+
*/
|
|
2975
|
+
addressFullPath(index) {
|
|
2976
|
+
const ret = wasm.wollet_addressFullPath(this.__wbg_ptr, index);
|
|
2977
|
+
if (ret[3]) {
|
|
2978
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2979
|
+
}
|
|
2980
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
2981
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
2982
|
+
return v1;
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* @param {Update} update
|
|
2986
|
+
*/
|
|
2987
|
+
applyUpdate(update) {
|
|
2988
|
+
_assertClass(update, Update);
|
|
2989
|
+
const ret = wasm.wollet_applyUpdate(this.__wbg_ptr, update.__wbg_ptr);
|
|
2990
|
+
if (ret[1]) {
|
|
2991
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
/**
|
|
2995
|
+
* @returns {any}
|
|
2996
|
+
*/
|
|
2997
|
+
balance() {
|
|
2998
|
+
const ret = wasm.wollet_balance(this.__wbg_ptr);
|
|
2999
|
+
if (ret[2]) {
|
|
3000
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3001
|
+
}
|
|
3002
|
+
return takeFromExternrefTable0(ret[0]);
|
|
3003
|
+
}
|
|
3004
|
+
/**
|
|
3005
|
+
* @returns {(WalletTx)[]}
|
|
3006
|
+
*/
|
|
3007
|
+
transactions() {
|
|
3008
|
+
const ret = wasm.wollet_transactions(this.__wbg_ptr);
|
|
3009
|
+
if (ret[3]) {
|
|
3010
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
3011
|
+
}
|
|
3012
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3013
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
3014
|
+
return v1;
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* Finalize and consume the given PSET, returning the finalized one
|
|
3018
|
+
* @param {Pset} pset
|
|
3019
|
+
* @returns {Pset}
|
|
3020
|
+
*/
|
|
3021
|
+
finalize(pset) {
|
|
3022
|
+
_assertClass(pset, Pset);
|
|
3023
|
+
var ptr0 = pset.__destroy_into_raw();
|
|
3024
|
+
const ret = wasm.wollet_finalize(this.__wbg_ptr, ptr0);
|
|
3025
|
+
if (ret[2]) {
|
|
3026
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3027
|
+
}
|
|
3028
|
+
return Pset.__wrap(ret[0]);
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* @param {Pset} pset
|
|
3032
|
+
* @returns {PsetDetails}
|
|
3033
|
+
*/
|
|
3034
|
+
psetDetails(pset) {
|
|
3035
|
+
_assertClass(pset, Pset);
|
|
3036
|
+
const ret = wasm.wollet_psetDetails(this.__wbg_ptr, pset.__wbg_ptr);
|
|
3037
|
+
if (ret[2]) {
|
|
3038
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3039
|
+
}
|
|
3040
|
+
return PsetDetails.__wrap(ret[0]);
|
|
3041
|
+
}
|
|
3042
|
+
/**
|
|
3043
|
+
* @returns {WolletDescriptor}
|
|
3044
|
+
*/
|
|
3045
|
+
descriptor() {
|
|
3046
|
+
const ret = wasm.wollet_descriptor(this.__wbg_ptr);
|
|
3047
|
+
if (ret[2]) {
|
|
3048
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3049
|
+
}
|
|
3050
|
+
return WolletDescriptor.__wrap(ret[0]);
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* @returns {bigint}
|
|
3054
|
+
*/
|
|
3055
|
+
status() {
|
|
3056
|
+
const ret = wasm.wollet_status(this.__wbg_ptr);
|
|
3057
|
+
return BigInt.asUintN(64, ret);
|
|
3058
|
+
}
|
|
3059
|
+
/**
|
|
3060
|
+
* @returns {Tip}
|
|
3061
|
+
*/
|
|
3062
|
+
tip() {
|
|
3063
|
+
const ret = wasm.wollet_tip(this.__wbg_ptr);
|
|
3064
|
+
return Tip.__wrap(ret);
|
|
3065
|
+
}
|
|
3066
|
+
/**
|
|
3067
|
+
* wraps [lwk_wollet::Wollet::never_scanned()]
|
|
3068
|
+
* @returns {boolean}
|
|
3069
|
+
*/
|
|
3070
|
+
neverScanned() {
|
|
3071
|
+
const ret = wasm.wollet_neverScanned(this.__wbg_ptr);
|
|
3072
|
+
return ret !== 0;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
module.exports.Wollet = Wollet;
|
|
3076
|
+
|
|
3077
|
+
const WolletDescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3078
|
+
? { register: () => {}, unregister: () => {} }
|
|
3079
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wolletdescriptor_free(ptr >>> 0, 1));
|
|
3080
|
+
/**
|
|
3081
|
+
* Wrapper of [`lwk_wollet::WolletDescriptor`]
|
|
3082
|
+
*/
|
|
3083
|
+
class WolletDescriptor {
|
|
3084
|
+
|
|
3085
|
+
static __wrap(ptr) {
|
|
3086
|
+
ptr = ptr >>> 0;
|
|
3087
|
+
const obj = Object.create(WolletDescriptor.prototype);
|
|
3088
|
+
obj.__wbg_ptr = ptr;
|
|
3089
|
+
WolletDescriptorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3090
|
+
return obj;
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
__destroy_into_raw() {
|
|
3094
|
+
const ptr = this.__wbg_ptr;
|
|
3095
|
+
this.__wbg_ptr = 0;
|
|
3096
|
+
WolletDescriptorFinalization.unregister(this);
|
|
3097
|
+
return ptr;
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
free() {
|
|
3101
|
+
const ptr = this.__destroy_into_raw();
|
|
3102
|
+
wasm.__wbg_wolletdescriptor_free(ptr, 0);
|
|
3103
|
+
}
|
|
3104
|
+
/**
|
|
3105
|
+
* Creates a `WolletDescriptor`
|
|
3106
|
+
* @param {string} descriptor
|
|
3107
|
+
*/
|
|
3108
|
+
constructor(descriptor) {
|
|
3109
|
+
const ptr0 = passStringToWasm0(descriptor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3111
|
+
const ret = wasm.wolletdescriptor_new(ptr0, len0);
|
|
3112
|
+
if (ret[2]) {
|
|
3113
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3114
|
+
}
|
|
3115
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
3116
|
+
WolletDescriptorFinalization.register(this, this.__wbg_ptr, this);
|
|
3117
|
+
return this;
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* @returns {string}
|
|
3121
|
+
*/
|
|
3122
|
+
toString() {
|
|
3123
|
+
let deferred1_0;
|
|
3124
|
+
let deferred1_1;
|
|
3125
|
+
try {
|
|
3126
|
+
const ret = wasm.wolletdescriptor_toString(this.__wbg_ptr);
|
|
3127
|
+
deferred1_0 = ret[0];
|
|
3128
|
+
deferred1_1 = ret[1];
|
|
3129
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3130
|
+
} finally {
|
|
3131
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* @param {number} threshold
|
|
3136
|
+
* @param {(string)[]} participants
|
|
3137
|
+
* @returns {WolletDescriptor}
|
|
3138
|
+
*/
|
|
3139
|
+
static newMultiWshSlip77(threshold, participants) {
|
|
3140
|
+
const ptr0 = passArrayJsValueToWasm0(participants, wasm.__wbindgen_malloc);
|
|
3141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3142
|
+
const ret = wasm.wolletdescriptor_newMultiWshSlip77(threshold, ptr0, len0);
|
|
3143
|
+
if (ret[2]) {
|
|
3144
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3145
|
+
}
|
|
3146
|
+
return WolletDescriptor.__wrap(ret[0]);
|
|
3147
|
+
}
|
|
3148
|
+
/**
|
|
3149
|
+
* @returns {boolean}
|
|
3150
|
+
*/
|
|
3151
|
+
isMainnet() {
|
|
3152
|
+
const ret = wasm.wolletdescriptor_isMainnet(this.__wbg_ptr);
|
|
3153
|
+
return ret !== 0;
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
module.exports.WolletDescriptor = WolletDescriptor;
|
|
3157
|
+
|
|
3158
|
+
const XpubFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3159
|
+
? { register: () => {}, unregister: () => {} }
|
|
3160
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_xpub_free(ptr >>> 0, 1));
|
|
3161
|
+
/**
|
|
3162
|
+
* Wrapper of [`bip32::Xpub`]
|
|
3163
|
+
*/
|
|
3164
|
+
class Xpub {
|
|
3165
|
+
|
|
3166
|
+
static __wrap(ptr) {
|
|
3167
|
+
ptr = ptr >>> 0;
|
|
3168
|
+
const obj = Object.create(Xpub.prototype);
|
|
3169
|
+
obj.__wbg_ptr = ptr;
|
|
3170
|
+
XpubFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3171
|
+
return obj;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
__destroy_into_raw() {
|
|
3175
|
+
const ptr = this.__wbg_ptr;
|
|
3176
|
+
this.__wbg_ptr = 0;
|
|
3177
|
+
XpubFinalization.unregister(this);
|
|
3178
|
+
return ptr;
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
free() {
|
|
3182
|
+
const ptr = this.__destroy_into_raw();
|
|
3183
|
+
wasm.__wbg_xpub_free(ptr, 0);
|
|
3184
|
+
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Creates a Mnemonic
|
|
3187
|
+
* @param {string} s
|
|
3188
|
+
*/
|
|
3189
|
+
constructor(s) {
|
|
3190
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3191
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3192
|
+
const ret = wasm.xpub_new(ptr0, len0);
|
|
3193
|
+
if (ret[2]) {
|
|
3194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3195
|
+
}
|
|
3196
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
3197
|
+
XpubFinalization.register(this, this.__wbg_ptr, this);
|
|
3198
|
+
return this;
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* @returns {string}
|
|
3202
|
+
*/
|
|
3203
|
+
toString() {
|
|
3204
|
+
let deferred1_0;
|
|
3205
|
+
let deferred1_1;
|
|
3206
|
+
try {
|
|
3207
|
+
const ret = wasm.xpub_toString(this.__wbg_ptr);
|
|
3208
|
+
deferred1_0 = ret[0];
|
|
3209
|
+
deferred1_1 = ret[1];
|
|
3210
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3211
|
+
} finally {
|
|
3212
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
/**
|
|
3216
|
+
* @returns {string}
|
|
3217
|
+
*/
|
|
3218
|
+
identifier() {
|
|
3219
|
+
let deferred1_0;
|
|
3220
|
+
let deferred1_1;
|
|
3221
|
+
try {
|
|
3222
|
+
const ret = wasm.xpub_identifier(this.__wbg_ptr);
|
|
3223
|
+
deferred1_0 = ret[0];
|
|
3224
|
+
deferred1_1 = ret[1];
|
|
3225
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3226
|
+
} finally {
|
|
3227
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* @returns {string}
|
|
3232
|
+
*/
|
|
3233
|
+
fingerprint() {
|
|
3234
|
+
let deferred1_0;
|
|
3235
|
+
let deferred1_1;
|
|
3236
|
+
try {
|
|
3237
|
+
const ret = wasm.xpub_fingerprint(this.__wbg_ptr);
|
|
3238
|
+
deferred1_0 = ret[0];
|
|
3239
|
+
deferred1_1 = ret[1];
|
|
3240
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3241
|
+
} finally {
|
|
3242
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
/**
|
|
3246
|
+
* Returns true if the passed string is a valid xpub with a valid keyorigin if present
|
|
3247
|
+
* @param {string} s
|
|
3248
|
+
* @returns {boolean}
|
|
3249
|
+
*/
|
|
3250
|
+
static isValidWithKeyOrigin(s) {
|
|
3251
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3253
|
+
const ret = wasm.xpub_isValidWithKeyOrigin(ptr0, len0);
|
|
3254
|
+
return ret !== 0;
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
module.exports.Xpub = Xpub;
|
|
3258
|
+
|
|
3259
|
+
module.exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
3260
|
+
const ret = String(arg1);
|
|
3261
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3262
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3263
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3264
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3265
|
+
};
|
|
3266
|
+
|
|
3267
|
+
module.exports.__wbg_abort_05026c983d86824c = function(arg0) {
|
|
3268
|
+
arg0.abort();
|
|
3269
|
+
};
|
|
3270
|
+
|
|
3271
|
+
module.exports.__wbg_append_72d1635ad8643998 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
3272
|
+
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
3273
|
+
}, arguments) };
|
|
3274
|
+
|
|
3275
|
+
module.exports.__wbg_arrayBuffer_d0ca2ad8bda0039b = function() { return handleError(function (arg0) {
|
|
3276
|
+
const ret = arg0.arrayBuffer();
|
|
3277
|
+
return ret;
|
|
3278
|
+
}, arguments) };
|
|
3279
|
+
|
|
3280
|
+
module.exports.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
|
|
3281
|
+
const ret = arg0.buffer;
|
|
3282
|
+
return ret;
|
|
3283
|
+
};
|
|
3284
|
+
|
|
3285
|
+
module.exports.__wbg_call_500db948e69c7330 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
3286
|
+
const ret = arg0.call(arg1, arg2);
|
|
3287
|
+
return ret;
|
|
3288
|
+
}, arguments) };
|
|
3289
|
+
|
|
3290
|
+
module.exports.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) {
|
|
3291
|
+
const ret = arg0.call(arg1);
|
|
3292
|
+
return ret;
|
|
3293
|
+
}, arguments) };
|
|
3294
|
+
|
|
3295
|
+
module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
|
|
3296
|
+
const ret = arg0.crypto;
|
|
3297
|
+
return ret;
|
|
3298
|
+
};
|
|
3299
|
+
|
|
3300
|
+
module.exports.__wbg_done_f22c1561fa919baa = function(arg0) {
|
|
3301
|
+
const ret = arg0.done;
|
|
3302
|
+
return ret;
|
|
3303
|
+
};
|
|
3304
|
+
|
|
3305
|
+
module.exports.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) {
|
|
3306
|
+
const ret = arg0.fetch(arg1);
|
|
3307
|
+
return ret;
|
|
3308
|
+
};
|
|
3309
|
+
|
|
3310
|
+
module.exports.__wbg_fetch_b335d17f45a8b5a1 = function(arg0) {
|
|
3311
|
+
const ret = fetch(arg0);
|
|
3312
|
+
return ret;
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
module.exports.__wbg_getDevices_e3b981f8ab3f64ca = function(arg0) {
|
|
3316
|
+
const ret = arg0.getDevices();
|
|
3317
|
+
return ret;
|
|
3318
|
+
};
|
|
3319
|
+
|
|
3320
|
+
module.exports.__wbg_getPorts_bcbc416782ca640e = function(arg0) {
|
|
3321
|
+
const ret = arg0.getPorts();
|
|
3322
|
+
return ret;
|
|
3323
|
+
};
|
|
3324
|
+
|
|
3325
|
+
module.exports.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
|
|
3326
|
+
arg0.getRandomValues(arg1);
|
|
3327
|
+
}, arguments) };
|
|
3328
|
+
|
|
3329
|
+
module.exports.__wbg_getWriter_dd1c7a1972bcd348 = function() { return handleError(function (arg0) {
|
|
3330
|
+
const ret = arg0.getWriter();
|
|
3331
|
+
return ret;
|
|
3332
|
+
}, arguments) };
|
|
3333
|
+
|
|
3334
|
+
module.exports.__wbg_get_9aa3dff3f0266054 = function(arg0, arg1) {
|
|
3335
|
+
const ret = arg0[arg1 >>> 0];
|
|
3336
|
+
return ret;
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
module.exports.__wbg_get_bbccf8970793c087 = function() { return handleError(function (arg0, arg1) {
|
|
3340
|
+
const ret = Reflect.get(arg0, arg1);
|
|
3341
|
+
return ret;
|
|
3342
|
+
}, arguments) };
|
|
3343
|
+
|
|
3344
|
+
module.exports.__wbg_has_94c2fc1d261bbfe9 = function() { return handleError(function (arg0, arg1) {
|
|
3345
|
+
const ret = Reflect.has(arg0, arg1);
|
|
3346
|
+
return ret;
|
|
3347
|
+
}, arguments) };
|
|
3348
|
+
|
|
3349
|
+
module.exports.__wbg_headers_24e3e19fe3f187c0 = function(arg0) {
|
|
3350
|
+
const ret = arg0.headers;
|
|
3351
|
+
return ret;
|
|
3352
|
+
};
|
|
3353
|
+
|
|
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
|
+
module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) {
|
|
3371
|
+
let result;
|
|
3372
|
+
try {
|
|
3373
|
+
result = arg0 instanceof Response;
|
|
3374
|
+
} catch (_) {
|
|
3375
|
+
result = false;
|
|
3376
|
+
}
|
|
3377
|
+
const ret = result;
|
|
3378
|
+
return ret;
|
|
3379
|
+
};
|
|
3380
|
+
|
|
3381
|
+
module.exports.__wbg_instanceof_SerialPort_859e0e152f7eb0c4 = function(arg0) {
|
|
3382
|
+
let result;
|
|
3383
|
+
try {
|
|
3384
|
+
result = arg0 instanceof SerialPort;
|
|
3385
|
+
} catch (_) {
|
|
3386
|
+
result = false;
|
|
3387
|
+
}
|
|
3388
|
+
const ret = result;
|
|
3389
|
+
return ret;
|
|
3390
|
+
};
|
|
3391
|
+
|
|
3392
|
+
module.exports.__wbg_instanceof_Window_d2514c6a7ee7ba60 = function(arg0) {
|
|
3393
|
+
let result;
|
|
3394
|
+
try {
|
|
3395
|
+
result = arg0 instanceof Window;
|
|
3396
|
+
} catch (_) {
|
|
3397
|
+
result = false;
|
|
3398
|
+
}
|
|
3399
|
+
const ret = result;
|
|
3400
|
+
return ret;
|
|
3401
|
+
};
|
|
3402
|
+
|
|
3403
|
+
module.exports.__wbg_isArray_1ba11a930108ec51 = function(arg0) {
|
|
3404
|
+
const ret = Array.isArray(arg0);
|
|
3405
|
+
return ret;
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
module.exports.__wbg_issuance_new = function(arg0) {
|
|
3409
|
+
const ret = Issuance.__wrap(arg0);
|
|
3410
|
+
return ret;
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
module.exports.__wbg_iterator_23604bb983791576 = function() {
|
|
3414
|
+
const ret = Symbol.iterator;
|
|
3415
|
+
return ret;
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
module.exports.__wbg_jade_new = function(arg0) {
|
|
3419
|
+
const ret = Jade.__wrap(arg0);
|
|
3420
|
+
return ret;
|
|
3421
|
+
};
|
|
3422
|
+
|
|
3423
|
+
module.exports.__wbg_length_65d1cd11729ced11 = function(arg0) {
|
|
3424
|
+
const ret = arg0.length;
|
|
3425
|
+
return ret;
|
|
3426
|
+
};
|
|
3427
|
+
|
|
3428
|
+
module.exports.__wbg_length_d65cf0786bfc5739 = function(arg0) {
|
|
3429
|
+
const ret = arg0.length;
|
|
3430
|
+
return ret;
|
|
3431
|
+
};
|
|
3432
|
+
|
|
3433
|
+
module.exports.__wbg_log_5f82480ac7a101b6 = function(arg0, arg1) {
|
|
3434
|
+
console.log(arg0, arg1);
|
|
3435
|
+
};
|
|
3436
|
+
|
|
3437
|
+
module.exports.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
3438
|
+
const ret = arg0.msCrypto;
|
|
3439
|
+
return ret;
|
|
3440
|
+
};
|
|
3441
|
+
|
|
3442
|
+
module.exports.__wbg_navigator_0fe968937104eaa7 = function(arg0) {
|
|
3443
|
+
const ret = arg0.navigator;
|
|
3444
|
+
return ret;
|
|
3445
|
+
};
|
|
3446
|
+
|
|
3447
|
+
module.exports.__wbg_new_254fa9eac11932ae = function() {
|
|
3448
|
+
const ret = new Array();
|
|
3449
|
+
return ret;
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3452
|
+
module.exports.__wbg_new_2deffdefb590e47b = function() { return handleError(function (arg0) {
|
|
3453
|
+
const ret = new ReadableStreamDefaultReader(arg0);
|
|
3454
|
+
return ret;
|
|
3455
|
+
}, arguments) };
|
|
3456
|
+
|
|
3457
|
+
module.exports.__wbg_new_35d748855c4620b9 = function() { return handleError(function () {
|
|
3458
|
+
const ret = new Headers();
|
|
3459
|
+
return ret;
|
|
3460
|
+
}, arguments) };
|
|
3461
|
+
|
|
3462
|
+
module.exports.__wbg_new_3d446df9155128ef = function(arg0, arg1) {
|
|
3463
|
+
try {
|
|
3464
|
+
var state0 = {a: arg0, b: arg1};
|
|
3465
|
+
var cb0 = (arg0, arg1) => {
|
|
3466
|
+
const a = state0.a;
|
|
3467
|
+
state0.a = 0;
|
|
3468
|
+
try {
|
|
3469
|
+
return __wbg_adapter_379(a, state0.b, arg0, arg1);
|
|
3470
|
+
} finally {
|
|
3471
|
+
state0.a = a;
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3474
|
+
const ret = new Promise(cb0);
|
|
3475
|
+
return ret;
|
|
3476
|
+
} finally {
|
|
3477
|
+
state0.a = state0.b = 0;
|
|
3478
|
+
}
|
|
3479
|
+
};
|
|
3480
|
+
|
|
3481
|
+
module.exports.__wbg_new_3ff5b33b1ce712df = function(arg0) {
|
|
3482
|
+
const ret = new Uint8Array(arg0);
|
|
3483
|
+
return ret;
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3486
|
+
module.exports.__wbg_new_5f48f21d4be11586 = function() { return handleError(function () {
|
|
3487
|
+
const ret = new AbortController();
|
|
3488
|
+
return ret;
|
|
3489
|
+
}, arguments) };
|
|
3490
|
+
|
|
3491
|
+
module.exports.__wbg_new_688846f374351c92 = function() {
|
|
3492
|
+
const ret = new Object();
|
|
3493
|
+
return ret;
|
|
3494
|
+
};
|
|
3495
|
+
|
|
3496
|
+
module.exports.__wbg_new_bc96c6a1c0786643 = function() {
|
|
3497
|
+
const ret = new Map();
|
|
3498
|
+
return ret;
|
|
3499
|
+
};
|
|
3500
|
+
|
|
3501
|
+
module.exports.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) {
|
|
3502
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
3503
|
+
return ret;
|
|
3504
|
+
};
|
|
3505
|
+
|
|
3506
|
+
module.exports.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) {
|
|
3507
|
+
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
3508
|
+
return ret;
|
|
3509
|
+
};
|
|
3510
|
+
|
|
3511
|
+
module.exports.__wbg_newwithlength_34ce8f1051e74449 = function(arg0) {
|
|
3512
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
3513
|
+
return ret;
|
|
3514
|
+
};
|
|
3515
|
+
|
|
3516
|
+
module.exports.__wbg_newwithstrandinit_a1f6583f20e4faff = function() { return handleError(function (arg0, arg1, arg2) {
|
|
3517
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
3518
|
+
return ret;
|
|
3519
|
+
}, arguments) };
|
|
3520
|
+
|
|
3521
|
+
module.exports.__wbg_next_01dd9234a5bf6d05 = function() { return handleError(function (arg0) {
|
|
3522
|
+
const ret = arg0.next();
|
|
3523
|
+
return ret;
|
|
3524
|
+
}, arguments) };
|
|
3525
|
+
|
|
3526
|
+
module.exports.__wbg_next_137428deb98342b0 = function(arg0) {
|
|
3527
|
+
const ret = arg0.next;
|
|
3528
|
+
return ret;
|
|
3529
|
+
};
|
|
3530
|
+
|
|
3531
|
+
module.exports.__wbg_node_02999533c4ea02e3 = function(arg0) {
|
|
3532
|
+
const ret = arg0.node;
|
|
3533
|
+
return ret;
|
|
3534
|
+
};
|
|
3535
|
+
|
|
3536
|
+
module.exports.__wbg_now_64d0bb151e5d3889 = function() {
|
|
3537
|
+
const ret = Date.now();
|
|
3538
|
+
return ret;
|
|
3539
|
+
};
|
|
3540
|
+
|
|
3541
|
+
module.exports.__wbg_open_c0755c79d6623261 = function(arg0, arg1) {
|
|
3542
|
+
const ret = arg0.open(arg1);
|
|
3543
|
+
return ret;
|
|
3544
|
+
};
|
|
3545
|
+
|
|
3546
|
+
module.exports.__wbg_optionwallettxout_new = function(arg0) {
|
|
3547
|
+
const ret = OptionWalletTxOut.__wrap(arg0);
|
|
3548
|
+
return ret;
|
|
3549
|
+
};
|
|
3550
|
+
|
|
3551
|
+
module.exports.__wbg_process_5c1d670bc53614b8 = function(arg0) {
|
|
3552
|
+
const ret = arg0.process;
|
|
3553
|
+
return ret;
|
|
3554
|
+
};
|
|
3555
|
+
|
|
3556
|
+
module.exports.__wbg_pset_new = function(arg0) {
|
|
3557
|
+
const ret = Pset.__wrap(arg0);
|
|
3558
|
+
return ret;
|
|
3559
|
+
};
|
|
3560
|
+
|
|
3561
|
+
module.exports.__wbg_psetinput_new = function(arg0) {
|
|
3562
|
+
const ret = PsetInput.__wrap(arg0);
|
|
3563
|
+
return ret;
|
|
3564
|
+
};
|
|
3565
|
+
|
|
3566
|
+
module.exports.__wbg_psetsignatures_new = function(arg0) {
|
|
3567
|
+
const ret = PsetSignatures.__wrap(arg0);
|
|
3568
|
+
return ret;
|
|
3569
|
+
};
|
|
3570
|
+
|
|
3571
|
+
module.exports.__wbg_queueMicrotask_2181040e064c0dc8 = function(arg0) {
|
|
3572
|
+
queueMicrotask(arg0);
|
|
3573
|
+
};
|
|
3574
|
+
|
|
3575
|
+
module.exports.__wbg_queueMicrotask_ef9ac43769cbcc4f = function(arg0) {
|
|
3576
|
+
const ret = arg0.queueMicrotask;
|
|
3577
|
+
return ret;
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
module.exports.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
|
|
3581
|
+
arg0.randomFillSync(arg1);
|
|
3582
|
+
}, arguments) };
|
|
3583
|
+
|
|
3584
|
+
module.exports.__wbg_read_4d173e86f707008c = function(arg0) {
|
|
3585
|
+
const ret = arg0.read();
|
|
3586
|
+
return ret;
|
|
3587
|
+
};
|
|
3588
|
+
|
|
3589
|
+
module.exports.__wbg_readable_6f2f0016480ce261 = function(arg0) {
|
|
3590
|
+
const ret = arg0.readable;
|
|
3591
|
+
return ret;
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3594
|
+
module.exports.__wbg_recipient_new = function(arg0) {
|
|
3595
|
+
const ret = Recipient.__wrap(arg0);
|
|
3596
|
+
return ret;
|
|
3597
|
+
};
|
|
3598
|
+
|
|
3599
|
+
module.exports.__wbg_requestDevice_80cf95954319a779 = function(arg0, arg1) {
|
|
3600
|
+
const ret = arg0.requestDevice(arg1);
|
|
3601
|
+
return ret;
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3604
|
+
module.exports.__wbg_requestPort_4017b10c6ed80bc9 = function(arg0, arg1) {
|
|
3605
|
+
const ret = arg0.requestPort(arg1);
|
|
3606
|
+
return ret;
|
|
3607
|
+
};
|
|
3608
|
+
|
|
3609
|
+
module.exports.__wbg_requestPort_fd685d24d556886e = function(arg0) {
|
|
3610
|
+
const ret = arg0.requestPort();
|
|
3611
|
+
return ret;
|
|
3612
|
+
};
|
|
3613
|
+
|
|
3614
|
+
module.exports.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
|
|
3615
|
+
const ret = module.require;
|
|
3616
|
+
return ret;
|
|
3617
|
+
}, arguments) };
|
|
3618
|
+
|
|
3619
|
+
module.exports.__wbg_resolve_0bf7c44d641804f9 = function(arg0) {
|
|
3620
|
+
const ret = Promise.resolve(arg0);
|
|
3621
|
+
return ret;
|
|
3622
|
+
};
|
|
3623
|
+
|
|
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
|
+
module.exports.__wbg_serial_af8521e375ee4947 = function(arg0) {
|
|
3630
|
+
const ret = arg0.serial;
|
|
3631
|
+
return ret;
|
|
3632
|
+
};
|
|
3633
|
+
|
|
3634
|
+
module.exports.__wbg_setTimeout_8d2afdcdb34b4e5a = function() { return handleError(function (arg0, arg1, arg2) {
|
|
3635
|
+
const ret = arg0.setTimeout(arg1, arg2);
|
|
3636
|
+
return ret;
|
|
3637
|
+
}, arguments) };
|
|
3638
|
+
|
|
3639
|
+
module.exports.__wbg_set_1d80752d0d5f0b21 = function(arg0, arg1, arg2) {
|
|
3640
|
+
arg0[arg1 >>> 0] = arg2;
|
|
3641
|
+
};
|
|
3642
|
+
|
|
3643
|
+
module.exports.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) {
|
|
3644
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
3645
|
+
};
|
|
3646
|
+
|
|
3647
|
+
module.exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
3648
|
+
arg0[arg1] = arg2;
|
|
3649
|
+
};
|
|
3650
|
+
|
|
3651
|
+
module.exports.__wbg_set_76818dc3c59a63d5 = function(arg0, arg1, arg2) {
|
|
3652
|
+
const ret = arg0.set(arg1, arg2);
|
|
3653
|
+
return ret;
|
|
3654
|
+
};
|
|
3655
|
+
|
|
3656
|
+
module.exports.__wbg_setbaudrate_1ae9e2eeefa2bee6 = function(arg0, arg1) {
|
|
3657
|
+
arg0.baudRate = arg1 >>> 0;
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3660
|
+
module.exports.__wbg_setbody_64920df008e48adc = function(arg0, arg1) {
|
|
3661
|
+
arg0.body = arg1;
|
|
3662
|
+
};
|
|
3663
|
+
|
|
3664
|
+
module.exports.__wbg_setcredentials_cfc15e48e3a3a535 = function(arg0, arg1) {
|
|
3665
|
+
arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
|
|
3666
|
+
};
|
|
3667
|
+
|
|
3668
|
+
module.exports.__wbg_setfilters_51bbf67999aa61d4 = function(arg0, arg1) {
|
|
3669
|
+
arg0.filters = arg1;
|
|
3670
|
+
};
|
|
3671
|
+
|
|
3672
|
+
module.exports.__wbg_setfilters_6826706298fde705 = function(arg0, arg1) {
|
|
3673
|
+
arg0.filters = arg1;
|
|
3674
|
+
};
|
|
3675
|
+
|
|
3676
|
+
module.exports.__wbg_setheaders_4c921e8e226bdfa7 = function(arg0, arg1) {
|
|
3677
|
+
arg0.headers = arg1;
|
|
3678
|
+
};
|
|
3679
|
+
|
|
3680
|
+
module.exports.__wbg_setmethod_cfc7f688ba46a6be = function(arg0, arg1, arg2) {
|
|
3681
|
+
arg0.method = getStringFromWasm0(arg1, arg2);
|
|
3682
|
+
};
|
|
3683
|
+
|
|
3684
|
+
module.exports.__wbg_setmode_cd03637eb7da01e0 = function(arg0, arg1) {
|
|
3685
|
+
arg0.mode = __wbindgen_enum_RequestMode[arg1];
|
|
3686
|
+
};
|
|
3687
|
+
|
|
3688
|
+
module.exports.__wbg_setsignal_f766190d206f09e5 = function(arg0, arg1) {
|
|
3689
|
+
arg0.signal = arg1;
|
|
3690
|
+
};
|
|
3691
|
+
|
|
3692
|
+
module.exports.__wbg_signal_1fdadeba2d04660e = function(arg0) {
|
|
3693
|
+
const ret = arg0.signal;
|
|
3694
|
+
return ret;
|
|
3695
|
+
};
|
|
3696
|
+
|
|
3697
|
+
module.exports.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() {
|
|
3698
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
3699
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3700
|
+
};
|
|
3701
|
+
|
|
3702
|
+
module.exports.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() {
|
|
3703
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
3704
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3705
|
+
};
|
|
3706
|
+
|
|
3707
|
+
module.exports.__wbg_static_accessor_SELF_1dc398a895c82351 = function() {
|
|
3708
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
3709
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3710
|
+
};
|
|
3711
|
+
|
|
3712
|
+
module.exports.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() {
|
|
3713
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
3714
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3715
|
+
};
|
|
3716
|
+
|
|
3717
|
+
module.exports.__wbg_status_317f53bc4c7638df = function(arg0) {
|
|
3718
|
+
const ret = arg0.status;
|
|
3719
|
+
return ret;
|
|
3720
|
+
};
|
|
3721
|
+
|
|
3722
|
+
module.exports.__wbg_stringify_f4f701bc34ceda61 = function() { return handleError(function (arg0) {
|
|
3723
|
+
const ret = JSON.stringify(arg0);
|
|
3724
|
+
return ret;
|
|
3725
|
+
}, arguments) };
|
|
3726
|
+
|
|
3727
|
+
module.exports.__wbg_subarray_46adeb9b86949d12 = function(arg0, arg1, arg2) {
|
|
3728
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
3729
|
+
return ret;
|
|
3730
|
+
};
|
|
3731
|
+
|
|
3732
|
+
module.exports.__wbg_text_dfc4cb7631d2eb34 = function() { return handleError(function (arg0) {
|
|
3733
|
+
const ret = arg0.text();
|
|
3734
|
+
return ret;
|
|
3735
|
+
}, arguments) };
|
|
3736
|
+
|
|
3737
|
+
module.exports.__wbg_then_0438fad860fe38e1 = function(arg0, arg1) {
|
|
3738
|
+
const ret = arg0.then(arg1);
|
|
3739
|
+
return ret;
|
|
3740
|
+
};
|
|
3741
|
+
|
|
3742
|
+
module.exports.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) {
|
|
3743
|
+
const ret = arg0.then(arg1, arg2);
|
|
3744
|
+
return ret;
|
|
3745
|
+
};
|
|
3746
|
+
|
|
3747
|
+
module.exports.__wbg_txid_new = function(arg0) {
|
|
3748
|
+
const ret = Txid.__wrap(arg0);
|
|
3749
|
+
return ret;
|
|
3750
|
+
};
|
|
3751
|
+
|
|
3752
|
+
module.exports.__wbg_update_new = function(arg0) {
|
|
3753
|
+
const ret = Update.__wrap(arg0);
|
|
3754
|
+
return ret;
|
|
3755
|
+
};
|
|
3756
|
+
|
|
3757
|
+
module.exports.__wbg_url_5327bc0a41a9b085 = function(arg0, arg1) {
|
|
3758
|
+
const ret = arg1.url;
|
|
3759
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3760
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3761
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3762
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3763
|
+
};
|
|
3764
|
+
|
|
3765
|
+
module.exports.__wbg_value_4c32fd138a88eee2 = function(arg0) {
|
|
3766
|
+
const ret = arg0.value;
|
|
3767
|
+
return ret;
|
|
3768
|
+
};
|
|
3769
|
+
|
|
3770
|
+
module.exports.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
|
|
3771
|
+
const ret = arg0.versions;
|
|
3772
|
+
return ret;
|
|
3773
|
+
};
|
|
3774
|
+
|
|
3775
|
+
module.exports.__wbg_wallettx_new = function(arg0) {
|
|
3776
|
+
const ret = WalletTx.__wrap(arg0);
|
|
3777
|
+
return ret;
|
|
3778
|
+
};
|
|
3779
|
+
|
|
3780
|
+
module.exports.__wbg_wolletdescriptor_new = function(arg0) {
|
|
3781
|
+
const ret = WolletDescriptor.__wrap(arg0);
|
|
3782
|
+
return ret;
|
|
3783
|
+
};
|
|
3784
|
+
|
|
3785
|
+
module.exports.__wbg_writable_42ec41878b656f61 = function(arg0) {
|
|
3786
|
+
const ret = arg0.writable;
|
|
3787
|
+
return ret;
|
|
3788
|
+
};
|
|
3789
|
+
|
|
3790
|
+
module.exports.__wbg_write_0aea81ae26043440 = function(arg0, arg1) {
|
|
3791
|
+
const ret = arg0.write(arg1);
|
|
3792
|
+
return ret;
|
|
3793
|
+
};
|
|
3794
|
+
|
|
3795
|
+
module.exports.__wbg_xpub_new = function(arg0) {
|
|
3796
|
+
const ret = Xpub.__wrap(arg0);
|
|
3797
|
+
return ret;
|
|
3798
|
+
};
|
|
3799
|
+
|
|
3800
|
+
module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
3801
|
+
const ret = arg0;
|
|
3802
|
+
return ret;
|
|
3803
|
+
};
|
|
3804
|
+
|
|
3805
|
+
module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
3806
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
3807
|
+
return ret;
|
|
3808
|
+
};
|
|
3809
|
+
|
|
3810
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
3811
|
+
const obj = arg0.original;
|
|
3812
|
+
if (obj.cnt-- == 1) {
|
|
3813
|
+
obj.a = 0;
|
|
3814
|
+
return true;
|
|
3815
|
+
}
|
|
3816
|
+
const ret = false;
|
|
3817
|
+
return ret;
|
|
3818
|
+
};
|
|
3819
|
+
|
|
3820
|
+
module.exports.__wbindgen_closure_wrapper8773 = function(arg0, arg1, arg2) {
|
|
3821
|
+
const ret = makeMutClosure(arg0, arg1, 966, __wbg_adapter_36);
|
|
3822
|
+
return ret;
|
|
3823
|
+
};
|
|
3824
|
+
|
|
3825
|
+
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
3826
|
+
const ret = debugString(arg1);
|
|
3827
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3828
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3829
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3830
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3831
|
+
};
|
|
3832
|
+
|
|
3833
|
+
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
3834
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
3835
|
+
return ret;
|
|
3836
|
+
};
|
|
3837
|
+
|
|
3838
|
+
module.exports.__wbindgen_init_externref_table = function() {
|
|
3839
|
+
const table = wasm.__wbindgen_export_4;
|
|
3840
|
+
const offset = table.grow(4);
|
|
3841
|
+
table.set(0, undefined);
|
|
3842
|
+
table.set(offset + 0, undefined);
|
|
3843
|
+
table.set(offset + 1, null);
|
|
3844
|
+
table.set(offset + 2, true);
|
|
3845
|
+
table.set(offset + 3, false);
|
|
3846
|
+
;
|
|
3847
|
+
};
|
|
3848
|
+
|
|
3849
|
+
module.exports.__wbindgen_is_function = function(arg0) {
|
|
3850
|
+
const ret = typeof(arg0) === 'function';
|
|
3851
|
+
return ret;
|
|
3852
|
+
};
|
|
3853
|
+
|
|
3854
|
+
module.exports.__wbindgen_is_object = function(arg0) {
|
|
3855
|
+
const val = arg0;
|
|
3856
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
3857
|
+
return ret;
|
|
3858
|
+
};
|
|
3859
|
+
|
|
3860
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
3861
|
+
const ret = typeof(arg0) === 'string';
|
|
3862
|
+
return ret;
|
|
3863
|
+
};
|
|
3864
|
+
|
|
3865
|
+
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
3866
|
+
const ret = arg0 === undefined;
|
|
3867
|
+
return ret;
|
|
3868
|
+
};
|
|
3869
|
+
|
|
3870
|
+
module.exports.__wbindgen_memory = function() {
|
|
3871
|
+
const ret = wasm.memory;
|
|
3872
|
+
return ret;
|
|
3873
|
+
};
|
|
3874
|
+
|
|
3875
|
+
module.exports.__wbindgen_number_new = function(arg0) {
|
|
3876
|
+
const ret = arg0;
|
|
3877
|
+
return ret;
|
|
3878
|
+
};
|
|
3879
|
+
|
|
3880
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
3881
|
+
const obj = arg1;
|
|
3882
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
3883
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3884
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3885
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3886
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3887
|
+
};
|
|
3888
|
+
|
|
3889
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
3890
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
3891
|
+
return ret;
|
|
3892
|
+
};
|
|
3893
|
+
|
|
3894
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
3895
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3898
|
+
const path = require('path').join(__dirname, 'lwk_wasm_bg.wasm');
|
|
3899
|
+
const bytes = require('fs').readFileSync(path);
|
|
3900
|
+
|
|
3901
|
+
const wasmModule = new WebAssembly.Module(bytes);
|
|
3902
|
+
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
3903
|
+
wasm = wasmInstance.exports;
|
|
3904
|
+
module.exports.__wasm = wasm;
|
|
3905
|
+
|
|
3906
|
+
wasm.__wbindgen_start();
|
|
3907
|
+
|