lwk_node 0.11.1 → 0.12.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 CHANGED
@@ -16,24 +16,40 @@ export enum Chain {
16
16
  Internal = 1,
17
17
  }
18
18
  /**
19
- * Wrapper of [`elements::Address`]
19
+ * An Elements (Liquid) address
20
20
  */
21
21
  export class Address {
22
22
  free(): void;
23
23
  /**
24
24
  * Creates an `Address`
25
25
  *
26
- * If you know the network, you can use [`Address::parse()`] to validate that the network is consistent.
26
+ * If you know the network, you can use `parse()` to validate that the network is consistent.
27
27
  */
28
28
  constructor(s: string);
29
29
  /**
30
30
  * Parses an `Address` ensuring is for the right network
31
31
  */
32
32
  static parse(s: string, network: Network): Address;
33
+ /**
34
+ * Return the script pubkey of the address.
35
+ */
33
36
  scriptPubkey(): Script;
37
+ /**
38
+ * Return true if the address is blinded, in other words, if it has a blinding key.
39
+ */
34
40
  isBlinded(): boolean;
41
+ /**
42
+ * Return true if the address is for mainnet.
43
+ */
35
44
  isMainnet(): boolean;
45
+ /**
46
+ * Return the unconfidential address, in other words, the address without the blinding key.
47
+ */
36
48
  toUnconfidential(): Address;
49
+ /**
50
+ * Return the string representation of the address.
51
+ * This representation can be used to recreate the address via `new()`
52
+ */
37
53
  toString(): string;
38
54
  /**
39
55
  * Returns a string encoding an image in a uri
@@ -51,16 +67,43 @@ export class Address {
51
67
  QRCodeText(): string;
52
68
  }
53
69
  /**
54
- * Wrapper of [`lwk_wollet::AddressResult`]
70
+ * Value returned from asking an address to the wallet.
71
+ * Containing the confidential address and its
72
+ * derivation index (the last element in the derivation path)
55
73
  */
56
74
  export class AddressResult {
57
75
  private constructor();
58
76
  free(): void;
77
+ /**
78
+ * Return the address.
79
+ */
59
80
  address(): Address;
81
+ /**
82
+ * Return the derivation index of the address.
83
+ */
60
84
  index(): number;
61
85
  }
62
86
  /**
63
- * Wrapper of [`lwk_wollet::amp0::Amp0`]
87
+ * Context for actions related to an AMP0 (sub)account
88
+ *
89
+ * <div class="warning">
90
+ * <b>WARNING:</b>
91
+ *
92
+ * AMP0 is based on a legacy system, and some things do not fit precisely the way LWK allows to do
93
+ * things.
94
+ *
95
+ * Callers must be careful with the following:
96
+ * * <b>Addresses: </b>
97
+ * to get addresses use [`Amp0::address()`]. This ensures
98
+ * that all addresses used are correctly monitored by the AMP0 server.
99
+ * * <b>Syncing: </b>
100
+ * to sync the AMP0 [`crate::Wollet`], use [`Amp0::last_index()`] and [`crate::clients::blocking::BlockchainBackend::full_scan_to_index()`]. This ensures that all utxos are synced, even if there are gaps between higher than the GAP LIMIT.
101
+ *
102
+ * <i>
103
+ * Failing to do the above might lead to inconsistent states, where funds are not shown or they
104
+ * cannot be spent!
105
+ * </i>
106
+ * </div>
64
107
  */
65
108
  export class Amp0 {
66
109
  private constructor();
@@ -103,7 +146,64 @@ export class Amp0 {
103
146
  sign(amp0pset: Amp0Pset): Promise<Transaction>;
104
147
  }
105
148
  /**
106
- * Wrapper of [`lwk_wollet::amp0::Amp0Pset`]
149
+ * Session connecting to AMP0
150
+ */
151
+ export class Amp0Connected {
152
+ free(): void;
153
+ /**
154
+ * Connect and register to AMP0
155
+ */
156
+ constructor(network: Network, signer_data: Amp0SignerData);
157
+ /**
158
+ * Obtain a login challenge
159
+ *
160
+ * This must be signed with [`amp0_sign_challenge()`].
161
+ */
162
+ getChallenge(): Promise<string>;
163
+ /**
164
+ * Log in
165
+ *
166
+ * `sig` must be obtained from [`amp0_sign_challenge()`] called with the value returned
167
+ * by [`Amp0Connected::get_challenge()`]
168
+ */
169
+ login(sig: string): Promise<Amp0LoggedIn>;
170
+ }
171
+ /**
172
+ * Session logged in AMP0
173
+ */
174
+ export class Amp0LoggedIn {
175
+ private constructor();
176
+ free(): void;
177
+ /**
178
+ * List of AMP IDs.
179
+ */
180
+ getAmpIds(): string[];
181
+ /**
182
+ * Get the next account for AMP0 account creation
183
+ *
184
+ * This must be given to [`amp0_account_xpub()`] to obtain the xpub to pass to
185
+ * [`Amp0LoggedIn::create_amp0_account()`]
186
+ */
187
+ nextAccount(): number;
188
+ /**
189
+ * Create a new AMP0 account
190
+ *
191
+ * `account_xpub` must be obtained from [`amp0_account_xpub()`] called with the value obtained from
192
+ * [`Amp0LoggedIn::next_account()`]
193
+ */
194
+ createAmp0Account(pointer: number, account_xpub: string): Promise<string>;
195
+ /**
196
+ * Create a new Watch-Only entry for this wallet
197
+ */
198
+ createWatchOnly(username: string, password: string): Promise<void>;
199
+ }
200
+ /**
201
+ * A PSET to use with AMP0
202
+ *
203
+ * When asking AMP0 to cosign, the caller must pass some extra data that does not belong to the
204
+ * PSET. This struct holds and manage the necessary data.
205
+ *
206
+ * If you're not dealing with AMP0, do not use this struct.
107
207
  */
108
208
  export class Amp0Pset {
109
209
  free(): void;
@@ -120,28 +220,50 @@ export class Amp0Pset {
120
220
  */
121
221
  blindingNonces(): string[];
122
222
  }
223
+ export class Amp0SignerData {
224
+ private constructor();
225
+ free(): void;
226
+ }
123
227
  /**
124
- * Wrapper of [`lwk_wollet::amp2::Amp2`]
228
+ * Context for actions interacting with Asset Management Platform version 2
125
229
  */
126
230
  export class Amp2 {
127
231
  private constructor();
128
232
  free(): void;
233
+ /**
234
+ * Create a new AMP2 client with the default url and server key for the testnet network.
235
+ */
129
236
  static newTestnet(): Amp2;
237
+ /**
238
+ * Get an AMP2 wallet descriptor from the keyorigin xpub string obtained from a signer
239
+ */
130
240
  descriptorFromStr(keyorigin_xpub: string): Amp2Descriptor;
241
+ /**
242
+ * Register an AMP2 wallet with the AMP2 server
243
+ */
131
244
  register(desc: Amp2Descriptor): Promise<string>;
245
+ /**
246
+ * Ask the AMP2 server to cosign a PSET
247
+ */
132
248
  cosign(pset: Pset): Promise<Pset>;
133
249
  }
134
250
  /**
135
- * Wrapper of [`lwk_wollet::amp2::Amp2Descriptor`]
251
+ * An Asset Management Platform version 2 descriptor
136
252
  */
137
253
  export class Amp2Descriptor {
138
254
  private constructor();
139
255
  free(): void;
256
+ /**
257
+ * Return the descriptor as a `WolletDescriptor`
258
+ */
140
259
  descriptor(): WolletDescriptor;
260
+ /**
261
+ * Return the string representation of the descriptor.
262
+ */
141
263
  toString(): string;
142
264
  }
143
265
  /**
144
- * Wrapper of [`lwk_wollet::AssetAmount`]
266
+ * An asset identifier and an amount in satoshi units
145
267
  */
146
268
  export class AssetAmount {
147
269
  private constructor();
@@ -150,7 +272,7 @@ export class AssetAmount {
150
272
  asset(): AssetId;
151
273
  }
152
274
  /**
153
- * A valid asset identifier. wrapper of [`elements::AssetId`]
275
+ * A valid asset identifier.
154
276
  *
155
277
  * 32 bytes encoded as hex string.
156
278
  */
@@ -160,25 +282,69 @@ export class AssetId {
160
282
  * Creates an `AssetId`
161
283
  */
162
284
  constructor(asset_id: string);
285
+ /**
286
+ * Return the string representation of the asset identifier (64 hex characters).
287
+ * This representation can be used to recreate the asset identifier via `new()`
288
+ */
163
289
  toString(): string;
164
290
  }
165
291
  /**
166
- * A collection of asset identifiers. wrapper of [`Vec<elements::AssetId>`]
292
+ * An ordered collection of asset identifiers.
167
293
  */
168
294
  export class AssetIds {
169
295
  private constructor();
170
296
  free(): void;
297
+ /**
298
+ * Return an empty list of asset identifiers.
299
+ */
171
300
  static empty(): AssetIds;
301
+ /**
302
+ * Return the string representation of this list of asset identifiers.
303
+ */
172
304
  toString(): string;
173
305
  }
306
+ /**
307
+ * Data related to an asset in the registry:
308
+ * - contract: the contract of the asset
309
+ * - tx: the issuance transaction of the asset
310
+ */
174
311
  export class AssetMeta {
175
312
  private constructor();
176
313
  free(): void;
314
+ /**
315
+ * Return the contract of the asset.
316
+ */
177
317
  contract(): Contract;
318
+ /**
319
+ * Return the issuance transaction of the asset.
320
+ */
178
321
  tx(): Transaction;
179
322
  }
180
323
  /**
181
- * wrapper over [`lwk_common::Bip`]
324
+ * A signed balance of assets, to represent a balance with negative values such
325
+ * as the results of a transaction from the perspective of a wallet.
326
+ */
327
+ export class Balance {
328
+ private constructor();
329
+ free(): void;
330
+ /**
331
+ * Convert the balance to a JsValue for serialization
332
+ *
333
+ * Note: the amounts are strings since `JSON.stringify` cannot handle `BigInt`s.
334
+ * Use `entries()` to get the raw data.
335
+ */
336
+ toJSON(): any;
337
+ /**
338
+ * Returns the balance as an array of [key, value] pairs.
339
+ */
340
+ entries(): any;
341
+ /**
342
+ * Return the string representation of the balance.
343
+ */
344
+ toString(): string;
345
+ }
346
+ /**
347
+ * The bip variant for a descriptor like specified in the bips (49, 84, 87)
182
348
  */
183
349
  export class Bip {
184
350
  private constructor();
@@ -195,10 +361,13 @@ export class Bip {
195
361
  * Creates a bip87 variant
196
362
  */
197
363
  static bip87(): Bip;
364
+ /**
365
+ * Return the string representation of the bip variant, such as "bip49", "bip84" or "bip87"
366
+ */
198
367
  toString(): string;
199
368
  }
200
369
  /**
201
- * Wrapper of [`lwk_wollet::Contract`]
370
+ * A contract defining metadata of an asset such the name and the ticker
202
371
  */
203
372
  export class Contract {
204
373
  free(): void;
@@ -206,43 +375,110 @@ export class Contract {
206
375
  * Creates a `Contract`
207
376
  */
208
377
  constructor(domain: string, issuer_pubkey: string, name: string, precision: number, ticker: string, version: number);
378
+ /**
379
+ * Return the string representation of the contract.
380
+ */
209
381
  toString(): string;
382
+ /**
383
+ * Return the domain of the issuer of the contract.
384
+ */
210
385
  domain(): string;
386
+ /**
387
+ * Make a copy of the contract.
388
+ *
389
+ * This is needed to pass it to a function that requires a `Contract` (without borrowing)
390
+ * but you need the same contract after that call.
391
+ */
211
392
  clone(): Contract;
212
393
  }
213
394
  /**
214
- * Wrapper of [`asyncr::EsploraClient`]
395
+ * A blockchain backend implementation based on the
396
+ * [esplora HTTP API](https://github.com/blockstream/esplora/blob/master/API.md).
397
+ * But can also use the [waterfalls](https://github.com/RCasatta/waterfalls)
398
+ * endpoint to speed up the scan if supported by the server.
215
399
  */
216
400
  export class EsploraClient {
217
401
  free(): void;
218
402
  /**
219
- * Creates a client, wrapper of [`asyncr::EsploraClient`]
403
+ * Creates an Esplora client with the given options
220
404
  */
221
405
  constructor(network: Network, url: string, waterfalls: boolean, concurrency: number, utxo_only: boolean);
406
+ /**
407
+ * Scan the blockchain for the scripts generated by a watch-only wallet
408
+ *
409
+ * This method scans both external and internal address chains, stopping after finding
410
+ * 20 consecutive unused addresses (the gap limit) as recommended by
411
+ * [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#address-gap-limit).
412
+ *
413
+ * Returns `Some(Update)` if any changes were found during scanning, or `None` if no changes
414
+ * were detected.
415
+ *
416
+ * To scan beyond the gap limit use `full_scan_to_index()` instead.
417
+ */
222
418
  fullScan(wollet: Wollet): Promise<Update | undefined>;
223
419
  /**
224
420
  * Scan the blockchain for the scripts generated by a watch-only wallet up to a specified derivation index
421
+ *
422
+ * While `full_scan()` stops after finding 20 consecutive unused addresses (the gap limit),
423
+ * this method will scan at least up to the given derivation index. This is useful to prevent
424
+ * missing funds in cases where outputs exist beyond the gap limit.
425
+ *
426
+ * Will scan both external and internal address chains up to the given index for maximum safety,
427
+ * even though internal addresses may not need such deep scanning.
428
+ *
429
+ * If transactions are found beyond the gap limit during this scan, subsequent calls to
430
+ * `full_scan()` will automatically scan up to the highest used index, preventing any
431
+ * previously-found transactions from being missed.
432
+ *
433
+ * See `full_scan_to_index()` for a blocking version of this method.
225
434
  */
226
435
  fullScanToIndex(wollet: Wollet, index: number): Promise<Update | undefined>;
436
+ /**
437
+ * Broadcast a transaction to the network so that a miner can include it in a block.
438
+ */
227
439
  broadcastTx(tx: Transaction): Promise<Txid>;
440
+ /**
441
+ * Broadcast a PSET by extracting the transaction from the PSET and broadcasting it.
442
+ */
228
443
  broadcast(pset: Pset): Promise<Txid>;
444
+ /**
445
+ * Set the waterfalls server recipient key. This is used to encrypt the descriptor when calling the waterfalls endpoint.
446
+ */
229
447
  setWaterfallsServerRecipient(recipient: string): Promise<void>;
230
448
  }
231
449
  /**
232
- * PSET details from a perspective of a wallet, wrapper of [`lwk_common::Issuance`]
450
+ * The details of an issuance or reissuance.
233
451
  */
234
452
  export class Issuance {
235
453
  private constructor();
236
454
  free(): void;
455
+ /**
456
+ * Return the asset id or None if it's a null issuance
457
+ */
237
458
  asset(): AssetId | undefined;
459
+ /**
460
+ * Return the token id or None if it's a null issuance
461
+ */
238
462
  token(): AssetId | undefined;
463
+ /**
464
+ * Return the previous output index or None if it's a null issuance
465
+ */
239
466
  prevVout(): number | undefined;
467
+ /**
468
+ * Return the previous transaction id or None if it's a null issuance
469
+ */
240
470
  prevTxid(): Txid | undefined;
471
+ /**
472
+ * Return true if this is effectively an issuance
473
+ */
241
474
  isIssuance(): boolean;
475
+ /**
476
+ * Return true if this is effectively a reissuance
477
+ */
242
478
  isReissuance(): boolean;
243
479
  }
244
480
  /**
245
- * Wrapper of [`asyncr::Jade`]
481
+ * A Jade hardware wallet usable via Web Serial
246
482
  */
247
483
  export class Jade {
248
484
  free(): void;
@@ -280,7 +516,7 @@ export class Jade {
280
516
  registerDescriptor(name: string, desc: WolletDescriptor): Promise<boolean>;
281
517
  }
282
518
  /**
283
- * WebSocket-based Wrapper of [`asyncr::Jade`]
519
+ * WebSocket-based `Jade` useful for testing in the browser with the Jade emulator.
284
520
  */
285
521
  export class JadeWebSocket {
286
522
  free(): void;
@@ -340,7 +576,9 @@ export class LedgerWeb {
340
576
  getReceiveAddressSingle(index: number): Promise<string>;
341
577
  }
342
578
  /**
343
- * Wrapper of [`bip39::Mnemonic`]
579
+ * A mnemonic secret code used as a master secret for a bip39 wallet.
580
+ *
581
+ * Supported number of words are 12, 15, 18, 21, and 24.
344
582
  */
345
583
  export class Mnemonic {
346
584
  free(): void;
@@ -348,6 +586,12 @@ export class Mnemonic {
348
586
  * Creates a Mnemonic
349
587
  */
350
588
  constructor(s: string);
589
+ /**
590
+ * Return the string representation of the Mnemonic.
591
+ * This representation can be used to recreate the Mnemonic via `new()`
592
+ *
593
+ * Note this is secret information, do not log it.
594
+ */
351
595
  toString(): string;
352
596
  /**
353
597
  * Creates a Mnemonic from entropy, at least 16 bytes are needed.
@@ -359,7 +603,7 @@ export class Mnemonic {
359
603
  static fromRandom(word_count: number): Mnemonic;
360
604
  }
361
605
  /**
362
- * Wrapper of [`lwk_wollet::ElementsNetwork`]
606
+ * The network of the elements blockchain such as mainnet, testnet or regtest.
363
607
  */
364
608
  export class Network {
365
609
  private constructor();
@@ -380,13 +624,37 @@ export class Network {
380
624
  * Creates the default regtest `Network` with the policy asset `5ac9f65c0efcc4775e0baec4ec03abdde22473cd3cf33c0419ca290e0751b225`
381
625
  */
382
626
  static regtestDefault(): Network;
627
+ /**
628
+ * Return the default esplora client for this network
629
+ */
383
630
  defaultEsploraClient(): EsploraClient;
631
+ /**
632
+ * Return true if the network is a mainnet network
633
+ */
384
634
  isMainnet(): boolean;
635
+ /**
636
+ * Return true if the network is a testnet network
637
+ */
385
638
  isTestnet(): boolean;
639
+ /**
640
+ * Return true if the network is a regtest network
641
+ */
386
642
  isRegtest(): boolean;
643
+ /**
644
+ * Return a string representation of the network, like "liquid", "liquid-testnet" or "liquid-regtest"
645
+ */
387
646
  toString(): string;
647
+ /**
648
+ * Return the policy asset for this network
649
+ */
388
650
  policyAsset(): AssetId;
651
+ /**
652
+ * Return the transaction builder for this network
653
+ */
389
654
  txBuilder(): TxBuilder;
655
+ /**
656
+ * Return the default explorer URL for this network
657
+ */
390
658
  defaultExplorerUrl(): string;
391
659
  }
392
660
  /**
@@ -396,10 +664,13 @@ export class Network {
396
664
  export class OptionWalletTxOut {
397
665
  private constructor();
398
666
  free(): void;
667
+ /**
668
+ * Return a copy of the WalletTxOut if it exists, otherwise None
669
+ */
399
670
  get(): WalletTxOut | undefined;
400
671
  }
401
672
  /**
402
- * Wrapper of [`elements::OutPoint`]
673
+ * A reference to a transaction output
403
674
  */
404
675
  export class OutPoint {
405
676
  free(): void;
@@ -407,38 +678,78 @@ export class OutPoint {
407
678
  * Creates an `OutPoint`
408
679
  */
409
680
  constructor(s: string);
681
+ /**
682
+ * Return the transaction identifier.
683
+ */
410
684
  txid(): Txid;
685
+ /**
686
+ * Return the output index.
687
+ */
411
688
  vout(): number;
412
689
  }
413
690
  /**
414
- * Wrapper of [`lwk_common::precision::Precision`]
691
+ * Helper to convert satoshi values of an asset to the value with the given precision and viceversa.
692
+ *
693
+ * For example 100 satoshi with precision 2 is "1.00"
415
694
  */
416
695
  export class Precision {
417
696
  free(): void;
418
697
  /**
419
- * Creates a Precision
698
+ * Create a new Precision, useful to encode e decode values for assets with precision.
699
+ * erroring if the given precision is greater than the allowed maximum (8)
420
700
  */
421
701
  constructor(precision: number);
702
+ /**
703
+ * Convert the given satoshi value to the formatted value according to our precision
704
+ *
705
+ * For example 100 satoshi with precision 2 is "1.00"
706
+ */
422
707
  satsToString(sats: bigint): string;
708
+ /**
709
+ * Convert the given string with precision to satoshi units.
710
+ *
711
+ * For example the string "1.00" of an asset with precision 2 is 100 satoshi.
712
+ */
423
713
  stringToSats(sats: string): bigint;
424
714
  }
425
715
  /**
426
- * Partially Signed Elements Transaction, wrapper of [`PartiallySignedTransaction`]
716
+ * Partially Signed Elements Transaction
427
717
  */
428
718
  export class Pset {
429
719
  free(): void;
430
720
  /**
431
- * Creates a `Pset`
721
+ * Creates a `Pset` from its base64 string representation.
432
722
  */
433
723
  constructor(base64: string);
724
+ /**
725
+ * Return a base64 string representation of the Pset.
726
+ * The string can be used to re-create the Pset via `new()`
727
+ */
434
728
  toString(): string;
729
+ /**
730
+ * Extract the Transaction from a Pset by filling in
731
+ * the available signature information in place.
732
+ */
435
733
  extractTx(): Transaction;
734
+ /**
735
+ * Attempt to merge with another `Pset`.
736
+ */
436
737
  combine(other: Pset): void;
738
+ /**
739
+ * Return a copy of the inputs of this PSET
740
+ */
437
741
  inputs(): PsetInput[];
742
+ /**
743
+ * Return a copy of the outputs of this PSET
744
+ */
438
745
  outputs(): PsetOutput[];
439
746
  }
440
747
  /**
441
- * PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetBalance`]
748
+ * The details regarding balance and amounts in a PSET:
749
+ *
750
+ * - The fee of the transaction in the PSET
751
+ * - The net balance of the assets in the PSET from the point of view of the wallet
752
+ * - The outputs going out of the wallet
442
753
  */
443
754
  export class PsetBalance {
444
755
  private constructor();
@@ -447,21 +758,35 @@ export class PsetBalance {
447
758
  /**
448
759
  * The net balance for every asset with respect of the wallet asking the pset details
449
760
  */
450
- balances(): any;
761
+ balances(): Balance;
451
762
  recipients(): Recipient[];
452
763
  }
453
764
  /**
454
- * PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetDetails`]
765
+ * The details of a Partially Signed Elements Transaction:
766
+ *
767
+ * - the net balance from the point of view of the wallet
768
+ * - the available and missing signatures for each input
769
+ * - for issuances and reissuances transactions contains the issuance or reissuance details
455
770
  */
456
771
  export class PsetDetails {
457
772
  private constructor();
458
773
  free(): void;
774
+ /**
775
+ * Return the balance of the PSET from the point of view of the wallet
776
+ * that generated this via `psetDetails()`
777
+ */
459
778
  balance(): PsetBalance;
460
779
  /**
461
780
  * For each input existing or missing signatures
462
781
  */
463
782
  signatures(): PsetSignatures[];
783
+ /**
784
+ * Set of fingerprints for which the PSET is missing a signature
785
+ */
464
786
  fingerprintsMissing(): string[];
787
+ /**
788
+ * List of fingerprints for which the PSET has a signature
789
+ */
465
790
  fingerprintsHas(): string[];
466
791
  /**
467
792
  * Return an element for every input that could possibly be a issuance or a reissuance
@@ -500,7 +825,7 @@ export class PsetOutput {
500
825
  scriptPubkey(): Script;
501
826
  }
502
827
  /**
503
- * PSET details from a perspective of a wallet, wrapper of [`lwk_common::PsetSignatures`]
828
+ * The details of the signatures in a PSET, divided in available and missing signatures.
504
829
  */
505
830
  export class PsetSignatures {
506
831
  private constructor();
@@ -522,16 +847,53 @@ export class Recipient {
522
847
  address(): Address | undefined;
523
848
  vout(): number;
524
849
  }
850
+ /**
851
+ * A Registry, a repository to store and retrieve asset metadata, like the name or the ticker of an asset.
852
+ */
525
853
  export class Registry {
526
854
  private constructor();
527
855
  free(): void;
856
+ /**
857
+ * Create a new registry cache specifying the URL of the registry,
858
+ * fetch the assets metadata identified by the given asset ids and cache them for later local retrieval.
859
+ * Use `default_for_network()` to get the default registry for the given network.
860
+ */
528
861
  static new(url: string, asset_ids: AssetIds): Promise<Registry>;
862
+ /**
863
+ * Return the default registry for the given network,
864
+ * fetch the assets metadata identified by the given asset ids and cache them for later local retrieval.
865
+ * Use `new()` to specify a custom URL
866
+ */
529
867
  static defaultForNetwork(network: Network, asset_ids: AssetIds): Promise<Registry>;
868
+ /**
869
+ * Create a new registry cache, using only the hardcoded assets.
870
+ *
871
+ * Hardcoded assets are the policy assets (LBTC, tLBTC, rLBTC) and the USDT asset on mainnet.
872
+ */
530
873
  static defaultHardcodedForNetwork(network: Network): Registry;
874
+ /**
875
+ * Fetch the contract and the issuance transaction of the given asset id from the registry
876
+ */
531
877
  fetchWithTx(asset_id: AssetId, client: EsploraClient): Promise<AssetMeta>;
878
+ /**
879
+ * Post a contract to the registry for registration.
880
+ */
532
881
  post(data: RegistryPost): Promise<void>;
882
+ /**
883
+ * Return the asset metadata related to the given asset id if it exists in this registry.
884
+ */
533
885
  get(asset_id: AssetId): RegistryData | undefined;
886
+ /**
887
+ * Return the asset metadata related to the given token id,
888
+ * in other words `token_id` is the reissuance token of the returned asset
889
+ */
534
890
  getAssetOfToken(token_id: AssetId): RegistryData | undefined;
891
+ /**
892
+ * Add the contracts information of the assets used in the Pset
893
+ * if available in this registry.
894
+ * Without the contract information, the partially signed transaction
895
+ * is valid but will not show asset information when signed with an hardware wallet.
896
+ */
535
897
  addContracts(pset: Pset): Pset;
536
898
  }
537
899
  export class RegistryData {
@@ -542,29 +904,62 @@ export class RegistryData {
542
904
  name(): string;
543
905
  domain(): string;
544
906
  }
907
+ /**
908
+ * The data to post to the registry to publish a contract for an asset id
909
+ */
545
910
  export class RegistryPost {
546
911
  free(): void;
912
+ /**
913
+ * Create a new registry post object to be used to publish a contract for an asset id in the registry.
914
+ */
547
915
  constructor(contract: Contract, asset_id: AssetId);
916
+ /**
917
+ * Return a string representation of the registry post (mostly for debugging).
918
+ */
548
919
  toString(): string;
549
920
  }
550
921
  /**
551
- * Wrapper of [`elements::Script`]
922
+ * An Elements (Liquid) script
552
923
  */
553
924
  export class Script {
554
925
  free(): void;
555
926
  /**
556
- * Creates a `Script`
927
+ * Creates a `Script` from its hex string representation.
557
928
  */
558
929
  constructor(s: string);
930
+ /**
931
+ * Return the consensus encoded bytes of the script.
932
+ */
559
933
  bytes(): Uint8Array;
934
+ /**
935
+ * Return the string of the script showing op codes and their arguments.
936
+ *
937
+ * For example: "OP_DUP OP_HASH160 OP_PUSHBYTES_20 088ac47276d105b91cf9aa27a00112421dd5f23c OP_EQUALVERIFY OP_CHECKSIG"
938
+ */
560
939
  asm(): string;
940
+ /**
941
+ * Return the string representation of the script (hex encoding of its consensus encoded bytes).
942
+ * This representation can be used to recreate the script via `new()`
943
+ */
561
944
  toString(): string;
562
945
  }
563
946
  /**
564
- * A Software signer, wrapper of [`lwk_signer::SwSigner`]
947
+ * A Software signer.
565
948
  */
566
949
  export class Signer {
567
950
  free(): void;
951
+ /**
952
+ * AMP0 signer data for login
953
+ */
954
+ amp0SignerData(): Amp0SignerData;
955
+ /**
956
+ * AMP0 sign login challenge
957
+ */
958
+ amp0SignChallenge(challenge: string): string;
959
+ /**
960
+ * AMP0 account xpub
961
+ */
962
+ amp0AccountXpub(account: number): string;
568
963
  /**
569
964
  * Creates a `Signer`
570
965
  */
@@ -577,9 +972,25 @@ export class Signer {
577
972
  * Sign a message with the master key, return the signature as a base64 string
578
973
  */
579
974
  signMessage(message: string): string;
975
+ /**
976
+ * Return the witness public key hash, slip77 descriptor of this signer
977
+ */
580
978
  wpkhSlip77Descriptor(): WolletDescriptor;
979
+ /**
980
+ * Return the extended public key of the signer
981
+ */
581
982
  getMasterXpub(): Xpub;
983
+ /**
984
+ * Return keyorigin and xpub, like "[73c5da0a/84h/1h/0h]tpub..."
985
+ */
582
986
  keyoriginXpub(bip: Bip): string;
987
+ /**
988
+ * Return the signer fingerprint
989
+ */
990
+ fingerprint(): string;
991
+ /**
992
+ * Return the mnemonic of the signer
993
+ */
583
994
  mnemonic(): Mnemonic;
584
995
  }
585
996
  export class Singlesig {
@@ -588,7 +999,7 @@ export class Singlesig {
588
999
  static from(variant: string): Singlesig;
589
1000
  }
590
1001
  /**
591
- * Wrapper of [`lwk_wollet::Tip`]
1002
+ * Blockchain tip, the highest valid block in the blockchain
592
1003
  */
593
1004
  export class Tip {
594
1005
  private constructor();
@@ -598,9 +1009,9 @@ export class Tip {
598
1009
  timestamp(): number | undefined;
599
1010
  }
600
1011
  /**
601
- * A Liquid transaction, wrapper of [`elements::Transaction`]
1012
+ * A Liquid transaction
602
1013
  *
603
- * See [`crate::WalletTx`] for the transaction as seen from the perspective of the wallet
1014
+ * See `WalletTx` for the transaction as seen from the perspective of the wallet
604
1015
  * where you can actually see unblinded amounts and tx net-balance.
605
1016
  */
606
1017
  export class Transaction {
@@ -609,13 +1020,26 @@ export class Transaction {
609
1020
  * Creates a `Transaction`
610
1021
  */
611
1022
  constructor(tx_hex: string);
1023
+ /**
1024
+ * Return the transaction identifier.
1025
+ */
612
1026
  txid(): Txid;
1027
+ /**
1028
+ * Return the consensus encoded bytes of the transaction.
1029
+ */
613
1030
  bytes(): Uint8Array;
1031
+ /**
1032
+ * Return the fee of the transaction in the given asset.
1033
+ * At the moment the only asset that can be used as fee is the policy asset (LBTC for mainnet).
1034
+ */
614
1035
  fee(policy_asset: AssetId): bigint;
1036
+ /**
1037
+ * Return the hex representation of the transaction. More precisely, they are the consensus encoded bytes of the transaction converted in hex.
1038
+ */
615
1039
  toString(): string;
616
1040
  }
617
1041
  /**
618
- * Wrapper of [`lwk_wollet::TxBuilder`]
1042
+ * A transaction builder
619
1043
  */
620
1044
  export class TxBuilder {
621
1045
  free(): void;
@@ -664,31 +1088,87 @@ export class TxBuilder {
664
1088
  */
665
1089
  addExplicitRecipient(address: Address, satoshi: bigint, asset: AssetId): TxBuilder;
666
1090
  /**
667
- * Issue an asset, wrapper of [`lwk_wollet::TxBuilder::issue_asset()`]
1091
+ * Issue an asset
1092
+ *
1093
+ * There will be `asset_sats` units of this asset that will be received by
1094
+ * `asset_receiver` if it's set, otherwise to an address of the wallet generating the issuance.
1095
+ *
1096
+ * There will be `token_sats` reissuance tokens that allow token holder to reissue the created
1097
+ * asset. Reissuance token will be received by `token_receiver` if it's some, or to an
1098
+ * address of the wallet generating the issuance if none.
1099
+ *
1100
+ * If a `contract` is provided, it's metadata will be committed in the generated asset id.
1101
+ *
1102
+ * Can't be used if `reissue_asset` has been called
668
1103
  */
669
1104
  issueAsset(asset_sats: bigint, asset_receiver: Address | null | undefined, token_sats: bigint, token_receiver?: Address | null, contract?: Contract | null): TxBuilder;
670
1105
  /**
671
- * Reissue an asset, wrapper of [`lwk_wollet::TxBuilder::reissue_asset()`]
1106
+ * Reissue an asset
1107
+ *
1108
+ * reissue the asset defined by `asset_to_reissue`, provided the reissuance token is owned
1109
+ * by the wallet generating te reissuance.
1110
+ *
1111
+ * Generated transaction will create `satoshi_to_reissue` new asset units, and they will be
1112
+ * sent to the provided `asset_receiver` address if some, or to an address from the wallet
1113
+ * generating the reissuance transaction if none.
1114
+ *
1115
+ * If the issuance transaction does not involve this wallet,
1116
+ * pass the issuance transaction in `issuance_tx`.
672
1117
  */
673
1118
  reissueAsset(asset_to_reissue: AssetId, satoshi_to_reissue: bigint, asset_receiver?: Address | null, issuance_tx?: Transaction | null): TxBuilder;
674
1119
  /**
675
- * Manual coin selection, wrapper of [`lwk_wollet::TxBuilder::set_wallet_utxos()`]
1120
+ * Switch to manual coin selection by giving a list of internal UTXOs to use.
1121
+ *
1122
+ * All passed UTXOs are added to the transaction.
1123
+ * No other wallet UTXO is added to the transaction, caller is supposed to add enough UTXOs to
1124
+ * cover for all recipients and fees.
1125
+ *
1126
+ * This method never fails, any error will be raised in [`TxBuilder::finish`].
1127
+ *
1128
+ * Possible errors:
1129
+ * * OutPoint doesn't belong to the wallet
1130
+ * * Insufficient funds (remember to include L-BTC utxos for fees)
676
1131
  */
677
1132
  setWalletUtxos(outpoints: OutPoint[]): TxBuilder;
1133
+ /**
1134
+ * Return a string representation of the transaction builder (mostly for debugging)
1135
+ */
678
1136
  toString(): string;
1137
+ /**
1138
+ * Set data to create a PSET from which you
1139
+ * can create a LiquiDEX proposal
1140
+ */
679
1141
  liquidexMake(utxo: OutPoint, address: Address, satoshi: bigint, asset_id: AssetId): TxBuilder;
1142
+ /**
1143
+ * Set data to take LiquiDEX proposals
1144
+ */
680
1145
  liquidexTake(proposals: ValidatedLiquidexProposal[]): TxBuilder;
681
1146
  }
682
1147
  /**
683
- * Wrapper of [`elements::TxOutSecrets`]
1148
+ * Contains unblinded information such as the asset and the value of a transaction output
684
1149
  */
685
1150
  export class TxOutSecrets {
686
1151
  private constructor();
687
1152
  free(): void;
1153
+ /**
1154
+ * Return the asset of the output.
1155
+ */
688
1156
  asset(): AssetId;
1157
+ /**
1158
+ * Return the asset blinding factor as a hex string.
1159
+ */
689
1160
  assetBlindingFactor(): string;
1161
+ /**
1162
+ * Return the value of the output.
1163
+ */
690
1164
  value(): bigint;
1165
+ /**
1166
+ * Return the value blinding factor as a hex string.
1167
+ */
691
1168
  valueBlindingFactor(): string;
1169
+ /**
1170
+ * Return true if the output is explicit (no blinding factors).
1171
+ */
692
1172
  isExplicit(): boolean;
693
1173
  /**
694
1174
  * Get the asset commitment
@@ -711,13 +1191,26 @@ export class TxOutSecrets {
711
1191
  export class Txid {
712
1192
  free(): void;
713
1193
  /**
714
- * Creates a `Txid`
1194
+ * Creates a `Txid` from its hex string representation (64 characters).
715
1195
  */
716
1196
  constructor(tx_id: string);
1197
+ /**
1198
+ * Return the string representation of the transaction identifier as shown in the explorer.
1199
+ * This representation can be used to recreate the transaction identifier via `new()`
1200
+ */
717
1201
  toString(): string;
718
1202
  }
719
1203
  /**
720
- * Wrapper of [`lwk_wollet::LiquidexProposal<Unvalidated>`]
1204
+ * LiquiDEX swap proposal
1205
+ *
1206
+ * A LiquiDEX swap proposal is a transaction with one input and one output created by the "maker".
1207
+ * The transaction "swaps" the input for the output, meaning that the "maker" sends the input and
1208
+ * receives the output.
1209
+ * However the transaction is incomplete (unbalanced and without a fee output), thus it cannot be
1210
+ * broadcast.
1211
+ * The "taker" can "complete" the transaction (using [`crate::TxBuilder::liquidex_take()`]) by
1212
+ * adding more inputs and more outputs to balance the amounts, meaning that the "taker" sends the
1213
+ * output and receives the input.
721
1214
  */
722
1215
  export class UnvalidatedLiquidexProposal {
723
1216
  private constructor();
@@ -729,7 +1222,8 @@ export class UnvalidatedLiquidexProposal {
729
1222
  toString(): string;
730
1223
  }
731
1224
  /**
732
- * Wrapper of [`lwk_wollet::Update`]
1225
+ * An Update contains the delta of information to be applied to the wallet to reach the latest status.
1226
+ * It's created passing a reference to the wallet to the blockchain client
733
1227
  */
734
1228
  export class Update {
735
1229
  free(): void;
@@ -737,14 +1231,33 @@ export class Update {
737
1231
  * Creates an `Update`
738
1232
  */
739
1233
  constructor(bytes: Uint8Array);
1234
+ /**
1235
+ * Serialize an update to a byte array
1236
+ */
740
1237
  serialize(): Uint8Array;
1238
+ /**
1239
+ * Serialize an update to a base64 encoded string,
1240
+ * encrypted with a key derived from the descriptor.
1241
+ * Decrypt using `deserialize_decrypted_base64()`
1242
+ */
741
1243
  serializeEncryptedBase64(desc: WolletDescriptor): string;
1244
+ /**
1245
+ * Deserialize an update from a base64 encoded string,
1246
+ * decrypted with a key derived from the descriptor.
1247
+ * Create the base64 using `serialize_encrypted_base64()`
1248
+ */
742
1249
  static deserializeDecryptedBase64(base64: string, desc: WolletDescriptor): Update;
1250
+ /**
1251
+ * Whether this update only changes the tip
1252
+ */
743
1253
  onlyTip(): boolean;
1254
+ /**
1255
+ * Prune the update, removing unneeded data from transactions.
1256
+ */
744
1257
  prune(wollet: Wollet): void;
745
1258
  }
746
1259
  /**
747
- * Wrapper of [`lwk_wollet::LiquidexProposal<Validated>`]
1260
+ * Created by validating `UnvalidatedLiquidexProposal` via `validate()` or `insecure_validate()`
748
1261
  */
749
1262
  export class ValidatedLiquidexProposal {
750
1263
  private constructor();
@@ -754,38 +1267,96 @@ export class ValidatedLiquidexProposal {
754
1267
  toString(): string;
755
1268
  }
756
1269
  /**
757
- * Wrapper of [`lwk_wollet::WalletTx`]
1270
+ * Value returned by asking transactions to the wallet. Contains details about a transaction
1271
+ * from the perspective of the wallet, for example the net-balance of the transaction for the
1272
+ * wallet.
758
1273
  */
759
1274
  export class WalletTx {
760
1275
  private constructor();
761
1276
  free(): void;
1277
+ /**
1278
+ * Return a copy of the transaction.
1279
+ */
762
1280
  tx(): Transaction;
1281
+ /**
1282
+ * Return the height of the block containing the transaction if it's confirmed.
1283
+ */
763
1284
  height(): number | undefined;
764
- balance(): any;
1285
+ /**
1286
+ * Return the net balance of the transaction for the wallet.
1287
+ */
1288
+ balance(): Balance;
1289
+ /**
1290
+ * Return the transaction identifier.
1291
+ */
765
1292
  txid(): Txid;
1293
+ /**
1294
+ * Return the fee of the transaction.
1295
+ */
766
1296
  fee(): bigint;
1297
+ /**
1298
+ * Return the type of the transaction. Can be "issuance", "reissuance", "burn", "redeposit", "incoming", "outgoing" or "unknown".
1299
+ */
767
1300
  txType(): string;
1301
+ /**
1302
+ * Return the timestamp of the block containing the transaction if it's confirmed.
1303
+ */
768
1304
  timestamp(): number | undefined;
1305
+ /**
1306
+ * Return a list with the same number of elements as the inputs of the transaction.
1307
+ * The element in the list is a `WalletTxOut` (the output spent to create the input)
1308
+ * if it belongs to the wallet, while it is None for inputs owned by others
1309
+ */
769
1310
  inputs(): OptionWalletTxOut[];
1311
+ /**
1312
+ * Return a list with the same number of elements as the outputs of the transaction.
1313
+ * The element in the list is a `WalletTxOut` if it belongs to the wallet,
1314
+ * while it is None for inputs owned by others
1315
+ */
770
1316
  outputs(): OptionWalletTxOut[];
1317
+ /**
1318
+ * Return the URL to the transaction on the given explorer including the information
1319
+ * needed to unblind the transaction in the explorer UI.
1320
+ */
771
1321
  unblindedUrl(explorer_url: string): string;
772
1322
  }
773
1323
  /**
774
- * Wrapper of [`lwk_wollet::WalletTxOut`]
1324
+ * Details of a wallet transaction output used in `WalletTx`
775
1325
  */
776
1326
  export class WalletTxOut {
777
1327
  private constructor();
778
1328
  free(): void;
1329
+ /**
1330
+ * Return the outpoint (txid and vout) of this `WalletTxOut`.
1331
+ */
779
1332
  outpoint(): OutPoint;
1333
+ /**
1334
+ * Return the script pubkey of the address of this `WalletTxOut`.
1335
+ */
780
1336
  scriptPubkey(): Script;
1337
+ /**
1338
+ * Return the height of the block containing this output if it's confirmed.
1339
+ */
781
1340
  height(): number | undefined;
1341
+ /**
1342
+ * Return the unblinded values of this `WalletTxOut`.
1343
+ */
782
1344
  unblinded(): TxOutSecrets;
1345
+ /**
1346
+ * Return the wildcard index used to derive the address of this `WalletTxOut`.
1347
+ */
783
1348
  wildcardIndex(): number;
1349
+ /**
1350
+ * Return the chain of this `WalletTxOut`. Can be "Chain::External" or "Chain::Internal" (change).
1351
+ */
784
1352
  extInt(): Chain;
1353
+ /**
1354
+ * Return the address of this `WalletTxOut`.
1355
+ */
785
1356
  address(): Address;
786
1357
  }
787
1358
  /**
788
- * Wrapper of [`lwk_wollet::Wollet`]
1359
+ * A watch-only wallet defined by a CT descriptor.
789
1360
  */
790
1361
  export class Wollet {
791
1362
  free(): void;
@@ -800,11 +1371,59 @@ export class Wollet {
800
1371
  * otherwise the last unused address.
801
1372
  */
802
1373
  address(index?: number | null): AddressResult;
1374
+ /**
1375
+ * Get the full derivation path for an address
1376
+ *
1377
+ * Note: will be removed once we add the full path to lwk_wollet::AddressResult
1378
+ */
803
1379
  addressFullPath(index: number): Uint32Array;
1380
+ /**
1381
+ * Apply an update containing blockchain data
1382
+ *
1383
+ * To update the wallet you need to first obtain the blockchain data relevant for the wallet.
1384
+ * This can be done using a `full_scan()`, which
1385
+ * returns an `Update` that contains new transaction and other data relevant for the
1386
+ * wallet.
1387
+ * The update must then be applied to the `Wollet` so that wollet methods such as
1388
+ * `balance()` or `transactions()` include the new data.
1389
+ *
1390
+ * However getting blockchain data involves network calls, so between the full scan start and
1391
+ * when the update is applied it might elapse a significant amount of time.
1392
+ * In that interval, applying any update, or any transaction using `apply_transaction()`,
1393
+ * will cause this function to return a `Error::UpdateOnDifferentStatus`.
1394
+ * Callers should either avoid applying updates and transactions, or they can catch the error
1395
+ * and wait for a new full scan to be completed and applied.
1396
+ */
804
1397
  applyUpdate(update: Update): void;
805
- applyTransaction(tx: Transaction): void;
806
- balance(): any;
1398
+ /**
1399
+ * Apply a transaction to the wallet state
1400
+ *
1401
+ * Wallet transactions are normally obtained using a `full_scan()`
1402
+ * and applying the result with `apply_update()`. However a
1403
+ * full scan involves network calls and it can take a significant amount of time.
1404
+ *
1405
+ * If the caller does not want to wait for a full scan containing the transaction, it can
1406
+ * apply the transaction to the wallet state using this function.
1407
+ *
1408
+ * Note: if this transaction is *not* returned by a next full scan, after `apply_update()` it will disappear from the
1409
+ * transactions list, will not be included in balance computations, and by the remaining
1410
+ * wollet methods.
1411
+ *
1412
+ * Calling this method, might cause `apply_update()` to fail with a
1413
+ * `Error::UpdateOnDifferentStatus`, make sure to either avoid it or handle the error properly.
1414
+ */
1415
+ applyTransaction(tx: Transaction): Balance;
1416
+ /**
1417
+ * Get the wallet balance for each assets
1418
+ */
1419
+ balance(): Balance;
1420
+ /**
1421
+ * Get the asset identifiers owned by the wallet
1422
+ */
807
1423
  assetsOwned(): AssetIds;
1424
+ /**
1425
+ * Get the wallet transactions
1426
+ */
808
1427
  transactions(): WalletTx[];
809
1428
  /**
810
1429
  * Get the unspent transaction outputs of the wallet
@@ -818,12 +1437,29 @@ export class Wollet {
818
1437
  * Finalize and consume the given PSET, returning the finalized one
819
1438
  */
820
1439
  finalize(pset: Pset): Pset;
1440
+ /**
1441
+ * Get the PSET details with respect to the wallet
1442
+ */
821
1443
  psetDetails(pset: Pset): PsetDetails;
1444
+ /**
1445
+ * Get a copy of the wallet descriptor of this wallet.
1446
+ */
822
1447
  descriptor(): WolletDescriptor;
1448
+ /**
1449
+ * A deterministic value derived from the descriptor, the config and the content of this wollet,
1450
+ * including what's in the wallet store (transactions etc)
1451
+ *
1452
+ * In this case, we don't need cryptographic assurance guaranteed by the std default hasher (siphash)
1453
+ * And we can use a much faster hasher, which is used also in the rust compiler.
1454
+ * ([source](https://nnethercote.github.io/2021/12/08/a-brutally-effective-hash-function-in-rust.html))
1455
+ */
823
1456
  status(): bigint;
1457
+ /**
1458
+ * Get the blockchain tip at the time of the last update of this wollet.
1459
+ */
824
1460
  tip(): Tip;
825
1461
  /**
826
- * wraps [lwk_wollet::Wollet::never_scanned()]
1462
+ * Returns true if this wollet has never received an updated applyed to it
827
1463
  */
828
1464
  neverScanned(): boolean;
829
1465
  /**
@@ -832,7 +1468,7 @@ export class Wollet {
832
1468
  isAmp0(): boolean;
833
1469
  }
834
1470
  /**
835
- * Wrapper of [`lwk_wollet::WolletDescriptor`]
1471
+ * A wrapper that contains only the subset of CT descriptors handled by wollet
836
1472
  */
837
1473
  export class WolletDescriptor {
838
1474
  free(): void;
@@ -840,8 +1476,20 @@ export class WolletDescriptor {
840
1476
  * Creates a `WolletDescriptor`
841
1477
  */
842
1478
  constructor(descriptor: string);
1479
+ /**
1480
+ * Return the string representation of the descriptor, including the checksum.
1481
+ * This representation can be used to recreate the descriptor via `new()`
1482
+ */
843
1483
  toString(): string;
1484
+ /**
1485
+ * Create a new multisig descriptor, where each participant is a keyorigin_xpub and it requires at least threshold signatures to spend.
1486
+ * Errors if the threshold is 0 or greater than the number of participants.
1487
+ * Uses slip77 for the blinding key.
1488
+ */
844
1489
  static newMultiWshSlip77(threshold: number, participants: string[]): WolletDescriptor;
1490
+ /**
1491
+ * Whether the descriptor is for mainnet
1492
+ */
845
1493
  isMainnet(): boolean;
846
1494
  /**
847
1495
  * Whether the descriptor is AMP0
@@ -849,19 +1497,32 @@ export class WolletDescriptor {
849
1497
  isAmp0(): boolean;
850
1498
  }
851
1499
  /**
852
- * Wrapper of [`bip32::Xpub`]
1500
+ * An extended public key
853
1501
  */
854
1502
  export class Xpub {
855
1503
  free(): void;
856
1504
  /**
857
- * Creates a Mnemonic
1505
+ * Creates a Xpub
858
1506
  */
859
1507
  constructor(s: string);
1508
+ /**
1509
+ * Return the string representation of the Xpub.
1510
+ * This representation can be used to recreate the Xpub via `new()`
1511
+ */
860
1512
  toString(): string;
1513
+ /**
1514
+ * Return the identifier of the Xpub.
1515
+ * This is a 40 hex characters string (20 bytes).
1516
+ */
861
1517
  identifier(): string;
1518
+ /**
1519
+ * Return the first four bytes of the identifier as hex string
1520
+ * This is a 8 hex characters string (4 bytes).
1521
+ */
862
1522
  fingerprint(): string;
863
1523
  /**
864
- * Returns true if the passed string is a valid xpub with a valid keyorigin if present
1524
+ * Returns true if the passed string is a valid xpub with a valid keyorigin if present.
1525
+ * For example: "[73c5da0a/84h/1h/0h]tpub..."
865
1526
  */
866
1527
  static isValidWithKeyOrigin(s: string): boolean;
867
1528
  }