lwk_node 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lwk_wasm.d.ts +68 -19
- package/lwk_wasm.js +564 -167
- package/lwk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
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
|
* Wallet chain
|
|
5
6
|
*/
|
|
@@ -37,7 +38,7 @@ export class Address {
|
|
|
37
38
|
* and use styling to scale up the image in the browser. eg
|
|
38
39
|
* `style="image-rendering: pixelated; border: 20px solid white;"`
|
|
39
40
|
*/
|
|
40
|
-
QRCodeUri(pixel_per_module?: number): string;
|
|
41
|
+
QRCodeUri(pixel_per_module?: number | null): string;
|
|
41
42
|
/**
|
|
42
43
|
* Returns a string of the QR code printable in a terminal environment
|
|
43
44
|
*/
|
|
@@ -85,6 +86,12 @@ export class AssetId {
|
|
|
85
86
|
constructor(asset_id: string);
|
|
86
87
|
toString(): string;
|
|
87
88
|
}
|
|
89
|
+
export class AssetMeta {
|
|
90
|
+
private constructor();
|
|
91
|
+
free(): void;
|
|
92
|
+
contract(): Contract;
|
|
93
|
+
tx(): Transaction;
|
|
94
|
+
}
|
|
88
95
|
/**
|
|
89
96
|
* wrapper over [`lwk_common::Bip`]
|
|
90
97
|
*/
|
|
@@ -186,6 +193,29 @@ export class Jade {
|
|
|
186
193
|
keyoriginXpub(bip: Bip): Promise<string>;
|
|
187
194
|
registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
|
|
188
195
|
}
|
|
196
|
+
export class LedgerWeb {
|
|
197
|
+
free(): void;
|
|
198
|
+
/**
|
|
199
|
+
* hid_device must be already opened
|
|
200
|
+
*/
|
|
201
|
+
constructor(hid_device: HIDDevice, network: Network);
|
|
202
|
+
getVersion(): Promise<string>;
|
|
203
|
+
deriveXpub(path: string): Promise<string>;
|
|
204
|
+
slip77MasterBlindingKey(): Promise<string>;
|
|
205
|
+
fingerprint(): Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
* TODO Should use Signer::wpkh_slip77_descriptor
|
|
208
|
+
*/
|
|
209
|
+
wpkhSlip77Descriptor(): Promise<WolletDescriptor>;
|
|
210
|
+
/**
|
|
211
|
+
* Sign and consume the given PSET, returning the signed one
|
|
212
|
+
*/
|
|
213
|
+
sign(pset: Pset): Promise<Pset>;
|
|
214
|
+
/**
|
|
215
|
+
* Return a single sig address with the given `variant` and `index`
|
|
216
|
+
*/
|
|
217
|
+
getReceiveAddressSingle(index: number): Promise<string>;
|
|
218
|
+
}
|
|
189
219
|
/**
|
|
190
220
|
* Wrapper of [`bip39::Mnemonic`]
|
|
191
221
|
*/
|
|
@@ -224,11 +254,13 @@ export class Network {
|
|
|
224
254
|
*/
|
|
225
255
|
static regtest(policy_asset: AssetId): Network;
|
|
226
256
|
/**
|
|
227
|
-
* Creates the default regtest `Network`
|
|
257
|
+
* Creates the default regtest `Network` with the policy asset `5ac9f65c0efcc4775e0baec4ec03abdde22473cd3cf33c0419ca290e0751b225`
|
|
228
258
|
*/
|
|
229
259
|
static regtestDefault(): Network;
|
|
230
260
|
defaultEsploraClient(): EsploraClient;
|
|
231
261
|
isMainnet(): boolean;
|
|
262
|
+
isTestnet(): boolean;
|
|
263
|
+
isRegtest(): boolean;
|
|
232
264
|
toString(): string;
|
|
233
265
|
policyAsset(): AssetId;
|
|
234
266
|
txBuilder(): TxBuilder;
|
|
@@ -279,7 +311,7 @@ export class Pset {
|
|
|
279
311
|
toString(): string;
|
|
280
312
|
extractTx(): Transaction;
|
|
281
313
|
combine(other: Pset): void;
|
|
282
|
-
inputs():
|
|
314
|
+
inputs(): PsetInput[];
|
|
283
315
|
}
|
|
284
316
|
/**
|
|
285
317
|
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetBalance`]
|
|
@@ -292,7 +324,7 @@ export class PsetBalance {
|
|
|
292
324
|
* The net balance for every asset with respect of the wallet asking the pset details
|
|
293
325
|
*/
|
|
294
326
|
balances(): any;
|
|
295
|
-
recipients():
|
|
327
|
+
recipients(): Recipient[];
|
|
296
328
|
}
|
|
297
329
|
/**
|
|
298
330
|
* PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetDetails`]
|
|
@@ -304,13 +336,13 @@ export class PsetDetails {
|
|
|
304
336
|
/**
|
|
305
337
|
* For each input existing or missing signatures
|
|
306
338
|
*/
|
|
307
|
-
signatures():
|
|
308
|
-
fingerprintsMissing():
|
|
309
|
-
fingerprintsHas():
|
|
339
|
+
signatures(): PsetSignatures[];
|
|
340
|
+
fingerprintsMissing(): string[];
|
|
341
|
+
fingerprintsHas(): string[];
|
|
310
342
|
/**
|
|
311
343
|
* Return an element for every input that could possibly be a issuance or a reissuance
|
|
312
344
|
*/
|
|
313
|
-
inputsIssuances():
|
|
345
|
+
inputsIssuances(): Issuance[];
|
|
314
346
|
}
|
|
315
347
|
/**
|
|
316
348
|
* PSET input
|
|
@@ -358,6 +390,19 @@ export class Recipient {
|
|
|
358
390
|
address(): Address | undefined;
|
|
359
391
|
vout(): number;
|
|
360
392
|
}
|
|
393
|
+
export class Registry {
|
|
394
|
+
private constructor();
|
|
395
|
+
free(): void;
|
|
396
|
+
static new(url: string): Registry;
|
|
397
|
+
static defaultForNetwork(network: Network): Registry;
|
|
398
|
+
fetchWithTx(asset_id: AssetId, client: EsploraClient): Promise<AssetMeta>;
|
|
399
|
+
post(data: RegistryPost): Promise<void>;
|
|
400
|
+
}
|
|
401
|
+
export class RegistryPost {
|
|
402
|
+
free(): void;
|
|
403
|
+
constructor(contract: Contract, asset_id: AssetId);
|
|
404
|
+
toString(): string;
|
|
405
|
+
}
|
|
361
406
|
/**
|
|
362
407
|
* Wrapper of [`elements::Script`]
|
|
363
408
|
*/
|
|
@@ -384,6 +429,10 @@ export class Signer {
|
|
|
384
429
|
* Sign and consume the given PSET, returning the signed one
|
|
385
430
|
*/
|
|
386
431
|
sign(pset: Pset): Pset;
|
|
432
|
+
/**
|
|
433
|
+
* Sign a message with the master key, return the signature as a base64 string
|
|
434
|
+
*/
|
|
435
|
+
signMessage(message: string): string;
|
|
387
436
|
wpkhSlip77Descriptor(): WolletDescriptor;
|
|
388
437
|
getMasterXpub(): Xpub;
|
|
389
438
|
keyoriginXpub(bip: Bip): string;
|
|
@@ -437,7 +486,7 @@ export class TxBuilder {
|
|
|
437
486
|
/**
|
|
438
487
|
* Set the fee rate
|
|
439
488
|
*/
|
|
440
|
-
feeRate(fee_rate?: number): TxBuilder;
|
|
489
|
+
feeRate(fee_rate?: number | null): TxBuilder;
|
|
441
490
|
/**
|
|
442
491
|
* Select all available L-BTC inputs
|
|
443
492
|
*/
|
|
@@ -465,15 +514,15 @@ export class TxBuilder {
|
|
|
465
514
|
/**
|
|
466
515
|
* Issue an asset, wrapper of [`lwk_wollet::TxBuilder::issue_asset()`]
|
|
467
516
|
*/
|
|
468
|
-
issueAsset(asset_sats: bigint, asset_receiver: Address | undefined, token_sats: bigint, token_receiver?: Address, contract?: Contract): TxBuilder;
|
|
517
|
+
issueAsset(asset_sats: bigint, asset_receiver: Address | null | undefined, token_sats: bigint, token_receiver?: Address | null, contract?: Contract | null): TxBuilder;
|
|
469
518
|
/**
|
|
470
519
|
* Reissue an asset, wrapper of [`lwk_wollet::TxBuilder::reissue_asset()`]
|
|
471
520
|
*/
|
|
472
|
-
reissueAsset(asset_to_reissue: AssetId, satoshi_to_reissue: bigint, asset_receiver?: Address, issuance_tx?: Transaction): TxBuilder;
|
|
521
|
+
reissueAsset(asset_to_reissue: AssetId, satoshi_to_reissue: bigint, asset_receiver?: Address | null, issuance_tx?: Transaction | null): TxBuilder;
|
|
473
522
|
/**
|
|
474
523
|
* Manual coin selection, wrapper of [`lwk_wollet::TxBuilder::set_wallet_utxos()`]
|
|
475
524
|
*/
|
|
476
|
-
setWalletUtxos(outpoints:
|
|
525
|
+
setWalletUtxos(outpoints: OutPoint[]): TxBuilder;
|
|
477
526
|
toString(): string;
|
|
478
527
|
}
|
|
479
528
|
/**
|
|
@@ -528,8 +577,8 @@ export class WalletTx {
|
|
|
528
577
|
fee(): bigint;
|
|
529
578
|
txType(): string;
|
|
530
579
|
timestamp(): number | undefined;
|
|
531
|
-
inputs():
|
|
532
|
-
outputs():
|
|
580
|
+
inputs(): OptionWalletTxOut[];
|
|
581
|
+
outputs(): OptionWalletTxOut[];
|
|
533
582
|
unblindedUrl(explorer_url: string): string;
|
|
534
583
|
}
|
|
535
584
|
/**
|
|
@@ -561,19 +610,19 @@ export class Wollet {
|
|
|
561
610
|
* If Some return the address at the given index,
|
|
562
611
|
* otherwise the last unused address.
|
|
563
612
|
*/
|
|
564
|
-
address(index?: number): AddressResult;
|
|
613
|
+
address(index?: number | null): AddressResult;
|
|
565
614
|
addressFullPath(index: number): Uint32Array;
|
|
566
615
|
applyUpdate(update: Update): void;
|
|
567
616
|
balance(): any;
|
|
568
|
-
transactions():
|
|
617
|
+
transactions(): WalletTx[];
|
|
569
618
|
/**
|
|
570
619
|
* Get the unspent transaction outputs of the wallet
|
|
571
620
|
*/
|
|
572
|
-
utxos():
|
|
621
|
+
utxos(): WalletTxOut[];
|
|
573
622
|
/**
|
|
574
623
|
* Get all the transaction outputs of the wallet, both spent and unspent
|
|
575
624
|
*/
|
|
576
|
-
txos():
|
|
625
|
+
txos(): WalletTxOut[];
|
|
577
626
|
/**
|
|
578
627
|
* Finalize and consume the given PSET, returning the finalized one
|
|
579
628
|
*/
|
|
@@ -597,7 +646,7 @@ export class WolletDescriptor {
|
|
|
597
646
|
*/
|
|
598
647
|
constructor(descriptor: string);
|
|
599
648
|
toString(): string;
|
|
600
|
-
static newMultiWshSlip77(threshold: number, participants:
|
|
649
|
+
static newMultiWshSlip77(threshold: number, participants: string[]): WolletDescriptor;
|
|
601
650
|
isMainnet(): boolean;
|
|
602
651
|
}
|
|
603
652
|
/**
|