function isTaprootOutput(output, script) {
  return (
    output &&
    !!(
      output.tapInternalKey ||
      output.tapTree ||
      (output.tapBip32Derivation && output.tapBip32Derivation.length) ||
      (script && isP2TR(script))
    )
  );
}
Checks if a PSBT output is a taproot output.
@param output The PSBT output to check.
@param script The script to check. Optional.
@returns True if the output is a taproot output, false otherwise.