function serializeTaprootSignature(sig, sighashType) {
  const sighashTypeByte = sighashType
    ? Uint8Array.from([sighashType])
    : Uint8Array.from([]);
  return tools.concat([sig, sighashTypeByte]);
}
Serializes a taproot signature.
@param sig The signature to serialize.
@param sighashType The sighash type. Optional.
@returns The serialized taproot signature.