aiken_design_patterns/parameter_validation/advanced
Advanced parameter-application helpers for arbitrary Data parameters.
Unlike the base helpers, this reconstructs the final applied script from
the Flat prefix immediately before the parameter payload, and serialises
the parameter as Plutus Data on-chain.
The script instance must be parameterised off-chain with the canonical CBOR
emitted by aiken/cbor.serialise. A semantically equivalent, non-canonical
CBOR encoding produces different script bytes and therefore a different hash.
Functions
apply_param(
version: Int,
flat_prefix_without_parameter_header: ByteArray,
parameter: Data,
) -> ScriptHash
Apply a single Data parameter to a script Flat prefix and return the
resulting script hash.
flat_prefix_without_parameter_header must contain the Flat bytes of the
script up to, but not including, the Flat bytestring chunk-length byte for
the parameter payload. The outer CBOR bytestring header must not be included.
The script instance must use the canonical parameter CBOR produced by
cbor.serialise.