@scure/btc-signer 2.0.0 → 2.2.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/utxo.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as P from 'micro-packed';
2
2
  import * as psbt from './psbt.ts';
3
3
  import { Transaction, type TxOpts } from './transaction.ts';
4
- import { type Bytes, NETWORK } from './utils.ts';
4
+ import { type Bytes, NETWORK, type TArg } from './utils.ts';
5
+ /** Minimal output target accepted by the UTXO selector. */
5
6
  export type Output = {
6
7
  address: string;
7
8
  amount: bigint;
@@ -9,6 +10,7 @@ export type Output = {
9
10
  script: Uint8Array;
10
11
  amount: bigint;
11
12
  };
13
+ /** Intermediate accumulation result returned by selection heuristics. */
12
14
  export type Accumulated = {
13
15
  indices: number[];
14
16
  fee: bigint | undefined;
@@ -16,13 +18,14 @@ export type Accumulated = {
16
18
  total: bigint;
17
19
  } | undefined;
18
20
  export declare const _cmpBig: (a: bigint, b: bigint) => 0 | 1 | -1;
21
+ /** Options for fee estimation and UTXO selection. */
19
22
  export type EstimatorOpts = TxOpts & {
20
23
  feePerByte: bigint;
21
24
  changeAddress: string;
22
25
  alwaysChange?: boolean;
23
26
  bip69?: boolean;
24
27
  network?: typeof NETWORK;
25
- dust?: number;
28
+ dust?: bigint;
26
29
  dustRelayFeeRate?: bigint;
27
30
  createTx?: boolean;
28
31
  requiredInputs?: psbt.TransactionInputUpdate[];
@@ -31,6 +34,7 @@ export type EstimatorOpts = TxOpts & {
31
34
  type SortStrategy = 'Newest' | 'Oldest' | 'Smallest' | 'Biggest';
32
35
  type ExactStrategy = `exact${SortStrategy}`;
33
36
  type AccumStrategy = `accum${SortStrategy}`;
37
+ /** Supported UTXO selection strategies. */
34
38
  export type SelectionStrategy = 'all' | 'default' | AccumStrategy | `${ExactStrategy}/${AccumStrategy}`;
35
39
  export declare class _Estimator {
36
40
  private baseWeight;
@@ -54,8 +58,8 @@ export declare class _Estimator {
54
58
  default(): Accumulated;
55
59
  private select;
56
60
  result(strategy: SelectionStrategy): ({
57
- inputs: psbt.PSBTKeyMapKeys<{
58
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
61
+ inputs: ({
62
+ nonWitnessUtxo?: P.StructInput<{
59
63
  version: number;
60
64
  segwitFlag: boolean | undefined;
61
65
  inputs: P.StructInput<{
@@ -68,54 +72,219 @@ export declare class _Estimator {
68
72
  amount: /*elided*/ any;
69
73
  script: /*elided*/ any;
70
74
  }>[];
71
- witnesses: P.Option<Bytes[][]>;
75
+ witnesses: P.Option<P.Bytes[][]>;
72
76
  lockTime: number;
73
- }>>, readonly [], readonly [0, 2], false];
74
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
77
+ }> | undefined;
78
+ witnessUtxo?: P.StructInput<{
75
79
  amount: bigint;
76
- script: Bytes;
77
- }>>, readonly [], readonly [0, 2], false];
78
- readonly partialSig: readonly [2, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
79
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
80
- readonly redeemScript: readonly [4, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
81
- readonly witnessScript: readonly [5, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
82
- readonly bip32Derivation: readonly [6, P.CoderType<Bytes>, P.CoderType<P.StructInput<{
80
+ script: P.Bytes;
81
+ }> | undefined;
82
+ partialSig?: [Bytes, Bytes][] | undefined;
83
+ sighashType?: number | undefined;
84
+ redeemScript?: Bytes | undefined;
85
+ witnessScript?: Bytes | undefined;
86
+ bip32Derivation?: [Bytes, P.StructInput<{
83
87
  fingerprint: number;
84
88
  path: number[];
85
- }>>, readonly [], readonly [0, 2], false];
86
- readonly finalScriptSig: readonly [7, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
87
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Bytes[]>, readonly [], readonly [0, 2], false];
88
- readonly porCommitment: readonly [9, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
89
- readonly ripemd160: readonly [10, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
90
- readonly sha256: readonly [11, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
91
- readonly hash160: readonly [12, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
92
- readonly hash256: readonly [13, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
93
- readonly txid: readonly [14, false, P.CoderType<Bytes>, readonly [2], readonly [2], true];
94
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
95
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
96
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
97
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
98
- readonly tapKeySig: readonly [19, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
99
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
89
+ }>][] | undefined;
90
+ finalScriptSig?: Bytes | undefined;
91
+ finalScriptWitness?: Bytes[] | undefined;
92
+ porCommitment?: Bytes | undefined;
93
+ ripemd160?: [Bytes, Bytes][] | undefined;
94
+ sha256?: [Bytes, Bytes][] | undefined;
95
+ hash160?: [Bytes, Bytes][] | undefined;
96
+ hash256?: [Bytes, Bytes][] | undefined;
97
+ txid?: P.Bytes | undefined;
98
+ index?: number | undefined;
99
+ sequence?: number | undefined;
100
+ requiredTimeLocktime?: number | undefined;
101
+ requiredHeightLocktime?: number | undefined;
102
+ tapKeySig?: Bytes | undefined;
103
+ tapScriptSig?: [P.StructInput<{
100
104
  pubKey: Bytes;
101
105
  leafHash: P.Bytes;
102
- }>>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
103
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
106
+ }>, Bytes][] | undefined;
107
+ tapLeafScript?: [P.StructInput<{
104
108
  version: number;
105
109
  internalKey: P.Bytes;
106
110
  merklePath: P.Bytes[];
107
- }>>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
108
- readonly tapBip32Derivation: readonly [22, P.CoderType<Bytes>, P.CoderType<P.StructInput<{
111
+ }>, Bytes][] | undefined;
112
+ tapBip32Derivation?: [Bytes, P.StructInput<{
109
113
  hashes: P.Bytes[];
110
114
  der: P.StructInput<{
111
115
  fingerprint: /*elided*/ any;
112
116
  path: /*elided*/ any;
113
117
  }>;
114
- }>>, readonly [], readonly [0, 2], false];
115
- readonly tapInternalKey: readonly [23, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
116
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
117
- readonly proprietary: readonly [252, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
118
- }>[];
118
+ }>][] | undefined;
119
+ tapInternalKey?: Bytes | undefined;
120
+ tapMerkleRoot?: Bytes | undefined;
121
+ proprietary?: [Bytes, Bytes][] | undefined;
122
+ } & {
123
+ unknown?: [P.UnwrapCoder<P.CoderType<P.StructInput<{
124
+ type: number;
125
+ key: Bytes;
126
+ }>>>, Bytes][];
127
+ } & {
128
+ nonWitnessUtxo?: ({
129
+ version: number;
130
+ inputs: P.StructInput<{
131
+ txid: P.Bytes;
132
+ index: number;
133
+ finalScriptSig: P.Bytes;
134
+ sequence: number;
135
+ }>[];
136
+ outputs: P.StructInput<{
137
+ amount: bigint;
138
+ script: P.Bytes;
139
+ }>[];
140
+ lockTime: number;
141
+ } & {
142
+ segwitFlag?: boolean | undefined;
143
+ witnesses?: P.Option<P.Bytes[][]>;
144
+ } & {
145
+ version: number;
146
+ inputs: P.StructInput<{
147
+ txid: P.Bytes;
148
+ index: number;
149
+ finalScriptSig: P.Bytes;
150
+ sequence: number;
151
+ }>[] & ({
152
+ index: number;
153
+ sequence: number;
154
+ txid: P.Bytes;
155
+ finalScriptSig: P.Bytes;
156
+ } & {} & {
157
+ index: number;
158
+ sequence: number;
159
+ txid: P.Bytes & Uint8Array<ArrayBuffer>;
160
+ finalScriptSig: P.Bytes & Uint8Array<ArrayBuffer>;
161
+ })[];
162
+ outputs: P.StructInput<{
163
+ amount: bigint;
164
+ script: P.Bytes;
165
+ }>[] & ({
166
+ script: P.Bytes;
167
+ amount: bigint;
168
+ } & {} & {
169
+ script: P.Bytes & Uint8Array<ArrayBuffer>;
170
+ amount: bigint;
171
+ })[];
172
+ lockTime: number;
173
+ segwitFlag?: boolean | undefined;
174
+ witnesses?: (P.Bytes[][] & (P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[])[]) | undefined;
175
+ }) | undefined;
176
+ witnessUtxo?: ({
177
+ script: P.Bytes;
178
+ amount: bigint;
179
+ } & {} & {
180
+ script: P.Bytes & Uint8Array<ArrayBuffer>;
181
+ amount: bigint;
182
+ }) | undefined;
183
+ partialSig?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
184
+ sighashType?: number | undefined;
185
+ redeemScript?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
186
+ witnessScript?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
187
+ bip32Derivation?: ([Bytes, P.StructInput<{
188
+ fingerprint: number;
189
+ path: number[];
190
+ }>][] & ([Bytes, P.StructInput<{
191
+ fingerprint: number;
192
+ path: number[];
193
+ }>] & [Bytes & Uint8Array<ArrayBuffer>, {
194
+ path: number[];
195
+ fingerprint: number;
196
+ } & {} & {
197
+ path: number[] & number[];
198
+ fingerprint: number;
199
+ }])[]) | undefined;
200
+ finalScriptSig?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
201
+ finalScriptWitness?: (Bytes[] & (Bytes & Uint8Array<ArrayBuffer>)[]) | undefined;
202
+ porCommitment?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
203
+ ripemd160?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
204
+ sha256?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
205
+ hash160?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
206
+ hash256?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
207
+ txid?: (P.Bytes & Uint8Array<ArrayBuffer>) | undefined;
208
+ index?: number | undefined;
209
+ sequence?: number | undefined;
210
+ requiredTimeLocktime?: number | undefined;
211
+ requiredHeightLocktime?: number | undefined;
212
+ tapKeySig?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
213
+ tapScriptSig?: ([P.StructInput<{
214
+ pubKey: Bytes;
215
+ leafHash: P.Bytes;
216
+ }>, Bytes][] & ([P.StructInput<{
217
+ pubKey: Bytes;
218
+ leafHash: P.Bytes;
219
+ }>, Bytes] & [{
220
+ pubKey: Bytes;
221
+ leafHash: P.Bytes;
222
+ } & {} & {
223
+ pubKey: Bytes & Uint8Array<ArrayBuffer>;
224
+ leafHash: P.Bytes & Uint8Array<ArrayBuffer>;
225
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
226
+ tapLeafScript?: ([P.StructInput<{
227
+ version: number;
228
+ internalKey: P.Bytes;
229
+ merklePath: P.Bytes[];
230
+ }>, Bytes][] & ([P.StructInput<{
231
+ version: number;
232
+ internalKey: P.Bytes;
233
+ merklePath: P.Bytes[];
234
+ }>, Bytes] & [{
235
+ version: number;
236
+ internalKey: P.Bytes;
237
+ merklePath: P.Bytes[];
238
+ } & {} & {
239
+ version: number;
240
+ internalKey: P.Bytes & Uint8Array<ArrayBuffer>;
241
+ merklePath: P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[];
242
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
243
+ tapBip32Derivation?: ([Bytes, P.StructInput<{
244
+ hashes: P.Bytes[];
245
+ der: P.StructInput<{
246
+ fingerprint: /*elided*/ any;
247
+ path: /*elided*/ any;
248
+ }>;
249
+ }>][] & ([Bytes, P.StructInput<{
250
+ hashes: P.Bytes[];
251
+ der: P.StructInput<{
252
+ fingerprint: /*elided*/ any;
253
+ path: /*elided*/ any;
254
+ }>;
255
+ }>] & [Bytes & Uint8Array<ArrayBuffer>, {
256
+ der: P.StructInput<{
257
+ fingerprint: number;
258
+ path: number[];
259
+ }>;
260
+ hashes: P.Bytes[];
261
+ } & {} & {
262
+ der: {
263
+ path: number[];
264
+ fingerprint: number;
265
+ } & {} & {
266
+ path: number[] & number[];
267
+ fingerprint: number;
268
+ };
269
+ hashes: P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[];
270
+ }])[]) | undefined;
271
+ tapInternalKey?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
272
+ tapMerkleRoot?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
273
+ proprietary?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
274
+ unknown?: ([P.StructInput<{
275
+ type: number;
276
+ key: Bytes;
277
+ }>, Bytes][] & ([P.StructInput<{
278
+ type: number;
279
+ key: Bytes;
280
+ }>, Bytes] & [{
281
+ type: number;
282
+ key: Bytes;
283
+ } & {} & {
284
+ type: number;
285
+ key: Bytes & Uint8Array<ArrayBuffer>;
286
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
287
+ })[];
119
288
  outputs: Output[];
120
289
  fee: bigint | undefined;
121
290
  weight: number;
@@ -124,9 +293,38 @@ export declare class _Estimator {
124
293
  tx: Transaction | undefined;
125
294
  }) | undefined;
126
295
  }
127
- export declare function selectUTXO(inputs: psbt.TransactionInputUpdate[], outputs: Output[], strategy: SelectionStrategy, opts: EstimatorOpts): ({
128
- inputs: psbt.PSBTKeyMapKeys<{
129
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
296
+ /**
297
+ * Selects inputs for the requested outputs using the configured strategy.
298
+ * @param inputs - candidate inputs that may be selected
299
+ * @param outputs - desired transaction outputs
300
+ * @param strategy - selection heuristic to use
301
+ * @param opts - Fee-estimation and transaction-construction options. See {@link EstimatorOpts}.
302
+ * @returns Selection result, optionally including a constructed transaction.
303
+ * @throws If the UTXO set, outputs, or estimator options are invalid. {@link Error}
304
+ * @example
305
+ * Estimate fees, pick inputs, and build a transaction for the selected set.
306
+ * ```ts
307
+ * import { p2wpkh } from '@scure/btc-signer/payment.js';
308
+ * import { pubECDSA, randomPrivateKeyBytes } from '@scure/btc-signer/utils.js';
309
+ * import { selectUTXO } from '@scure/btc-signer/utxo.js';
310
+ * import { hex } from '@scure/base';
311
+ * const spend = p2wpkh(pubECDSA(randomPrivateKeyBytes()));
312
+ * const change = p2wpkh(pubECDSA(randomPrivateKeyBytes()));
313
+ * selectUTXO(
314
+ * [{
315
+ * txid: hex.decode('0000000000000000000000000000000000000000000000000000000000000001'),
316
+ * index: 0,
317
+ * witnessUtxo: { amount: 50_000n, script: spend.script },
318
+ * }],
319
+ * [{ address: spend.address!, amount: 10_000n }],
320
+ * 'default',
321
+ * { feePerByte: 1n, changeAddress: change.address! }
322
+ * );
323
+ * ```
324
+ */
325
+ export declare function selectUTXO(inputs: TArg<psbt.TransactionInputUpdate[]>, outputs: TArg<Output[]>, strategy: SelectionStrategy, opts: TArg<EstimatorOpts>): ({
326
+ inputs: ({
327
+ nonWitnessUtxo?: P.StructInput<{
130
328
  version: number;
131
329
  segwitFlag: boolean | undefined;
132
330
  inputs: P.StructInput<{
@@ -139,54 +337,219 @@ export declare function selectUTXO(inputs: psbt.TransactionInputUpdate[], output
139
337
  amount: /*elided*/ any;
140
338
  script: /*elided*/ any;
141
339
  }>[];
142
- witnesses: P.Option<Bytes[][]>;
340
+ witnesses: P.Option<P.Bytes[][]>;
143
341
  lockTime: number;
144
- }>>, readonly [], readonly [0, 2], false];
145
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
342
+ }> | undefined;
343
+ witnessUtxo?: P.StructInput<{
146
344
  amount: bigint;
147
- script: Bytes;
148
- }>>, readonly [], readonly [0, 2], false];
149
- readonly partialSig: readonly [2, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
150
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
151
- readonly redeemScript: readonly [4, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
152
- readonly witnessScript: readonly [5, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
153
- readonly bip32Derivation: readonly [6, P.CoderType<Bytes>, P.CoderType<P.StructInput<{
345
+ script: P.Bytes;
346
+ }> | undefined;
347
+ partialSig?: [Bytes, Bytes][] | undefined;
348
+ sighashType?: number | undefined;
349
+ redeemScript?: Bytes | undefined;
350
+ witnessScript?: Bytes | undefined;
351
+ bip32Derivation?: [Bytes, P.StructInput<{
154
352
  fingerprint: number;
155
353
  path: number[];
156
- }>>, readonly [], readonly [0, 2], false];
157
- readonly finalScriptSig: readonly [7, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
158
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Bytes[]>, readonly [], readonly [0, 2], false];
159
- readonly porCommitment: readonly [9, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
160
- readonly ripemd160: readonly [10, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
161
- readonly sha256: readonly [11, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
162
- readonly hash160: readonly [12, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
163
- readonly hash256: readonly [13, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
164
- readonly txid: readonly [14, false, P.CoderType<Bytes>, readonly [2], readonly [2], true];
165
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
166
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
167
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
168
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
169
- readonly tapKeySig: readonly [19, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
170
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
354
+ }>][] | undefined;
355
+ finalScriptSig?: Bytes | undefined;
356
+ finalScriptWitness?: Bytes[] | undefined;
357
+ porCommitment?: Bytes | undefined;
358
+ ripemd160?: [Bytes, Bytes][] | undefined;
359
+ sha256?: [Bytes, Bytes][] | undefined;
360
+ hash160?: [Bytes, Bytes][] | undefined;
361
+ hash256?: [Bytes, Bytes][] | undefined;
362
+ txid?: P.Bytes | undefined;
363
+ index?: number | undefined;
364
+ sequence?: number | undefined;
365
+ requiredTimeLocktime?: number | undefined;
366
+ requiredHeightLocktime?: number | undefined;
367
+ tapKeySig?: Bytes | undefined;
368
+ tapScriptSig?: [P.StructInput<{
171
369
  pubKey: Bytes;
172
370
  leafHash: P.Bytes;
173
- }>>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
174
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
371
+ }>, Bytes][] | undefined;
372
+ tapLeafScript?: [P.StructInput<{
175
373
  version: number;
176
374
  internalKey: P.Bytes;
177
375
  merklePath: P.Bytes[];
178
- }>>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
179
- readonly tapBip32Derivation: readonly [22, P.CoderType<Bytes>, P.CoderType<P.StructInput<{
376
+ }>, Bytes][] | undefined;
377
+ tapBip32Derivation?: [Bytes, P.StructInput<{
180
378
  hashes: P.Bytes[];
181
379
  der: P.StructInput<{
182
380
  fingerprint: /*elided*/ any;
183
381
  path: /*elided*/ any;
184
382
  }>;
185
- }>>, readonly [], readonly [0, 2], false];
186
- readonly tapInternalKey: readonly [23, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
187
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
188
- readonly proprietary: readonly [252, P.CoderType<Bytes>, P.CoderType<Bytes>, readonly [], readonly [0, 2], false];
189
- }>[];
383
+ }>][] | undefined;
384
+ tapInternalKey?: Bytes | undefined;
385
+ tapMerkleRoot?: Bytes | undefined;
386
+ proprietary?: [Bytes, Bytes][] | undefined;
387
+ } & {
388
+ unknown?: [P.UnwrapCoder<P.CoderType<P.StructInput<{
389
+ type: number;
390
+ key: Bytes;
391
+ }>>>, Bytes][];
392
+ } & {
393
+ nonWitnessUtxo?: ({
394
+ version: number;
395
+ inputs: P.StructInput<{
396
+ txid: P.Bytes;
397
+ index: number;
398
+ finalScriptSig: P.Bytes;
399
+ sequence: number;
400
+ }>[];
401
+ outputs: P.StructInput<{
402
+ amount: bigint;
403
+ script: P.Bytes;
404
+ }>[];
405
+ lockTime: number;
406
+ } & {
407
+ segwitFlag?: boolean | undefined;
408
+ witnesses?: P.Option<P.Bytes[][]>;
409
+ } & {
410
+ version: number;
411
+ inputs: P.StructInput<{
412
+ txid: P.Bytes;
413
+ index: number;
414
+ finalScriptSig: P.Bytes;
415
+ sequence: number;
416
+ }>[] & ({
417
+ index: number;
418
+ sequence: number;
419
+ txid: P.Bytes;
420
+ finalScriptSig: P.Bytes;
421
+ } & {} & {
422
+ index: number;
423
+ sequence: number;
424
+ txid: P.Bytes & Uint8Array<ArrayBuffer>;
425
+ finalScriptSig: P.Bytes & Uint8Array<ArrayBuffer>;
426
+ })[];
427
+ outputs: P.StructInput<{
428
+ amount: bigint;
429
+ script: P.Bytes;
430
+ }>[] & ({
431
+ script: P.Bytes;
432
+ amount: bigint;
433
+ } & {} & {
434
+ script: P.Bytes & Uint8Array<ArrayBuffer>;
435
+ amount: bigint;
436
+ })[];
437
+ lockTime: number;
438
+ segwitFlag?: boolean | undefined;
439
+ witnesses?: (P.Bytes[][] & (P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[])[]) | undefined;
440
+ }) | undefined;
441
+ witnessUtxo?: ({
442
+ script: P.Bytes;
443
+ amount: bigint;
444
+ } & {} & {
445
+ script: P.Bytes & Uint8Array<ArrayBuffer>;
446
+ amount: bigint;
447
+ }) | undefined;
448
+ partialSig?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
449
+ sighashType?: number | undefined;
450
+ redeemScript?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
451
+ witnessScript?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
452
+ bip32Derivation?: ([Bytes, P.StructInput<{
453
+ fingerprint: number;
454
+ path: number[];
455
+ }>][] & ([Bytes, P.StructInput<{
456
+ fingerprint: number;
457
+ path: number[];
458
+ }>] & [Bytes & Uint8Array<ArrayBuffer>, {
459
+ path: number[];
460
+ fingerprint: number;
461
+ } & {} & {
462
+ path: number[] & number[];
463
+ fingerprint: number;
464
+ }])[]) | undefined;
465
+ finalScriptSig?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
466
+ finalScriptWitness?: (Bytes[] & (Bytes & Uint8Array<ArrayBuffer>)[]) | undefined;
467
+ porCommitment?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
468
+ ripemd160?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
469
+ sha256?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
470
+ hash160?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
471
+ hash256?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
472
+ txid?: (P.Bytes & Uint8Array<ArrayBuffer>) | undefined;
473
+ index?: number | undefined;
474
+ sequence?: number | undefined;
475
+ requiredTimeLocktime?: number | undefined;
476
+ requiredHeightLocktime?: number | undefined;
477
+ tapKeySig?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
478
+ tapScriptSig?: ([P.StructInput<{
479
+ pubKey: Bytes;
480
+ leafHash: P.Bytes;
481
+ }>, Bytes][] & ([P.StructInput<{
482
+ pubKey: Bytes;
483
+ leafHash: P.Bytes;
484
+ }>, Bytes] & [{
485
+ pubKey: Bytes;
486
+ leafHash: P.Bytes;
487
+ } & {} & {
488
+ pubKey: Bytes & Uint8Array<ArrayBuffer>;
489
+ leafHash: P.Bytes & Uint8Array<ArrayBuffer>;
490
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
491
+ tapLeafScript?: ([P.StructInput<{
492
+ version: number;
493
+ internalKey: P.Bytes;
494
+ merklePath: P.Bytes[];
495
+ }>, Bytes][] & ([P.StructInput<{
496
+ version: number;
497
+ internalKey: P.Bytes;
498
+ merklePath: P.Bytes[];
499
+ }>, Bytes] & [{
500
+ version: number;
501
+ internalKey: P.Bytes;
502
+ merklePath: P.Bytes[];
503
+ } & {} & {
504
+ version: number;
505
+ internalKey: P.Bytes & Uint8Array<ArrayBuffer>;
506
+ merklePath: P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[];
507
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
508
+ tapBip32Derivation?: ([Bytes, P.StructInput<{
509
+ hashes: P.Bytes[];
510
+ der: P.StructInput<{
511
+ fingerprint: /*elided*/ any;
512
+ path: /*elided*/ any;
513
+ }>;
514
+ }>][] & ([Bytes, P.StructInput<{
515
+ hashes: P.Bytes[];
516
+ der: P.StructInput<{
517
+ fingerprint: /*elided*/ any;
518
+ path: /*elided*/ any;
519
+ }>;
520
+ }>] & [Bytes & Uint8Array<ArrayBuffer>, {
521
+ der: P.StructInput<{
522
+ fingerprint: number;
523
+ path: number[];
524
+ }>;
525
+ hashes: P.Bytes[];
526
+ } & {} & {
527
+ der: {
528
+ path: number[];
529
+ fingerprint: number;
530
+ } & {} & {
531
+ path: number[] & number[];
532
+ fingerprint: number;
533
+ };
534
+ hashes: P.Bytes[] & (P.Bytes & Uint8Array<ArrayBuffer>)[];
535
+ }])[]) | undefined;
536
+ tapInternalKey?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
537
+ tapMerkleRoot?: (Bytes & Uint8Array<ArrayBuffer>) | undefined;
538
+ proprietary?: ([Bytes, Bytes][] & ([Bytes, Bytes] & [Bytes & Uint8Array<ArrayBuffer>, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
539
+ unknown?: ([P.StructInput<{
540
+ type: number;
541
+ key: Bytes;
542
+ }>, Bytes][] & ([P.StructInput<{
543
+ type: number;
544
+ key: Bytes;
545
+ }>, Bytes] & [{
546
+ type: number;
547
+ key: Bytes;
548
+ } & {} & {
549
+ type: number;
550
+ key: Bytes & Uint8Array<ArrayBuffer>;
551
+ }, Bytes & Uint8Array<ArrayBuffer>])[]) | undefined;
552
+ })[];
190
553
  outputs: Output[];
191
554
  fee: bigint | undefined;
192
555
  weight: number;
package/utxo.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["src/utxo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,KAAK,IAAI,MAAM,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