The DescriptorsFactory function creates and returns the parseKeyExpression function, which is an implementation of this interface.

It parses and destructures a key expression string (xpub, xprv, pubkey or wif) into KeyInfo.

For example, given this keyExpression: [d34db33f/49'/0'/0']tpubDCdxmvzJ5QBjTN8oCjjyT2V58AyZvA1fkmCeZRC75QMoaHcVP2m45Bv3hmnR7ttAwkb2UNYyoXdHVt4gwBqRrJqLUU2JrM43HippxiWpHra/1/2/3/4/*, this is the parsed result:

 {
keyExpression:
"[d34db33f/49'/0'/0']tpubDCdxmvzJ5QBjTN8oCjjyT2V58AyZvA1fkmCeZRC75QMoaHcVP2m45Bv3hmnR7ttAwkb2UNYyoXdHVt4gwBqRrJqLUU2JrM43HippxiWpHra/1/2/3/4/*",
keyPath: '/1/2/3/4/*',
originPath: "/49'/0'/0'",
path: "m/49'/0'/0'/1/2/3/4/*",
// Other relevant properties of the type `KeyInfo`: `pubkey`, `ecpair` & `bip32` interfaces, `masterFingerprint`, etc.
}

See KeyInfo for the complete list of elements retrieved by this function.

Hierarchy

  • ParseKeyExpression
  • Parameters

    • params: {
          keyExpression: string;
          isSegwit?: boolean;
          network?: Network;
      }
      • keyExpression: string
      • Optional isSegwit?: boolean

        Indicates if this key expression belongs to a a SegWit output. When set, further checks are done to ensure the public key (if present in the expression) is compressed (33 bytes).

      • Optional network?: Network

    Returns KeyInfo