assist/data

This module contains code for extracting data from a potential inline datum found in either an input or output.

Functions

input_datum(possible_input: Input) -> Data

Find the datum data on an input or error. The data is assumed to be an inline datum.

expect datum: Datum = data.input_datum(this_input)

input_datum_by_hash(
  possible_input: Input,
  datums: Dict<Hash<Blake2b_256, Data>, Data>,
) -> Data

Find the datum data on a input by the datum hash or error. The data is assumed to be embedded data and must be referenced by its hash.

expect datum: Datum = data.input_datum_by_hash(this_input, these_datums)

metadata(metadata: Dict<Data, Data>, key: Data) -> Data

Find some data from the metadata or fail. The key and value can be arbitrary data. This function is designed to work on the CIP68 generic type.

expect datum: Data = data.metadata(cip68.metadatum, datum.data_key)

output_datum(possible_output: Output) -> Data

Find the datum data on an output or error. The data is assumed to be an inline datum.

expect datum: Datum = data.output_datum(that_output)

output_datum_by_hash(
  possible_output: Output,
  datums: Dict<Hash<Blake2b_256, Data>, Data>,
) -> Data

Find the datum data on an output or error. The data is assumed to be embedded.

expect datum: Datum = data.output_datum_by_hash(that_output, these_datums)
Search Document