UNPKG

@bitgo/utxo-lib

Version:

Client-side Bitcoin JavaScript library

50 lines 2.82 kB
/** * Contains helper methods for determining if a transaction output belongs to a given BitGo wallet */ import { Triple } from '../../types'; import { UtxoPsbt } from '../../UtxoPsbt'; import { PsbtOutput } from 'bip174/src/lib/interfaces'; import { BIP32Interface } from '@bitgo/secp256k1'; /** * Derives the appropriate BIP32 key pair for a given output. * It uses either tapBip32Derivation or bip32Derivation paths from the output. * @param bip32 - The BIP32Interface object to derive from. * @param output - The specific PSBT output to derive for. * @returns The derived BIP32 key pair if master fingerprint matches, or undefined. */ export declare function deriveKeyPairForOutput(bip32: BIP32Interface, output: PsbtOutput): BIP32Interface | undefined; /** * Determines if a specified output in a PSBT is an output of the wallet represented by the given root nodes. * @param psbt - The PSBT to check. * @param outputIndex - The index of the output to check. * @param rootWalletNodes - The root nodes representing the wallet. * @returns A boolean indicating if the output belongs to the wallet. */ export declare function isWalletOutput(psbt: UtxoPsbt, outputIndex: number, rootWalletNodes: Triple<BIP32Interface>): boolean; /** * Finds indices of all outputs in a PSBT that belong to the wallet represented by the given root nodes. * @param psbt - The PSBT to search through. * @param rootWalletNodes - The root nodes representing the wallet. * @returns An array of indices corresponding to wallet outputs. */ export declare function findWalletOutputIndices(psbt: UtxoPsbt, rootWalletNodes: Triple<BIP32Interface>): number[]; /** * Calculates the total amount of all wallet outputs in a PSBT for the wallet represented by the given root nodes. * @param psbt - The PSBT to calculate for. * @param rootWalletNodes - The root nodes representing the wallet. * @returns The total amount of wallet outputs. */ export declare function getTotalAmountOfWalletOutputs(psbt: UtxoPsbt, rootWalletNodes: Triple<BIP32Interface>): bigint; /** * Finds indices of all internal outputs in a PSBT, identified as outputs belonging to the wallet's root nodes within the PSBT. * @param psbt - The PSBT containing the wallet's root nodes as indicated by global Xpubs. * @returns An array of indices of internal outputs. */ export declare function findInternalOutputIndices(psbt: UtxoPsbt): number[]; /** * Calculates the total amount of all internal outputs in a PSBT, identified as outputs belonging to the wallet's root nodes within the PSBT. * @param psbt - The PSBT containing the wallet's root nodes as indicated by global Xpubs. * @returns The total amount of internal outputs. */ export declare function getTotalAmountOfInternalOutputs(psbt: UtxoPsbt): bigint; //# sourceMappingURL=PsbtOutputs.d.ts.map