1 |
|
2 | import { Psbt as PsbtBase } from 'bip174';
|
3 | import { KeyValue, PsbtGlobalUpdate, PsbtInput, PsbtInputUpdate, PsbtOutput, PsbtOutputUpdate, TransactionInput, TransactionOutput } from 'bip174/src/lib/interfaces';
|
4 | import { Signer, SignerAsync } from './ecpair';
|
5 | import { Network } from './networks';
|
6 | import { Transaction } from './transaction';
|
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 | export declare class Psbt {
|
40 | readonly data: PsbtBase;
|
41 | static fromBase64(data: string, opts?: PsbtOptsOptional): Psbt;
|
42 | static fromHex(data: string, opts?: PsbtOptsOptional): Psbt;
|
43 | static fromBuffer(buffer: Buffer, opts?: PsbtOptsOptional): Psbt;
|
44 | private __CACHE;
|
45 | private opts;
|
46 | constructor(opts?: PsbtOptsOptional, data?: PsbtBase);
|
47 | readonly inputCount: number;
|
48 | combine(...those: Psbt[]): this;
|
49 | clone(): Psbt;
|
50 | setMaximumFeeRate(satoshiPerByte: number): void;
|
51 | setVersion(version: number): this;
|
52 | setLocktime(locktime: number): this;
|
53 | setInputSequence(inputIndex: number, sequence: number): this;
|
54 | addInputs(inputDatas: PsbtInputExtended[]): this;
|
55 | addInput(inputData: PsbtInputExtended): this;
|
56 | addOutputs(outputDatas: PsbtOutputExtended[]): this;
|
57 | addOutput(outputData: PsbtOutputExtended): this;
|
58 | extractTransaction(disableFeeCheck?: boolean): Transaction;
|
59 | getFeeRate(): number;
|
60 | getFee(): number;
|
61 | finalizeAllInputs(): this;
|
62 | finalizeInput(inputIndex: number): this;
|
63 | validateSignaturesOfAllInputs(): boolean;
|
64 | validateSignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
|
65 | signAllInputsHD(hdKeyPair: HDSigner, sighashTypes?: number[]): this;
|
66 | signAllInputsHDAsync(hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
|
67 | signInputHD(inputIndex: number, hdKeyPair: HDSigner, sighashTypes?: number[]): this;
|
68 | signInputHDAsync(inputIndex: number, hdKeyPair: HDSigner | HDSignerAsync, sighashTypes?: number[]): Promise<void>;
|
69 | signAllInputs(keyPair: Signer, sighashTypes?: number[]): this;
|
70 | signAllInputsAsync(keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
|
71 | signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
|
72 | signInputAsync(inputIndex: number, keyPair: Signer | SignerAsync, sighashTypes?: number[]): Promise<void>;
|
73 | toBuffer(): Buffer;
|
74 | toHex(): string;
|
75 | toBase64(): string;
|
76 | updateGlobal(updateData: PsbtGlobalUpdate): this;
|
77 | updateInput(inputIndex: number, updateData: PsbtInputUpdate): this;
|
78 | updateOutput(outputIndex: number, updateData: PsbtOutputUpdate): this;
|
79 | addUnknownKeyValToGlobal(keyVal: KeyValue): this;
|
80 | addUnknownKeyValToInput(inputIndex: number, keyVal: KeyValue): this;
|
81 | addUnknownKeyValToOutput(outputIndex: number, keyVal: KeyValue): this;
|
82 | clearFinalizedInput(inputIndex: number): this;
|
83 | }
|
84 | interface PsbtOptsOptional {
|
85 | network?: Network;
|
86 | maximumFeeRate?: number;
|
87 | }
|
88 | interface PsbtInputExtended extends PsbtInput, TransactionInput {
|
89 | }
|
90 | interface PsbtOutputExtended extends PsbtOutput, TransactionOutput {
|
91 | }
|
92 | interface HDSignerBase {
|
93 | |
94 |
|
95 |
|
96 | publicKey: Buffer;
|
97 | |
98 |
|
99 |
|
100 | fingerprint: Buffer;
|
101 | }
|
102 | interface HDSigner extends HDSignerBase {
|
103 | |
104 |
|
105 |
|
106 |
|
107 | derivePath(path: string): HDSigner;
|
108 | |
109 |
|
110 |
|
111 |
|
112 | sign(hash: Buffer): Buffer;
|
113 | }
|
114 |
|
115 |
|
116 |
|
117 | interface HDSignerAsync extends HDSignerBase {
|
118 | derivePath(path: string): HDSignerAsync;
|
119 | sign(hash: Buffer): Promise<Buffer>;
|
120 | }
|
121 | export {};
|