lwk_node 0.16.0 → 0.17.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
@@ -164,9 +164,9 @@ export class Amp0Connected {
164
164
  free(): void;
165
165
  [Symbol.dispose](): void;
166
166
  /**
167
- * Connect and register to AMP0
167
+ * Connect and register to AMP0.
168
168
  */
169
- constructor(network: Network, signer_data: Amp0SignerData);
169
+ static connect(network: Network, signer_data: Amp0SignerData): Promise<Amp0Connected>;
170
170
  /**
171
171
  * Obtain a login challenge
172
172
  *
@@ -247,6 +247,13 @@ export class Amp2 {
247
247
  private constructor();
248
248
  free(): void;
249
249
  [Symbol.dispose](): void;
250
+ /**
251
+ * Create a new AMP2 client
252
+ *
253
+ * * `server_key` - The keyorigin xpub of the AMP2 server key
254
+ * * `url` - The URL of the AMP2 server
255
+ */
256
+ static new(server_key: string, url: string): Amp2;
250
257
  /**
251
258
  * Create a new AMP2 client with the default url and server key for the testnet network.
252
259
  */
@@ -254,7 +261,7 @@ export class Amp2 {
254
261
  /**
255
262
  * Get an AMP2 wallet descriptor from the keyorigin xpub string obtained from a signer
256
263
  */
257
- descriptorFromStr(keyorigin_xpub: string): Amp2Descriptor;
264
+ descriptorFromStr(keyorigin_xpub: string, descriptor_blinding_key: string): Amp2Descriptor;
258
265
  /**
259
266
  * Register an AMP2 wallet with the AMP2 server
260
267
  */
@@ -745,12 +752,12 @@ export class Jade {
745
752
  free(): void;
746
753
  [Symbol.dispose](): void;
747
754
  /**
748
- * Creates a Jade from Web Serial for the given network
755
+ * Creates a Jade from Web Serial for the given network.
749
756
  *
750
757
  * When filter is true, it will filter available serial with Blockstream released chips, use
751
758
  * false if you don't see your DYI jade
752
759
  */
753
- constructor(network: Network, filter: boolean);
760
+ static fromSerial(network: Network, filter: boolean): Promise<Jade>;
754
761
  getVersion(): Promise<any>;
755
762
  getMasterXpub(): Promise<Xpub>;
756
763
  /**
@@ -788,7 +795,7 @@ export class JadeWebSocket {
788
795
  *
789
796
  * The url should point to your WebSocket bridge that connects to the Docker Jade emulator
790
797
  */
791
- constructor(network: Network, url: string);
798
+ static fromWebSocket(network: Network, url: string): Promise<JadeWebSocket>;
792
799
  getVersion(): Promise<any>;
793
800
  getMasterXpub(): Promise<Xpub>;
794
801
  /**
@@ -824,7 +831,8 @@ export class JsStoreLink {
824
831
  /**
825
832
  * Create a new `JsStoreLink` from a JavaScript storage object.
826
833
  *
827
- * The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
834
+ * The JS object must have `get(key)`, `put(key, value)`, `remove(key)`,
835
+ * and `isPersisted()` methods.
828
836
  */
829
837
  constructor(storage: any);
830
838
  }
@@ -1215,6 +1223,10 @@ export class Pset {
1215
1223
  * Return a copy of the outputs of this PSET
1216
1224
  */
1217
1225
  outputs(): PsetOutput[];
1226
+ /**
1227
+ * Add wallet details to this PSET in place
1228
+ */
1229
+ addDetails(wollet: Wollet): void;
1218
1230
  }
1219
1231
  /**
1220
1232
  * The details regarding balance and amounts in a PSET:
@@ -1719,6 +1731,115 @@ export class TxBuilder {
1719
1731
  */
1720
1732
  addInputRangeproofs(add_rangeproofs: boolean): TxBuilder;
1721
1733
  }
1734
+ /**
1735
+ * Transaction details
1736
+ */
1737
+ export class TxDetails {
1738
+ private constructor();
1739
+ free(): void;
1740
+ [Symbol.dispose](): void;
1741
+ /**
1742
+ * Transaction
1743
+ */
1744
+ tx(): Transaction | undefined;
1745
+ /**
1746
+ * Txid
1747
+ */
1748
+ txid(): Txid;
1749
+ /**
1750
+ * Blockchain height
1751
+ */
1752
+ height(): number | undefined;
1753
+ /**
1754
+ * Timestamp
1755
+ *
1756
+ * A reasonable timestamp, that however can be inaccurate.
1757
+ * If you need a precise timestamp, do not use this value.
1758
+ */
1759
+ timestamp(): number | undefined;
1760
+ /**
1761
+ * Transaction type
1762
+ *
1763
+ * A tentative description of the transaction type, which
1764
+ * however might be inaccurate. Use this if you want a simple
1765
+ * description of what this transaction is doing, but do
1766
+ * not rely on the value returned.
1767
+ */
1768
+ txType(): string;
1769
+ /**
1770
+ * Balance
1771
+ *
1772
+ * Net balance from the `Wollet` perspective
1773
+ */
1774
+ balance(): Balance;
1775
+ /**
1776
+ * Asset fees
1777
+ */
1778
+ feesAsset(asset: AssetId): bigint;
1779
+ /**
1780
+ * Unblinded URL
1781
+ */
1782
+ unblindedUrl(explorer_url: string): string;
1783
+ /**
1784
+ * Inputs
1785
+ */
1786
+ inputs(): TxOutDetails[];
1787
+ /**
1788
+ * Outputs
1789
+ */
1790
+ outputs(): TxOutDetails[];
1791
+ }
1792
+ /**
1793
+ * Options for transaction details
1794
+ */
1795
+ export class TxOpt {
1796
+ private constructor();
1797
+ free(): void;
1798
+ [Symbol.dispose](): void;
1799
+ static default(): TxOpt;
1800
+ }
1801
+ /**
1802
+ * Transaction output details
1803
+ */
1804
+ export class TxOutDetails {
1805
+ private constructor();
1806
+ free(): void;
1807
+ [Symbol.dispose](): void;
1808
+ /**
1809
+ * Outpoint
1810
+ */
1811
+ outpoint(): OutPoint;
1812
+ /**
1813
+ * Scriptpubkey
1814
+ */
1815
+ script_pubkey(): Script | undefined;
1816
+ /**
1817
+ * Height
1818
+ */
1819
+ height(): number | undefined;
1820
+ /**
1821
+ * Address
1822
+ */
1823
+ address(): Address | undefined;
1824
+ /**
1825
+ * Unblinded values (asset, amount, blinders)
1826
+ */
1827
+ unblinded(): TxOutSecrets | undefined;
1828
+ /**
1829
+ * Whether the transaction output is explicit
1830
+ */
1831
+ is_explicit(): boolean;
1832
+ /**
1833
+ * Whether the output is spent by a previously downloaded transaction
1834
+ *
1835
+ * Note: this value might be inaccurate. We compute this from downloaded
1836
+ * transactions, however we only download transactions relevant for the
1837
+ * wallet (i.e. if they include inputs or outputs that belong to the
1838
+ * wallet), thus for non-wallet outputs we might set this value
1839
+ * incorrectly. For wallet outputs, it can be outdated.
1840
+ */
1841
+ is_spent(): boolean;
1842
+ }
1722
1843
  /**
1723
1844
  * Contains unblinded information such as the asset and the value of a transaction output
1724
1845
  */
@@ -1783,6 +1904,16 @@ export class Txid {
1783
1904
  */
1784
1905
  toString(): string;
1785
1906
  }
1907
+ /**
1908
+ * Options for transaction details
1909
+ */
1910
+ export class TxsOpt {
1911
+ private constructor();
1912
+ free(): void;
1913
+ [Symbol.dispose](): void;
1914
+ static default(): TxsOpt;
1915
+ static withPagination(offset: number, limit: number): TxsOpt;
1916
+ }
1786
1917
  /**
1787
1918
  * LiquiDEX swap proposal
1788
1919
  *
@@ -1981,6 +2112,22 @@ export class WalletTxOut {
1981
2112
  export class Wollet {
1982
2113
  free(): void;
1983
2114
  [Symbol.dispose](): void;
2115
+ /**
2116
+ * Get the transaction list
2117
+ *
2118
+ * **Experimental**: This API may change without notice.
2119
+ */
2120
+ txs(opt: TxsOpt): TxDetails[];
2121
+ /**
2122
+ * Number of transactions
2123
+ */
2124
+ numTxs(): number;
2125
+ /**
2126
+ * Get the details of a transaction
2127
+ *
2128
+ * **Experimental**: This API may change without notice.
2129
+ */
2130
+ txDetails(txid: Txid, opt: TxOpt): TxDetails | undefined;
1984
2131
  /**
1985
2132
  * Create a `Wollet`
1986
2133
  */
@@ -2047,9 +2194,13 @@ export class Wollet {
2047
2194
  */
2048
2195
  assetsOwned(): AssetIds;
2049
2196
  /**
2050
- * Get the wallet transactions
2197
+ * Get the wallet transactions, sorted by height descending, then txid descending with unconfirmed first
2051
2198
  */
2052
2199
  transactions(): WalletTx[];
2200
+ /**
2201
+ * Get the wallet transactions with pagination sorted by height descending, then txid descending with unconfirmed first
2202
+ */
2203
+ transactionsPaginated(offset: number, limit: number): WalletTx[];
2053
2204
  /**
2054
2205
  * Get the unspent transaction outputs of the wallet
2055
2206
  */
@@ -2092,6 +2243,62 @@ export class Wollet {
2092
2243
  */
2093
2244
  isAmp0(): boolean;
2094
2245
  }
2246
+ /**
2247
+ * A builder for constructing [`Wollet`] instances.
2248
+ */
2249
+ export class WolletBuilder {
2250
+ free(): void;
2251
+ [Symbol.dispose](): void;
2252
+ /**
2253
+ * Create a builder for a watch-only wallet.
2254
+ */
2255
+ constructor(network: Network, descriptor: WolletDescriptor);
2256
+ /**
2257
+ * Set the threshold used to merge persisted updates during build.
2258
+ *
2259
+ * **Experimental**: This API may change without notice.
2260
+ *
2261
+ * `None` disables merging (default behavior).
2262
+ */
2263
+ withMergeThreshold(merge_threshold?: number | null): WolletBuilder;
2264
+ /**
2265
+ * Set the wallet as "utxo only".
2266
+ *
2267
+ * **Experimental**: This API may change without notice.
2268
+ */
2269
+ utxoOnly(utxo_only: boolean): WolletBuilder;
2270
+ /**
2271
+ * Persist wallet updates in the given JavaScript storage object.
2272
+ *
2273
+ * **Experimental**: This API may change without notice.
2274
+ *
2275
+ * Wallet data is persisted in clear.
2276
+ *
2277
+ * The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
2278
+ */
2279
+ withExperimentalStore(storage: any): WolletBuilder;
2280
+ /**
2281
+ * Persist wallet transactions in the given JavaScript
2282
+ * storage object.
2283
+ *
2284
+ * **Experimental**: This API may change without notice.
2285
+ *
2286
+ * The JS object must have `get(key)`, `put(key, value)`, and `remove(key)` methods.
2287
+ */
2288
+ withTxsStore(storage: any): WolletBuilder;
2289
+ /**
2290
+ * Set encryption for the transactions store.
2291
+ *
2292
+ * **Experimental**: This API may change without notice.
2293
+ *
2294
+ * Default: encrypted if the store is persisted.
2295
+ */
2296
+ setEncryptionTxsStore(encrypt: boolean): WolletBuilder;
2297
+ /**
2298
+ * Build the wallet from this builder.
2299
+ */
2300
+ build(): Wollet;
2301
+ }
2095
2302
  /**
2096
2303
  * A wrapper that contains only the subset of CT descriptors handled by wollet
2097
2304
  */