lwk_node 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -39
- package/lwk_wasm.d.ts +232 -7
- package/lwk_wasm.js +747 -115
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/lwk_wasm.js
CHANGED
|
@@ -102,15 +102,22 @@ function handleError(f, args) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function
|
|
106
|
-
ptr =
|
|
107
|
-
|
|
105
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
106
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
107
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
108
|
+
WASM_VECTOR_LEN = arg.length;
|
|
109
|
+
return ptr;
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
function isLikeNone(x) {
|
|
111
113
|
return x === undefined || x === null;
|
|
112
114
|
}
|
|
113
115
|
|
|
116
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
117
|
+
ptr = ptr >>> 0;
|
|
118
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
function debugString(val) {
|
|
115
122
|
// primitive types
|
|
116
123
|
const type = typeof val;
|
|
@@ -210,17 +217,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
210
217
|
return real;
|
|
211
218
|
}
|
|
212
219
|
|
|
213
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
214
|
-
ptr = ptr >>> 0;
|
|
215
|
-
const mem = getDataViewMemory0();
|
|
216
|
-
const result = [];
|
|
217
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
218
|
-
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
219
|
-
}
|
|
220
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
221
|
-
return result;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
220
|
function takeFromExternrefTable0(idx) {
|
|
225
221
|
const value = wasm.__wbindgen_export_4.get(idx);
|
|
226
222
|
wasm.__externref_table_dealloc(idx);
|
|
@@ -233,6 +229,27 @@ function _assertClass(instance, klass) {
|
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
|
|
232
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
233
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
234
|
+
for (let i = 0; i < array.length; i++) {
|
|
235
|
+
const add = addToExternrefTable0(array[i]);
|
|
236
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
237
|
+
}
|
|
238
|
+
WASM_VECTOR_LEN = array.length;
|
|
239
|
+
return ptr;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
243
|
+
ptr = ptr >>> 0;
|
|
244
|
+
const mem = getDataViewMemory0();
|
|
245
|
+
const result = [];
|
|
246
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
247
|
+
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
248
|
+
}
|
|
249
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
|
|
236
253
|
let cachedUint32ArrayMemory0 = null;
|
|
237
254
|
|
|
238
255
|
function getUint32ArrayMemory0() {
|
|
@@ -248,6 +265,14 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
248
265
|
WASM_VECTOR_LEN = arg.length;
|
|
249
266
|
return ptr;
|
|
250
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* @returns {Promise<HIDDevice>}
|
|
270
|
+
*/
|
|
271
|
+
exports.searchLedgerDevice = function() {
|
|
272
|
+
const ret = wasm.searchLedgerDevice();
|
|
273
|
+
return ret;
|
|
274
|
+
};
|
|
275
|
+
|
|
251
276
|
/**
|
|
252
277
|
* Convert the given string to a QR code image uri
|
|
253
278
|
*
|
|
@@ -280,56 +305,32 @@ exports.stringToQr = function(str, pixel_per_module) {
|
|
|
280
305
|
}
|
|
281
306
|
};
|
|
282
307
|
|
|
283
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
284
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
285
|
-
for (let i = 0; i < array.length; i++) {
|
|
286
|
-
const add = addToExternrefTable0(array[i]);
|
|
287
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
288
|
-
}
|
|
289
|
-
WASM_VECTOR_LEN = array.length;
|
|
290
|
-
return ptr;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* @returns {Promise<HIDDevice>}
|
|
294
|
-
*/
|
|
295
|
-
exports.searchLedgerDevice = function() {
|
|
296
|
-
const ret = wasm.searchLedgerDevice();
|
|
297
|
-
return ret;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
301
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
302
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
303
|
-
WASM_VECTOR_LEN = arg.length;
|
|
304
|
-
return ptr;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
308
|
function getArrayU32FromWasm0(ptr, len) {
|
|
308
309
|
ptr = ptr >>> 0;
|
|
309
310
|
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
310
311
|
}
|
|
311
|
-
function __wbg_adapter_12(arg0, arg1
|
|
312
|
-
wasm.
|
|
312
|
+
function __wbg_adapter_12(arg0, arg1) {
|
|
313
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h912986096667d3cb(arg0, arg1);
|
|
313
314
|
}
|
|
314
315
|
|
|
315
|
-
function
|
|
316
|
-
wasm.
|
|
316
|
+
function __wbg_adapter_15(arg0, arg1, arg2) {
|
|
317
|
+
wasm.closure1352_externref_shim(arg0, arg1, arg2);
|
|
317
318
|
}
|
|
318
319
|
|
|
319
|
-
function
|
|
320
|
-
wasm.
|
|
320
|
+
function __wbg_adapter_24(arg0, arg1, arg2) {
|
|
321
|
+
wasm.closure1999_externref_shim(arg0, arg1, arg2);
|
|
321
322
|
}
|
|
322
323
|
|
|
323
|
-
function
|
|
324
|
-
wasm.
|
|
324
|
+
function __wbg_adapter_31(arg0, arg1, arg2) {
|
|
325
|
+
wasm.closure804_externref_shim(arg0, arg1, arg2);
|
|
325
326
|
}
|
|
326
327
|
|
|
327
|
-
function
|
|
328
|
-
wasm.
|
|
328
|
+
function __wbg_adapter_34(arg0, arg1) {
|
|
329
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h94f351489121fb87(arg0, arg1);
|
|
329
330
|
}
|
|
330
331
|
|
|
331
|
-
function
|
|
332
|
-
wasm.
|
|
332
|
+
function __wbg_adapter_694(arg0, arg1, arg2, arg3) {
|
|
333
|
+
wasm.closure2782_externref_shim(arg0, arg1, arg2, arg3);
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
/**
|
|
@@ -1168,6 +1169,104 @@ if (Symbol.dispose) AssetAmount.prototype[Symbol.dispose] = AssetAmount.prototyp
|
|
|
1168
1169
|
|
|
1169
1170
|
exports.AssetAmount = AssetAmount;
|
|
1170
1171
|
|
|
1172
|
+
const AssetBlindingFactorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1173
|
+
? { register: () => {}, unregister: () => {} }
|
|
1174
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_assetblindingfactor_free(ptr >>> 0, 1));
|
|
1175
|
+
/**
|
|
1176
|
+
* A blinding factor for asset commitments.
|
|
1177
|
+
*/
|
|
1178
|
+
class AssetBlindingFactor {
|
|
1179
|
+
|
|
1180
|
+
static __wrap(ptr) {
|
|
1181
|
+
ptr = ptr >>> 0;
|
|
1182
|
+
const obj = Object.create(AssetBlindingFactor.prototype);
|
|
1183
|
+
obj.__wbg_ptr = ptr;
|
|
1184
|
+
AssetBlindingFactorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1185
|
+
return obj;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
__destroy_into_raw() {
|
|
1189
|
+
const ptr = this.__wbg_ptr;
|
|
1190
|
+
this.__wbg_ptr = 0;
|
|
1191
|
+
AssetBlindingFactorFinalization.unregister(this);
|
|
1192
|
+
return ptr;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
free() {
|
|
1196
|
+
const ptr = this.__destroy_into_raw();
|
|
1197
|
+
wasm.__wbg_assetblindingfactor_free(ptr, 0);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Creates an `AssetBlindingFactor` from a string.
|
|
1201
|
+
* @param {string} s
|
|
1202
|
+
* @returns {AssetBlindingFactor}
|
|
1203
|
+
*/
|
|
1204
|
+
static fromString(s) {
|
|
1205
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1206
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1207
|
+
const ret = wasm.assetblindingfactor_fromString(ptr0, len0);
|
|
1208
|
+
if (ret[2]) {
|
|
1209
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1210
|
+
}
|
|
1211
|
+
return AssetBlindingFactor.__wrap(ret[0]);
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Creates an `AssetBlindingFactor` from a byte slice.
|
|
1215
|
+
* @param {Uint8Array} bytes
|
|
1216
|
+
* @returns {AssetBlindingFactor}
|
|
1217
|
+
*/
|
|
1218
|
+
static fromBytes(bytes) {
|
|
1219
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1220
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1221
|
+
const ret = wasm.assetblindingfactor_fromBytes(ptr0, len0);
|
|
1222
|
+
if (ret[2]) {
|
|
1223
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1224
|
+
}
|
|
1225
|
+
return AssetBlindingFactor.__wrap(ret[0]);
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Returns a zero asset blinding factor.
|
|
1229
|
+
* @returns {AssetBlindingFactor}
|
|
1230
|
+
*/
|
|
1231
|
+
static zero() {
|
|
1232
|
+
const ret = wasm.assetblindingfactor_zero();
|
|
1233
|
+
return AssetBlindingFactor.__wrap(ret);
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Returns the bytes (32 bytes) in little-endian byte order.
|
|
1237
|
+
*
|
|
1238
|
+
* This is the internal representation used by secp256k1. The byte order is
|
|
1239
|
+
* reversed compared to the hex string representation (which uses big-endian,
|
|
1240
|
+
* following Bitcoin display conventions).
|
|
1241
|
+
* @returns {Uint8Array}
|
|
1242
|
+
*/
|
|
1243
|
+
toBytes() {
|
|
1244
|
+
const ret = wasm.assetblindingfactor_toBytes(this.__wbg_ptr);
|
|
1245
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1246
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1247
|
+
return v1;
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Returns string representation of the ABF
|
|
1251
|
+
* @returns {string}
|
|
1252
|
+
*/
|
|
1253
|
+
toString() {
|
|
1254
|
+
let deferred1_0;
|
|
1255
|
+
let deferred1_1;
|
|
1256
|
+
try {
|
|
1257
|
+
const ret = wasm.assetblindingfactor_toString(this.__wbg_ptr);
|
|
1258
|
+
deferred1_0 = ret[0];
|
|
1259
|
+
deferred1_1 = ret[1];
|
|
1260
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1261
|
+
} finally {
|
|
1262
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
if (Symbol.dispose) AssetBlindingFactor.prototype[Symbol.dispose] = AssetBlindingFactor.prototype.free;
|
|
1267
|
+
|
|
1268
|
+
exports.AssetBlindingFactor = AssetBlindingFactor;
|
|
1269
|
+
|
|
1171
1270
|
const AssetIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1172
1271
|
? { register: () => {}, unregister: () => {} }
|
|
1173
1272
|
: new FinalizationRegistry(ptr => wasm.__wbg_assetid_free(ptr >>> 0, 1));
|
|
@@ -1199,6 +1298,8 @@ class AssetId {
|
|
|
1199
1298
|
}
|
|
1200
1299
|
/**
|
|
1201
1300
|
* Creates an `AssetId`
|
|
1301
|
+
*
|
|
1302
|
+
* Deprecated: use `from_string()` instead
|
|
1202
1303
|
* @param {string} asset_id
|
|
1203
1304
|
*/
|
|
1204
1305
|
constructor(asset_id) {
|
|
@@ -1212,9 +1313,47 @@ class AssetId {
|
|
|
1212
1313
|
AssetIdFinalization.register(this, this.__wbg_ptr, this);
|
|
1213
1314
|
return this;
|
|
1214
1315
|
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Creates an `AssetId` from hex string
|
|
1318
|
+
* @param {string} s
|
|
1319
|
+
* @returns {AssetId}
|
|
1320
|
+
*/
|
|
1321
|
+
static fromString(s) {
|
|
1322
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1323
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1324
|
+
const ret = wasm.assetid_fromString(ptr0, len0);
|
|
1325
|
+
if (ret[2]) {
|
|
1326
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1327
|
+
}
|
|
1328
|
+
return AssetId.__wrap(ret[0]);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Creates an `AssetId` from a bytes.
|
|
1332
|
+
* @param {Uint8Array} bytes
|
|
1333
|
+
* @returns {AssetId}
|
|
1334
|
+
*/
|
|
1335
|
+
static fromBytes(bytes) {
|
|
1336
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1337
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1338
|
+
const ret = wasm.assetid_fromBytes(ptr0, len0);
|
|
1339
|
+
if (ret[2]) {
|
|
1340
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1341
|
+
}
|
|
1342
|
+
return AssetId.__wrap(ret[0]);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Returns the `AssetId` bytes in little-endian byte order.
|
|
1346
|
+
* @returns {Uint8Array}
|
|
1347
|
+
*/
|
|
1348
|
+
toBytes() {
|
|
1349
|
+
const ret = wasm.assetid_toBytes(this.__wbg_ptr);
|
|
1350
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1351
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1352
|
+
return v1;
|
|
1353
|
+
}
|
|
1215
1354
|
/**
|
|
1216
1355
|
* Return the string representation of the asset identifier (64 hex characters).
|
|
1217
|
-
* This representation can be used to recreate the asset identifier via `
|
|
1356
|
+
* This representation can be used to recreate the asset identifier via `fromString()`
|
|
1218
1357
|
* @returns {string}
|
|
1219
1358
|
*/
|
|
1220
1359
|
toString() {
|
|
@@ -2175,6 +2314,49 @@ if (Symbol.dispose) ExchangeRates.prototype[Symbol.dispose] = ExchangeRates.prot
|
|
|
2175
2314
|
|
|
2176
2315
|
exports.ExchangeRates = ExchangeRates;
|
|
2177
2316
|
|
|
2317
|
+
const ExternalUtxoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2318
|
+
? { register: () => {}, unregister: () => {} }
|
|
2319
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_externalutxo_free(ptr >>> 0, 1));
|
|
2320
|
+
/**
|
|
2321
|
+
* An external UTXO, owned by another wallet.
|
|
2322
|
+
*/
|
|
2323
|
+
class ExternalUtxo {
|
|
2324
|
+
|
|
2325
|
+
__destroy_into_raw() {
|
|
2326
|
+
const ptr = this.__wbg_ptr;
|
|
2327
|
+
this.__wbg_ptr = 0;
|
|
2328
|
+
ExternalUtxoFinalization.unregister(this);
|
|
2329
|
+
return ptr;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
free() {
|
|
2333
|
+
const ptr = this.__destroy_into_raw();
|
|
2334
|
+
wasm.__wbg_externalutxo_free(ptr, 0);
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* Construct an ExternalUtxo
|
|
2338
|
+
* @param {number} vout
|
|
2339
|
+
* @param {Transaction} tx
|
|
2340
|
+
* @param {TxOutSecrets} unblinded
|
|
2341
|
+
* @param {number} max_weight_to_satisfy
|
|
2342
|
+
* @param {boolean} is_segwit
|
|
2343
|
+
*/
|
|
2344
|
+
constructor(vout, tx, unblinded, max_weight_to_satisfy, is_segwit) {
|
|
2345
|
+
_assertClass(tx, Transaction);
|
|
2346
|
+
_assertClass(unblinded, TxOutSecrets);
|
|
2347
|
+
const ret = wasm.externalutxo_new(vout, tx.__wbg_ptr, unblinded.__wbg_ptr, max_weight_to_satisfy, is_segwit);
|
|
2348
|
+
if (ret[2]) {
|
|
2349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2350
|
+
}
|
|
2351
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2352
|
+
ExternalUtxoFinalization.register(this, this.__wbg_ptr, this);
|
|
2353
|
+
return this;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
if (Symbol.dispose) ExternalUtxo.prototype[Symbol.dispose] = ExternalUtxo.prototype.free;
|
|
2357
|
+
|
|
2358
|
+
exports.ExternalUtxo = ExternalUtxo;
|
|
2359
|
+
|
|
2178
2360
|
const InvoiceResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2179
2361
|
? { register: () => {}, unregister: () => {} }
|
|
2180
2362
|
: new FinalizationRegistry(ptr => wasm.__wbg_invoiceresponse_free(ptr >>> 0, 1));
|
|
@@ -2672,6 +2854,122 @@ if (Symbol.dispose) JadeWebSocket.prototype[Symbol.dispose] = JadeWebSocket.prot
|
|
|
2672
2854
|
|
|
2673
2855
|
exports.JadeWebSocket = JadeWebSocket;
|
|
2674
2856
|
|
|
2857
|
+
const JsStoreLinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2858
|
+
? { register: () => {}, unregister: () => {} }
|
|
2859
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsstorelink_free(ptr >>> 0, 1));
|
|
2860
|
+
/**
|
|
2861
|
+
* A bridge that connects a [`JsStorage`] to [`lwk_common::Store`].
|
|
2862
|
+
*/
|
|
2863
|
+
class JsStoreLink {
|
|
2864
|
+
|
|
2865
|
+
__destroy_into_raw() {
|
|
2866
|
+
const ptr = this.__wbg_ptr;
|
|
2867
|
+
this.__wbg_ptr = 0;
|
|
2868
|
+
JsStoreLinkFinalization.unregister(this);
|
|
2869
|
+
return ptr;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
free() {
|
|
2873
|
+
const ptr = this.__destroy_into_raw();
|
|
2874
|
+
wasm.__wbg_jsstorelink_free(ptr, 0);
|
|
2875
|
+
}
|
|
2876
|
+
/**
|
|
2877
|
+
* Create a new `JsStoreLink` from a JavaScript storage object.
|
|
2878
|
+
*
|
|
2879
|
+
* The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
|
|
2880
|
+
* @param {any} storage
|
|
2881
|
+
*/
|
|
2882
|
+
constructor(storage) {
|
|
2883
|
+
const ret = wasm.jsstorelink_new(storage);
|
|
2884
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2885
|
+
JsStoreLinkFinalization.register(this, this.__wbg_ptr, this);
|
|
2886
|
+
return this;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
if (Symbol.dispose) JsStoreLink.prototype[Symbol.dispose] = JsStoreLink.prototype.free;
|
|
2890
|
+
|
|
2891
|
+
exports.JsStoreLink = JsStoreLink;
|
|
2892
|
+
|
|
2893
|
+
const JsTestStoreFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2894
|
+
? { register: () => {}, unregister: () => {} }
|
|
2895
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsteststore_free(ptr >>> 0, 1));
|
|
2896
|
+
/**
|
|
2897
|
+
* Test helper to verify Rust can read/write through a JS store.
|
|
2898
|
+
*/
|
|
2899
|
+
class JsTestStore {
|
|
2900
|
+
|
|
2901
|
+
__destroy_into_raw() {
|
|
2902
|
+
const ptr = this.__wbg_ptr;
|
|
2903
|
+
this.__wbg_ptr = 0;
|
|
2904
|
+
JsTestStoreFinalization.unregister(this);
|
|
2905
|
+
return ptr;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
free() {
|
|
2909
|
+
const ptr = this.__destroy_into_raw();
|
|
2910
|
+
wasm.__wbg_jsteststore_free(ptr, 0);
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* Create a new test helper wrapping the given JS storage.
|
|
2914
|
+
* @param {any} storage
|
|
2915
|
+
*/
|
|
2916
|
+
constructor(storage) {
|
|
2917
|
+
const ret = wasm.jsteststore_new(storage);
|
|
2918
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2919
|
+
JsTestStoreFinalization.register(this, this.__wbg_ptr, this);
|
|
2920
|
+
return this;
|
|
2921
|
+
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Write a key-value pair to the store.
|
|
2924
|
+
* @param {string} key
|
|
2925
|
+
* @param {Uint8Array} value
|
|
2926
|
+
*/
|
|
2927
|
+
write(key, value) {
|
|
2928
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2929
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2930
|
+
const ptr1 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
|
|
2931
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2932
|
+
const ret = wasm.jsteststore_write(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2933
|
+
if (ret[1]) {
|
|
2934
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2938
|
+
* Read a value from the store.
|
|
2939
|
+
* @param {string} key
|
|
2940
|
+
* @returns {Uint8Array | undefined}
|
|
2941
|
+
*/
|
|
2942
|
+
read(key) {
|
|
2943
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2944
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2945
|
+
const ret = wasm.jsteststore_read(this.__wbg_ptr, ptr0, len0);
|
|
2946
|
+
if (ret[3]) {
|
|
2947
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2948
|
+
}
|
|
2949
|
+
let v2;
|
|
2950
|
+
if (ret[0] !== 0) {
|
|
2951
|
+
v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2952
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2953
|
+
}
|
|
2954
|
+
return v2;
|
|
2955
|
+
}
|
|
2956
|
+
/**
|
|
2957
|
+
* Remove a key from the store.
|
|
2958
|
+
* @param {string} key
|
|
2959
|
+
*/
|
|
2960
|
+
remove(key) {
|
|
2961
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2962
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2963
|
+
const ret = wasm.jsteststore_remove(this.__wbg_ptr, ptr0, len0);
|
|
2964
|
+
if (ret[1]) {
|
|
2965
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
if (Symbol.dispose) JsTestStore.prototype[Symbol.dispose] = JsTestStore.prototype.free;
|
|
2970
|
+
|
|
2971
|
+
exports.JsTestStore = JsTestStore;
|
|
2972
|
+
|
|
2675
2973
|
const LastUsedIndexResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2676
2974
|
? { register: () => {}, unregister: () => {} }
|
|
2677
2975
|
: new FinalizationRegistry(ptr => wasm.__wbg_lastusedindexresponse_free(ptr >>> 0, 1));
|
|
@@ -3191,6 +3489,22 @@ class Network {
|
|
|
3191
3489
|
const ret = wasm.network_policyAsset(this.__wbg_ptr);
|
|
3192
3490
|
return AssetId.__wrap(ret);
|
|
3193
3491
|
}
|
|
3492
|
+
/**
|
|
3493
|
+
* Return the genesis block hash for this network as hex string.
|
|
3494
|
+
* @returns {string}
|
|
3495
|
+
*/
|
|
3496
|
+
genesisBlockHash() {
|
|
3497
|
+
let deferred1_0;
|
|
3498
|
+
let deferred1_1;
|
|
3499
|
+
try {
|
|
3500
|
+
const ret = wasm.network_genesisBlockHash(this.__wbg_ptr);
|
|
3501
|
+
deferred1_0 = ret[0];
|
|
3502
|
+
deferred1_1 = ret[1];
|
|
3503
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3504
|
+
} finally {
|
|
3505
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3194
3508
|
/**
|
|
3195
3509
|
* Return the transaction builder for this network
|
|
3196
3510
|
* @returns {TxBuilder}
|
|
@@ -3296,7 +3610,7 @@ class OutPoint {
|
|
|
3296
3610
|
wasm.__wbg_outpoint_free(ptr, 0);
|
|
3297
3611
|
}
|
|
3298
3612
|
/**
|
|
3299
|
-
* Creates an `OutPoint`
|
|
3613
|
+
* Creates an `OutPoint` from a string representation.
|
|
3300
3614
|
* @param {string} s
|
|
3301
3615
|
*/
|
|
3302
3616
|
constructor(s) {
|
|
@@ -3310,6 +3624,17 @@ class OutPoint {
|
|
|
3310
3624
|
OutPointFinalization.register(this, this.__wbg_ptr, this);
|
|
3311
3625
|
return this;
|
|
3312
3626
|
}
|
|
3627
|
+
/**
|
|
3628
|
+
* Creates an `OutPoint` from a transaction ID and output index.
|
|
3629
|
+
* @param {Txid} txid
|
|
3630
|
+
* @param {number} vout
|
|
3631
|
+
* @returns {OutPoint}
|
|
3632
|
+
*/
|
|
3633
|
+
static fromParts(txid, vout) {
|
|
3634
|
+
_assertClass(txid, Txid);
|
|
3635
|
+
const ret = wasm.outpoint_fromParts(txid.__wbg_ptr, vout);
|
|
3636
|
+
return OutPoint.__wrap(ret);
|
|
3637
|
+
}
|
|
3313
3638
|
/**
|
|
3314
3639
|
* Return the transaction identifier.
|
|
3315
3640
|
* @returns {Txid}
|
|
@@ -3810,6 +4135,19 @@ class Pset {
|
|
|
3810
4135
|
}
|
|
3811
4136
|
return Transaction.__wrap(ret[0]);
|
|
3812
4137
|
}
|
|
4138
|
+
/**
|
|
4139
|
+
* Get the unique id of the PSET as defined by [BIP-370](https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki#unique-identification)
|
|
4140
|
+
*
|
|
4141
|
+
* The unique id is the txid of the PSET with sequence numbers of inputs set to 0
|
|
4142
|
+
* @returns {Txid}
|
|
4143
|
+
*/
|
|
4144
|
+
uniqueId() {
|
|
4145
|
+
const ret = wasm.pset_uniqueId(this.__wbg_ptr);
|
|
4146
|
+
if (ret[2]) {
|
|
4147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4148
|
+
}
|
|
4149
|
+
return Txid.__wrap(ret[0]);
|
|
4150
|
+
}
|
|
3813
4151
|
/**
|
|
3814
4152
|
* Attempt to merge with another `Pset`.
|
|
3815
4153
|
* @param {Pset} other
|
|
@@ -4035,6 +4373,22 @@ class PsetInput {
|
|
|
4035
4373
|
const ret = wasm.psetinput_previousVout(this.__wbg_ptr);
|
|
4036
4374
|
return ret >>> 0;
|
|
4037
4375
|
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Prevout scriptpubkey of the input
|
|
4378
|
+
* @returns {Script | undefined}
|
|
4379
|
+
*/
|
|
4380
|
+
previousScriptPubkey() {
|
|
4381
|
+
const ret = wasm.psetinput_previousScriptPubkey(this.__wbg_ptr);
|
|
4382
|
+
return ret === 0 ? undefined : Script.__wrap(ret);
|
|
4383
|
+
}
|
|
4384
|
+
/**
|
|
4385
|
+
* Redeem script of the input
|
|
4386
|
+
* @returns {Script | undefined}
|
|
4387
|
+
*/
|
|
4388
|
+
redeemScript() {
|
|
4389
|
+
const ret = wasm.psetinput_redeemScript(this.__wbg_ptr);
|
|
4390
|
+
return ret === 0 ? undefined : Script.__wrap(ret);
|
|
4391
|
+
}
|
|
4038
4392
|
/**
|
|
4039
4393
|
* If the input has an issuance, the asset id
|
|
4040
4394
|
* @returns {AssetId | undefined}
|
|
@@ -4051,6 +4405,36 @@ class PsetInput {
|
|
|
4051
4405
|
const ret = wasm.psetinput_issuanceToken(this.__wbg_ptr);
|
|
4052
4406
|
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
4053
4407
|
}
|
|
4408
|
+
/**
|
|
4409
|
+
* If the input has a (re)issuance, the issuance object
|
|
4410
|
+
* @returns {Issuance | undefined}
|
|
4411
|
+
*/
|
|
4412
|
+
issuance() {
|
|
4413
|
+
const ret = wasm.psetinput_issuance(this.__wbg_ptr);
|
|
4414
|
+
return ret === 0 ? undefined : Issuance.__wrap(ret);
|
|
4415
|
+
}
|
|
4416
|
+
/**
|
|
4417
|
+
* Input sighash
|
|
4418
|
+
* @returns {number}
|
|
4419
|
+
*/
|
|
4420
|
+
sighash() {
|
|
4421
|
+
const ret = wasm.psetinput_sighash(this.__wbg_ptr);
|
|
4422
|
+
return ret >>> 0;
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* If the input has an issuance, returns [asset_id, token_id].
|
|
4426
|
+
* Returns undefined if the input has no issuance.
|
|
4427
|
+
* @returns {AssetId[] | undefined}
|
|
4428
|
+
*/
|
|
4429
|
+
issuanceIds() {
|
|
4430
|
+
const ret = wasm.psetinput_issuanceIds(this.__wbg_ptr);
|
|
4431
|
+
let v1;
|
|
4432
|
+
if (ret[0] !== 0) {
|
|
4433
|
+
v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
4434
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4435
|
+
}
|
|
4436
|
+
return v1;
|
|
4437
|
+
}
|
|
4054
4438
|
}
|
|
4055
4439
|
if (Symbol.dispose) PsetInput.prototype[Symbol.dispose] = PsetInput.prototype.free;
|
|
4056
4440
|
|
|
@@ -4084,12 +4468,37 @@ class PsetOutput {
|
|
|
4084
4468
|
wasm.__wbg_psetoutput_free(ptr, 0);
|
|
4085
4469
|
}
|
|
4086
4470
|
/**
|
|
4471
|
+
* Get the script pubkey
|
|
4087
4472
|
* @returns {Script}
|
|
4088
4473
|
*/
|
|
4089
4474
|
scriptPubkey() {
|
|
4090
4475
|
const ret = wasm.psetoutput_scriptPubkey(this.__wbg_ptr);
|
|
4091
4476
|
return Script.__wrap(ret);
|
|
4092
4477
|
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Get the explicit amount, if set
|
|
4480
|
+
* @returns {bigint | undefined}
|
|
4481
|
+
*/
|
|
4482
|
+
amount() {
|
|
4483
|
+
const ret = wasm.psetoutput_amount(this.__wbg_ptr);
|
|
4484
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
4485
|
+
}
|
|
4486
|
+
/**
|
|
4487
|
+
* Get the explicit asset ID, if set
|
|
4488
|
+
* @returns {AssetId | undefined}
|
|
4489
|
+
*/
|
|
4490
|
+
asset() {
|
|
4491
|
+
const ret = wasm.psetoutput_asset(this.__wbg_ptr);
|
|
4492
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
4493
|
+
}
|
|
4494
|
+
/**
|
|
4495
|
+
* Get the blinder index, if set
|
|
4496
|
+
* @returns {number | undefined}
|
|
4497
|
+
*/
|
|
4498
|
+
blinderIndex() {
|
|
4499
|
+
const ret = wasm.psetoutput_blinderIndex(this.__wbg_ptr);
|
|
4500
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
4501
|
+
}
|
|
4093
4502
|
}
|
|
4094
4503
|
if (Symbol.dispose) PsetOutput.prototype[Symbol.dispose] = PsetOutput.prototype.free;
|
|
4095
4504
|
|
|
@@ -4517,6 +4926,14 @@ class Script {
|
|
|
4517
4926
|
ScriptFinalization.register(this, this.__wbg_ptr, this);
|
|
4518
4927
|
return this;
|
|
4519
4928
|
}
|
|
4929
|
+
/**
|
|
4930
|
+
* Creates an empty `Script`.
|
|
4931
|
+
* @returns {Script}
|
|
4932
|
+
*/
|
|
4933
|
+
static empty() {
|
|
4934
|
+
const ret = wasm.script_empty();
|
|
4935
|
+
return Script.__wrap(ret);
|
|
4936
|
+
}
|
|
4520
4937
|
/**
|
|
4521
4938
|
* Return the consensus encoded bytes of the script.
|
|
4522
4939
|
* @returns {Uint8Array}
|
|
@@ -4527,6 +4944,24 @@ class Script {
|
|
|
4527
4944
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
4528
4945
|
return v1;
|
|
4529
4946
|
}
|
|
4947
|
+
/**
|
|
4948
|
+
* Returns SHA256 of the script's consensus bytes.
|
|
4949
|
+
*
|
|
4950
|
+
* Returns an equivalent value to the `jet::input_script_hash(index)`/`jet::output_script_hash(index)`.
|
|
4951
|
+
* @returns {string}
|
|
4952
|
+
*/
|
|
4953
|
+
jet_sha256_hex() {
|
|
4954
|
+
let deferred1_0;
|
|
4955
|
+
let deferred1_1;
|
|
4956
|
+
try {
|
|
4957
|
+
const ret = wasm.script_jet_sha256_hex(this.__wbg_ptr);
|
|
4958
|
+
deferred1_0 = ret[0];
|
|
4959
|
+
deferred1_1 = ret[1];
|
|
4960
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4961
|
+
} finally {
|
|
4962
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4530
4965
|
/**
|
|
4531
4966
|
* Return the string of the script showing op codes and their arguments.
|
|
4532
4967
|
*
|
|
@@ -4545,6 +4980,45 @@ class Script {
|
|
|
4545
4980
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4546
4981
|
}
|
|
4547
4982
|
}
|
|
4983
|
+
/**
|
|
4984
|
+
* Creates an OP_RETURN script with the given data.
|
|
4985
|
+
* @param {Uint8Array} data
|
|
4986
|
+
* @returns {Script}
|
|
4987
|
+
*/
|
|
4988
|
+
static newOpReturn(data) {
|
|
4989
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
4990
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4991
|
+
const ret = wasm.script_newOpReturn(ptr0, len0);
|
|
4992
|
+
return Script.__wrap(ret);
|
|
4993
|
+
}
|
|
4994
|
+
/**
|
|
4995
|
+
* Returns true if the script is provably unspendable.
|
|
4996
|
+
*
|
|
4997
|
+
* A script is provably unspendable if it starts with OP_RETURN or is larger
|
|
4998
|
+
* than the maximum script size.
|
|
4999
|
+
* @returns {boolean}
|
|
5000
|
+
*/
|
|
5001
|
+
isProvablyUnspendable() {
|
|
5002
|
+
const ret = wasm.script_isProvablyUnspendable(this.__wbg_ptr);
|
|
5003
|
+
return ret !== 0;
|
|
5004
|
+
}
|
|
5005
|
+
/**
|
|
5006
|
+
* Returns true if this script_pubkey is provably SegWit.
|
|
5007
|
+
*
|
|
5008
|
+
* This checks if the script_pubkey is provably SegWit based on the
|
|
5009
|
+
* script_pubkey itself and an optional redeem_script.
|
|
5010
|
+
* @param {Script | null} [redeem_script]
|
|
5011
|
+
* @returns {boolean}
|
|
5012
|
+
*/
|
|
5013
|
+
isProvablySegwit(redeem_script) {
|
|
5014
|
+
let ptr0 = 0;
|
|
5015
|
+
if (!isLikeNone(redeem_script)) {
|
|
5016
|
+
_assertClass(redeem_script, Script);
|
|
5017
|
+
ptr0 = redeem_script.__destroy_into_raw();
|
|
5018
|
+
}
|
|
5019
|
+
const ret = wasm.script_isProvablySegwit(this.__wbg_ptr, ptr0);
|
|
5020
|
+
return ret !== 0;
|
|
5021
|
+
}
|
|
4548
5022
|
/**
|
|
4549
5023
|
* Return the string representation of the script (hex encoding of its consensus encoded bytes).
|
|
4550
5024
|
* This representation can be used to recreate the script via `new()`
|
|
@@ -4930,6 +5404,8 @@ class Transaction {
|
|
|
4930
5404
|
}
|
|
4931
5405
|
/**
|
|
4932
5406
|
* Creates a `Transaction`
|
|
5407
|
+
*
|
|
5408
|
+
* Deprecated: use `fromString()` instead.
|
|
4933
5409
|
* @param {string} tx_hex
|
|
4934
5410
|
*/
|
|
4935
5411
|
constructor(tx_hex) {
|
|
@@ -4943,6 +5419,34 @@ class Transaction {
|
|
|
4943
5419
|
TransactionFinalization.register(this, this.__wbg_ptr, this);
|
|
4944
5420
|
return this;
|
|
4945
5421
|
}
|
|
5422
|
+
/**
|
|
5423
|
+
* Creates a `Transaction` from hex-encoded consensus bytes.
|
|
5424
|
+
* @param {string} s
|
|
5425
|
+
* @returns {Transaction}
|
|
5426
|
+
*/
|
|
5427
|
+
static fromString(s) {
|
|
5428
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5429
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5430
|
+
const ret = wasm.transaction_fromString(ptr0, len0);
|
|
5431
|
+
if (ret[2]) {
|
|
5432
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5433
|
+
}
|
|
5434
|
+
return Transaction.__wrap(ret[0]);
|
|
5435
|
+
}
|
|
5436
|
+
/**
|
|
5437
|
+
* Creates a `Transaction` from consensus-encoded bytes.
|
|
5438
|
+
* @param {Uint8Array} bytes
|
|
5439
|
+
* @returns {Transaction}
|
|
5440
|
+
*/
|
|
5441
|
+
static fromBytes(bytes) {
|
|
5442
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
5443
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5444
|
+
const ret = wasm.transaction_fromBytes(ptr0, len0);
|
|
5445
|
+
if (ret[2]) {
|
|
5446
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5447
|
+
}
|
|
5448
|
+
return Transaction.__wrap(ret[0]);
|
|
5449
|
+
}
|
|
4946
5450
|
/**
|
|
4947
5451
|
* Return the transaction identifier.
|
|
4948
5452
|
* @returns {Txid}
|
|
@@ -4955,6 +5459,18 @@ class Transaction {
|
|
|
4955
5459
|
* Return the consensus encoded bytes of the transaction.
|
|
4956
5460
|
* @returns {Uint8Array}
|
|
4957
5461
|
*/
|
|
5462
|
+
toBytes() {
|
|
5463
|
+
const ret = wasm.transaction_toBytes(this.__wbg_ptr);
|
|
5464
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
5465
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
5466
|
+
return v1;
|
|
5467
|
+
}
|
|
5468
|
+
/**
|
|
5469
|
+
* Return the consensus encoded bytes of the transaction.
|
|
5470
|
+
*
|
|
5471
|
+
* Deprecated: use `toBytes()` instead.
|
|
5472
|
+
* @returns {Uint8Array}
|
|
5473
|
+
*/
|
|
4958
5474
|
bytes() {
|
|
4959
5475
|
const ret = wasm.transaction_bytes(this.__wbg_ptr);
|
|
4960
5476
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
@@ -5026,7 +5542,7 @@ class TxBuilder {
|
|
|
5026
5542
|
*/
|
|
5027
5543
|
constructor(network) {
|
|
5028
5544
|
_assertClass(network, Network);
|
|
5029
|
-
const ret = wasm.
|
|
5545
|
+
const ret = wasm.network_txBuilder(network.__wbg_ptr);
|
|
5030
5546
|
this.__wbg_ptr = ret >>> 0;
|
|
5031
5547
|
TxBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
5032
5548
|
return this;
|
|
@@ -5355,6 +5871,19 @@ class TxOutSecrets {
|
|
|
5355
5871
|
const ptr = this.__destroy_into_raw();
|
|
5356
5872
|
wasm.__wbg_txoutsecrets_free(ptr, 0);
|
|
5357
5873
|
}
|
|
5874
|
+
/**
|
|
5875
|
+
* Creates a new `TxOutSecrets` for an explicit (unblinded) output.
|
|
5876
|
+
*
|
|
5877
|
+
* The blinding factors are set to zero.
|
|
5878
|
+
* @param {AssetId} asset_id
|
|
5879
|
+
* @param {bigint} value
|
|
5880
|
+
* @returns {TxOutSecrets}
|
|
5881
|
+
*/
|
|
5882
|
+
static fromExplicit(asset_id, value) {
|
|
5883
|
+
_assertClass(asset_id, AssetId);
|
|
5884
|
+
const ret = wasm.txoutsecrets_fromExplicit(asset_id.__wbg_ptr, value);
|
|
5885
|
+
return TxOutSecrets.__wrap(ret);
|
|
5886
|
+
}
|
|
5358
5887
|
/**
|
|
5359
5888
|
* Return the asset of the output.
|
|
5360
5889
|
* @returns {AssetId}
|
|
@@ -5364,20 +5893,12 @@ class TxOutSecrets {
|
|
|
5364
5893
|
return AssetId.__wrap(ret);
|
|
5365
5894
|
}
|
|
5366
5895
|
/**
|
|
5367
|
-
* Return the asset blinding factor as a
|
|
5368
|
-
* @returns {
|
|
5896
|
+
* Return the asset blinding factor as a typed object.
|
|
5897
|
+
* @returns {AssetBlindingFactor}
|
|
5369
5898
|
*/
|
|
5370
5899
|
assetBlindingFactor() {
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
try {
|
|
5374
|
-
const ret = wasm.txoutsecrets_assetBlindingFactor(this.__wbg_ptr);
|
|
5375
|
-
deferred1_0 = ret[0];
|
|
5376
|
-
deferred1_1 = ret[1];
|
|
5377
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
5378
|
-
} finally {
|
|
5379
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
5380
|
-
}
|
|
5900
|
+
const ret = wasm.txoutsecrets_assetBlindingFactor(this.__wbg_ptr);
|
|
5901
|
+
return AssetBlindingFactor.__wrap(ret);
|
|
5381
5902
|
}
|
|
5382
5903
|
/**
|
|
5383
5904
|
* Return the value of the output.
|
|
@@ -5388,20 +5909,12 @@ class TxOutSecrets {
|
|
|
5388
5909
|
return BigInt.asUintN(64, ret);
|
|
5389
5910
|
}
|
|
5390
5911
|
/**
|
|
5391
|
-
* Return the value blinding factor as a
|
|
5392
|
-
* @returns {
|
|
5912
|
+
* Return the value blinding factor as a typed object.
|
|
5913
|
+
* @returns {ValueBlindingFactor}
|
|
5393
5914
|
*/
|
|
5394
5915
|
valueBlindingFactor() {
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
try {
|
|
5398
|
-
const ret = wasm.txoutsecrets_valueBlindingFactor(this.__wbg_ptr);
|
|
5399
|
-
deferred1_0 = ret[0];
|
|
5400
|
-
deferred1_1 = ret[1];
|
|
5401
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
5402
|
-
} finally {
|
|
5403
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
5404
|
-
}
|
|
5916
|
+
const ret = wasm.txoutsecrets_valueBlindingFactor(this.__wbg_ptr);
|
|
5917
|
+
return ValueBlindingFactor.__wrap(ret);
|
|
5405
5918
|
}
|
|
5406
5919
|
/**
|
|
5407
5920
|
* Return true if the output is explicit (no blinding factors).
|
|
@@ -5814,6 +6327,104 @@ if (Symbol.dispose) ValidatedLiquidexProposal.prototype[Symbol.dispose] = Valida
|
|
|
5814
6327
|
|
|
5815
6328
|
exports.ValidatedLiquidexProposal = ValidatedLiquidexProposal;
|
|
5816
6329
|
|
|
6330
|
+
const ValueBlindingFactorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6331
|
+
? { register: () => {}, unregister: () => {} }
|
|
6332
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_valueblindingfactor_free(ptr >>> 0, 1));
|
|
6333
|
+
/**
|
|
6334
|
+
* A blinding factor for value commitments.
|
|
6335
|
+
*/
|
|
6336
|
+
class ValueBlindingFactor {
|
|
6337
|
+
|
|
6338
|
+
static __wrap(ptr) {
|
|
6339
|
+
ptr = ptr >>> 0;
|
|
6340
|
+
const obj = Object.create(ValueBlindingFactor.prototype);
|
|
6341
|
+
obj.__wbg_ptr = ptr;
|
|
6342
|
+
ValueBlindingFactorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
6343
|
+
return obj;
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6346
|
+
__destroy_into_raw() {
|
|
6347
|
+
const ptr = this.__wbg_ptr;
|
|
6348
|
+
this.__wbg_ptr = 0;
|
|
6349
|
+
ValueBlindingFactorFinalization.unregister(this);
|
|
6350
|
+
return ptr;
|
|
6351
|
+
}
|
|
6352
|
+
|
|
6353
|
+
free() {
|
|
6354
|
+
const ptr = this.__destroy_into_raw();
|
|
6355
|
+
wasm.__wbg_valueblindingfactor_free(ptr, 0);
|
|
6356
|
+
}
|
|
6357
|
+
/**
|
|
6358
|
+
* Creates a `ValueBlindingFactor` from a string.
|
|
6359
|
+
* @param {string} s
|
|
6360
|
+
* @returns {ValueBlindingFactor}
|
|
6361
|
+
*/
|
|
6362
|
+
static fromString(s) {
|
|
6363
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
6364
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6365
|
+
const ret = wasm.valueblindingfactor_fromString(ptr0, len0);
|
|
6366
|
+
if (ret[2]) {
|
|
6367
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
6368
|
+
}
|
|
6369
|
+
return ValueBlindingFactor.__wrap(ret[0]);
|
|
6370
|
+
}
|
|
6371
|
+
/**
|
|
6372
|
+
* Creates a `ValueBlindingFactor` from a byte slice.
|
|
6373
|
+
* @param {Uint8Array} bytes
|
|
6374
|
+
* @returns {ValueBlindingFactor}
|
|
6375
|
+
*/
|
|
6376
|
+
static fromBytes(bytes) {
|
|
6377
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
6378
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6379
|
+
const ret = wasm.valueblindingfactor_fromBytes(ptr0, len0);
|
|
6380
|
+
if (ret[2]) {
|
|
6381
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
6382
|
+
}
|
|
6383
|
+
return ValueBlindingFactor.__wrap(ret[0]);
|
|
6384
|
+
}
|
|
6385
|
+
/**
|
|
6386
|
+
* Returns a zero value blinding factor.
|
|
6387
|
+
* @returns {ValueBlindingFactor}
|
|
6388
|
+
*/
|
|
6389
|
+
static zero() {
|
|
6390
|
+
const ret = wasm.valueblindingfactor_zero();
|
|
6391
|
+
return ValueBlindingFactor.__wrap(ret);
|
|
6392
|
+
}
|
|
6393
|
+
/**
|
|
6394
|
+
* Returns the bytes (32 bytes) in little-endian byte order.
|
|
6395
|
+
*
|
|
6396
|
+
* This is the internal representation used by secp256k1. The byte order is
|
|
6397
|
+
* reversed compared to the hex string representation (which uses big-endian,
|
|
6398
|
+
* following Bitcoin display conventions).
|
|
6399
|
+
* @returns {Uint8Array}
|
|
6400
|
+
*/
|
|
6401
|
+
toBytes() {
|
|
6402
|
+
const ret = wasm.valueblindingfactor_toBytes(this.__wbg_ptr);
|
|
6403
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
6404
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
6405
|
+
return v1;
|
|
6406
|
+
}
|
|
6407
|
+
/**
|
|
6408
|
+
* Returns string representation of the VBF
|
|
6409
|
+
* @returns {string}
|
|
6410
|
+
*/
|
|
6411
|
+
toString() {
|
|
6412
|
+
let deferred1_0;
|
|
6413
|
+
let deferred1_1;
|
|
6414
|
+
try {
|
|
6415
|
+
const ret = wasm.valueblindingfactor_toString(this.__wbg_ptr);
|
|
6416
|
+
deferred1_0 = ret[0];
|
|
6417
|
+
deferred1_1 = ret[1];
|
|
6418
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
6419
|
+
} finally {
|
|
6420
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
if (Symbol.dispose) ValueBlindingFactor.prototype[Symbol.dispose] = ValueBlindingFactor.prototype.free;
|
|
6425
|
+
|
|
6426
|
+
exports.ValueBlindingFactor = ValueBlindingFactor;
|
|
6427
|
+
|
|
5817
6428
|
const WalletTxFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5818
6429
|
? { register: () => {}, unregister: () => {} }
|
|
5819
6430
|
: new FinalizationRegistry(ptr => wasm.__wbg_wallettx_free(ptr >>> 0, 1));
|
|
@@ -6590,6 +7201,11 @@ exports.__wbg_arrayBuffer_9c99b8e2809e8cbb = function() { return handleError(fun
|
|
|
6590
7201
|
return ret;
|
|
6591
7202
|
}, arguments) };
|
|
6592
7203
|
|
|
7204
|
+
exports.__wbg_assetid_new = function(arg0) {
|
|
7205
|
+
const ret = AssetId.__wrap(arg0);
|
|
7206
|
+
return ret;
|
|
7207
|
+
};
|
|
7208
|
+
|
|
6593
7209
|
exports.__wbg_assetmeta_new = function(arg0) {
|
|
6594
7210
|
const ret = AssetMeta.__wrap(arg0);
|
|
6595
7211
|
return ret;
|
|
@@ -6717,6 +7333,14 @@ exports.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
|
|
|
6717
7333
|
return ret;
|
|
6718
7334
|
};
|
|
6719
7335
|
|
|
7336
|
+
exports.__wbg_get_39bedfef9433a446 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
7337
|
+
const ret = arg1.get(getStringFromWasm0(arg2, arg3));
|
|
7338
|
+
var ptr1 = isLikeNone(ret) ? 0 : passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
7339
|
+
var len1 = WASM_VECTOR_LEN;
|
|
7340
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
7341
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
7342
|
+
}, arguments) };
|
|
7343
|
+
|
|
6720
7344
|
exports.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
|
|
6721
7345
|
const ret = Reflect.get(arg0, arg1);
|
|
6722
7346
|
return ret;
|
|
@@ -6848,7 +7472,7 @@ exports.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
|
|
|
6848
7472
|
return ret;
|
|
6849
7473
|
};
|
|
6850
7474
|
|
|
6851
|
-
exports.
|
|
7475
|
+
exports.__wbg_log_56ce8a47744d4384 = function(arg0, arg1) {
|
|
6852
7476
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
6853
7477
|
};
|
|
6854
7478
|
|
|
@@ -6884,7 +7508,7 @@ exports.__wbg_new_2e3c58a15f39f5f9 = function(arg0, arg1) {
|
|
|
6884
7508
|
const a = state0.a;
|
|
6885
7509
|
state0.a = 0;
|
|
6886
7510
|
try {
|
|
6887
|
-
return
|
|
7511
|
+
return __wbg_adapter_694(a, state0.b, arg0, arg1);
|
|
6888
7512
|
} finally {
|
|
6889
7513
|
state0.a = a;
|
|
6890
7514
|
}
|
|
@@ -7055,6 +7679,10 @@ exports.__wbg_push_330b2eb93e4e1212 = function(arg0, arg1) {
|
|
|
7055
7679
|
return ret;
|
|
7056
7680
|
};
|
|
7057
7681
|
|
|
7682
|
+
exports.__wbg_put_fe176894adb408a3 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
7683
|
+
arg0.put(getStringFromWasm0(arg1, arg2), getArrayU8FromWasm0(arg3, arg4));
|
|
7684
|
+
}, arguments) };
|
|
7685
|
+
|
|
7058
7686
|
exports.__wbg_queueMicrotask_25d0739ac89e8c88 = function(arg0) {
|
|
7059
7687
|
queueMicrotask(arg0);
|
|
7060
7688
|
};
|
|
@@ -7101,6 +7729,10 @@ exports.__wbg_registry_new = function(arg0) {
|
|
|
7101
7729
|
return ret;
|
|
7102
7730
|
};
|
|
7103
7731
|
|
|
7732
|
+
exports.__wbg_remove_730839cfb0946c97 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
7733
|
+
arg0.remove(getStringFromWasm0(arg1, arg2));
|
|
7734
|
+
}, arguments) };
|
|
7735
|
+
|
|
7104
7736
|
exports.__wbg_requestDevice_225891d9a80a7b19 = function(arg0, arg1) {
|
|
7105
7737
|
const ret = arg0.requestDevice(arg1);
|
|
7106
7738
|
return ret;
|
|
@@ -7434,15 +8066,9 @@ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
|
7434
8066
|
return ret;
|
|
7435
8067
|
};
|
|
7436
8068
|
|
|
7437
|
-
exports.
|
|
7438
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7439
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7440
|
-
return ret;
|
|
7441
|
-
};
|
|
7442
|
-
|
|
7443
|
-
exports.__wbindgen_cast_29502e455aa89f54 = function(arg0, arg1) {
|
|
7444
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 1470, function: Function { arguments: [], shim_idx: 1471, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7445
|
-
const ret = makeMutClosure(arg0, arg1, 1470, __wbg_adapter_19);
|
|
8069
|
+
exports.__wbindgen_cast_257f3a138b297868 = function(arg0, arg1) {
|
|
8070
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1351, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1352, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8071
|
+
const ret = makeMutClosure(arg0, arg1, 1351, __wbg_adapter_15);
|
|
7446
8072
|
return ret;
|
|
7447
8073
|
};
|
|
7448
8074
|
|
|
@@ -7452,21 +8078,15 @@ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
|
7452
8078
|
return ret;
|
|
7453
8079
|
};
|
|
7454
8080
|
|
|
7455
|
-
exports.
|
|
7456
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7457
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7458
|
-
return ret;
|
|
7459
|
-
};
|
|
7460
|
-
|
|
7461
|
-
exports.__wbindgen_cast_8498ce9f6d02ec68 = function(arg0, arg1) {
|
|
7462
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 1952, function: Function { arguments: [Externref], shim_idx: 1963, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7463
|
-
const ret = makeMutClosure(arg0, arg1, 1952, __wbg_adapter_25);
|
|
8081
|
+
exports.__wbindgen_cast_502ef75e0c858dae = function(arg0, arg1) {
|
|
8082
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1988, function: Function { arguments: [Externref], shim_idx: 1999, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8083
|
+
const ret = makeMutClosure(arg0, arg1, 1988, __wbg_adapter_24);
|
|
7464
8084
|
return ret;
|
|
7465
8085
|
};
|
|
7466
8086
|
|
|
7467
|
-
exports.
|
|
7468
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7469
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
8087
|
+
exports.__wbindgen_cast_8b5320884bc68146 = function(arg0, arg1) {
|
|
8088
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1493, function: Function { arguments: [], shim_idx: 1494, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8089
|
+
const ret = makeMutClosure(arg0, arg1, 1493, __wbg_adapter_12);
|
|
7470
8090
|
return ret;
|
|
7471
8091
|
};
|
|
7472
8092
|
|
|
@@ -7476,21 +8096,9 @@ exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
|
7476
8096
|
return ret;
|
|
7477
8097
|
};
|
|
7478
8098
|
|
|
7479
|
-
exports.
|
|
7480
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7481
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7482
|
-
return ret;
|
|
7483
|
-
};
|
|
7484
|
-
|
|
7485
|
-
exports.__wbindgen_cast_c7181fb9120fd364 = function(arg0, arg1) {
|
|
7486
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 1332, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1333, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7487
|
-
const ret = makeMutClosure(arg0, arg1, 1332, __wbg_adapter_12);
|
|
7488
|
-
return ret;
|
|
7489
|
-
};
|
|
7490
|
-
|
|
7491
|
-
exports.__wbindgen_cast_c8d7b74f3f2593d8 = function(arg0, arg1) {
|
|
7492
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 1915, function: Function { arguments: [], shim_idx: 1916, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7493
|
-
const ret = makeMutClosure(arg0, arg1, 1915, __wbg_adapter_22);
|
|
8099
|
+
exports.__wbindgen_cast_c00b3b75575ef5a8 = function(arg0, arg1) {
|
|
8100
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1351, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1352, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8101
|
+
const ret = makeMutClosure(arg0, arg1, 1351, __wbg_adapter_15);
|
|
7494
8102
|
return ret;
|
|
7495
8103
|
};
|
|
7496
8104
|
|
|
@@ -7500,12 +8108,36 @@ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
|
7500
8108
|
return ret;
|
|
7501
8109
|
};
|
|
7502
8110
|
|
|
8111
|
+
exports.__wbindgen_cast_d13e729c37297ac9 = function(arg0, arg1) {
|
|
8112
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1351, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1352, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8113
|
+
const ret = makeMutClosure(arg0, arg1, 1351, __wbg_adapter_15);
|
|
8114
|
+
return ret;
|
|
8115
|
+
};
|
|
8116
|
+
|
|
7503
8117
|
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
7504
8118
|
// Cast intrinsic for `F64 -> Externref`.
|
|
7505
8119
|
const ret = arg0;
|
|
7506
8120
|
return ret;
|
|
7507
8121
|
};
|
|
7508
8122
|
|
|
8123
|
+
exports.__wbindgen_cast_db7bbe564cc094a2 = function(arg0, arg1) {
|
|
8124
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1953, function: Function { arguments: [], shim_idx: 1954, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8125
|
+
const ret = makeMutClosure(arg0, arg1, 1953, __wbg_adapter_34);
|
|
8126
|
+
return ret;
|
|
8127
|
+
};
|
|
8128
|
+
|
|
8129
|
+
exports.__wbindgen_cast_f36c9415fb8ff7bb = function(arg0, arg1) {
|
|
8130
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 671, function: Function { arguments: [NamedExternref("HIDInputReportEvent")], shim_idx: 804, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8131
|
+
const ret = makeMutClosure(arg0, arg1, 671, __wbg_adapter_31);
|
|
8132
|
+
return ret;
|
|
8133
|
+
};
|
|
8134
|
+
|
|
8135
|
+
exports.__wbindgen_cast_f944d0f89d71242c = function(arg0, arg1) {
|
|
8136
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1351, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1352, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
8137
|
+
const ret = makeMutClosure(arg0, arg1, 1351, __wbg_adapter_15);
|
|
8138
|
+
return ret;
|
|
8139
|
+
};
|
|
8140
|
+
|
|
7509
8141
|
exports.__wbindgen_init_externref_table = function() {
|
|
7510
8142
|
const table = wasm.__wbindgen_export_4;
|
|
7511
8143
|
const offset = table.grow(4);
|