@bitcoinerlab/descriptors 3.0.6 → 3.1.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/README.md +9 -487
- package/index.d.ts +13 -0
- package/index.js +27 -0
- package/package.json +25 -52
- package/dist/applyPR2137.d.ts +0 -2
- package/dist/applyPR2137.js +0 -153
- package/dist/bitcoinjs-lib-internals.d.ts +0 -10
- package/dist/bitcoinjs-lib-internals.js +0 -60
- package/dist/checksum.d.ts +0 -6
- package/dist/checksum.js +0 -58
- package/dist/descriptors.d.ts +0 -433
- package/dist/descriptors.js +0 -1743
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -85
- package/dist/keyExpressions.d.ts +0 -83
- package/dist/keyExpressions.js +0 -247
- package/dist/ledger.d.ts +0 -167
- package/dist/ledger.js +0 -580
- package/dist/miniscript.d.ts +0 -123
- package/dist/miniscript.js +0 -305
- package/dist/multipath.d.ts +0 -13
- package/dist/multipath.js +0 -76
- package/dist/networkUtils.d.ts +0 -3
- package/dist/networkUtils.js +0 -16
- package/dist/parseUtils.d.ts +0 -7
- package/dist/parseUtils.js +0 -46
- package/dist/psbt.d.ts +0 -44
- package/dist/psbt.js +0 -193
- package/dist/re.d.ts +0 -31
- package/dist/re.js +0 -79
- package/dist/resourceLimits.d.ts +0 -25
- package/dist/resourceLimits.js +0 -89
- package/dist/scriptExpressions.d.ts +0 -95
- package/dist/scriptExpressions.js +0 -89
- package/dist/signers.d.ts +0 -84
- package/dist/signers.js +0 -215
- package/dist/stackResourceLimits.d.ts +0 -17
- package/dist/stackResourceLimits.js +0 -35
- package/dist/tapMiniscript.d.ts +0 -220
- package/dist/tapMiniscript.js +0 -510
- package/dist/tapTree.d.ts +0 -86
- package/dist/tapTree.js +0 -166
- package/dist/types.d.ts +0 -238
- package/dist/types.js +0 -4
package/dist/descriptors.d.ts
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import { Network, Payment, Psbt } from 'bitcoinjs-lib';
|
|
2
|
-
import type { PartialSig } from 'bip174';
|
|
3
|
-
import { BIP32API } from 'bip32';
|
|
4
|
-
import { ECPairAPI } from 'ecpair';
|
|
5
|
-
import type { TinySecp256k1Interface, Preimage, Expansion, ExpansionMap, KeyExpressionParser } from './types';
|
|
6
|
-
import type { TapTreeInfoNode, TapTreeNode } from './tapTree';
|
|
7
|
-
import type { TaprootLeafSatisfaction } from './tapMiniscript';
|
|
8
|
-
/**
|
|
9
|
-
* Constructs the necessary functions and classes for working with descriptors
|
|
10
|
-
* using an external elliptic curve (ecc) library.
|
|
11
|
-
*
|
|
12
|
-
* Notably, it returns the {@link _Internal_.Output | `Output`} class, which
|
|
13
|
-
* provides methods to create, sign, and finalize PSBTs based on descriptor
|
|
14
|
-
* expressions.
|
|
15
|
-
*
|
|
16
|
-
* The Factory also returns utility methods like `expand` (detailed below)
|
|
17
|
-
* and `parseKeyExpression` (see {@link KeyExpressionParser}).
|
|
18
|
-
*
|
|
19
|
-
* Additionally, for convenience, the function returns `BIP32` and `ECPair`.
|
|
20
|
-
* These are {@link https://github.com/bitcoinjs bitcoinjs-lib} classes designed
|
|
21
|
-
* for managing {@link https://github.com/bitcoinjs/bip32 | `BIP32`} keys and
|
|
22
|
-
* public/private key pairs:
|
|
23
|
-
* {@link https://github.com/bitcoinjs/ecpair | `ECPair`}, respectively.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} ecc - An object with elliptic curve operations, such as
|
|
26
|
-
* [tiny-secp256k1](https://github.com/bitcoinjs/tiny-secp256k1) or
|
|
27
|
-
* [@bitcoinerlab/secp256k1](https://github.com/bitcoinerlab/secp256k1).
|
|
28
|
-
*/
|
|
29
|
-
export declare function DescriptorsFactory(ecc: TinySecp256k1Interface): {
|
|
30
|
-
Output: {
|
|
31
|
-
new ({ descriptor, index, change, checksumRequired, allowMiniscriptInP2SH, network, preimages, signersPubKeys, taprootSpendPath, tapLeaf }: {
|
|
32
|
-
/**
|
|
33
|
-
* The descriptor string in ASCII format. It may include a "*" to denote an arbitrary index (aka ranged descriptors).
|
|
34
|
-
*/
|
|
35
|
-
descriptor: string;
|
|
36
|
-
/**
|
|
37
|
-
* The descriptor's index in the case of a range descriptor (must be an integer >=0).
|
|
38
|
-
*
|
|
39
|
-
* This `Output` class always models a concrete spendable output.
|
|
40
|
-
* If the descriptor contains any wildcard (`*`), an `index` is required.
|
|
41
|
-
*/
|
|
42
|
-
index?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Multipath branch selector for key-path tuples like `/<0;1>/*`.
|
|
45
|
-
*
|
|
46
|
-
* The value passed in `change` must be one of the numbers present in the
|
|
47
|
-
* tuple.
|
|
48
|
-
*
|
|
49
|
-
* Examples:
|
|
50
|
-
* - `/<0;1>/*` accepts `change: 0` (typically receive) or `change: 1`
|
|
51
|
-
* (typically change).
|
|
52
|
-
* - `/<0;1;2>/*` accepts `change: 0`, `1` or `2`.
|
|
53
|
-
*
|
|
54
|
-
* This parameter is independent from `index`: `change` resolves
|
|
55
|
-
* multipath tuples, while `index` resolves the final wildcard `*`.
|
|
56
|
-
*/
|
|
57
|
-
change?: number;
|
|
58
|
-
/**
|
|
59
|
-
* An optional flag indicating whether the descriptor is required to include a checksum.
|
|
60
|
-
* @defaultValue false
|
|
61
|
-
*/
|
|
62
|
-
checksumRequired?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* A flag indicating whether this instance can parse and generate script satisfactions for sh(miniscript) top-level expressions of miniscripts. This is not recommended.
|
|
65
|
-
* @defaultValue false
|
|
66
|
-
*/
|
|
67
|
-
allowMiniscriptInP2SH?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* One of bitcoinjs-lib [`networks`](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/networks.js) (or another one following the same interface).
|
|
70
|
-
* @defaultValue networks.bitcoin
|
|
71
|
-
*/
|
|
72
|
-
network?: Network;
|
|
73
|
-
/**
|
|
74
|
-
* An array of preimages if the miniscript-based descriptor uses them.
|
|
75
|
-
*
|
|
76
|
-
* This info is necessary to finalize Psbts. Leave it `undefined` if your
|
|
77
|
-
* miniscript-based descriptor does not use preimages or you don't know
|
|
78
|
-
* or don't wanto use them.
|
|
79
|
-
*
|
|
80
|
-
* You can also leave it `undefined` if only need to generate the
|
|
81
|
-
* `scriptPubKey` or `address` for a descriptor.
|
|
82
|
-
*
|
|
83
|
-
* @defaultValue `[]`
|
|
84
|
-
*/
|
|
85
|
-
preimages?: Preimage[];
|
|
86
|
-
/**
|
|
87
|
-
* An array of the public keys used for signing the transaction when
|
|
88
|
-
* spending the previous output associated with this descriptor.
|
|
89
|
-
*
|
|
90
|
-
* This parameter is only used if the descriptor object is being used to
|
|
91
|
-
* finalize a transaction. It is necessary to specify the spending path
|
|
92
|
-
* when working with miniscript-based expressions that have multiple
|
|
93
|
-
* spending paths.
|
|
94
|
-
*
|
|
95
|
-
* Set this parameter to an array containing the public
|
|
96
|
-
* keys involved in the desired spending path. Leave it `undefined` if you
|
|
97
|
-
* only need to generate the `scriptPubKey` or `address` for a descriptor,
|
|
98
|
-
* or if all the public keys involved in the descriptor will sign the
|
|
99
|
-
* transaction. In the latter case, the satisfier will automatically
|
|
100
|
-
* choose the most optimal spending path (if more than one is available).
|
|
101
|
-
* If omitted, this library assumes that all keys in the miniscript can
|
|
102
|
-
* sign. For taproot script-path spends, keys are inferred per leaf.
|
|
103
|
-
*
|
|
104
|
-
* For more details on using this parameter, refer to [this Stack Exchange
|
|
105
|
-
* answer](https://bitcoin.stackexchange.com/a/118036/89665).
|
|
106
|
-
*/
|
|
107
|
-
signersPubKeys?: Uint8Array[];
|
|
108
|
-
/**
|
|
109
|
-
* Taproot spend path policy. Use `key` to force key-path estimation,
|
|
110
|
-
* or `script` to estimate script-path spends.
|
|
111
|
-
*
|
|
112
|
-
* This setting only applies to `tr(KEY,TREE)` descriptors.
|
|
113
|
-
* For `tr(KEY)` descriptors, only key-path is available.
|
|
114
|
-
*
|
|
115
|
-
* When `script` is selected:
|
|
116
|
-
* - if `tapLeaf` is provided, that leaf is used.
|
|
117
|
-
* - if `tapLeaf` is omitted, the satisfier auto-selects the leaf with the
|
|
118
|
-
* smallest witness among satisfiable candidates.
|
|
119
|
-
*
|
|
120
|
-
* Default policy is `script` for `tr(KEY,TREE)` and `key` for key-only
|
|
121
|
-
* taproot descriptors (`tr(KEY)` and `addr(TR_ADDRESS)`).
|
|
122
|
-
*/
|
|
123
|
-
taprootSpendPath?: "key" | "script";
|
|
124
|
-
/**
|
|
125
|
-
* Optional taproot leaf selector (tapleaf hash or miniscript string).
|
|
126
|
-
* Only used when taprootSpendPath is `script` and descriptor is
|
|
127
|
-
* `tr(KEY,TREE)`. If omitted, the smallest satisfiable leaf is selected.
|
|
128
|
-
*/
|
|
129
|
-
tapLeaf?: Uint8Array | string;
|
|
130
|
-
}): {
|
|
131
|
-
readonly "__#private@#payment": Payment;
|
|
132
|
-
readonly "__#private@#preimages": Preimage[];
|
|
133
|
-
readonly "__#private@#signersPubKeys"?: Uint8Array[];
|
|
134
|
-
readonly "__#private@#miniscript"?: string;
|
|
135
|
-
readonly "__#private@#witnessScript"?: Uint8Array;
|
|
136
|
-
readonly "__#private@#redeemScript"?: Uint8Array;
|
|
137
|
-
readonly "__#private@#isSegwit"?: boolean;
|
|
138
|
-
readonly "__#private@#isTaproot"?: boolean;
|
|
139
|
-
readonly "__#private@#expandedExpression"?: string;
|
|
140
|
-
readonly "__#private@#expandedMiniscript"?: string;
|
|
141
|
-
readonly "__#private@#tapTreeExpression"?: string;
|
|
142
|
-
readonly "__#private@#tapTree"?: TapTreeNode;
|
|
143
|
-
readonly "__#private@#tapTreeInfo"?: TapTreeInfoNode;
|
|
144
|
-
readonly "__#private@#taprootSpendPath": "key" | "script";
|
|
145
|
-
readonly "__#private@#tapLeaf"?: Uint8Array | string;
|
|
146
|
-
readonly "__#private@#expansionMap"?: ExpansionMap;
|
|
147
|
-
readonly "__#private@#network": Network;
|
|
148
|
-
"__#private@#resolveMiniscriptSignersPubKeys"(): Uint8Array[];
|
|
149
|
-
"__#private@#assertMiniscriptSatisfactionResourceLimits"(scriptSatisfaction: Uint8Array): void;
|
|
150
|
-
/**
|
|
151
|
-
* Returns the compiled Script Satisfaction for a miniscript-based Output.
|
|
152
|
-
* The satisfaction is the unlocking script, derived by the Satisfier
|
|
153
|
-
* algorithm (https://bitcoin.sipa.be/miniscript/).
|
|
154
|
-
*
|
|
155
|
-
* This method uses a two-pass flow:
|
|
156
|
-
* 1) Planning: constraints (nLockTime/nSequence) are computed using fake
|
|
157
|
-
* signatures. This is done since the final solution may not need all the
|
|
158
|
-
* signatures in signersPubKeys. And we may avoid the user do extra
|
|
159
|
-
* signing (tedious op with HWW).
|
|
160
|
-
* 2) Signing: the provided signatures are used to build the final
|
|
161
|
-
* satisfaction, while enforcing the planned constraints so the same
|
|
162
|
-
* solution is selected. Not all the signatures of signersPubKeys may
|
|
163
|
-
* be required.
|
|
164
|
-
*
|
|
165
|
-
* The return value includes the satisfaction script and the constraints.
|
|
166
|
-
*/
|
|
167
|
-
getScriptSatisfaction(signatures: PartialSig[]): {
|
|
168
|
-
scriptSatisfaction: Uint8Array;
|
|
169
|
-
nLockTime: number | undefined;
|
|
170
|
-
nSequence: number | undefined;
|
|
171
|
-
};
|
|
172
|
-
"__#private@#resolveTapTreeSignersPubKeys"(): Uint8Array[];
|
|
173
|
-
/**
|
|
174
|
-
* Returns the taproot script‑path satisfaction for a tap miniscript
|
|
175
|
-
* descriptor. This mirrors {@link getScriptSatisfaction} and uses the same
|
|
176
|
-
* two‑pass plan/sign flow.
|
|
177
|
-
*
|
|
178
|
-
* In addition to nLockTime/nSequence, it returns the selected tapLeafHash
|
|
179
|
-
* (the leaf chosen during planning) and the leaf’s tapscript.
|
|
180
|
-
*/
|
|
181
|
-
getTapScriptSatisfaction(signatures: PartialSig[]): TaprootLeafSatisfaction;
|
|
182
|
-
/**
|
|
183
|
-
* Gets the planning constraints (nSequence and nLockTime) derived from the
|
|
184
|
-
* descriptor, just using the expression, signersPubKeys and preimages
|
|
185
|
-
* (using fake signatures).
|
|
186
|
-
* For taproot script-path spends, it also returns the selected tapLeafHash.
|
|
187
|
-
*
|
|
188
|
-
* We just need to know which will be the signatures that will be
|
|
189
|
-
* used (signersPubKeys) but final signatures are not necessary for
|
|
190
|
-
* obtaning nLockTime and nSequence.
|
|
191
|
-
*
|
|
192
|
-
* Remember: nSequence and nLockTime are part of the hash that is signed.
|
|
193
|
-
* Thus, they must not change after computing the signatures.
|
|
194
|
-
* When running miniscript satisfactions with final signatures,
|
|
195
|
-
* satisfyMiniscript verifies that the time constraints did not change.
|
|
196
|
-
*/
|
|
197
|
-
"__#private@#getConstraints"(): {
|
|
198
|
-
nLockTime: number | undefined;
|
|
199
|
-
nSequence: number | undefined;
|
|
200
|
-
tapLeafHash: Uint8Array | undefined;
|
|
201
|
-
} | undefined;
|
|
202
|
-
/**
|
|
203
|
-
* Creates and returns an instance of bitcoinjs-lib
|
|
204
|
-
* [`Payment`](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/payments/index.ts)'s interface with the `scriptPubKey` of this `Output`.
|
|
205
|
-
*/
|
|
206
|
-
getPayment(): Payment;
|
|
207
|
-
/**
|
|
208
|
-
* Returns the Bitcoin Address of this `Output`.
|
|
209
|
-
*/
|
|
210
|
-
getAddress(): string;
|
|
211
|
-
/**
|
|
212
|
-
* Returns this `Output`'s scriptPubKey.
|
|
213
|
-
*/
|
|
214
|
-
getScriptPubKey(): Uint8Array;
|
|
215
|
-
/**
|
|
216
|
-
* Gets the nSequence required to fulfill this `Output`.
|
|
217
|
-
*/
|
|
218
|
-
getSequence(): number | undefined;
|
|
219
|
-
/**
|
|
220
|
-
* Gets the nLockTime required to fulfill this `Output`.
|
|
221
|
-
*/
|
|
222
|
-
getLockTime(): number | undefined;
|
|
223
|
-
/**
|
|
224
|
-
* Returns the tapleaf hash selected during planning for taproot script-path
|
|
225
|
-
* spends. If signersPubKeys are provided, selection is optimized for those
|
|
226
|
-
* pubkeys. If a specific tapLeaf selector is used in spending calls, this
|
|
227
|
-
* reflects that selection.
|
|
228
|
-
*/
|
|
229
|
-
getTapLeafHash(): Uint8Array | undefined;
|
|
230
|
-
/**
|
|
231
|
-
* Gets the witnessScript required to fulfill this `Output`. Only applies to
|
|
232
|
-
* Segwit outputs.
|
|
233
|
-
*/
|
|
234
|
-
getWitnessScript(): Uint8Array | undefined;
|
|
235
|
-
/**
|
|
236
|
-
* Gets the redeemScript required to fullfill this `Output`. Only applies to
|
|
237
|
-
* SH outputs: sh(wpkh), sh(wsh), sh(lockingScript).
|
|
238
|
-
*/
|
|
239
|
-
getRedeemScript(): Uint8Array | undefined;
|
|
240
|
-
/**
|
|
241
|
-
* Gets the bitcoinjs-lib [`network`](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/ts_src/networks.ts) used to create this `Output`.
|
|
242
|
-
*/
|
|
243
|
-
getNetwork(): Network;
|
|
244
|
-
/**
|
|
245
|
-
* Whether this `Output` is Segwit.
|
|
246
|
-
*
|
|
247
|
-
* *NOTE:* When the descriptor in an input is `addr(address)`, it is assumed
|
|
248
|
-
* that any `addr(SH_TYPE_ADDRESS)` is in fact a Segwit `SH_WPKH`
|
|
249
|
-
* (Script Hash-Witness Public Key Hash).
|
|
250
|
-
* For inputs using arbitrary scripts (not standard addresses),
|
|
251
|
-
* use a descriptor in the format `sh(MINISCRIPT)`.
|
|
252
|
-
*
|
|
253
|
-
*/
|
|
254
|
-
isSegwit(): boolean | undefined;
|
|
255
|
-
/**
|
|
256
|
-
* Whether this `Output` is Taproot.
|
|
257
|
-
*/
|
|
258
|
-
isTaproot(): boolean | undefined;
|
|
259
|
-
/**
|
|
260
|
-
* Attempts to determine the type of output script by testing it against
|
|
261
|
-
* various payment types.
|
|
262
|
-
*
|
|
263
|
-
* This method tries to identify if the output is one of the following types:
|
|
264
|
-
* - P2SH (Pay to Script Hash)
|
|
265
|
-
* - P2WSH (Pay to Witness Script Hash)
|
|
266
|
-
* - P2WPKH (Pay to Witness Public Key Hash)
|
|
267
|
-
* - P2PKH (Pay to Public Key Hash)
|
|
268
|
-
* - P2TR (Pay to Taproot)
|
|
269
|
-
*
|
|
270
|
-
* @returns An object { isPKH: boolean; isWPKH: boolean; isSH: boolean; isWSH: boolean; isTR: boolean;}
|
|
271
|
-
* with boolean properties indicating the detected output type
|
|
272
|
-
*/
|
|
273
|
-
guessOutput(): {
|
|
274
|
-
isPKH: boolean;
|
|
275
|
-
isWPKH: boolean;
|
|
276
|
-
isSH: boolean;
|
|
277
|
-
isWSH: boolean;
|
|
278
|
-
isTR: boolean;
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Computes the Weight Unit contributions of this Output as if it were the
|
|
282
|
-
* input in a tx.
|
|
283
|
-
*
|
|
284
|
-
* *NOTE:* When the descriptor in an input is `addr(address)`, it is assumed
|
|
285
|
-
* that any `addr(SH_TYPE_ADDRESS)` is in fact a Segwit `SH_WPKH`
|
|
286
|
-
* (Script Hash-Witness Public Key Hash).
|
|
287
|
-
*, Also any `addr(SINGLE_KEY_ADDRESS)` * is assumed to be a single key Taproot
|
|
288
|
-
* address (like those defined in BIP86).
|
|
289
|
-
* For inputs using arbitrary scripts (not standard addresses),
|
|
290
|
-
* use a descriptor in the format `sh(MINISCRIPT)`, `wsh(MINISCRIPT)` or
|
|
291
|
-
* `tr(KEY,TREE)` for taproot script-path expressions.
|
|
292
|
-
*/
|
|
293
|
-
inputWeight(isSegwitTx: boolean, signatures: PartialSig[] | "DANGEROUSLY_USE_FAKE_SIGNATURES", options?: {
|
|
294
|
-
taprootSighash?: "SIGHASH_DEFAULT" | "non-SIGHASH_DEFAULT";
|
|
295
|
-
}): number;
|
|
296
|
-
/**
|
|
297
|
-
* Computes the Weight Unit contributions of this Output as if it were the
|
|
298
|
-
* output in a tx.
|
|
299
|
-
*/
|
|
300
|
-
outputWeight(): number;
|
|
301
|
-
/**
|
|
302
|
-
* Sets this output as an input of the provided `psbt` and updates the
|
|
303
|
-
* `psbt` locktime if required by the descriptor.
|
|
304
|
-
*
|
|
305
|
-
* `psbt` and `vout` are mandatory. Include `txHex` as well. The pair
|
|
306
|
-
* `vout` and `txHex` define the transaction and output number this instance
|
|
307
|
-
* pertains to.
|
|
308
|
-
*
|
|
309
|
-
* Though not advised, for Segwit inputs you can pass `txId` and `value`
|
|
310
|
-
* in lieu of `txHex`. If doing so, ensure `value` accuracy to avoid
|
|
311
|
-
* potential fee attacks -
|
|
312
|
-
* [See this issue](https://github.com/bitcoinjs/bitcoinjs-lib/issues/1625).
|
|
313
|
-
*
|
|
314
|
-
* Note: Hardware wallets need the [full `txHex` for Segwit](https://blog.trezor.io/details-of-firmware-updates-for-trezor-one-version-1-9-1-and-trezor-model-t-version-2-3-1-1eba8f60f2dd).
|
|
315
|
-
*
|
|
316
|
-
* When unsure, always use `txHex`, and skip `txId` and `value` for safety.
|
|
317
|
-
*
|
|
318
|
-
* Use `rbf` to mark whether this tx can be replaced with another with
|
|
319
|
-
* higher fee while being in the mempool. Note that a tx will automatically
|
|
320
|
-
* be marked as replacable if a single input requests it.
|
|
321
|
-
* Note that any transaction using a relative timelock (nSequence < 0x80000000)
|
|
322
|
-
* also falls within the RBF range (nSequence < 0xFFFFFFFE), making it
|
|
323
|
-
* inherently replaceable. So don't set `rbf` to false if this is tx uses
|
|
324
|
-
* relative time locks.
|
|
325
|
-
*
|
|
326
|
-
* @returns A finalizer function to be used after signing the `psbt`.
|
|
327
|
-
* This function ensures that this input is properly finalized.
|
|
328
|
-
* The finalizer completes the PSBT input by adding the unlocking script
|
|
329
|
-
* (`scriptWitness` or `scriptSig`) that satisfies this `Output`'s spending
|
|
330
|
-
* conditions. Because these scripts include signatures, you should finish
|
|
331
|
-
* all signing operations before calling the finalizer.
|
|
332
|
-
* The finalizer has this signature:
|
|
333
|
-
*
|
|
334
|
-
* `( { psbt, validate = true } : { psbt: Psbt; validate: boolean | undefined } ) => void`
|
|
335
|
-
*
|
|
336
|
-
*/
|
|
337
|
-
updatePsbtAsInput({ psbt, txHex, txId, value, vout, rbf }: {
|
|
338
|
-
psbt: Psbt;
|
|
339
|
-
txHex?: string;
|
|
340
|
-
txId?: string;
|
|
341
|
-
value?: bigint;
|
|
342
|
-
vout: number;
|
|
343
|
-
rbf?: boolean;
|
|
344
|
-
}): ({ psbt, validate }: {
|
|
345
|
-
psbt: Psbt;
|
|
346
|
-
/** Runs further test on the validity of the signatures.
|
|
347
|
-
* It speeds down the finalization process but makes sure the psbt will
|
|
348
|
-
* be valid.
|
|
349
|
-
* @default true */
|
|
350
|
-
validate?: boolean | undefined;
|
|
351
|
-
}) => void;
|
|
352
|
-
/**
|
|
353
|
-
* Adds this output as an output of the provided `psbt` with the given
|
|
354
|
-
* value.
|
|
355
|
-
* @param params - The parameters for the method.
|
|
356
|
-
* @param params.psbt - The Partially Signed Bitcoin Transaction.
|
|
357
|
-
* @param params.value - The value for the output in satoshis.
|
|
358
|
-
*/
|
|
359
|
-
updatePsbtAsOutput({ psbt, value }: {
|
|
360
|
-
psbt: Psbt;
|
|
361
|
-
value: bigint;
|
|
362
|
-
}): void;
|
|
363
|
-
"__#private@#assertPsbtInput"({ psbt, index }: {
|
|
364
|
-
psbt: Psbt;
|
|
365
|
-
index: number;
|
|
366
|
-
}): void;
|
|
367
|
-
/**
|
|
368
|
-
* Decomposes the descriptor used to form this `Output` into its elemental
|
|
369
|
-
* parts. See {@link ExpansionMap ExpansionMap} for a detailed explanation.
|
|
370
|
-
*/
|
|
371
|
-
expand(): {
|
|
372
|
-
expansionMap?: ExpansionMap;
|
|
373
|
-
tapTreeInfo?: TapTreeInfoNode;
|
|
374
|
-
tapTree?: TapTreeNode;
|
|
375
|
-
tapTreeExpression?: string;
|
|
376
|
-
expandedMiniscript?: string;
|
|
377
|
-
miniscript?: string;
|
|
378
|
-
expandedExpression?: string;
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
};
|
|
382
|
-
parseKeyExpression: KeyExpressionParser;
|
|
383
|
-
expand: (params: {
|
|
384
|
-
/**
|
|
385
|
-
* The descriptor expression to be expanded.
|
|
386
|
-
*/
|
|
387
|
-
descriptor: string;
|
|
388
|
-
/**
|
|
389
|
-
* The descriptor index, if ranged.
|
|
390
|
-
*/
|
|
391
|
-
index?: number;
|
|
392
|
-
/**
|
|
393
|
-
* Multipath branch selector used for descriptor key-path tuples like
|
|
394
|
-
* `/<0;1>/*` (and shorthand `/**`).
|
|
395
|
-
*
|
|
396
|
-
* The value passed in `change` must be one of the numbers present in the
|
|
397
|
-
* tuple. For example:
|
|
398
|
-
* - `/<0;1>/*` accepts `change: 0` or `change: 1`
|
|
399
|
-
* - `/<0;1;2>/*` accepts `change: 0`, `1` or `2`
|
|
400
|
-
*/
|
|
401
|
-
change?: number;
|
|
402
|
-
/**
|
|
403
|
-
* A flag indicating whether the descriptor is required to include a checksum.
|
|
404
|
-
* @defaultValue false
|
|
405
|
-
*/
|
|
406
|
-
checksumRequired?: boolean;
|
|
407
|
-
/**
|
|
408
|
-
* The Bitcoin network to use.
|
|
409
|
-
* @defaultValue `networks.bitcoin`
|
|
410
|
-
*/
|
|
411
|
-
network?: Network;
|
|
412
|
-
/**
|
|
413
|
-
* Flag to allow miniscript in P2SH.
|
|
414
|
-
* @defaultValue false
|
|
415
|
-
*/
|
|
416
|
-
allowMiniscriptInP2SH?: boolean;
|
|
417
|
-
}) => Expansion;
|
|
418
|
-
ECPair: ECPairAPI;
|
|
419
|
-
BIP32: BIP32API;
|
|
420
|
-
};
|
|
421
|
-
type OutputConstructor = ReturnType<typeof DescriptorsFactory>['Output'];
|
|
422
|
-
/**
|
|
423
|
-
* The {@link DescriptorsFactory | `DescriptorsFactory`} function internally
|
|
424
|
-
* creates and returns the {@link _Internal_.Output | `Output`} class.
|
|
425
|
-
* This class is specialized for the provided `TinySecp256k1Interface`.
|
|
426
|
-
* Use `OutputInstance` to declare instances for this class:
|
|
427
|
-
* `const: OutputInstance = new Output();`
|
|
428
|
-
*
|
|
429
|
-
* See the {@link _Internal_.Output | documentation for the internal `Output`
|
|
430
|
-
* class} for a complete list of available methods.
|
|
431
|
-
*/
|
|
432
|
-
type OutputInstance = InstanceType<OutputConstructor>;
|
|
433
|
-
export { OutputInstance, OutputConstructor };
|