lwk_node 0.14.1 → 0.15.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 +145 -14
- package/lwk_wasm.js +520 -149
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,42 +119,4 @@ node network.js
|
|
|
119
119
|
|
|
120
120
|
## Javascript code conventions
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
For object that have a string representation we implement `std::fmt::Display` and we expose them like that
|
|
125
|
-
|
|
126
|
-
```rust
|
|
127
|
-
#[wasm_bindgen(js_name = toString)]
|
|
128
|
-
pub fn to_string_js(&self) -> String {
|
|
129
|
-
self.to_string()
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### JSON
|
|
134
|
-
|
|
135
|
-
For objects that have a json representation, like the balance we provide a `toJSON()` method that must work when the caller use for example `JSON.stringify(object)`
|
|
136
|
-
Unfortunately `JSON.stringify` cannot serialize big integers by default, thus we use string representation for `BigInt`.
|
|
137
|
-
|
|
138
|
-
### Entries
|
|
139
|
-
|
|
140
|
-
Since JSON doesn't support `BigInt` some object expose also the js standard `entries()` method so that the following code is possible
|
|
141
|
-
|
|
142
|
-
```js
|
|
143
|
-
const balance = wallet.balance();
|
|
144
|
-
|
|
145
|
-
// 1. Create a Map
|
|
146
|
-
const balanceMap = new Map(balance.entries());
|
|
147
|
-
|
|
148
|
-
// 2. Iterate directly in a for...of loop
|
|
149
|
-
for (const [currency, amount] of balance.entries()) {
|
|
150
|
-
console.log(`${currency}: ${amount}`);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// 3. Convert to a plain object
|
|
154
|
-
const balanceObject = Object.fromEntries(balance.entries());
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Documentation
|
|
158
|
-
|
|
159
|
-
Documentation of this crate should not use link to rust types such as [`Transaction`] because they are not usable in end-user javascript packages.
|
|
160
|
-
Many types are wrappers of types in lwk crates, in this cases we mostly duplicate the original documentation with context adjustment.
|
|
122
|
+
For new additions and improvements, follow our [guidelines](GUIDE.md).
|
package/lwk_wasm.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function searchLedgerDevice(): Promise<HIDDevice>;
|
|
3
4
|
/**
|
|
4
5
|
* Convert the given string to a QR code image uri
|
|
5
6
|
*
|
|
@@ -9,7 +10,6 @@
|
|
|
9
10
|
* for example in html: `style="image-rendering: pixelated; border: 20px solid white;"`
|
|
10
11
|
*/
|
|
11
12
|
export function stringToQr(str: string, pixel_per_module?: number | null): string;
|
|
12
|
-
export function searchLedgerDevice(): Promise<HIDDevice>;
|
|
13
13
|
/**
|
|
14
14
|
* Wallet chain
|
|
15
15
|
*/
|
|
@@ -620,6 +620,17 @@ export class ExchangeRates {
|
|
|
620
620
|
*/
|
|
621
621
|
serialize(): string;
|
|
622
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* An external UTXO, owned by another wallet.
|
|
625
|
+
*/
|
|
626
|
+
export class ExternalUtxo {
|
|
627
|
+
free(): void;
|
|
628
|
+
[Symbol.dispose](): void;
|
|
629
|
+
/**
|
|
630
|
+
* Construct an ExternalUtxo
|
|
631
|
+
*/
|
|
632
|
+
constructor(vout: number, tx: Transaction, unblinded: TxOutSecrets, max_weight_to_satisfy: number, is_segwit: boolean);
|
|
633
|
+
}
|
|
623
634
|
/**
|
|
624
635
|
* Wrapper over [`lwk_boltz::InvoiceResponse`]
|
|
625
636
|
*/
|
|
@@ -758,6 +769,42 @@ export class JadeWebSocket {
|
|
|
758
769
|
keyoriginXpub(bip: Bip): Promise<string>;
|
|
759
770
|
registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
|
|
760
771
|
}
|
|
772
|
+
/**
|
|
773
|
+
* A bridge that connects a [`JsStorage`] to [`lwk_common::Store`].
|
|
774
|
+
*/
|
|
775
|
+
export class JsStoreLink {
|
|
776
|
+
free(): void;
|
|
777
|
+
[Symbol.dispose](): void;
|
|
778
|
+
/**
|
|
779
|
+
* Create a new `JsStoreLink` from a JavaScript storage object.
|
|
780
|
+
*
|
|
781
|
+
* The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
|
|
782
|
+
*/
|
|
783
|
+
constructor(storage: any);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Test helper to verify Rust can read/write through a JS store.
|
|
787
|
+
*/
|
|
788
|
+
export class JsTestStore {
|
|
789
|
+
free(): void;
|
|
790
|
+
[Symbol.dispose](): void;
|
|
791
|
+
/**
|
|
792
|
+
* Create a new test helper wrapping the given JS storage.
|
|
793
|
+
*/
|
|
794
|
+
constructor(storage: any);
|
|
795
|
+
/**
|
|
796
|
+
* Write a key-value pair to the store.
|
|
797
|
+
*/
|
|
798
|
+
write(key: string, value: Uint8Array): void;
|
|
799
|
+
/**
|
|
800
|
+
* Read a value from the store.
|
|
801
|
+
*/
|
|
802
|
+
read(key: string): Uint8Array | undefined;
|
|
803
|
+
/**
|
|
804
|
+
* Remove a key from the store.
|
|
805
|
+
*/
|
|
806
|
+
remove(key: string): void;
|
|
807
|
+
}
|
|
761
808
|
/**
|
|
762
809
|
* Response from the last_used_index endpoint
|
|
763
810
|
*
|
|
@@ -920,6 +967,10 @@ export class Network {
|
|
|
920
967
|
* Return the policy asset for this network
|
|
921
968
|
*/
|
|
922
969
|
policyAsset(): AssetId;
|
|
970
|
+
/**
|
|
971
|
+
* Return the genesis block hash for this network as hex string.
|
|
972
|
+
*/
|
|
973
|
+
genesisBlockHash(): string;
|
|
923
974
|
/**
|
|
924
975
|
* Return the transaction builder for this network
|
|
925
976
|
*/
|
|
@@ -949,9 +1000,13 @@ export class OutPoint {
|
|
|
949
1000
|
free(): void;
|
|
950
1001
|
[Symbol.dispose](): void;
|
|
951
1002
|
/**
|
|
952
|
-
* Creates an `OutPoint`
|
|
1003
|
+
* Creates an `OutPoint` from a string representation.
|
|
953
1004
|
*/
|
|
954
1005
|
constructor(s: string);
|
|
1006
|
+
/**
|
|
1007
|
+
* Creates an `OutPoint` from a transaction ID and output index.
|
|
1008
|
+
*/
|
|
1009
|
+
static fromParts(txid: Txid, vout: number): OutPoint;
|
|
955
1010
|
/**
|
|
956
1011
|
* Return the transaction identifier.
|
|
957
1012
|
*/
|
|
@@ -1096,6 +1151,12 @@ export class Pset {
|
|
|
1096
1151
|
* the available signature information in place.
|
|
1097
1152
|
*/
|
|
1098
1153
|
extractTx(): Transaction;
|
|
1154
|
+
/**
|
|
1155
|
+
* Get the unique id of the PSET as defined by [BIP-370](https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki#unique-identification)
|
|
1156
|
+
*
|
|
1157
|
+
* The unique id is the txid of the PSET with sequence numbers of inputs set to 0
|
|
1158
|
+
*/
|
|
1159
|
+
uniqueId(): Txid;
|
|
1099
1160
|
/**
|
|
1100
1161
|
* Attempt to merge with another `Pset`.
|
|
1101
1162
|
*/
|
|
@@ -1175,6 +1236,14 @@ export class PsetInput {
|
|
|
1175
1236
|
* Prevout vout of the input
|
|
1176
1237
|
*/
|
|
1177
1238
|
previousVout(): number;
|
|
1239
|
+
/**
|
|
1240
|
+
* Prevout scriptpubkey of the input
|
|
1241
|
+
*/
|
|
1242
|
+
previousScriptPubkey(): Script | undefined;
|
|
1243
|
+
/**
|
|
1244
|
+
* Redeem script of the input
|
|
1245
|
+
*/
|
|
1246
|
+
redeemScript(): Script | undefined;
|
|
1178
1247
|
/**
|
|
1179
1248
|
* If the input has an issuance, the asset id
|
|
1180
1249
|
*/
|
|
@@ -1183,6 +1252,19 @@ export class PsetInput {
|
|
|
1183
1252
|
* If the input has an issuance, the token id
|
|
1184
1253
|
*/
|
|
1185
1254
|
issuanceToken(): AssetId | undefined;
|
|
1255
|
+
/**
|
|
1256
|
+
* If the input has a (re)issuance, the issuance object
|
|
1257
|
+
*/
|
|
1258
|
+
issuance(): Issuance | undefined;
|
|
1259
|
+
/**
|
|
1260
|
+
* Input sighash
|
|
1261
|
+
*/
|
|
1262
|
+
sighash(): number;
|
|
1263
|
+
/**
|
|
1264
|
+
* If the input has an issuance, returns [asset_id, token_id].
|
|
1265
|
+
* Returns undefined if the input has no issuance.
|
|
1266
|
+
*/
|
|
1267
|
+
issuanceIds(): AssetId[] | undefined;
|
|
1186
1268
|
}
|
|
1187
1269
|
/**
|
|
1188
1270
|
* PSET output
|
|
@@ -1191,7 +1273,22 @@ export class PsetOutput {
|
|
|
1191
1273
|
private constructor();
|
|
1192
1274
|
free(): void;
|
|
1193
1275
|
[Symbol.dispose](): void;
|
|
1276
|
+
/**
|
|
1277
|
+
* Get the script pubkey
|
|
1278
|
+
*/
|
|
1194
1279
|
scriptPubkey(): Script;
|
|
1280
|
+
/**
|
|
1281
|
+
* Get the explicit amount, if set
|
|
1282
|
+
*/
|
|
1283
|
+
amount(): bigint | undefined;
|
|
1284
|
+
/**
|
|
1285
|
+
* Get the explicit asset ID, if set
|
|
1286
|
+
*/
|
|
1287
|
+
asset(): AssetId | undefined;
|
|
1288
|
+
/**
|
|
1289
|
+
* Get the blinder index, if set
|
|
1290
|
+
*/
|
|
1291
|
+
blinderIndex(): number | undefined;
|
|
1195
1292
|
}
|
|
1196
1293
|
/**
|
|
1197
1294
|
* The details of the signatures in a PSET, divided in available and missing signatures.
|
|
@@ -1302,16 +1399,44 @@ export class Script {
|
|
|
1302
1399
|
* Creates a `Script` from its hex string representation.
|
|
1303
1400
|
*/
|
|
1304
1401
|
constructor(s: string);
|
|
1402
|
+
/**
|
|
1403
|
+
* Creates an empty `Script`.
|
|
1404
|
+
*/
|
|
1405
|
+
static empty(): Script;
|
|
1305
1406
|
/**
|
|
1306
1407
|
* Return the consensus encoded bytes of the script.
|
|
1307
1408
|
*/
|
|
1308
1409
|
bytes(): Uint8Array;
|
|
1410
|
+
/**
|
|
1411
|
+
* Returns SHA256 of the script's consensus bytes.
|
|
1412
|
+
*
|
|
1413
|
+
* Returns an equivalent value to the `jet::input_script_hash(index)`/`jet::output_script_hash(index)`.
|
|
1414
|
+
*/
|
|
1415
|
+
jet_sha256_hex(): string;
|
|
1309
1416
|
/**
|
|
1310
1417
|
* Return the string of the script showing op codes and their arguments.
|
|
1311
1418
|
*
|
|
1312
1419
|
* For example: "OP_DUP OP_HASH160 OP_PUSHBYTES_20 088ac47276d105b91cf9aa27a00112421dd5f23c OP_EQUALVERIFY OP_CHECKSIG"
|
|
1313
1420
|
*/
|
|
1314
1421
|
asm(): string;
|
|
1422
|
+
/**
|
|
1423
|
+
* Creates an OP_RETURN script with the given data.
|
|
1424
|
+
*/
|
|
1425
|
+
static newOpReturn(data: Uint8Array): Script;
|
|
1426
|
+
/**
|
|
1427
|
+
* Returns true if the script is provably unspendable.
|
|
1428
|
+
*
|
|
1429
|
+
* A script is provably unspendable if it starts with OP_RETURN or is larger
|
|
1430
|
+
* than the maximum script size.
|
|
1431
|
+
*/
|
|
1432
|
+
isProvablyUnspendable(): boolean;
|
|
1433
|
+
/**
|
|
1434
|
+
* Returns true if this script_pubkey is provably SegWit.
|
|
1435
|
+
*
|
|
1436
|
+
* This checks if the script_pubkey is provably SegWit based on the
|
|
1437
|
+
* script_pubkey itself and an optional redeem_script.
|
|
1438
|
+
*/
|
|
1439
|
+
isProvablySegwit(redeem_script?: Script | null): boolean;
|
|
1315
1440
|
/**
|
|
1316
1441
|
* Return the string representation of the script (hex encoding of its consensus encoded bytes).
|
|
1317
1442
|
* This representation can be used to recreate the script via `new()`
|
|
@@ -1324,18 +1449,6 @@ export class Script {
|
|
|
1324
1449
|
export class Signer {
|
|
1325
1450
|
free(): void;
|
|
1326
1451
|
[Symbol.dispose](): void;
|
|
1327
|
-
/**
|
|
1328
|
-
* AMP0 signer data for login
|
|
1329
|
-
*/
|
|
1330
|
-
amp0SignerData(): Amp0SignerData;
|
|
1331
|
-
/**
|
|
1332
|
-
* AMP0 sign login challenge
|
|
1333
|
-
*/
|
|
1334
|
-
amp0SignChallenge(challenge: string): string;
|
|
1335
|
-
/**
|
|
1336
|
-
* AMP0 account xpub
|
|
1337
|
-
*/
|
|
1338
|
-
amp0AccountXpub(account: number): string;
|
|
1339
1452
|
/**
|
|
1340
1453
|
* Creates a `Signer`
|
|
1341
1454
|
*/
|
|
@@ -1372,6 +1485,18 @@ export class Signer {
|
|
|
1372
1485
|
* Return the derived BIP85 mnemonic
|
|
1373
1486
|
*/
|
|
1374
1487
|
derive_bip85_mnemonic(index: number, word_count: number): Mnemonic;
|
|
1488
|
+
/**
|
|
1489
|
+
* AMP0 signer data for login
|
|
1490
|
+
*/
|
|
1491
|
+
amp0SignerData(): Amp0SignerData;
|
|
1492
|
+
/**
|
|
1493
|
+
* AMP0 sign login challenge
|
|
1494
|
+
*/
|
|
1495
|
+
amp0SignChallenge(challenge: string): string;
|
|
1496
|
+
/**
|
|
1497
|
+
* AMP0 account xpub
|
|
1498
|
+
*/
|
|
1499
|
+
amp0AccountXpub(account: number): string;
|
|
1375
1500
|
}
|
|
1376
1501
|
export class Singlesig {
|
|
1377
1502
|
private constructor();
|
|
@@ -1539,6 +1664,12 @@ export class TxOutSecrets {
|
|
|
1539
1664
|
private constructor();
|
|
1540
1665
|
free(): void;
|
|
1541
1666
|
[Symbol.dispose](): void;
|
|
1667
|
+
/**
|
|
1668
|
+
* Creates a new `TxOutSecrets` for an explicit (unblinded) output.
|
|
1669
|
+
*
|
|
1670
|
+
* The blinding factors are set to zero.
|
|
1671
|
+
*/
|
|
1672
|
+
static fromExplicit(asset_id: AssetId, value: bigint): TxOutSecrets;
|
|
1542
1673
|
/**
|
|
1543
1674
|
* Return the asset of the output.
|
|
1544
1675
|
*/
|
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,15 +217,10 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
210
217
|
return real;
|
|
211
218
|
}
|
|
212
219
|
|
|
213
|
-
function
|
|
214
|
-
|
|
215
|
-
|
|
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)));
|
|
220
|
+
function _assertClass(instance, klass) {
|
|
221
|
+
if (!(instance instanceof klass)) {
|
|
222
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
219
223
|
}
|
|
220
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
221
|
-
return result;
|
|
222
224
|
}
|
|
223
225
|
|
|
224
226
|
function takeFromExternrefTable0(idx) {
|
|
@@ -227,10 +229,14 @@ function takeFromExternrefTable0(idx) {
|
|
|
227
229
|
return value;
|
|
228
230
|
}
|
|
229
231
|
|
|
230
|
-
function
|
|
231
|
-
|
|
232
|
-
|
|
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);
|
|
233
237
|
}
|
|
238
|
+
WASM_VECTOR_LEN = array.length;
|
|
239
|
+
return ptr;
|
|
234
240
|
}
|
|
235
241
|
|
|
236
242
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -248,6 +254,30 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
248
254
|
WASM_VECTOR_LEN = arg.length;
|
|
249
255
|
return ptr;
|
|
250
256
|
}
|
|
257
|
+
|
|
258
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
259
|
+
ptr = ptr >>> 0;
|
|
260
|
+
const mem = getDataViewMemory0();
|
|
261
|
+
const result = [];
|
|
262
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
263
|
+
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
264
|
+
}
|
|
265
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
270
|
+
ptr = ptr >>> 0;
|
|
271
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @returns {Promise<HIDDevice>}
|
|
275
|
+
*/
|
|
276
|
+
exports.searchLedgerDevice = function() {
|
|
277
|
+
const ret = wasm.searchLedgerDevice();
|
|
278
|
+
return ret;
|
|
279
|
+
};
|
|
280
|
+
|
|
251
281
|
/**
|
|
252
282
|
* Convert the given string to a QR code image uri
|
|
253
283
|
*
|
|
@@ -280,56 +310,28 @@ exports.stringToQr = function(str, pixel_per_module) {
|
|
|
280
310
|
}
|
|
281
311
|
};
|
|
282
312
|
|
|
283
|
-
function
|
|
284
|
-
|
|
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;
|
|
313
|
+
function __wbg_adapter_6(arg0, arg1, arg2) {
|
|
314
|
+
wasm.closure1965_externref_shim(arg0, arg1, arg2);
|
|
291
315
|
}
|
|
292
|
-
/**
|
|
293
|
-
* @returns {Promise<HIDDevice>}
|
|
294
|
-
*/
|
|
295
|
-
exports.searchLedgerDevice = function() {
|
|
296
|
-
const ret = wasm.searchLedgerDevice();
|
|
297
|
-
return ret;
|
|
298
|
-
};
|
|
299
316
|
|
|
300
|
-
function
|
|
301
|
-
|
|
302
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
303
|
-
WASM_VECTOR_LEN = arg.length;
|
|
304
|
-
return ptr;
|
|
317
|
+
function __wbg_adapter_9(arg0, arg1, arg2) {
|
|
318
|
+
wasm.closure1211_externref_shim(arg0, arg1, arg2);
|
|
305
319
|
}
|
|
306
320
|
|
|
307
|
-
function
|
|
308
|
-
|
|
309
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
310
|
-
}
|
|
311
|
-
function __wbg_adapter_12(arg0, arg1, arg2) {
|
|
312
|
-
wasm.closure1333_externref_shim(arg0, arg1, arg2);
|
|
321
|
+
function __wbg_adapter_14(arg0, arg1) {
|
|
322
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h94f351489121fb87(arg0, arg1);
|
|
313
323
|
}
|
|
314
324
|
|
|
315
|
-
function
|
|
325
|
+
function __wbg_adapter_25(arg0, arg1) {
|
|
316
326
|
wasm.wasm_bindgen__convert__closures_____invoke__h912986096667d3cb(arg0, arg1);
|
|
317
327
|
}
|
|
318
328
|
|
|
319
|
-
function
|
|
320
|
-
wasm.
|
|
329
|
+
function __wbg_adapter_28(arg0, arg1, arg2) {
|
|
330
|
+
wasm.closure855_externref_shim(arg0, arg1, arg2);
|
|
321
331
|
}
|
|
322
332
|
|
|
323
|
-
function
|
|
324
|
-
wasm.
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
328
|
-
wasm.closure793_externref_shim(arg0, arg1, arg2);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function __wbg_adapter_647(arg0, arg1, arg2, arg3) {
|
|
332
|
-
wasm.closure2737_externref_shim(arg0, arg1, arg2, arg3);
|
|
333
|
+
function __wbg_adapter_678(arg0, arg1, arg2, arg3) {
|
|
334
|
+
wasm.closure2742_externref_shim(arg0, arg1, arg2, arg3);
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
/**
|
|
@@ -2175,6 +2177,49 @@ if (Symbol.dispose) ExchangeRates.prototype[Symbol.dispose] = ExchangeRates.prot
|
|
|
2175
2177
|
|
|
2176
2178
|
exports.ExchangeRates = ExchangeRates;
|
|
2177
2179
|
|
|
2180
|
+
const ExternalUtxoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2181
|
+
? { register: () => {}, unregister: () => {} }
|
|
2182
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_externalutxo_free(ptr >>> 0, 1));
|
|
2183
|
+
/**
|
|
2184
|
+
* An external UTXO, owned by another wallet.
|
|
2185
|
+
*/
|
|
2186
|
+
class ExternalUtxo {
|
|
2187
|
+
|
|
2188
|
+
__destroy_into_raw() {
|
|
2189
|
+
const ptr = this.__wbg_ptr;
|
|
2190
|
+
this.__wbg_ptr = 0;
|
|
2191
|
+
ExternalUtxoFinalization.unregister(this);
|
|
2192
|
+
return ptr;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
free() {
|
|
2196
|
+
const ptr = this.__destroy_into_raw();
|
|
2197
|
+
wasm.__wbg_externalutxo_free(ptr, 0);
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Construct an ExternalUtxo
|
|
2201
|
+
* @param {number} vout
|
|
2202
|
+
* @param {Transaction} tx
|
|
2203
|
+
* @param {TxOutSecrets} unblinded
|
|
2204
|
+
* @param {number} max_weight_to_satisfy
|
|
2205
|
+
* @param {boolean} is_segwit
|
|
2206
|
+
*/
|
|
2207
|
+
constructor(vout, tx, unblinded, max_weight_to_satisfy, is_segwit) {
|
|
2208
|
+
_assertClass(tx, Transaction);
|
|
2209
|
+
_assertClass(unblinded, TxOutSecrets);
|
|
2210
|
+
const ret = wasm.externalutxo_new(vout, tx.__wbg_ptr, unblinded.__wbg_ptr, max_weight_to_satisfy, is_segwit);
|
|
2211
|
+
if (ret[2]) {
|
|
2212
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2213
|
+
}
|
|
2214
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
2215
|
+
ExternalUtxoFinalization.register(this, this.__wbg_ptr, this);
|
|
2216
|
+
return this;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
if (Symbol.dispose) ExternalUtxo.prototype[Symbol.dispose] = ExternalUtxo.prototype.free;
|
|
2220
|
+
|
|
2221
|
+
exports.ExternalUtxo = ExternalUtxo;
|
|
2222
|
+
|
|
2178
2223
|
const InvoiceResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2179
2224
|
? { register: () => {}, unregister: () => {} }
|
|
2180
2225
|
: new FinalizationRegistry(ptr => wasm.__wbg_invoiceresponse_free(ptr >>> 0, 1));
|
|
@@ -2672,6 +2717,122 @@ if (Symbol.dispose) JadeWebSocket.prototype[Symbol.dispose] = JadeWebSocket.prot
|
|
|
2672
2717
|
|
|
2673
2718
|
exports.JadeWebSocket = JadeWebSocket;
|
|
2674
2719
|
|
|
2720
|
+
const JsStoreLinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2721
|
+
? { register: () => {}, unregister: () => {} }
|
|
2722
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsstorelink_free(ptr >>> 0, 1));
|
|
2723
|
+
/**
|
|
2724
|
+
* A bridge that connects a [`JsStorage`] to [`lwk_common::Store`].
|
|
2725
|
+
*/
|
|
2726
|
+
class JsStoreLink {
|
|
2727
|
+
|
|
2728
|
+
__destroy_into_raw() {
|
|
2729
|
+
const ptr = this.__wbg_ptr;
|
|
2730
|
+
this.__wbg_ptr = 0;
|
|
2731
|
+
JsStoreLinkFinalization.unregister(this);
|
|
2732
|
+
return ptr;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
free() {
|
|
2736
|
+
const ptr = this.__destroy_into_raw();
|
|
2737
|
+
wasm.__wbg_jsstorelink_free(ptr, 0);
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Create a new `JsStoreLink` from a JavaScript storage object.
|
|
2741
|
+
*
|
|
2742
|
+
* The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
|
|
2743
|
+
* @param {any} storage
|
|
2744
|
+
*/
|
|
2745
|
+
constructor(storage) {
|
|
2746
|
+
const ret = wasm.jsstorelink_new(storage);
|
|
2747
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2748
|
+
JsStoreLinkFinalization.register(this, this.__wbg_ptr, this);
|
|
2749
|
+
return this;
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
if (Symbol.dispose) JsStoreLink.prototype[Symbol.dispose] = JsStoreLink.prototype.free;
|
|
2753
|
+
|
|
2754
|
+
exports.JsStoreLink = JsStoreLink;
|
|
2755
|
+
|
|
2756
|
+
const JsTestStoreFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2757
|
+
? { register: () => {}, unregister: () => {} }
|
|
2758
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jsteststore_free(ptr >>> 0, 1));
|
|
2759
|
+
/**
|
|
2760
|
+
* Test helper to verify Rust can read/write through a JS store.
|
|
2761
|
+
*/
|
|
2762
|
+
class JsTestStore {
|
|
2763
|
+
|
|
2764
|
+
__destroy_into_raw() {
|
|
2765
|
+
const ptr = this.__wbg_ptr;
|
|
2766
|
+
this.__wbg_ptr = 0;
|
|
2767
|
+
JsTestStoreFinalization.unregister(this);
|
|
2768
|
+
return ptr;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
free() {
|
|
2772
|
+
const ptr = this.__destroy_into_raw();
|
|
2773
|
+
wasm.__wbg_jsteststore_free(ptr, 0);
|
|
2774
|
+
}
|
|
2775
|
+
/**
|
|
2776
|
+
* Create a new test helper wrapping the given JS storage.
|
|
2777
|
+
* @param {any} storage
|
|
2778
|
+
*/
|
|
2779
|
+
constructor(storage) {
|
|
2780
|
+
const ret = wasm.jsteststore_new(storage);
|
|
2781
|
+
this.__wbg_ptr = ret >>> 0;
|
|
2782
|
+
JsTestStoreFinalization.register(this, this.__wbg_ptr, this);
|
|
2783
|
+
return this;
|
|
2784
|
+
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Write a key-value pair to the store.
|
|
2787
|
+
* @param {string} key
|
|
2788
|
+
* @param {Uint8Array} value
|
|
2789
|
+
*/
|
|
2790
|
+
write(key, value) {
|
|
2791
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2792
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2793
|
+
const ptr1 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
|
|
2794
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2795
|
+
const ret = wasm.jsteststore_write(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2796
|
+
if (ret[1]) {
|
|
2797
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Read a value from the store.
|
|
2802
|
+
* @param {string} key
|
|
2803
|
+
* @returns {Uint8Array | undefined}
|
|
2804
|
+
*/
|
|
2805
|
+
read(key) {
|
|
2806
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2807
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2808
|
+
const ret = wasm.jsteststore_read(this.__wbg_ptr, ptr0, len0);
|
|
2809
|
+
if (ret[3]) {
|
|
2810
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2811
|
+
}
|
|
2812
|
+
let v2;
|
|
2813
|
+
if (ret[0] !== 0) {
|
|
2814
|
+
v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
2815
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
2816
|
+
}
|
|
2817
|
+
return v2;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Remove a key from the store.
|
|
2821
|
+
* @param {string} key
|
|
2822
|
+
*/
|
|
2823
|
+
remove(key) {
|
|
2824
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2825
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2826
|
+
const ret = wasm.jsteststore_remove(this.__wbg_ptr, ptr0, len0);
|
|
2827
|
+
if (ret[1]) {
|
|
2828
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
if (Symbol.dispose) JsTestStore.prototype[Symbol.dispose] = JsTestStore.prototype.free;
|
|
2833
|
+
|
|
2834
|
+
exports.JsTestStore = JsTestStore;
|
|
2835
|
+
|
|
2675
2836
|
const LastUsedIndexResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2676
2837
|
? { register: () => {}, unregister: () => {} }
|
|
2677
2838
|
: new FinalizationRegistry(ptr => wasm.__wbg_lastusedindexresponse_free(ptr >>> 0, 1));
|
|
@@ -3191,6 +3352,22 @@ class Network {
|
|
|
3191
3352
|
const ret = wasm.network_policyAsset(this.__wbg_ptr);
|
|
3192
3353
|
return AssetId.__wrap(ret);
|
|
3193
3354
|
}
|
|
3355
|
+
/**
|
|
3356
|
+
* Return the genesis block hash for this network as hex string.
|
|
3357
|
+
* @returns {string}
|
|
3358
|
+
*/
|
|
3359
|
+
genesisBlockHash() {
|
|
3360
|
+
let deferred1_0;
|
|
3361
|
+
let deferred1_1;
|
|
3362
|
+
try {
|
|
3363
|
+
const ret = wasm.network_genesisBlockHash(this.__wbg_ptr);
|
|
3364
|
+
deferred1_0 = ret[0];
|
|
3365
|
+
deferred1_1 = ret[1];
|
|
3366
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
3367
|
+
} finally {
|
|
3368
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3194
3371
|
/**
|
|
3195
3372
|
* Return the transaction builder for this network
|
|
3196
3373
|
* @returns {TxBuilder}
|
|
@@ -3296,7 +3473,7 @@ class OutPoint {
|
|
|
3296
3473
|
wasm.__wbg_outpoint_free(ptr, 0);
|
|
3297
3474
|
}
|
|
3298
3475
|
/**
|
|
3299
|
-
* Creates an `OutPoint`
|
|
3476
|
+
* Creates an `OutPoint` from a string representation.
|
|
3300
3477
|
* @param {string} s
|
|
3301
3478
|
*/
|
|
3302
3479
|
constructor(s) {
|
|
@@ -3310,6 +3487,17 @@ class OutPoint {
|
|
|
3310
3487
|
OutPointFinalization.register(this, this.__wbg_ptr, this);
|
|
3311
3488
|
return this;
|
|
3312
3489
|
}
|
|
3490
|
+
/**
|
|
3491
|
+
* Creates an `OutPoint` from a transaction ID and output index.
|
|
3492
|
+
* @param {Txid} txid
|
|
3493
|
+
* @param {number} vout
|
|
3494
|
+
* @returns {OutPoint}
|
|
3495
|
+
*/
|
|
3496
|
+
static fromParts(txid, vout) {
|
|
3497
|
+
_assertClass(txid, Txid);
|
|
3498
|
+
const ret = wasm.outpoint_fromParts(txid.__wbg_ptr, vout);
|
|
3499
|
+
return OutPoint.__wrap(ret);
|
|
3500
|
+
}
|
|
3313
3501
|
/**
|
|
3314
3502
|
* Return the transaction identifier.
|
|
3315
3503
|
* @returns {Txid}
|
|
@@ -3810,6 +3998,19 @@ class Pset {
|
|
|
3810
3998
|
}
|
|
3811
3999
|
return Transaction.__wrap(ret[0]);
|
|
3812
4000
|
}
|
|
4001
|
+
/**
|
|
4002
|
+
* Get the unique id of the PSET as defined by [BIP-370](https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki#unique-identification)
|
|
4003
|
+
*
|
|
4004
|
+
* The unique id is the txid of the PSET with sequence numbers of inputs set to 0
|
|
4005
|
+
* @returns {Txid}
|
|
4006
|
+
*/
|
|
4007
|
+
uniqueId() {
|
|
4008
|
+
const ret = wasm.pset_uniqueId(this.__wbg_ptr);
|
|
4009
|
+
if (ret[2]) {
|
|
4010
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4011
|
+
}
|
|
4012
|
+
return Txid.__wrap(ret[0]);
|
|
4013
|
+
}
|
|
3813
4014
|
/**
|
|
3814
4015
|
* Attempt to merge with another `Pset`.
|
|
3815
4016
|
* @param {Pset} other
|
|
@@ -4035,6 +4236,22 @@ class PsetInput {
|
|
|
4035
4236
|
const ret = wasm.psetinput_previousVout(this.__wbg_ptr);
|
|
4036
4237
|
return ret >>> 0;
|
|
4037
4238
|
}
|
|
4239
|
+
/**
|
|
4240
|
+
* Prevout scriptpubkey of the input
|
|
4241
|
+
* @returns {Script | undefined}
|
|
4242
|
+
*/
|
|
4243
|
+
previousScriptPubkey() {
|
|
4244
|
+
const ret = wasm.psetinput_previousScriptPubkey(this.__wbg_ptr);
|
|
4245
|
+
return ret === 0 ? undefined : Script.__wrap(ret);
|
|
4246
|
+
}
|
|
4247
|
+
/**
|
|
4248
|
+
* Redeem script of the input
|
|
4249
|
+
* @returns {Script | undefined}
|
|
4250
|
+
*/
|
|
4251
|
+
redeemScript() {
|
|
4252
|
+
const ret = wasm.psetinput_redeemScript(this.__wbg_ptr);
|
|
4253
|
+
return ret === 0 ? undefined : Script.__wrap(ret);
|
|
4254
|
+
}
|
|
4038
4255
|
/**
|
|
4039
4256
|
* If the input has an issuance, the asset id
|
|
4040
4257
|
* @returns {AssetId | undefined}
|
|
@@ -4051,6 +4268,36 @@ class PsetInput {
|
|
|
4051
4268
|
const ret = wasm.psetinput_issuanceToken(this.__wbg_ptr);
|
|
4052
4269
|
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
4053
4270
|
}
|
|
4271
|
+
/**
|
|
4272
|
+
* If the input has a (re)issuance, the issuance object
|
|
4273
|
+
* @returns {Issuance | undefined}
|
|
4274
|
+
*/
|
|
4275
|
+
issuance() {
|
|
4276
|
+
const ret = wasm.psetinput_issuance(this.__wbg_ptr);
|
|
4277
|
+
return ret === 0 ? undefined : Issuance.__wrap(ret);
|
|
4278
|
+
}
|
|
4279
|
+
/**
|
|
4280
|
+
* Input sighash
|
|
4281
|
+
* @returns {number}
|
|
4282
|
+
*/
|
|
4283
|
+
sighash() {
|
|
4284
|
+
const ret = wasm.psetinput_sighash(this.__wbg_ptr);
|
|
4285
|
+
return ret >>> 0;
|
|
4286
|
+
}
|
|
4287
|
+
/**
|
|
4288
|
+
* If the input has an issuance, returns [asset_id, token_id].
|
|
4289
|
+
* Returns undefined if the input has no issuance.
|
|
4290
|
+
* @returns {AssetId[] | undefined}
|
|
4291
|
+
*/
|
|
4292
|
+
issuanceIds() {
|
|
4293
|
+
const ret = wasm.psetinput_issuanceIds(this.__wbg_ptr);
|
|
4294
|
+
let v1;
|
|
4295
|
+
if (ret[0] !== 0) {
|
|
4296
|
+
v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
4297
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4298
|
+
}
|
|
4299
|
+
return v1;
|
|
4300
|
+
}
|
|
4054
4301
|
}
|
|
4055
4302
|
if (Symbol.dispose) PsetInput.prototype[Symbol.dispose] = PsetInput.prototype.free;
|
|
4056
4303
|
|
|
@@ -4084,12 +4331,37 @@ class PsetOutput {
|
|
|
4084
4331
|
wasm.__wbg_psetoutput_free(ptr, 0);
|
|
4085
4332
|
}
|
|
4086
4333
|
/**
|
|
4334
|
+
* Get the script pubkey
|
|
4087
4335
|
* @returns {Script}
|
|
4088
4336
|
*/
|
|
4089
4337
|
scriptPubkey() {
|
|
4090
4338
|
const ret = wasm.psetoutput_scriptPubkey(this.__wbg_ptr);
|
|
4091
4339
|
return Script.__wrap(ret);
|
|
4092
4340
|
}
|
|
4341
|
+
/**
|
|
4342
|
+
* Get the explicit amount, if set
|
|
4343
|
+
* @returns {bigint | undefined}
|
|
4344
|
+
*/
|
|
4345
|
+
amount() {
|
|
4346
|
+
const ret = wasm.psetoutput_amount(this.__wbg_ptr);
|
|
4347
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
4348
|
+
}
|
|
4349
|
+
/**
|
|
4350
|
+
* Get the explicit asset ID, if set
|
|
4351
|
+
* @returns {AssetId | undefined}
|
|
4352
|
+
*/
|
|
4353
|
+
asset() {
|
|
4354
|
+
const ret = wasm.psetoutput_asset(this.__wbg_ptr);
|
|
4355
|
+
return ret === 0 ? undefined : AssetId.__wrap(ret);
|
|
4356
|
+
}
|
|
4357
|
+
/**
|
|
4358
|
+
* Get the blinder index, if set
|
|
4359
|
+
* @returns {number | undefined}
|
|
4360
|
+
*/
|
|
4361
|
+
blinderIndex() {
|
|
4362
|
+
const ret = wasm.psetoutput_blinderIndex(this.__wbg_ptr);
|
|
4363
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
4364
|
+
}
|
|
4093
4365
|
}
|
|
4094
4366
|
if (Symbol.dispose) PsetOutput.prototype[Symbol.dispose] = PsetOutput.prototype.free;
|
|
4095
4367
|
|
|
@@ -4517,6 +4789,14 @@ class Script {
|
|
|
4517
4789
|
ScriptFinalization.register(this, this.__wbg_ptr, this);
|
|
4518
4790
|
return this;
|
|
4519
4791
|
}
|
|
4792
|
+
/**
|
|
4793
|
+
* Creates an empty `Script`.
|
|
4794
|
+
* @returns {Script}
|
|
4795
|
+
*/
|
|
4796
|
+
static empty() {
|
|
4797
|
+
const ret = wasm.script_empty();
|
|
4798
|
+
return Script.__wrap(ret);
|
|
4799
|
+
}
|
|
4520
4800
|
/**
|
|
4521
4801
|
* Return the consensus encoded bytes of the script.
|
|
4522
4802
|
* @returns {Uint8Array}
|
|
@@ -4527,6 +4807,24 @@ class Script {
|
|
|
4527
4807
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
4528
4808
|
return v1;
|
|
4529
4809
|
}
|
|
4810
|
+
/**
|
|
4811
|
+
* Returns SHA256 of the script's consensus bytes.
|
|
4812
|
+
*
|
|
4813
|
+
* Returns an equivalent value to the `jet::input_script_hash(index)`/`jet::output_script_hash(index)`.
|
|
4814
|
+
* @returns {string}
|
|
4815
|
+
*/
|
|
4816
|
+
jet_sha256_hex() {
|
|
4817
|
+
let deferred1_0;
|
|
4818
|
+
let deferred1_1;
|
|
4819
|
+
try {
|
|
4820
|
+
const ret = wasm.script_jet_sha256_hex(this.__wbg_ptr);
|
|
4821
|
+
deferred1_0 = ret[0];
|
|
4822
|
+
deferred1_1 = ret[1];
|
|
4823
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
4824
|
+
} finally {
|
|
4825
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4530
4828
|
/**
|
|
4531
4829
|
* Return the string of the script showing op codes and their arguments.
|
|
4532
4830
|
*
|
|
@@ -4545,6 +4843,45 @@ class Script {
|
|
|
4545
4843
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
4546
4844
|
}
|
|
4547
4845
|
}
|
|
4846
|
+
/**
|
|
4847
|
+
* Creates an OP_RETURN script with the given data.
|
|
4848
|
+
* @param {Uint8Array} data
|
|
4849
|
+
* @returns {Script}
|
|
4850
|
+
*/
|
|
4851
|
+
static newOpReturn(data) {
|
|
4852
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
4853
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4854
|
+
const ret = wasm.script_newOpReturn(ptr0, len0);
|
|
4855
|
+
return Script.__wrap(ret);
|
|
4856
|
+
}
|
|
4857
|
+
/**
|
|
4858
|
+
* Returns true if the script is provably unspendable.
|
|
4859
|
+
*
|
|
4860
|
+
* A script is provably unspendable if it starts with OP_RETURN or is larger
|
|
4861
|
+
* than the maximum script size.
|
|
4862
|
+
* @returns {boolean}
|
|
4863
|
+
*/
|
|
4864
|
+
isProvablyUnspendable() {
|
|
4865
|
+
const ret = wasm.script_isProvablyUnspendable(this.__wbg_ptr);
|
|
4866
|
+
return ret !== 0;
|
|
4867
|
+
}
|
|
4868
|
+
/**
|
|
4869
|
+
* Returns true if this script_pubkey is provably SegWit.
|
|
4870
|
+
*
|
|
4871
|
+
* This checks if the script_pubkey is provably SegWit based on the
|
|
4872
|
+
* script_pubkey itself and an optional redeem_script.
|
|
4873
|
+
* @param {Script | null} [redeem_script]
|
|
4874
|
+
* @returns {boolean}
|
|
4875
|
+
*/
|
|
4876
|
+
isProvablySegwit(redeem_script) {
|
|
4877
|
+
let ptr0 = 0;
|
|
4878
|
+
if (!isLikeNone(redeem_script)) {
|
|
4879
|
+
_assertClass(redeem_script, Script);
|
|
4880
|
+
ptr0 = redeem_script.__destroy_into_raw();
|
|
4881
|
+
}
|
|
4882
|
+
const ret = wasm.script_isProvablySegwit(this.__wbg_ptr, ptr0);
|
|
4883
|
+
return ret !== 0;
|
|
4884
|
+
}
|
|
4548
4885
|
/**
|
|
4549
4886
|
* Return the string representation of the script (hex encoding of its consensus encoded bytes).
|
|
4550
4887
|
* This representation can be used to recreate the script via `new()`
|
|
@@ -4586,65 +4923,6 @@ class Signer {
|
|
|
4586
4923
|
const ptr = this.__destroy_into_raw();
|
|
4587
4924
|
wasm.__wbg_signer_free(ptr, 0);
|
|
4588
4925
|
}
|
|
4589
|
-
/**
|
|
4590
|
-
* AMP0 signer data for login
|
|
4591
|
-
* @returns {Amp0SignerData}
|
|
4592
|
-
*/
|
|
4593
|
-
amp0SignerData() {
|
|
4594
|
-
const ret = wasm.signer_amp0SignerData(this.__wbg_ptr);
|
|
4595
|
-
if (ret[2]) {
|
|
4596
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4597
|
-
}
|
|
4598
|
-
return Amp0SignerData.__wrap(ret[0]);
|
|
4599
|
-
}
|
|
4600
|
-
/**
|
|
4601
|
-
* AMP0 sign login challenge
|
|
4602
|
-
* @param {string} challenge
|
|
4603
|
-
* @returns {string}
|
|
4604
|
-
*/
|
|
4605
|
-
amp0SignChallenge(challenge) {
|
|
4606
|
-
let deferred3_0;
|
|
4607
|
-
let deferred3_1;
|
|
4608
|
-
try {
|
|
4609
|
-
const ptr0 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4610
|
-
const len0 = WASM_VECTOR_LEN;
|
|
4611
|
-
const ret = wasm.signer_amp0SignChallenge(this.__wbg_ptr, ptr0, len0);
|
|
4612
|
-
var ptr2 = ret[0];
|
|
4613
|
-
var len2 = ret[1];
|
|
4614
|
-
if (ret[3]) {
|
|
4615
|
-
ptr2 = 0; len2 = 0;
|
|
4616
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
4617
|
-
}
|
|
4618
|
-
deferred3_0 = ptr2;
|
|
4619
|
-
deferred3_1 = len2;
|
|
4620
|
-
return getStringFromWasm0(ptr2, len2);
|
|
4621
|
-
} finally {
|
|
4622
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
4623
|
-
}
|
|
4624
|
-
}
|
|
4625
|
-
/**
|
|
4626
|
-
* AMP0 account xpub
|
|
4627
|
-
* @param {number} account
|
|
4628
|
-
* @returns {string}
|
|
4629
|
-
*/
|
|
4630
|
-
amp0AccountXpub(account) {
|
|
4631
|
-
let deferred2_0;
|
|
4632
|
-
let deferred2_1;
|
|
4633
|
-
try {
|
|
4634
|
-
const ret = wasm.signer_amp0AccountXpub(this.__wbg_ptr, account);
|
|
4635
|
-
var ptr1 = ret[0];
|
|
4636
|
-
var len1 = ret[1];
|
|
4637
|
-
if (ret[3]) {
|
|
4638
|
-
ptr1 = 0; len1 = 0;
|
|
4639
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
4640
|
-
}
|
|
4641
|
-
deferred2_0 = ptr1;
|
|
4642
|
-
deferred2_1 = len1;
|
|
4643
|
-
return getStringFromWasm0(ptr1, len1);
|
|
4644
|
-
} finally {
|
|
4645
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
4646
|
-
}
|
|
4647
|
-
}
|
|
4648
4926
|
/**
|
|
4649
4927
|
* Creates a `Signer`
|
|
4650
4928
|
* @param {Mnemonic} mnemonic
|
|
@@ -4789,6 +5067,65 @@ class Signer {
|
|
|
4789
5067
|
}
|
|
4790
5068
|
return Mnemonic.__wrap(ret[0]);
|
|
4791
5069
|
}
|
|
5070
|
+
/**
|
|
5071
|
+
* AMP0 signer data for login
|
|
5072
|
+
* @returns {Amp0SignerData}
|
|
5073
|
+
*/
|
|
5074
|
+
amp0SignerData() {
|
|
5075
|
+
const ret = wasm.signer_amp0SignerData(this.__wbg_ptr);
|
|
5076
|
+
if (ret[2]) {
|
|
5077
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
5078
|
+
}
|
|
5079
|
+
return Amp0SignerData.__wrap(ret[0]);
|
|
5080
|
+
}
|
|
5081
|
+
/**
|
|
5082
|
+
* AMP0 sign login challenge
|
|
5083
|
+
* @param {string} challenge
|
|
5084
|
+
* @returns {string}
|
|
5085
|
+
*/
|
|
5086
|
+
amp0SignChallenge(challenge) {
|
|
5087
|
+
let deferred3_0;
|
|
5088
|
+
let deferred3_1;
|
|
5089
|
+
try {
|
|
5090
|
+
const ptr0 = passStringToWasm0(challenge, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5091
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5092
|
+
const ret = wasm.signer_amp0SignChallenge(this.__wbg_ptr, ptr0, len0);
|
|
5093
|
+
var ptr2 = ret[0];
|
|
5094
|
+
var len2 = ret[1];
|
|
5095
|
+
if (ret[3]) {
|
|
5096
|
+
ptr2 = 0; len2 = 0;
|
|
5097
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5098
|
+
}
|
|
5099
|
+
deferred3_0 = ptr2;
|
|
5100
|
+
deferred3_1 = len2;
|
|
5101
|
+
return getStringFromWasm0(ptr2, len2);
|
|
5102
|
+
} finally {
|
|
5103
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
5104
|
+
}
|
|
5105
|
+
}
|
|
5106
|
+
/**
|
|
5107
|
+
* AMP0 account xpub
|
|
5108
|
+
* @param {number} account
|
|
5109
|
+
* @returns {string}
|
|
5110
|
+
*/
|
|
5111
|
+
amp0AccountXpub(account) {
|
|
5112
|
+
let deferred2_0;
|
|
5113
|
+
let deferred2_1;
|
|
5114
|
+
try {
|
|
5115
|
+
const ret = wasm.signer_amp0AccountXpub(this.__wbg_ptr, account);
|
|
5116
|
+
var ptr1 = ret[0];
|
|
5117
|
+
var len1 = ret[1];
|
|
5118
|
+
if (ret[3]) {
|
|
5119
|
+
ptr1 = 0; len1 = 0;
|
|
5120
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5121
|
+
}
|
|
5122
|
+
deferred2_0 = ptr1;
|
|
5123
|
+
deferred2_1 = len1;
|
|
5124
|
+
return getStringFromWasm0(ptr1, len1);
|
|
5125
|
+
} finally {
|
|
5126
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
5127
|
+
}
|
|
5128
|
+
}
|
|
4792
5129
|
}
|
|
4793
5130
|
if (Symbol.dispose) Signer.prototype[Symbol.dispose] = Signer.prototype.free;
|
|
4794
5131
|
|
|
@@ -5026,7 +5363,7 @@ class TxBuilder {
|
|
|
5026
5363
|
*/
|
|
5027
5364
|
constructor(network) {
|
|
5028
5365
|
_assertClass(network, Network);
|
|
5029
|
-
const ret = wasm.
|
|
5366
|
+
const ret = wasm.network_txBuilder(network.__wbg_ptr);
|
|
5030
5367
|
this.__wbg_ptr = ret >>> 0;
|
|
5031
5368
|
TxBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
5032
5369
|
return this;
|
|
@@ -5355,6 +5692,19 @@ class TxOutSecrets {
|
|
|
5355
5692
|
const ptr = this.__destroy_into_raw();
|
|
5356
5693
|
wasm.__wbg_txoutsecrets_free(ptr, 0);
|
|
5357
5694
|
}
|
|
5695
|
+
/**
|
|
5696
|
+
* Creates a new `TxOutSecrets` for an explicit (unblinded) output.
|
|
5697
|
+
*
|
|
5698
|
+
* The blinding factors are set to zero.
|
|
5699
|
+
* @param {AssetId} asset_id
|
|
5700
|
+
* @param {bigint} value
|
|
5701
|
+
* @returns {TxOutSecrets}
|
|
5702
|
+
*/
|
|
5703
|
+
static fromExplicit(asset_id, value) {
|
|
5704
|
+
_assertClass(asset_id, AssetId);
|
|
5705
|
+
const ret = wasm.txoutsecrets_fromExplicit(asset_id.__wbg_ptr, value);
|
|
5706
|
+
return TxOutSecrets.__wrap(ret);
|
|
5707
|
+
}
|
|
5358
5708
|
/**
|
|
5359
5709
|
* Return the asset of the output.
|
|
5360
5710
|
* @returns {AssetId}
|
|
@@ -6590,6 +6940,11 @@ exports.__wbg_arrayBuffer_9c99b8e2809e8cbb = function() { return handleError(fun
|
|
|
6590
6940
|
return ret;
|
|
6591
6941
|
}, arguments) };
|
|
6592
6942
|
|
|
6943
|
+
exports.__wbg_assetid_new = function(arg0) {
|
|
6944
|
+
const ret = AssetId.__wrap(arg0);
|
|
6945
|
+
return ret;
|
|
6946
|
+
};
|
|
6947
|
+
|
|
6593
6948
|
exports.__wbg_assetmeta_new = function(arg0) {
|
|
6594
6949
|
const ret = AssetMeta.__wrap(arg0);
|
|
6595
6950
|
return ret;
|
|
@@ -6722,6 +7077,14 @@ exports.__wbg_get_458e874b43b18b25 = function() { return handleError(function (a
|
|
|
6722
7077
|
return ret;
|
|
6723
7078
|
}, arguments) };
|
|
6724
7079
|
|
|
7080
|
+
exports.__wbg_get_f73bb45577f88031 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
7081
|
+
const ret = arg1.get(getStringFromWasm0(arg2, arg3));
|
|
7082
|
+
var ptr1 = isLikeNone(ret) ? 0 : passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
7083
|
+
var len1 = WASM_VECTOR_LEN;
|
|
7084
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
7085
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
7086
|
+
}, arguments) };
|
|
7087
|
+
|
|
6725
7088
|
exports.__wbg_has_b89e451f638123e3 = function() { return handleError(function (arg0, arg1) {
|
|
6726
7089
|
const ret = Reflect.has(arg0, arg1);
|
|
6727
7090
|
return ret;
|
|
@@ -6848,7 +7211,7 @@ exports.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
|
|
|
6848
7211
|
return ret;
|
|
6849
7212
|
};
|
|
6850
7213
|
|
|
6851
|
-
exports.
|
|
7214
|
+
exports.__wbg_log_7889594dfd0d33ca = function(arg0, arg1) {
|
|
6852
7215
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
6853
7216
|
};
|
|
6854
7217
|
|
|
@@ -6884,7 +7247,7 @@ exports.__wbg_new_2e3c58a15f39f5f9 = function(arg0, arg1) {
|
|
|
6884
7247
|
const a = state0.a;
|
|
6885
7248
|
state0.a = 0;
|
|
6886
7249
|
try {
|
|
6887
|
-
return
|
|
7250
|
+
return __wbg_adapter_678(a, state0.b, arg0, arg1);
|
|
6888
7251
|
} finally {
|
|
6889
7252
|
state0.a = a;
|
|
6890
7253
|
}
|
|
@@ -7055,6 +7418,10 @@ exports.__wbg_push_330b2eb93e4e1212 = function(arg0, arg1) {
|
|
|
7055
7418
|
return ret;
|
|
7056
7419
|
};
|
|
7057
7420
|
|
|
7421
|
+
exports.__wbg_put_cc75277821cdd6b8 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
7422
|
+
arg0.put(getStringFromWasm0(arg1, arg2), getArrayU8FromWasm0(arg3, arg4));
|
|
7423
|
+
}, arguments) };
|
|
7424
|
+
|
|
7058
7425
|
exports.__wbg_queueMicrotask_25d0739ac89e8c88 = function(arg0) {
|
|
7059
7426
|
queueMicrotask(arg0);
|
|
7060
7427
|
};
|
|
@@ -7101,6 +7468,10 @@ exports.__wbg_registry_new = function(arg0) {
|
|
|
7101
7468
|
return ret;
|
|
7102
7469
|
};
|
|
7103
7470
|
|
|
7471
|
+
exports.__wbg_remove_d275ae23515119c8 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
7472
|
+
arg0.remove(getStringFromWasm0(arg1, arg2));
|
|
7473
|
+
}, arguments) };
|
|
7474
|
+
|
|
7104
7475
|
exports.__wbg_requestDevice_225891d9a80a7b19 = function(arg0, arg1) {
|
|
7105
7476
|
const ret = arg0.requestDevice(arg1);
|
|
7106
7477
|
return ret;
|
|
@@ -7428,21 +7799,15 @@ exports.__wbg_xpub_new = function(arg0) {
|
|
|
7428
7799
|
return ret;
|
|
7429
7800
|
};
|
|
7430
7801
|
|
|
7431
|
-
exports.
|
|
7432
|
-
// Cast intrinsic for `
|
|
7433
|
-
const ret =
|
|
7802
|
+
exports.__wbindgen_cast_1cc4fdd2f159de97 = function(arg0, arg1) {
|
|
7803
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1210, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7804
|
+
const ret = makeMutClosure(arg0, arg1, 1210, __wbg_adapter_9);
|
|
7434
7805
|
return ret;
|
|
7435
7806
|
};
|
|
7436
7807
|
|
|
7437
|
-
exports.
|
|
7438
|
-
// Cast intrinsic for `
|
|
7439
|
-
const ret =
|
|
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);
|
|
7808
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
7809
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
7810
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
7446
7811
|
return ret;
|
|
7447
7812
|
};
|
|
7448
7813
|
|
|
@@ -7452,45 +7817,45 @@ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
|
7452
7817
|
return ret;
|
|
7453
7818
|
};
|
|
7454
7819
|
|
|
7455
|
-
exports.
|
|
7456
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7457
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7820
|
+
exports.__wbindgen_cast_4a32eb107c538612 = function(arg0, arg1) {
|
|
7821
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 854, function: Function { arguments: [NamedExternref("HIDInputReportEvent")], shim_idx: 855, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7822
|
+
const ret = makeMutClosure(arg0, arg1, 854, __wbg_adapter_28);
|
|
7458
7823
|
return ret;
|
|
7459
7824
|
};
|
|
7460
7825
|
|
|
7461
|
-
exports.
|
|
7462
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7463
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7826
|
+
exports.__wbindgen_cast_82b35546cfba6ba9 = function(arg0, arg1) {
|
|
7827
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1210, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 1211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7828
|
+
const ret = makeMutClosure(arg0, arg1, 1210, __wbg_adapter_9);
|
|
7464
7829
|
return ret;
|
|
7465
7830
|
};
|
|
7466
7831
|
|
|
7467
|
-
exports.
|
|
7468
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7469
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7832
|
+
exports.__wbindgen_cast_82fca60108194369 = function(arg0, arg1) {
|
|
7833
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1467, function: Function { arguments: [], shim_idx: 1468, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7834
|
+
const ret = makeMutClosure(arg0, arg1, 1467, __wbg_adapter_25);
|
|
7470
7835
|
return ret;
|
|
7471
7836
|
};
|
|
7472
7837
|
|
|
7473
|
-
exports.
|
|
7474
|
-
// Cast intrinsic for `
|
|
7475
|
-
const ret = arg0;
|
|
7838
|
+
exports.__wbindgen_cast_8c9414a833bf848b = function(arg0, arg1) {
|
|
7839
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1919, function: Function { arguments: [], shim_idx: 1920, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7840
|
+
const ret = makeMutClosure(arg0, arg1, 1919, __wbg_adapter_14);
|
|
7476
7841
|
return ret;
|
|
7477
7842
|
};
|
|
7478
7843
|
|
|
7479
|
-
exports.
|
|
7480
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7481
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7844
|
+
exports.__wbindgen_cast_95fb92c9f38f0051 = function(arg0, arg1) {
|
|
7845
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1954, function: Function { arguments: [Externref], shim_idx: 1965, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7846
|
+
const ret = makeMutClosure(arg0, arg1, 1954, __wbg_adapter_6);
|
|
7482
7847
|
return ret;
|
|
7483
7848
|
};
|
|
7484
7849
|
|
|
7485
|
-
exports.
|
|
7486
|
-
// Cast intrinsic for `
|
|
7487
|
-
const ret =
|
|
7850
|
+
exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
7851
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
7852
|
+
const ret = arg0;
|
|
7488
7853
|
return ret;
|
|
7489
7854
|
};
|
|
7490
7855
|
|
|
7491
|
-
exports.
|
|
7492
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
7493
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
7856
|
+
exports.__wbindgen_cast_c19f87c9f32561d7 = function(arg0, arg1) {
|
|
7857
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1210, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7858
|
+
const ret = makeMutClosure(arg0, arg1, 1210, __wbg_adapter_9);
|
|
7494
7859
|
return ret;
|
|
7495
7860
|
};
|
|
7496
7861
|
|
|
@@ -7500,6 +7865,12 @@ exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
|
7500
7865
|
return ret;
|
|
7501
7866
|
};
|
|
7502
7867
|
|
|
7868
|
+
exports.__wbindgen_cast_d0dca845d4d81404 = function(arg0, arg1) {
|
|
7869
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1210, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1211, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
7870
|
+
const ret = makeMutClosure(arg0, arg1, 1210, __wbg_adapter_9);
|
|
7871
|
+
return ret;
|
|
7872
|
+
};
|
|
7873
|
+
|
|
7503
7874
|
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
7504
7875
|
// Cast intrinsic for `F64 -> Externref`.
|
|
7505
7876
|
const ret = arg0;
|
package/lwk_wasm_bg.wasm
CHANGED
|
Binary file
|