bitcoinjs-lib/types/psbt.d.ts
2019-07-11 17:17:49 +09:00

63 lines
3.5 KiB
TypeScript

/// <reference types="node" />
import { Psbt as PsbtBase } from 'bip174';
import { Bip32Derivation, FinalScriptSig, FinalScriptWitness, GlobalXpub, KeyValue, NonWitnessUtxo, PartialSig, PorCommitment, RedeemScript, SighashType, TransactionInput, TransactionOutput, WitnessScript, WitnessUtxo } from 'bip174/src/lib/interfaces';
import { Signer, SignerAsync } from './ecpair';
import { Network } from './networks';
import { Transaction } from './transaction';
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;
private __CACHE;
private opts;
constructor(opts?: PsbtOptsOptional, data?: PsbtBase);
readonly inputCount: number;
combine(...those: Psbt[]): this;
clone(): Psbt;
setMaximumFeeRate(satoshiPerByte: number): void;
setVersion(version: number): this;
setLocktime(locktime: number): this;
setSequence(inputIndex: number, sequence: number): this;
addInputs(inputDatas: TransactionInput[]): this;
addInput(inputData: TransactionInput): this;
addOutputs(outputDatas: TransactionOutput[]): this;
addOutput(outputData: TransactionOutput): this;
extractTransaction(disableFeeCheck?: boolean): Transaction;
getFeeRate(): number;
finalizeAllInputs(): this;
finalizeInput(inputIndex: number): this;
validateAllSignatures(): boolean;
validateSignatures(inputIndex: number, pubkey?: Buffer): boolean;
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>;
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;
}
interface PsbtOptsOptional {
network?: Network;
maximumFeeRate?: number;
}
export {};