@scure/btc-signer 1.2.2 → 1.3.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.
Files changed (60) hide show
  1. package/README.md +19 -3
  2. package/lib/_type_test.d.ts +2 -0
  3. package/lib/_type_test.d.ts.map +1 -0
  4. package/lib/_type_test.js +59 -0
  5. package/lib/_type_test.js.map +1 -0
  6. package/lib/esm/_type_test.js +57 -0
  7. package/lib/esm/_type_test.js.map +1 -0
  8. package/lib/esm/index.js +13 -3007
  9. package/lib/esm/index.js.map +1 -1
  10. package/lib/esm/payment.js +681 -0
  11. package/lib/esm/payment.js.map +1 -0
  12. package/lib/esm/psbt.js +441 -0
  13. package/lib/esm/psbt.js.map +1 -0
  14. package/lib/esm/script.js +347 -0
  15. package/lib/esm/script.js.map +1 -0
  16. package/lib/esm/transaction.js +1013 -0
  17. package/lib/esm/transaction.js.map +1 -0
  18. package/lib/esm/utils.js +115 -0
  19. package/lib/esm/utils.js.map +1 -0
  20. package/lib/esm/utxo.js +491 -0
  21. package/lib/esm/utxo.js.map +1 -0
  22. package/lib/index.d.ts +18 -1439
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +53 -3042
  25. package/lib/index.js.map +1 -0
  26. package/lib/payment.d.ts +167 -0
  27. package/lib/payment.d.ts.map +1 -0
  28. package/lib/payment.js +704 -0
  29. package/lib/payment.js.map +1 -0
  30. package/lib/psbt.d.ts +834 -0
  31. package/lib/psbt.d.ts.map +1 -0
  32. package/lib/psbt.js +446 -0
  33. package/lib/psbt.js.map +1 -0
  34. package/lib/script.d.ts +154 -0
  35. package/lib/script.d.ts.map +1 -0
  36. package/lib/script.js +353 -0
  37. package/lib/script.js.map +1 -0
  38. package/lib/transaction.d.ts +223 -0
  39. package/lib/transaction.d.ts.map +1 -0
  40. package/lib/transaction.js +1022 -0
  41. package/lib/transaction.js.map +1 -0
  42. package/lib/utils.d.ts +30 -0
  43. package/lib/utils.d.ts.map +1 -0
  44. package/lib/utils.js +128 -0
  45. package/lib/utils.js.map +1 -0
  46. package/lib/utxo.d.ts +251 -0
  47. package/lib/utxo.d.ts.map +1 -0
  48. package/lib/utxo.js +501 -0
  49. package/lib/utxo.js.map +1 -0
  50. package/package.json +40 -10
  51. package/src/_type_test.ts +69 -0
  52. package/src/index.ts +28 -0
  53. package/src/package.json +3 -0
  54. package/src/payment.ts +749 -0
  55. package/src/psbt.ts +512 -0
  56. package/src/script.ts +236 -0
  57. package/src/transaction.ts +1065 -0
  58. package/src/utils.ts +118 -0
  59. package/src/utxo.ts +517 -0
  60. package/index.ts +0 -3067
package/lib/index.d.ts CHANGED
@@ -1,1440 +1,19 @@
1
- import type { Coder } from '@scure/base';
2
- import * as P from 'micro-packed';
3
- export type ExtendType<T, E> = {
4
- [K in keyof T]: K extends keyof E ? E[K] | T[K] : T[K];
5
- };
6
- export type RequireType<T, K extends keyof T> = T & {
7
- [P in K]-?: T[P];
8
- };
9
- export type Bytes = Uint8Array;
10
- export declare const base58check: import("@scure/base").BytesCoder;
11
- export declare function cloneDeep<T>(obj: T): T;
12
- export declare function taprootTweakPrivKey(privKey: Uint8Array, merkleRoot?: Uint8Array): Uint8Array;
13
- export declare function taprootTweakPubkey(pubKey: Uint8Array, h: Uint8Array): [Uint8Array, number];
14
- export declare const NETWORK: {
15
- bech32: string;
16
- pubKeyHash: number;
17
- scriptHash: number;
18
- wif: number;
19
- };
20
- export declare const TEST_NETWORK: typeof NETWORK;
21
- export declare const PRECISION = 8;
22
- export declare const DEFAULT_VERSION = 2;
23
- export declare const DEFAULT_LOCKTIME = 0;
24
- export declare const DEFAULT_SEQUENCE = 4294967295;
25
- export declare const Decimal: {
26
- encode: (from: bigint) => string;
27
- decode: (to: string) => bigint;
28
- };
29
- export declare function _cmpBytes(a: Bytes, b: Bytes): number;
30
- export declare enum OP {
31
- OP_0 = 0,
32
- PUSHDATA1 = 76,
33
- PUSHDATA2 = 77,
34
- PUSHDATA4 = 78,
35
- '1NEGATE' = 79,
36
- RESERVED = 80,
37
- OP_1 = 81,
38
- OP_2 = 82,
39
- OP_3 = 83,
40
- OP_4 = 84,
41
- OP_5 = 85,
42
- OP_6 = 86,
43
- OP_7 = 87,
44
- OP_8 = 88,
45
- OP_9 = 89,
46
- OP_10 = 90,
47
- OP_11 = 91,
48
- OP_12 = 92,
49
- OP_13 = 93,
50
- OP_14 = 94,
51
- OP_15 = 95,
52
- OP_16 = 96,
53
- NOP = 97,
54
- VER = 98,
55
- IF = 99,
56
- NOTIF = 100,
57
- VERIF = 101,
58
- VERNOTIF = 102,
59
- ELSE = 103,
60
- ENDIF = 104,
61
- VERIFY = 105,
62
- RETURN = 106,
63
- TOALTSTACK = 107,
64
- FROMALTSTACK = 108,
65
- '2DROP' = 109,
66
- '2DUP' = 110,
67
- '3DUP' = 111,
68
- '2OVER' = 112,
69
- '2ROT' = 113,
70
- '2SWAP' = 114,
71
- IFDUP = 115,
72
- DEPTH = 116,
73
- DROP = 117,
74
- DUP = 118,
75
- NIP = 119,
76
- OVER = 120,
77
- PICK = 121,
78
- ROLL = 122,
79
- ROT = 123,
80
- SWAP = 124,
81
- TUCK = 125,
82
- CAT = 126,
83
- SUBSTR = 127,
84
- LEFT = 128,
85
- RIGHT = 129,
86
- SIZE = 130,
87
- INVERT = 131,
88
- AND = 132,
89
- OR = 133,
90
- XOR = 134,
91
- EQUAL = 135,
92
- EQUALVERIFY = 136,
93
- RESERVED1 = 137,
94
- RESERVED2 = 138,
95
- '1ADD' = 139,
96
- '1SUB' = 140,
97
- '2MUL' = 141,
98
- '2DIV' = 142,
99
- NEGATE = 143,
100
- ABS = 144,
101
- NOT = 145,
102
- '0NOTEQUAL' = 146,
103
- ADD = 147,
104
- SUB = 148,
105
- MUL = 149,
106
- DIV = 150,
107
- MOD = 151,
108
- LSHIFT = 152,
109
- RSHIFT = 153,
110
- BOOLAND = 154,
111
- BOOLOR = 155,
112
- NUMEQUAL = 156,
113
- NUMEQUALVERIFY = 157,
114
- NUMNOTEQUAL = 158,
115
- LESSTHAN = 159,
116
- GREATERTHAN = 160,
117
- LESSTHANOREQUAL = 161,
118
- GREATERTHANOREQUAL = 162,
119
- MIN = 163,
120
- MAX = 164,
121
- WITHIN = 165,
122
- RIPEMD160 = 166,
123
- SHA1 = 167,
124
- SHA256 = 168,
125
- HASH160 = 169,
126
- HASH256 = 170,
127
- CODESEPARATOR = 171,
128
- CHECKSIG = 172,
129
- CHECKSIGVERIFY = 173,
130
- CHECKMULTISIG = 174,
131
- CHECKMULTISIGVERIFY = 175,
132
- NOP1 = 176,
133
- CHECKLOCKTIMEVERIFY = 177,
134
- CHECKSEQUENCEVERIFY = 178,
135
- NOP4 = 179,
136
- NOP5 = 180,
137
- NOP6 = 181,
138
- NOP7 = 182,
139
- NOP8 = 183,
140
- NOP9 = 184,
141
- NOP10 = 185,
142
- CHECKSIGADD = 186,
143
- INVALID = 255
144
- }
145
- type ScriptOP = keyof typeof OP | Bytes | number;
146
- type ScriptType = ScriptOP[];
147
- export declare const Script: P.CoderType<ScriptType>;
148
- export declare function ScriptNum(bytesLimit?: number, forceMinimal?: boolean): P.CoderType<bigint>;
149
- export declare function OpToNum(op: ScriptOP, bytesLimit?: number, forceMinimal?: boolean): number | undefined;
150
- export declare const CompactSize: P.CoderType<bigint>;
151
- export declare const BTCArray: <T>(t: P.CoderType<T>) => P.CoderType<T[]>;
152
- export declare const VarBytes: P.CoderType<Uint8Array>;
153
- export declare const RawInput: P.CoderType<P.StructInput<{
154
- txid: Uint8Array;
155
- index: number;
156
- finalScriptSig: Uint8Array;
157
- sequence: number;
158
- }>>;
159
- export declare const RawOutput: P.CoderType<P.StructInput<{
160
- amount: bigint;
161
- script: Uint8Array;
162
- }>>;
163
- export declare const RawWitness: P.CoderType<Uint8Array[]>;
164
- export declare const RawTx: P.CoderType<P.StructInput<{
165
- version: number;
166
- segwitFlag: boolean;
167
- inputs: P.StructInput<{
168
- txid: any;
169
- index: any;
170
- finalScriptSig: any;
171
- sequence: any;
172
- }>[];
173
- outputs: P.StructInput<{
174
- amount: any;
175
- script: any;
176
- }>[];
177
- witnesses: P.Option<Uint8Array[][]>;
178
- lockTime: number;
179
- }>>;
180
- type PSBTKeyCoder = P.CoderType<any> | false;
181
- type PSBTKeyMapInfo = Readonly<[
182
- number,
183
- PSBTKeyCoder,
184
- any,
185
- readonly number[],
186
- readonly number[],
187
- boolean
188
- ]>;
189
- type PSBTKeyMap = Record<string, PSBTKeyMapInfo>;
190
- export declare const TaprootControlBlock: P.CoderType<P.StructInput<{
191
- version: number;
192
- internalKey: Uint8Array;
193
- merklePath: Uint8Array[];
194
- }>>;
195
- declare const PSBTUnknownKey: P.CoderType<P.StructInput<{
196
- type: number;
197
- key: Uint8Array;
198
- }>>;
199
- type PSBTUnknownFields = {
200
- unknown?: [P.UnwrapCoder<typeof PSBTUnknownKey>, Bytes][];
201
- };
202
- type PSBTKeyMapKeys<T extends PSBTKeyMap> = {
203
- -readonly [K in keyof T]?: T[K][1] extends false ? P.UnwrapCoder<T[K][2]> : [P.UnwrapCoder<T[K][1]>, P.UnwrapCoder<T[K][2]>][];
204
- } & PSBTUnknownFields;
205
- declare function PSBTKeyMap<T extends PSBTKeyMap>(psbtEnum: T): P.CoderType<PSBTKeyMapKeys<T>>;
206
- declare const PSBTInputCoder: P.CoderType<PSBTKeyMapKeys<{
207
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
208
- version: number;
209
- segwitFlag: boolean;
210
- inputs: P.StructInput<{
211
- txid: any;
212
- index: any;
213
- finalScriptSig: any;
214
- sequence: any;
215
- }>[];
216
- outputs: P.StructInput<{
217
- amount: any;
218
- script: any;
219
- }>[];
220
- witnesses: P.Option<Uint8Array[][]>;
221
- lockTime: number;
222
- }>>, readonly [], readonly [0, 2], false];
223
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
224
- amount: bigint;
225
- script: Uint8Array;
226
- }>>, readonly [], readonly [0, 2], false];
227
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
228
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
229
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
230
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
231
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
232
- fingerprint: number;
233
- path: number[];
234
- }>>, readonly [], readonly [0, 2], false];
235
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
236
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
237
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
238
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
239
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
240
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
241
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
242
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
243
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
244
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
245
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
246
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
247
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
248
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
249
- pubKey: Uint8Array;
250
- leafHash: Uint8Array;
251
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
252
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
253
- version: number;
254
- internalKey: Uint8Array;
255
- merklePath: Uint8Array[];
256
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
257
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
258
- hashes: Uint8Array[];
259
- der: P.StructInput<{
260
- fingerprint: any;
261
- path: any;
262
- }>;
263
- }>>, readonly [], readonly [0, 2], false];
264
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
265
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
266
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
267
- }>>;
268
- declare const PSBTOutputCoder: P.CoderType<PSBTKeyMapKeys<{
269
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
270
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
271
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
272
- fingerprint: number;
273
- path: number[];
274
- }>>, readonly [], readonly [0, 2], false];
275
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
276
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
277
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
278
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
279
- depth: number;
280
- version: number;
281
- script: Uint8Array;
282
- }>[]>, readonly [], readonly [0, 2], false];
283
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
284
- hashes: Uint8Array[];
285
- der: P.StructInput<{
286
- fingerprint: any;
287
- path: any;
288
- }>;
289
- }>>, readonly [], readonly [0, 2], false];
290
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
291
- }>>;
292
- export declare const _RawPSBTV0: P.CoderType<P.StructInput<{
293
- magic: undefined;
294
- global: PSBTKeyMapKeys<{
295
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
296
- version: any;
297
- segwitFlag: any;
298
- inputs: any;
299
- outputs: any;
300
- witnesses: any;
301
- lockTime: any;
302
- }>>, readonly [0], readonly [0], false];
303
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
304
- fingerprint: any;
305
- path: any;
306
- }>>, readonly [], readonly [0, 2], false];
307
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
308
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
309
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
310
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
311
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
312
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
313
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
314
- }>;
315
- inputs: PSBTKeyMapKeys<{
316
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
317
- version: any;
318
- segwitFlag: any;
319
- inputs: any;
320
- outputs: any;
321
- witnesses: any;
322
- lockTime: any;
323
- }>>, readonly [], readonly [0, 2], false];
324
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
325
- amount: any;
326
- script: any;
327
- }>>, readonly [], readonly [0, 2], false];
328
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
329
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
330
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
331
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
332
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
333
- fingerprint: any;
334
- path: any;
335
- }>>, readonly [], readonly [0, 2], false];
336
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
337
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
338
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
339
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
340
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
341
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
342
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
343
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
344
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
345
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
346
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
347
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
348
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
349
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
350
- pubKey: any;
351
- leafHash: any;
352
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
353
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
354
- version: any;
355
- internalKey: any;
356
- merklePath: any;
357
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
358
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
359
- hashes: any;
360
- der: any;
361
- }>>, readonly [], readonly [0, 2], false];
362
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
363
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
364
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
365
- }>[];
366
- outputs: PSBTKeyMapKeys<{
367
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
368
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
369
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
370
- fingerprint: any;
371
- path: any;
372
- }>>, readonly [], readonly [0, 2], false];
373
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
374
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
375
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
376
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
377
- depth: any;
378
- version: any;
379
- script: any;
380
- }>[]>, readonly [], readonly [0, 2], false];
381
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
382
- hashes: any;
383
- der: any;
384
- }>>, readonly [], readonly [0, 2], false];
385
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
386
- }>[];
387
- }>>;
388
- export declare const _RawPSBTV2: P.CoderType<P.StructInput<{
389
- magic: undefined;
390
- global: PSBTKeyMapKeys<{
391
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
392
- version: any;
393
- segwitFlag: any;
394
- inputs: any;
395
- outputs: any;
396
- witnesses: any;
397
- lockTime: any;
398
- }>>, readonly [0], readonly [0], false];
399
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
400
- fingerprint: any;
401
- path: any;
402
- }>>, readonly [], readonly [0, 2], false];
403
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
404
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
405
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
406
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
407
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
408
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
409
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
410
- }>;
411
- inputs: PSBTKeyMapKeys<{
412
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
413
- version: any;
414
- segwitFlag: any;
415
- inputs: any;
416
- outputs: any;
417
- witnesses: any;
418
- lockTime: any;
419
- }>>, readonly [], readonly [0, 2], false];
420
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
421
- amount: any;
422
- script: any;
423
- }>>, readonly [], readonly [0, 2], false];
424
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
425
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
426
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
427
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
428
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
429
- fingerprint: any;
430
- path: any;
431
- }>>, readonly [], readonly [0, 2], false];
432
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
433
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
434
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
435
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
436
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
437
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
438
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
439
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
440
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
441
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
442
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
443
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
444
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
445
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
446
- pubKey: any;
447
- leafHash: any;
448
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
449
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
450
- version: any;
451
- internalKey: any;
452
- merklePath: any;
453
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
454
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
455
- hashes: any;
456
- der: any;
457
- }>>, readonly [], readonly [0, 2], false];
458
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
459
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
460
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
461
- }>[];
462
- outputs: PSBTKeyMapKeys<{
463
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
464
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
465
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
466
- fingerprint: any;
467
- path: any;
468
- }>>, readonly [], readonly [0, 2], false];
469
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
470
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
471
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
472
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
473
- depth: any;
474
- version: any;
475
- script: any;
476
- }>[]>, readonly [], readonly [0, 2], false];
477
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
478
- hashes: any;
479
- der: any;
480
- }>>, readonly [], readonly [0, 2], false];
481
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
482
- }>[];
483
- }>>;
484
- export type PSBTRaw = typeof _RawPSBTV0 | typeof _RawPSBTV2;
485
- export declare const _DebugPSBT: P.CoderType<P.StructInput<{
486
- magic: undefined;
487
- items: Record<string, string | Uint8Array>[];
488
- }>>;
489
- export declare const RawPSBTV0: P.CoderType<P.StructInput<{
490
- magic: undefined;
491
- global: PSBTKeyMapKeys<{
492
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
493
- version: any;
494
- segwitFlag: any;
495
- inputs: any;
496
- outputs: any;
497
- witnesses: any;
498
- lockTime: any;
499
- }>>, readonly [0], readonly [0], false];
500
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
501
- fingerprint: any;
502
- path: any;
503
- }>>, readonly [], readonly [0, 2], false];
504
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
505
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
506
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
507
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
508
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
509
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
510
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
511
- }>;
512
- inputs: PSBTKeyMapKeys<{
513
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
514
- version: any;
515
- segwitFlag: any;
516
- inputs: any;
517
- outputs: any;
518
- witnesses: any;
519
- lockTime: any;
520
- }>>, readonly [], readonly [0, 2], false];
521
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
522
- amount: any;
523
- script: any;
524
- }>>, readonly [], readonly [0, 2], false];
525
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
526
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
527
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
528
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
529
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
530
- fingerprint: any;
531
- path: any;
532
- }>>, readonly [], readonly [0, 2], false];
533
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
534
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
535
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
536
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
537
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
538
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
539
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
540
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
541
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
542
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
543
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
544
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
545
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
546
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
547
- pubKey: any;
548
- leafHash: any;
549
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
550
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
551
- version: any;
552
- internalKey: any;
553
- merklePath: any;
554
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
555
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
556
- hashes: any;
557
- der: any;
558
- }>>, readonly [], readonly [0, 2], false];
559
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
560
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
561
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
562
- }>[];
563
- outputs: PSBTKeyMapKeys<{
564
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
565
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
566
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
567
- fingerprint: any;
568
- path: any;
569
- }>>, readonly [], readonly [0, 2], false];
570
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
571
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
572
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
573
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
574
- depth: any;
575
- version: any;
576
- script: any;
577
- }>[]>, readonly [], readonly [0, 2], false];
578
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
579
- hashes: any;
580
- der: any;
581
- }>>, readonly [], readonly [0, 2], false];
582
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
583
- }>[];
584
- }> | P.StructInput<{
585
- magic: undefined;
586
- global: PSBTKeyMapKeys<{
587
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
588
- version: any;
589
- segwitFlag: any;
590
- inputs: any;
591
- outputs: any;
592
- witnesses: any;
593
- lockTime: any;
594
- }>>, readonly [0], readonly [0], false];
595
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
596
- fingerprint: any;
597
- path: any;
598
- }>>, readonly [], readonly [0, 2], false];
599
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
600
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
601
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
602
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
603
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
604
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
605
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
606
- }>;
607
- inputs: PSBTKeyMapKeys<{
608
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
609
- version: any;
610
- segwitFlag: any;
611
- inputs: any;
612
- outputs: any;
613
- witnesses: any;
614
- lockTime: any;
615
- }>>, readonly [], readonly [0, 2], false];
616
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
617
- amount: any;
618
- script: any;
619
- }>>, readonly [], readonly [0, 2], false];
620
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
621
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
622
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
623
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
624
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
625
- fingerprint: any;
626
- path: any;
627
- }>>, readonly [], readonly [0, 2], false];
628
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
629
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
630
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
631
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
632
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
633
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
634
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
635
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
636
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
637
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
638
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
639
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
640
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
641
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
642
- pubKey: any;
643
- leafHash: any;
644
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
645
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
646
- version: any;
647
- internalKey: any;
648
- merklePath: any;
649
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
650
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
651
- hashes: any;
652
- der: any;
653
- }>>, readonly [], readonly [0, 2], false];
654
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
655
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
656
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
657
- }>[];
658
- outputs: PSBTKeyMapKeys<{
659
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
660
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
661
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
662
- fingerprint: any;
663
- path: any;
664
- }>>, readonly [], readonly [0, 2], false];
665
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
666
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
667
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
668
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
669
- depth: any;
670
- version: any;
671
- script: any;
672
- }>[]>, readonly [], readonly [0, 2], false];
673
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
674
- hashes: any;
675
- der: any;
676
- }>>, readonly [], readonly [0, 2], false];
677
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
678
- }>[];
679
- }>>;
680
- export declare const RawPSBTV2: P.CoderType<P.StructInput<{
681
- magic: undefined;
682
- global: PSBTKeyMapKeys<{
683
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
684
- version: any;
685
- segwitFlag: any;
686
- inputs: any;
687
- outputs: any;
688
- witnesses: any;
689
- lockTime: any;
690
- }>>, readonly [0], readonly [0], false];
691
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
692
- fingerprint: any;
693
- path: any;
694
- }>>, readonly [], readonly [0, 2], false];
695
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
696
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
697
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
698
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
699
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
700
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
701
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
702
- }>;
703
- inputs: PSBTKeyMapKeys<{
704
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
705
- version: any;
706
- segwitFlag: any;
707
- inputs: any;
708
- outputs: any;
709
- witnesses: any;
710
- lockTime: any;
711
- }>>, readonly [], readonly [0, 2], false];
712
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
713
- amount: any;
714
- script: any;
715
- }>>, readonly [], readonly [0, 2], false];
716
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
717
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
718
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
719
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
720
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
721
- fingerprint: any;
722
- path: any;
723
- }>>, readonly [], readonly [0, 2], false];
724
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
725
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
726
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
727
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
728
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
729
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
730
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
731
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
732
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
733
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
734
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
735
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
736
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
737
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
738
- pubKey: any;
739
- leafHash: any;
740
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
741
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
742
- version: any;
743
- internalKey: any;
744
- merklePath: any;
745
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
746
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
747
- hashes: any;
748
- der: any;
749
- }>>, readonly [], readonly [0, 2], false];
750
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
751
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
752
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
753
- }>[];
754
- outputs: PSBTKeyMapKeys<{
755
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
756
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
757
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
758
- fingerprint: any;
759
- path: any;
760
- }>>, readonly [], readonly [0, 2], false];
761
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
762
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
763
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
764
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
765
- depth: any;
766
- version: any;
767
- script: any;
768
- }>[]>, readonly [], readonly [0, 2], false];
769
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
770
- hashes: any;
771
- der: any;
772
- }>>, readonly [], readonly [0, 2], false];
773
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
774
- }>[];
775
- }> | P.StructInput<{
776
- magic: undefined;
777
- global: PSBTKeyMapKeys<{
778
- readonly unsignedTx: readonly [0, false, P.CoderType<P.StructInput<{
779
- version: any;
780
- segwitFlag: any;
781
- inputs: any;
782
- outputs: any;
783
- witnesses: any;
784
- lockTime: any;
785
- }>>, readonly [0], readonly [0], false];
786
- readonly xpub: readonly [1, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
787
- fingerprint: any;
788
- path: any;
789
- }>>, readonly [], readonly [0, 2], false];
790
- readonly txVersion: readonly [2, false, P.CoderType<number>, readonly [2], readonly [2], false];
791
- readonly fallbackLocktime: readonly [3, false, P.CoderType<number>, readonly [], readonly [2], false];
792
- readonly inputCount: readonly [4, false, P.CoderType<number>, readonly [2], readonly [2], false];
793
- readonly outputCount: readonly [5, false, P.CoderType<number>, readonly [2], readonly [2], false];
794
- readonly txModifiable: readonly [6, false, P.CoderType<number>, readonly [], readonly [2], false];
795
- readonly version: readonly [251, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
796
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
797
- }>;
798
- inputs: PSBTKeyMapKeys<{
799
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
800
- version: any;
801
- segwitFlag: any;
802
- inputs: any;
803
- outputs: any;
804
- witnesses: any;
805
- lockTime: any;
806
- }>>, readonly [], readonly [0, 2], false];
807
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
808
- amount: any;
809
- script: any;
810
- }>>, readonly [], readonly [0, 2], false];
811
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
812
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
813
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
814
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
815
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
816
- fingerprint: any;
817
- path: any;
818
- }>>, readonly [], readonly [0, 2], false];
819
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
820
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
821
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
822
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
823
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
824
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
825
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
826
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
827
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
828
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
829
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
830
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
831
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
832
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
833
- pubKey: any;
834
- leafHash: any;
835
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
836
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
837
- version: any;
838
- internalKey: any;
839
- merklePath: any;
840
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
841
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
842
- hashes: any;
843
- der: any;
844
- }>>, readonly [], readonly [0, 2], false];
845
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
846
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
847
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
848
- }>[];
849
- outputs: PSBTKeyMapKeys<{
850
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
851
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
852
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
853
- fingerprint: any;
854
- path: any;
855
- }>>, readonly [], readonly [0, 2], false];
856
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
857
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
858
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
859
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
860
- depth: any;
861
- version: any;
862
- script: any;
863
- }>[]>, readonly [], readonly [0, 2], false];
864
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
865
- hashes: any;
866
- der: any;
867
- }>>, readonly [], readonly [0, 2], false];
868
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
869
- }>[];
870
- }>>;
871
- export type P2Ret = {
872
- type: string;
873
- script: Bytes;
874
- address?: string;
875
- redeemScript?: Bytes;
876
- witnessScript?: Bytes;
877
- };
878
- type OutPKType = {
879
- type: 'pk';
880
- pubkey: Bytes;
881
- };
882
- export declare const p2pk: (pubkey: Bytes, network?: {
883
- bech32: string;
884
- pubKeyHash: number;
885
- scriptHash: number;
886
- wif: number;
887
- }) => P2Ret;
888
- type OutPKHType = {
889
- type: 'pkh';
890
- hash: Bytes;
891
- };
892
- export declare const p2pkh: (publicKey: Bytes, network?: {
893
- bech32: string;
894
- pubKeyHash: number;
895
- scriptHash: number;
896
- wif: number;
897
- }) => P2Ret;
898
- type OutSHType = {
899
- type: 'sh';
900
- hash: Bytes;
901
- };
902
- export declare const p2sh: (child: P2Ret, network?: {
903
- bech32: string;
904
- pubKeyHash: number;
905
- scriptHash: number;
906
- wif: number;
907
- }) => P2Ret;
908
- type OutWSHType = {
909
- type: 'wsh';
910
- hash: Bytes;
911
- };
912
- export declare const p2wsh: (child: P2Ret, network?: {
913
- bech32: string;
914
- pubKeyHash: number;
915
- scriptHash: number;
916
- wif: number;
917
- }) => P2Ret;
918
- type OutWPKHType = {
919
- type: 'wpkh';
920
- hash: Bytes;
921
- };
922
- export declare const p2wpkh: (publicKey: Bytes, network?: {
923
- bech32: string;
924
- pubKeyHash: number;
925
- scriptHash: number;
926
- wif: number;
927
- }) => P2Ret;
928
- type OutMSType = {
929
- type: 'ms';
930
- pubkeys: Bytes[];
931
- m: number;
932
- };
933
- export declare const p2ms: (m: number, pubkeys: Bytes[], allowSamePubkeys?: boolean) => P2Ret;
934
- type OutTRType = {
935
- type: 'tr';
936
- pubkey: Bytes;
937
- };
938
- export type TaprootNode = {
939
- script: Bytes | string;
940
- leafVersion?: number;
941
- weight?: number;
942
- } & Partial<P2TROut>;
943
- export type TaprootScriptTree = TaprootNode | TaprootScriptTree[];
944
- export type TaprootScriptList = TaprootNode[];
945
- export declare function taprootListToTree(taprootList: TaprootScriptList): TaprootScriptTree;
946
- type TaprootLeaf = {
947
- type: 'leaf';
948
- version?: number;
949
- script: Bytes;
950
- hash: Bytes;
951
- path: Bytes[];
952
- };
953
- export declare const TAPROOT_UNSPENDABLE_KEY: Uint8Array;
954
- export type P2TROut = P2Ret & {
955
- tweakedPubkey: Uint8Array;
956
- tapInternalKey: Uint8Array;
957
- tapMerkleRoot?: Uint8Array;
958
- tapLeafScript?: TransactionInput['tapLeafScript'];
959
- leaves?: TaprootLeaf[];
960
- };
961
- export declare function p2tr(internalPubKey?: Bytes | string, tree?: TaprootScriptTree, network?: {
962
- bech32: string;
963
- pubKeyHash: number;
964
- scriptHash: number;
965
- wif: number;
966
- }, allowUnknownOutputs?: boolean): P2TROut;
967
- type OutTRNSType = {
968
- type: 'tr_ns';
969
- pubkeys: Bytes[];
970
- };
971
- export declare function combinations<T>(m: number, list: T[]): T[][];
972
- /**
973
- * M-of-N multi-leaf wallet via p2tr_ns. If m == n, single script is emitted.
974
- * Takes O(n^2) if m != n. 99-of-100 is ok, 5-of-100 is not.
975
- * `2-of-[A,B,C] => [A,B] | [A,C] | [B,C]`
976
- */
977
- export declare const p2tr_ns: (m: number, pubkeys: Bytes[], allowSamePubkeys?: boolean) => P2Ret[];
978
- export declare const p2tr_pk: (pubkey: Bytes) => P2Ret;
979
- type OutTRMSType = {
980
- type: 'tr_ms';
981
- pubkeys: Bytes[];
982
- m: number;
983
- };
984
- export declare function p2tr_ms(m: number, pubkeys: Bytes[], allowSamePubkeys?: boolean): {
985
- type: string;
986
- script: Uint8Array;
987
- };
988
- type OutUnknownType = {
989
- type: 'unknown';
990
- script: Bytes;
991
- };
992
- export declare const OutScript: P.CoderType<NonNullable<OutWSHType | OutPKType | OutPKHType | OutSHType | OutWPKHType | OutMSType | OutTRType | OutTRNSType | OutTRMSType | OutUnknownType | undefined>>;
993
- export declare function programToWitness(version: number, data: Bytes, network?: {
994
- bech32: string;
995
- pubKeyHash: number;
996
- scriptHash: number;
997
- wif: number;
998
- }): `${Lowercase<string>}1${string}`;
999
- export declare function WIF(network?: {
1000
- bech32: string;
1001
- pubKeyHash: number;
1002
- scriptHash: number;
1003
- wif: number;
1004
- }): Coder<Bytes, string>;
1005
- export declare function Address(network?: {
1006
- bech32: string;
1007
- pubKeyHash: number;
1008
- scriptHash: number;
1009
- wif: number;
1010
- }): {
1011
- encode(from: P.UnwrapCoder<typeof OutScript>): string;
1012
- decode(address: string): P.UnwrapCoder<typeof OutScript>;
1013
- };
1014
- /**
1015
- * Internal, exported only for backwards-compat. Use `SigHash` instead.
1016
- * @deprecated
1017
- */
1018
- export declare enum SignatureHash {
1019
- DEFAULT = 0,
1020
- ALL = 1,
1021
- NONE = 2,
1022
- SINGLE = 3,
1023
- ANYONECANPAY = 128
1024
- }
1025
- export declare enum SigHash {
1026
- DEFAULT = 0,
1027
- ALL = 1,
1028
- NONE = 2,
1029
- SINGLE = 3,
1030
- DEFAULT_ANYONECANPAY = 128,
1031
- ALL_ANYONECANPAY = 129,
1032
- NONE_ANYONECANPAY = 130,
1033
- SINGLE_ANYONECANPAY = 131
1034
- }
1035
- export declare const _sortPubkeys: (pubkeys: Bytes[]) => Uint8Array[];
1036
- export type TransactionInput = P.UnwrapCoder<typeof PSBTInputCoder>;
1037
- export type TransactionInputUpdate = ExtendType<TransactionInput, {
1038
- nonWitnessUtxo?: string | Bytes;
1039
- txid?: string;
1040
- }>;
1041
- export type TransactionInputRequired = {
1042
- txid: Bytes;
1043
- index: number;
1044
- sequence: number;
1045
- finalScriptSig: Bytes;
1046
- };
1047
- export type TransactionOutput = P.UnwrapCoder<typeof PSBTOutputCoder>;
1048
- export type TransactionOutputUpdate = ExtendType<TransactionOutput, {
1049
- script?: string;
1050
- }>;
1051
- export type TransactionOutputRequired = {
1052
- script: Bytes;
1053
- amount: bigint;
1054
- };
1055
- export declare const TAP_LEAF_VERSION = 192;
1056
- export declare const tapLeafHash: (script: Bytes, version?: number) => Uint8Array;
1057
- interface HDKey {
1058
- publicKey: Bytes;
1059
- privateKey: Bytes;
1060
- fingerprint: number;
1061
- derive(path: string): HDKey;
1062
- deriveChild(index: number): HDKey;
1063
- sign(hash: Bytes): Bytes;
1064
- }
1065
- export type Signer = Bytes | HDKey;
1066
- export type TxOpts = {
1067
- version?: number;
1068
- lockTime?: number;
1069
- PSBTVersion?: number;
1070
- /** @deprecated Use `allowUnknownOutputs` */
1071
- allowUnknowOutput?: boolean;
1072
- allowUnknownOutputs?: boolean;
1073
- /** @deprecated Use `allowUnknownInputs` */
1074
- allowUnknowInput?: boolean;
1075
- allowUnknownInputs?: boolean;
1076
- disableScriptCheck?: boolean;
1077
- bip174jsCompat?: boolean;
1078
- allowLegacyWitnessUtxo?: boolean;
1079
- lowR?: boolean;
1080
- };
1081
- declare function validateOpts(opts: TxOpts): Readonly<{
1082
- version: number;
1083
- lockTime: number;
1084
- PSBTVersion: number;
1085
- /** @deprecated Use `allowUnknownOutputs` */
1086
- allowUnknowOutput?: boolean | undefined;
1087
- allowUnknownOutputs?: boolean | undefined;
1088
- /** @deprecated Use `allowUnknownInputs` */
1089
- allowUnknowInput?: boolean | undefined;
1090
- allowUnknownInputs?: boolean | undefined;
1091
- disableScriptCheck?: boolean | undefined;
1092
- bip174jsCompat?: boolean | undefined;
1093
- allowLegacyWitnessUtxo?: boolean | undefined;
1094
- lowR?: boolean | undefined;
1095
- }>;
1096
- export declare class Transaction {
1097
- private global;
1098
- private inputs;
1099
- private outputs;
1100
- readonly opts: ReturnType<typeof validateOpts>;
1101
- constructor(opts?: TxOpts);
1102
- static fromRaw(raw: Bytes, opts?: TxOpts): Transaction;
1103
- static fromPSBT(psbt: Bytes, opts?: TxOpts): Transaction;
1104
- toPSBT(PSBTVersion?: number): Uint8Array;
1105
- get lockTime(): number;
1106
- get version(): number;
1107
- private inputStatus;
1108
- private inputSighash;
1109
- private signStatus;
1110
- get isFinal(): boolean;
1111
- get hasWitnesses(): boolean;
1112
- get weight(): number;
1113
- get vsize(): number;
1114
- toBytes(withScriptSig?: boolean, withWitness?: boolean): Uint8Array;
1115
- get unsignedTx(): Bytes;
1116
- get hex(): string;
1117
- get hash(): string;
1118
- get id(): string;
1119
- private checkInputIdx;
1120
- getInput(idx: number): PSBTKeyMapKeys<{
1121
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
1122
- version: number;
1123
- segwitFlag: boolean;
1124
- inputs: P.StructInput<{
1125
- txid: any;
1126
- index: any;
1127
- finalScriptSig: any;
1128
- sequence: any;
1129
- }>[];
1130
- outputs: P.StructInput<{
1131
- amount: any;
1132
- script: any;
1133
- }>[];
1134
- witnesses: P.Option<Uint8Array[][]>;
1135
- lockTime: number;
1136
- }>>, readonly [], readonly [0, 2], false];
1137
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
1138
- amount: bigint;
1139
- script: Uint8Array;
1140
- }>>, readonly [], readonly [0, 2], false];
1141
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1142
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
1143
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1144
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1145
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1146
- fingerprint: number;
1147
- path: number[];
1148
- }>>, readonly [], readonly [0, 2], false];
1149
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1150
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
1151
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1152
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1153
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1154
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1155
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1156
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
1157
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
1158
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
1159
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
1160
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
1161
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1162
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
1163
- pubKey: Uint8Array;
1164
- leafHash: Uint8Array;
1165
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1166
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
1167
- version: number;
1168
- internalKey: Uint8Array;
1169
- merklePath: Uint8Array[];
1170
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1171
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1172
- hashes: Uint8Array[];
1173
- der: P.StructInput<{
1174
- fingerprint: any;
1175
- path: any;
1176
- }>;
1177
- }>>, readonly [], readonly [0, 2], false];
1178
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1179
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1180
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1181
- }>;
1182
- get inputsLength(): number;
1183
- addInput(input: TransactionInputUpdate, _ignoreSignStatus?: boolean): number;
1184
- updateInput(idx: number, input: TransactionInputUpdate, _ignoreSignStatus?: boolean): void;
1185
- private checkOutputIdx;
1186
- getOutput(idx: number): PSBTKeyMapKeys<{
1187
- readonly redeemScript: readonly [0, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1188
- readonly witnessScript: readonly [1, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1189
- readonly bip32Derivation: readonly [2, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1190
- fingerprint: number;
1191
- path: number[];
1192
- }>>, readonly [], readonly [0, 2], false];
1193
- readonly amount: readonly [3, false, P.CoderType<bigint>, readonly [2], readonly [2], true];
1194
- readonly script: readonly [4, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
1195
- readonly tapInternalKey: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1196
- readonly tapTree: readonly [6, false, P.CoderType<P.StructInput<{
1197
- depth: number;
1198
- version: number;
1199
- script: Uint8Array;
1200
- }>[]>, readonly [], readonly [0, 2], false];
1201
- readonly tapBip32Derivation: readonly [7, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1202
- hashes: Uint8Array[];
1203
- der: P.StructInput<{
1204
- fingerprint: any;
1205
- path: any;
1206
- }>;
1207
- }>>, readonly [], readonly [0, 2], false];
1208
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1209
- }>;
1210
- get outputsLength(): number;
1211
- private normalizeOutput;
1212
- addOutput(o: TransactionOutputUpdate, _ignoreSignStatus?: boolean): number;
1213
- updateOutput(idx: number, output: TransactionOutputUpdate, _ignoreSignStatus?: boolean): void;
1214
- addOutputAddress(address: string, amount: bigint, network?: {
1215
- bech32: string;
1216
- pubKeyHash: number;
1217
- scriptHash: number;
1218
- wif: number;
1219
- }): number;
1220
- get fee(): bigint;
1221
- private preimageLegacy;
1222
- preimageWitnessV0(idx: number, prevOutScript: Bytes, hashType: number, amount: bigint): Uint8Array;
1223
- preimageWitnessV1(idx: number, prevOutScript: Bytes[], hashType: number, amount: bigint[], codeSeparator?: number, leafScript?: Bytes, leafVer?: number, annex?: Bytes): Uint8Array;
1224
- signIdx(privateKey: Signer, idx: number, allowedSighash?: SigHash[], _auxRand?: Bytes): boolean;
1225
- sign(privateKey: Signer, allowedSighash?: number[], _auxRand?: Bytes): number;
1226
- finalizeIdx(idx: number): void;
1227
- finalize(): void;
1228
- extract(): Uint8Array;
1229
- combine(other: Transaction): this;
1230
- clone(): Transaction;
1231
- }
1232
- export declare function getAddress(type: 'pkh' | 'wpkh' | 'tr', privKey: Bytes, network?: {
1233
- bech32: string;
1234
- pubKeyHash: number;
1235
- scriptHash: number;
1236
- wif: number;
1237
- }): string | undefined;
1238
- export declare function multisig(m: number, pubkeys: Bytes[], sorted?: boolean, witness?: boolean): P2Ret;
1239
- export declare function sortedMultisig(m: number, pubkeys: Bytes[], witness?: boolean): P2Ret;
1240
- export declare function bip32Path(path: string): number[];
1241
- export declare function PSBTCombine(psbts: Bytes[]): Bytes;
1242
- type Output = {
1243
- address: string;
1244
- amount: bigint;
1245
- } | {
1246
- script: Uint8Array;
1247
- amount: bigint;
1248
- };
1249
- export declare const _cmpBig: (a: bigint, b: bigint) => 0 | 1 | -1;
1250
- export type EstimatorOpts = TxOpts & {
1251
- feePerByte: bigint;
1252
- changeAddress: string;
1253
- alwaysChange?: boolean;
1254
- bip69?: boolean;
1255
- network?: typeof NETWORK;
1256
- dust?: number;
1257
- createTx?: boolean;
1258
- };
1259
- type SortStrategy = 'Newest' | 'Oldest' | 'Smallest' | 'Biggest';
1260
- type ExactStrategy = `exact${SortStrategy}`;
1261
- type AccumStrategy = `accum${SortStrategy}`;
1262
- export type SelectionStrategy = 'all' | 'default' | AccumStrategy | `${ExactStrategy}/${AccumStrategy}`;
1263
- export declare class _Estimator {
1264
- private inputs;
1265
- private outputs;
1266
- private opts;
1267
- private baseWeight;
1268
- private changeWeight;
1269
- private amount;
1270
- private normalizedInputs;
1271
- private dust;
1272
- constructor(inputs: TransactionInputUpdate[], outputs: Output[], opts: EstimatorOpts);
1273
- private checkInputIdx;
1274
- private sortIndices;
1275
- private sortOutputs;
1276
- private getSatoshi;
1277
- get biggest(): number[];
1278
- get smallest(): number[];
1279
- get oldest(): number[];
1280
- get newest(): number[];
1281
- accumulate(indices: number[], exact?: boolean, skipNegative?: boolean, all?: boolean): {
1282
- indices: number[];
1283
- fee: bigint | undefined;
1284
- weight: number;
1285
- total: bigint;
1286
- } | undefined;
1287
- default(): {
1288
- indices: number[];
1289
- fee: bigint | undefined;
1290
- weight: number;
1291
- total: bigint;
1292
- } | undefined;
1293
- private select;
1294
- result(strategy: SelectionStrategy): {
1295
- tx: Transaction | undefined;
1296
- inputs: ExtendType<PSBTKeyMapKeys<{
1297
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
1298
- version: number;
1299
- segwitFlag: boolean;
1300
- inputs: P.StructInput<{
1301
- txid: any;
1302
- index: any;
1303
- finalScriptSig: any;
1304
- sequence: any;
1305
- }>[];
1306
- outputs: P.StructInput<{
1307
- amount: any;
1308
- script: any;
1309
- }>[];
1310
- witnesses: P.Option<Uint8Array[][]>;
1311
- lockTime: number;
1312
- }>>, readonly [], readonly [0, 2], false];
1313
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
1314
- amount: bigint;
1315
- script: Uint8Array;
1316
- }>>, readonly [], readonly [0, 2], false];
1317
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1318
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
1319
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1320
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1321
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1322
- fingerprint: number;
1323
- path: number[];
1324
- }>>, readonly [], readonly [0, 2], false];
1325
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1326
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
1327
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1328
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1329
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1330
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1331
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1332
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
1333
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
1334
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
1335
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
1336
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
1337
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1338
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
1339
- pubKey: Uint8Array;
1340
- leafHash: Uint8Array;
1341
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1342
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
1343
- version: number;
1344
- internalKey: Uint8Array;
1345
- merklePath: Uint8Array[];
1346
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1347
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1348
- hashes: Uint8Array[];
1349
- der: P.StructInput<{
1350
- fingerprint: any;
1351
- path: any;
1352
- }>;
1353
- }>>, readonly [], readonly [0, 2], false];
1354
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1355
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1356
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1357
- }>, {
1358
- nonWitnessUtxo?: string | Uint8Array | undefined;
1359
- txid?: string | undefined;
1360
- }>[];
1361
- outputs: Output[];
1362
- fee: bigint | undefined;
1363
- weight: number;
1364
- change: boolean;
1365
- } | undefined;
1366
- }
1367
- export declare function selectUTXO(inputs: TransactionInputUpdate[], outputs: Output[], strategy: SelectionStrategy, opts: EstimatorOpts): {
1368
- tx: Transaction | undefined;
1369
- inputs: ExtendType<PSBTKeyMapKeys<{
1370
- readonly nonWitnessUtxo: readonly [0, false, P.CoderType<P.StructInput<{
1371
- version: number;
1372
- segwitFlag: boolean;
1373
- inputs: P.StructInput<{
1374
- txid: any;
1375
- index: any;
1376
- finalScriptSig: any;
1377
- sequence: any;
1378
- }>[];
1379
- outputs: P.StructInput<{
1380
- amount: any;
1381
- script: any;
1382
- }>[];
1383
- witnesses: P.Option<Uint8Array[][]>;
1384
- lockTime: number;
1385
- }>>, readonly [], readonly [0, 2], false];
1386
- readonly witnessUtxo: readonly [1, false, P.CoderType<P.StructInput<{
1387
- amount: bigint;
1388
- script: Uint8Array;
1389
- }>>, readonly [], readonly [0, 2], false];
1390
- readonly partialSig: readonly [2, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1391
- readonly sighashType: readonly [3, false, P.CoderType<number>, readonly [], readonly [0, 2], false];
1392
- readonly redeemScript: readonly [4, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1393
- readonly witnessScript: readonly [5, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1394
- readonly bip32Derivation: readonly [6, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1395
- fingerprint: number;
1396
- path: number[];
1397
- }>>, readonly [], readonly [0, 2], false];
1398
- readonly finalScriptSig: readonly [7, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1399
- readonly finalScriptWitness: readonly [8, false, P.CoderType<Uint8Array[]>, readonly [], readonly [0, 2], false];
1400
- readonly porCommitment: readonly [9, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1401
- readonly ripemd160: readonly [10, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1402
- readonly sha256: readonly [11, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1403
- readonly hash160: readonly [12, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1404
- readonly hash256: readonly [13, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1405
- readonly txid: readonly [14, false, P.CoderType<Uint8Array>, readonly [2], readonly [2], true];
1406
- readonly index: readonly [15, false, P.CoderType<number>, readonly [2], readonly [2], true];
1407
- readonly sequence: readonly [16, false, P.CoderType<number>, readonly [], readonly [2], true];
1408
- readonly requiredTimeLocktime: readonly [17, false, P.CoderType<number>, readonly [], readonly [2], false];
1409
- readonly requiredHeightLocktime: readonly [18, false, P.CoderType<number>, readonly [], readonly [2], false];
1410
- readonly tapKeySig: readonly [19, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1411
- readonly tapScriptSig: readonly [20, P.CoderType<P.StructInput<{
1412
- pubKey: Uint8Array;
1413
- leafHash: Uint8Array;
1414
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1415
- readonly tapLeafScript: readonly [21, P.CoderType<P.StructInput<{
1416
- version: number;
1417
- internalKey: Uint8Array;
1418
- merklePath: Uint8Array[];
1419
- }>>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1420
- readonly tapBip32Derivation: readonly [22, P.CoderType<Uint8Array>, P.CoderType<P.StructInput<{
1421
- hashes: Uint8Array[];
1422
- der: P.StructInput<{
1423
- fingerprint: any;
1424
- path: any;
1425
- }>;
1426
- }>>, readonly [], readonly [0, 2], false];
1427
- readonly tapInternalKey: readonly [23, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1428
- readonly tapMerkleRoot: readonly [24, false, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1429
- readonly proprietary: readonly [252, P.CoderType<Uint8Array>, P.CoderType<Uint8Array>, readonly [], readonly [0, 2], false];
1430
- }>, {
1431
- nonWitnessUtxo?: string | Uint8Array | undefined;
1432
- txid?: string | undefined;
1433
- }>[];
1434
- outputs: Output[];
1435
- fee: bigint | undefined;
1436
- weight: number;
1437
- change: boolean;
1438
- } | undefined;
1439
- export {};
1
+ /*! scure-btc-signer - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ import { isBytes, concatBytes, compareBytes } from './utils.js';
3
+ export { p2pk, p2pkh, p2sh, p2ms, p2wsh, p2wpkh, p2tr, p2tr_ns, p2tr_ms, p2tr_pk, multisig } from './payment.js';
4
+ export { OP, RawTx, CompactSize, Script, ScriptNum, ScriptType, MAX_SCRIPT_BYTE_LENGTH, } from './script.js';
5
+ export { Transaction } from './transaction.js';
6
+ export { getInputType, selectUTXO } from './utxo.js';
7
+ export { NETWORK, TEST_NETWORK, TAPROOT_UNSPENDABLE_KEY } from './utils.js';
8
+ export declare const utils: {
9
+ isBytes: typeof isBytes;
10
+ concatBytes: typeof concatBytes;
11
+ compareBytes: typeof compareBytes;
12
+ pubSchnorr: (priv: string | Uint8Array) => Uint8Array;
13
+ randomPrivateKeyBytes: () => Uint8Array;
14
+ };
15
+ export { Address, getAddress, WIF, OptScript, CustomScript, taprootListToTree, OutScript, _sortPubkeys, sortedMultisig, combinations } from './payment.js';
16
+ export { _DebugPSBT, TaprootControlBlock } from './psbt.js';
17
+ export { Decimal, bip32Path, SigHash, PSBTCombine, DEFAULT_SEQUENCE } from './transaction.js';
18
+ export { _cmpBig, _Estimator } from './utxo.js';
1440
19
  //# sourceMappingURL=index.d.ts.map