Emurgo / cardano-serialization-lib

This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
234 stars 125 forks source link

OutputDatum is not used in TransactionOutput #661

Open klntsky opened 8 months ago

klntsky commented 8 months ago

Looks like these two functions could have been combined into one that returns an optional OutputDatum:

declare export class TransactionOutput {
  ...
  /**
   * @returns {DataHash | void}
   */
  data_hash(): DataHash | void;

  /**
   * @returns {PlutusData | void}
   */
  plutus_data(): PlutusData | void;

OutputDatum definition for context:

declare export class OutputDatum {
  free(): void;

  /**
   * @param {DataHash} data_hash
   * @returns {OutputDatum}
   */
  static new_data_hash(data_hash: DataHash): OutputDatum;

  /**
   * @param {PlutusData} data
   * @returns {OutputDatum}
   */
  static new_data(data: PlutusData): OutputDatum;

  /**
   * @returns {DataHash | void}
   */
  data_hash(): DataHash | void;

  /**
   * @returns {PlutusData | void}
   */
  data(): PlutusData | void;
}
lisicky commented 8 months ago

Hi @klntsky ! It's good point but it leads API breaking changes, we might consider it but it's not priority now.