forked from bitcoinerlab/descriptors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
73 lines (67 loc) · 2.05 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) 2023 Jose-Luis Landabaso - https://bitcoinerlab.com
// Distributed under the MIT software license
export type { KeyInfo, Expansion } from './types';
import type { Psbt } from 'bitcoinjs-lib';
import type { DescriptorInstance, OutputInstance } from './descriptors';
export {
DescriptorsFactory,
DescriptorInstance,
DescriptorConstructor,
OutputInstance,
OutputConstructor
} from './descriptors';
export { DescriptorChecksum as checksum } from './checksum';
import * as signers from './signers';
export { signers };
/**
* @hidden @deprecated
* To finalize the `psbt`, you can either call the method
* `output.finalizePsbtInput({ index, psbt })` on each descriptor, passing as
* arguments the `psbt` and its input `index`, or call this helper function:
* `finalizePsbt({psbt, outputs })`. In the latter case, `outputs` is an
* array of {@link _Internal_.Output | Output elements} ordered in the array by
* their respective input index in the `psbt`.
*/
function finalizePsbt(params: {
psbt: Psbt;
outputs: OutputInstance[];
validate?: boolean | undefined;
}): void;
/**
* @deprecated
* @hidden
* To be removed in version 3.0
*/
function finalizePsbt(params: {
psbt: Psbt;
descriptors: DescriptorInstance[];
validate?: boolean | undefined;
}): void;
/**
* @hidden
* To be removed in v3.0 and replaced by the version with the signature that
* does not accept descriptors
*/
function finalizePsbt({
psbt,
outputs,
descriptors,
validate = true
}: {
psbt: Psbt;
outputs?: OutputInstance[];
descriptors?: DescriptorInstance[];
validate?: boolean | undefined;
}) {
if (descriptors && outputs)
throw new Error(`descriptors param has been deprecated`);
outputs = descriptors || outputs;
if (!outputs) throw new Error(`outputs not provided`);
outputs.forEach((output, inputIndex) =>
output.finalizePsbtInput({ index: inputIndex, psbt, validate })
);
}
export { finalizePsbt };
export { keyExpressionBIP32 } from './keyExpressions';
import * as scriptExpressions from './scriptExpressions';
export { scriptExpressions };