2019-07-04 07:33:36 +02:00
|
|
|
/// <reference types="node" />
|
2019-06-24 12:20:15 +02:00
|
|
|
import { Psbt as PsbtBase } from 'bip174';
|
2019-07-11 10:17:49 +02:00
|
|
|
import { Bip32Derivation, FinalScriptSig, FinalScriptWitness, GlobalXpub, KeyValue, NonWitnessUtxo, PartialSig, PorCommitment, RedeemScript, SighashType, TransactionInput, TransactionOutput, WitnessScript, WitnessUtxo } from 'bip174/src/lib/interfaces';
|
2019-07-03 08:34:18 +02:00
|
|
|
import { Signer, SignerAsync } from './ecpair';
|
2019-07-01 12:57:35 +02:00
|
|
|
import { Network } from './networks';
|
2019-07-03 08:13:36 +02:00
|
|
|
import { Transaction } from './transaction';
|
2019-07-11 10:17:49 +02:00
|
|
|
export declare class Psbt {
|
|
|
|
readonly data: PsbtBase;
|
|
|
|
static fromTransaction(txBuf: Buffer, opts?: PsbtOptsOptional): Psbt;
|
|
|
|
static fromBase64(data: string, opts?: PsbtOptsOptional): Psbt;
|
|
|
|
static fromHex(data: string, opts?: PsbtOptsOptional): Psbt;
|
|
|
|
static fromBuffer(buffer: Buffer, opts?: PsbtOptsOptional): Psbt;
|
2019-07-05 09:42:13 +02:00
|
|
|
private __CACHE;
|
2019-07-04 04:26:23 +02:00
|
|
|
private opts;
|
2019-07-11 10:17:49 +02:00
|
|
|
constructor(opts?: PsbtOptsOptional, data?: PsbtBase);
|
2019-07-05 09:42:13 +02:00
|
|
|
readonly inputCount: number;
|
2019-07-11 10:17:49 +02:00
|
|
|
combine(...those: Psbt[]): this;
|
2019-07-09 11:03:15 +02:00
|
|
|
clone(): Psbt;
|
2019-07-05 05:28:04 +02:00
|
|
|
setMaximumFeeRate(satoshiPerByte: number): void;
|
2019-07-04 06:42:34 +02:00
|
|
|
setVersion(version: number): this;
|
|
|
|
setLocktime(locktime: number): this;
|
2019-07-04 10:35:39 +02:00
|
|
|
setSequence(inputIndex: number, sequence: number): this;
|
2019-07-09 11:03:15 +02:00
|
|
|
addInputs(inputDatas: TransactionInput[]): this;
|
2019-07-04 06:33:08 +02:00
|
|
|
addInput(inputData: TransactionInput): this;
|
2019-07-09 11:03:15 +02:00
|
|
|
addOutputs(outputDatas: TransactionOutput[]): this;
|
2019-07-04 06:33:08 +02:00
|
|
|
addOutput(outputData: TransactionOutput): this;
|
2019-07-05 05:28:04 +02:00
|
|
|
extractTransaction(disableFeeCheck?: boolean): Transaction;
|
|
|
|
getFeeRate(): number;
|
2019-07-09 08:45:56 +02:00
|
|
|
finalizeAllInputs(): this;
|
|
|
|
finalizeInput(inputIndex: number): this;
|
|
|
|
validateAllSignatures(): boolean;
|
2019-07-08 08:46:06 +02:00
|
|
|
validateSignatures(inputIndex: number, pubkey?: Buffer): boolean;
|
2019-07-10 04:15:12 +02:00
|
|
|
sign(keyPair: Signer, sighashTypes?: number[]): this;
|
|
|
|
signAsync(keyPair: SignerAsync, sighashTypes?: number[]): Promise<void>;
|
|
|
|
signInput(inputIndex: number, keyPair: Signer, sighashTypes?: number[]): this;
|
|
|
|
signInputAsync(inputIndex: number, keyPair: SignerAsync, sighashTypes?: number[]): Promise<void>;
|
2019-07-11 10:17:49 +02:00
|
|
|
toBuffer(): Buffer;
|
|
|
|
toHex(): string;
|
|
|
|
toBase64(): string;
|
|
|
|
addGlobalXpubToGlobal(globalXpub: GlobalXpub): this;
|
|
|
|
addNonWitnessUtxoToInput(inputIndex: number, nonWitnessUtxo: NonWitnessUtxo): this;
|
|
|
|
addWitnessUtxoToInput(inputIndex: number, witnessUtxo: WitnessUtxo): this;
|
|
|
|
addPartialSigToInput(inputIndex: number, partialSig: PartialSig): this;
|
|
|
|
addSighashTypeToInput(inputIndex: number, sighashType: SighashType): this;
|
|
|
|
addRedeemScriptToInput(inputIndex: number, redeemScript: RedeemScript): this;
|
|
|
|
addWitnessScriptToInput(inputIndex: number, witnessScript: WitnessScript): this;
|
|
|
|
addBip32DerivationToInput(inputIndex: number, bip32Derivation: Bip32Derivation): this;
|
|
|
|
addFinalScriptSigToInput(inputIndex: number, finalScriptSig: FinalScriptSig): this;
|
|
|
|
addFinalScriptWitnessToInput(inputIndex: number, finalScriptWitness: FinalScriptWitness): this;
|
|
|
|
addPorCommitmentToInput(inputIndex: number, porCommitment: PorCommitment): this;
|
|
|
|
addRedeemScriptToOutput(outputIndex: number, redeemScript: RedeemScript): this;
|
|
|
|
addWitnessScriptToOutput(outputIndex: number, witnessScript: WitnessScript): this;
|
|
|
|
addBip32DerivationToOutput(outputIndex: number, bip32Derivation: Bip32Derivation): this;
|
|
|
|
addUnknownKeyValToGlobal(keyVal: KeyValue): this;
|
|
|
|
addUnknownKeyValToInput(inputIndex: number, keyVal: KeyValue): this;
|
|
|
|
addUnknownKeyValToOutput(outputIndex: number, keyVal: KeyValue): this;
|
|
|
|
clearFinalizedInput(inputIndex: number): this;
|
2019-06-24 12:20:15 +02:00
|
|
|
}
|
2019-07-04 04:26:23 +02:00
|
|
|
interface PsbtOptsOptional {
|
|
|
|
network?: Network;
|
2019-07-05 05:28:04 +02:00
|
|
|
maximumFeeRate?: number;
|
2019-07-04 04:26:23 +02:00
|
|
|
}
|
|
|
|
export {};
|