PHP WebShell

Текущая директория: /opt/BitGoJS/modules/unspents/dist/src

Просмотр файла: dimensions.d.ts

import * as utxolib from '@bitgo/utxo-lib';
import { bitgo } from '@bitgo/utxo-lib';
type ChainCode = bitgo.ChainCode;
import { VirtualSizes } from './virtualSizes';
export { VirtualSizes };
/**
 * Aggregate count and size of transaction outputs
 */
export declare class OutputDimensions {
    /**
     * Number of outputs
     */
    count: number;
    /**
     * Aggregate vSize
     */
    size: number;
    constructor({ count, size }?: OutputDimensions);
}
interface FromInputParams {
    assumeUnsigned?: Dimensions;
}
export interface FromUnspentParams {
    p2tr: {
        scriptPathLevel?: number;
    };
    p2trMusig2: {
        scriptPathLevel?: number;
    };
}
/**
 * Dimensions of a BitGo wallet transactions.
 */
export declare class Dimensions {
    /** Input counts for BitGo wallet multi-signature inputs */
    readonly nP2shInputs: number;
    readonly nP2shP2wshInputs: number;
    readonly nP2wshInputs: number;
    readonly nP2trKeypathInputs: number;
    readonly nP2trScriptPathLevel1Inputs: number;
    readonly nP2trScriptPathLevel2Inputs: number;
    readonly nP2shP2pkInputs: number;
    readonly outputs: OutputDimensions;
    constructor(d?: Partial<Dimensions>);
    private setProperty;
    static readonly ZERO: Readonly<Dimensions>;
    /**
     * @deprecated use ZERO
     * @return Dimensions for an empty transaction
     */
    static zero(): Readonly<Dimensions>;
    /**
     * @param size
     * @return Dimensions for a single output with given size
     */
    static singleOutput(size: number): Dimensions;
    static readonly SingleOutput: Readonly<{
        p2sh: Dimensions;
        p2shP2wsh: Dimensions;
        p2wsh: Dimensions;
        p2tr: Dimensions;
        p2pkh: Dimensions;
        p2wpkh: Dimensions;
    }>;
    /**
     * @return Number of total inputs (p2sh + p2shP2wsh + p2wsh + p2tr)
     */
    get nInputs(): number;
    set nInputs(_: number);
    /**
     * @return Number of total outputs
     */
    get nOutputs(): number;
    set nOutputs(_: number);
    /**
     * @param args - Dimensions (can be partially defined)
     * @return {Dimensions} sum of arguments
     */
    static sum(...args: Partial<Dimensions>[]): Dimensions;
    /**
     * @param chain
     * @return {Number}
     */
    static getOutputScriptLengthForChain(chain: ChainCode): number;
    /**
     * @param scriptLength
     * @return {Number} vSize of an output with script length
     */
    static getVSizeForOutputWithScriptLength(scriptLength: number): number;
    static readonly SingleInput: Readonly<{
        p2sh: Dimensions;
        p2shP2wsh: Dimensions;
        p2wsh: Dimensions;
        p2trKeypath: Dimensions;
        p2trScriptPathLevel1: Dimensions;
        p2trScriptPathLevel2: Dimensions;
        p2shP2pk: Dimensions;
    }>;
    /**
     * @return
     */
    static fromScriptType(scriptType: utxolib.bitgo.outputScripts.ScriptType | utxolib.bitgo.ParsedScriptType2Of3 | 'p2pkh', params?: {
        scriptPathLevel?: number;
    }): Dimensions;
    static readonly ASSUME_P2SH: Dimensions;
    static readonly ASSUME_P2SH_P2WSH: Dimensions;
    static readonly ASSUME_P2WSH: Dimensions;
    static readonly ASSUME_P2TR_KEYPATH: Dimensions;
    static readonly ASSUME_P2TR_SCRIPTPATH_LEVEL1: Dimensions;
    static readonly ASSUME_P2TR_SCRIPTPATH_LEVEL2: Dimensions;
    static readonly ASSUME_P2SH_P2PK_INPUT: Dimensions;
    private static getAssumedDimension;
    /**
     * @param input - the transaction input to count
     * @param params
     *        [param.assumeUnsigned] - default type for unsigned input
     */
    static fromInput(input: utxolib.TxInput, params?: FromInputParams): Dimensions;
    /**
     * Create Dimensions from psbt input
     * @param input - psbt input
     */
    static fromPsbtInput(input: bitgo.PsbtInputType): Dimensions;
    /**
     * @param inputs - Array of inputs
     * @param params - @see Dimensions.fromInput()
     * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromInput())
     */
    static fromInputs(inputs: utxolib.TxInput[], params?: FromInputParams): Dimensions;
    /**
     * Create Dimensions from multiple psbt inputs
     * @param inputs psbt input array
     * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromPsbtInput())
     */
    static fromPsbtInputs(inputs: bitgo.PsbtInputType[]): Dimensions;
    /**
     * @param scriptLength {number} - size of the output script in bytes
     * @return {Dimensions} - Dimensions of the output
     */
    static fromOutputScriptLength(scriptLength: number): Dimensions;
    /**
     * @param output - a tx output
     * @return Dimensions - the dimensions of the given output
     */
    static fromOutput({ script }: {
        script: Buffer;
    }): Dimensions;
    /**
     * @param outputs - Array of outputs
     * @return {Dimensions} sum of the dimensions for each output (@see Dimensions.fromOutput())
     */
    static fromOutputs(outputs: {
        script: Buffer;
    }[]): Dimensions;
    /**
     * Returns the dimensions of an output that will be created on a specific chain.
     * Currently, this simply adds a default output.
     *
     * @param chain - Chain code as defined by utxolib.bitgo
     * @return {Dimensions} - Dimensions for a single output on the given chain.
     */
    static fromOutputOnChain(chain: ChainCode): Dimensions;
    /**
     * Return dimensions of an unspent according to `chain` parameter
     * @param chain - Chain code as defined by utxo.chain
     * @param params - Hint for unspents with variable input sizes (p2tr, p2trMusig2)
     * @return {Dimensions} of the unspent
     * @throws if the chain code is invalid or unsupported
     */
    static fromUnspent({ chain }: {
        chain: number;
    }, params?: FromUnspentParams): Dimensions;
    /**
     * @param unspents
     * @param params - Hint for unspents with variable input sizes (p2tr, p2trMusig2)
     * @return {Dimensions} sum of the dimensions for each unspent (@see Dimensions.fromUnspent())
     */
    static fromUnspents(unspents: {
        chain: ChainCode;
    }[], params?: FromUnspentParams): Dimensions;
    /**
     * @param transaction - bitcoin-like transaction
     * @param [param.assumeUnsigned] - default type for unsigned inputs
     * @return {Dimensions}
     */
    static fromTransaction({ ins, outs, }: {
        ins: utxolib.TxInput[];
        outs: utxolib.TxOutput[];
    }, params?: FromInputParams): Dimensions;
    /**
     * Create Dimensions from psbt inputs and outputs
     * @param psbt
     * @return {Dimensions}
     */
    static fromPsbt(psbt: bitgo.UtxoPsbt): Dimensions;
    /**
     * @param dimensions (can be partially defined)
     * @return new dimensions with argument added
     */
    plus(dimensions: Partial<Dimensions>): Dimensions;
    /**
     * Multiply dimensions by a given factor
     * @param factor - Positive integer
     * @return {Dimensions}
     */
    times(factor: number): Dimensions;
    /**
     * @return Number of total inputs (p2sh, p2shP2wsh and p2wsh)
     * @deprecated use `dimension.nInputs` instead
     */
    getNInputs(): number;
    /**
     * @returns {boolean} true iff dimensions have one or more (p2sh)p2wsh inputs
     */
    isSegwit(): boolean;
    /**
     * @return {Number} overhead vsize, based on result isSegwit().
     */
    getOverheadVSize(): number;
    /**
     * @returns {number} vsize of inputs, without transaction overhead
     */
    getInputsVSize(): number;
    /**
     * @returns {number} return vsize of outputs, without overhead
     */
    getOutputsVSize(): number;
    /**
     * Estimates the virtual size (1/4 weight) of a signed transaction as sum of
     * overhead vsize, input vsize and output vsize.
     * @returns {Number} The estimated vsize of the transaction dimensions.
     */
    getVSize(): number;
}
//# sourceMappingURL=dimensions.d.ts.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!