UNPKG

@bitgo-beta/utxo-lib

Version:

Client-side Bitcoin JavaScript library

63 lines 2.81 kB
/// <reference types="node" /> import { UtxoTransaction } from './UtxoTransaction'; import { HDSigner, Psbt, TxOutput } from '../'; import { Psbt as PsbtBase } from 'bip174'; import { Network } from '..'; export interface HDTaprootSigner extends HDSigner { /** * The path string must match /^m(\/\d+'?)+$/ * ex. m/44'/0'/0'/1/23 levels with ' must be hard derivations */ derivePath(path: string): HDTaprootSigner; /** * Input hash (the "message digest") for the signature algorithm * Return a 64 byte signature (32 byte r and 32 byte s in that order) */ signSchnorr(hash: Buffer): Buffer; } export interface SchnorrSigner { publicKey: Buffer; signSchnorr(hash: Buffer): Buffer; } export interface TaprootSigner { leafHashes: Buffer[]; signer: SchnorrSigner; } export interface PsbtOpts { network: Network; } export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint>> extends Psbt { protected static transactionFromBuffer(buffer: Buffer, network: Network): UtxoTransaction<bigint>; static createPsbt(opts: PsbtOpts, data: PsbtBase): UtxoPsbt<UtxoTransaction<bigint>>; static fromBuffer(buffer: Buffer, opts: PsbtOpts): UtxoPsbt<UtxoTransaction<bigint>>; static fromTransactionComplete(transaction: UtxoTransaction<bigint>, prevOutputs: TxOutput<bigint>[], fetchTransactions: (txids: string[]) => Promise<Record<string, Buffer>>): Promise<UtxoPsbt<UtxoTransaction<bigint>>>; static fromTransaction(transaction: UtxoTransaction<bigint>, prevOutputs: TxOutput<bigint>[]): UtxoPsbt<UtxoTransaction<bigint>>; protected static newTransaction(network: Network): UtxoTransaction<bigint>; get tx(): Tx; protected checkForSignatures(propName?: string): void; /** * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts */ finalizeAllInputs(): this; finalizeTaprootInput(inputIndex: number): this; /** * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts * * Unlike the function it overrides, this does not take a validator. In BitGo * context, we know how we want to validate so we just hard code the right * validator. */ validateSignaturesOfAllInputs(): boolean; validateTaprootSignaturesOfInput(inputIndex: number): boolean; /** * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts */ signAllInputsHD(hdKeyPair: HDTaprootSigner, sighashTypes?: number[]): this; /** * Mostly copied from bitcoinjs-lib/ts_src/psbt.ts:signInputHD */ signTaprootInputHD(inputIndex: number, hdKeyPair: HDTaprootSigner, sighashTypes?: number[]): this; signTaprootInput(inputIndex: number, signer: SchnorrSigner, leafHashes: Buffer[], sighashTypes?: number[]): this; private getTaprootHashForSig; } //# sourceMappingURL=UtxoPsbt.d.ts.map