• Constructs the necessary functions and classes for working with descriptors using an external elliptic curve (ecc) library.

    Notably, it returns the Output class, which provides methods to create, sign, and finalize PSBTs based on descriptor expressions.

    While this Factory function includes the Descriptor class, note that this class was deprecated in v2.0 in favor of Output. For backward compatibility, the Descriptor class remains, but using Output is advised.

    The Factory also returns utility methods like expand (detailed below) and parseKeyExpression (see ParseKeyExpression).

    Additionally, for convenience, the function returns BIP32 and ECPair. These are bitcoinjs-lib classes designed for managing BIP32 keys and public/private key pairs: ECPair, respectively.

    Parameters

    Returns {
        Descriptor: typeof Descriptor;
        Output: typeof Output;
        parseKeyExpression: ParseKeyExpression;
        expand: ((params) => Expansion);
        ECPair: ECPairAPI;
        BIP32: BIP32API;
    }

    • Descriptor: typeof Descriptor
    • Output: typeof Output
    • parseKeyExpression: ParseKeyExpression
    • expand: ((params) => Expansion)
        • (params): Expansion
        • Parses and analyzies a descriptor expression and destructures it into its elemental parts.

          Parameters

          • params: {
                descriptor: string;
                index?: number;
                checksumRequired?: boolean;
                network?: Network;
                allowMiniscriptInP2SH?: boolean;
            }
            • descriptor: string

              The descriptor expression to be expanded.

            • Optional index?: number

              The descriptor index, if ranged.

            • Optional checksumRequired?: boolean

              A flag indicating whether the descriptor is required to include a checksum.

              Default Value

              false
              
            • Optional network?: Network

              The Bitcoin network to use.

              Default Value

              networks.bitcoin

            • Optional allowMiniscriptInP2SH?: boolean

              Flag to allow miniscript in P2SH.

              Default Value

              false
              

          Returns Expansion

          Throws

          Throws an error if the descriptor cannot be parsed or does not conform to the expected format.

    • ECPair: ECPairAPI
    • BIP32: BIP32API