scriptDatahash static method
ScriptDataHash
scriptDatahash({
- required List<
Redeemer> redeemers, - required Costmdls costmdls,
- PlutusList? datums,
Implementation
static ScriptDataHash scriptDatahash(
{required List<Redeemer> redeemers,
required Costmdls costmdls,
PlutusList? datums}) {
if (redeemers.isEmpty && datums != null) {
return ScriptDataHash(
QuickCrypto.blake2b256Hash([0x80, ...datums.serialize(), 0xA0]));
}
final List<int> redeemersBytes =
CborListValue.fixedLength(redeemers.map((e) => e.toCbor()).toList())
.encode();
return ScriptDataHash(QuickCrypto.blake2b256Hash([
...redeemersBytes,
...datums?.serialize() ?? <int>[],
...costmdls.languageViewEncoding().encode()
]));
}