UNPKG

@bitgo/utxo-lib

Version:

Client-side Bitcoin JavaScript library

70 lines 2.64 kB
import { ProprietaryKey } from 'bip174/src/lib/proprietaryKeyVal'; import { PsbtInput } from 'bip174/src/lib/interfaces'; import { Psbt } from 'bitcoinjs-lib/src/psbt'; /** * bitgo proprietary key identifier */ export declare const PSBT_PROPRIETARY_IDENTIFIER = "BITGO"; /** * subtype for proprietary keys that bitgo uses */ export declare enum ProprietaryKeySubtype { ZEC_CONSENSUS_BRANCH_ID = 0, MUSIG2_PARTICIPANT_PUB_KEYS = 1, MUSIG2_PUB_NONCE = 2, MUSIG2_PARTIAL_SIG = 3 } /** * Psbt proprietary keydata object. * <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata> * => <bytes valuedata> */ export interface ProprietaryKeyValue { key: ProprietaryKey; value: Buffer; } /** * Psbt proprietary keydata object search fields. * <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata> */ export interface ProprietaryKeySearch { identifier: string; subtype?: number; keydata?: Buffer; identifierEncoding?: BufferEncoding; } /** * Search any data from psbt proprietary key value against keydata. * Default identifierEncoding is utf-8 for identifier. */ export declare function getPsbtInputProprietaryKeyVals(input: PsbtInput, keySearch?: ProprietaryKeySearch): ProprietaryKeyValue[]; /** * @return partialSig/tapScriptSig/MUSIG2_PARTIAL_SIG count iff input is not finalized */ export declare function getPsbtInputSignatureCount(input: PsbtInput): number; /** * @return true iff PSBT input is finalized */ export declare function isPsbtInputFinalized(input: PsbtInput): boolean; /** * @return true iff data starts with magic PSBT byte sequence * @param data byte array or hex string * */ export declare function isPsbt(data: Buffer | string): boolean; /** * First checks if the input is already a buffer that starts with the magic PSBT byte sequence. * If not, it checks if the input is a base64- or hex-encoded string that starts with PSBT header. * * This function is useful when reading a file that could be in any of the above formats or when * dealing with a request that could contain a hex or base64 encoded PSBT. * * @param data * @return buffer that starts with the magic PSBT byte sequence * @throws Error when conversion is not possible */ export declare function toPsbtBuffer(data: Buffer | string): Buffer; /** * This function allows signing or validating a psbt with non-segwit inputs those do not contain nonWitnessUtxo. */ export declare function withUnsafeNonSegwit<T>(psbt: Psbt, fn: () => T, unsafe?: boolean): T; //# sourceMappingURL=PsbtUtil.d.ts.map