In #6247 @Unisay showed us how to access the datum and redeemer efficiently, but not simply. We could consider adding a dedicated data type for doing this lazy decoding (data JustGiveMeDatumAndRedeemer = <...>), so that unsafeFromBuiltinData does the right thing for it, however we actually probably don't need to, because once @ana-pantilie's work on backing ScriptContext by Data is done we'll probably be able to use the fields of ScriptContext directly (implemented as pattern synonyms, I assume)? Accessing both the datum and redeemer via fields is going to be less efficient than using a dedicated type though, because we'd have to skip the tx info twice for each of them for example, so maybe having a dedicated type is worth it in the end.
This issue is for figuring what interface we should provide for accessing the datum and redeemer, as well as implementing that interface.
In #6247 @Unisay showed us how to access the datum and redeemer efficiently, but not simply. We could consider adding a dedicated data type for doing this lazy decoding (
data JustGiveMeDatumAndRedeemer = <...>
), so thatunsafeFromBuiltinData
does the right thing for it, however we actually probably don't need to, because once @ana-pantilie's work on backingScriptContext
byData
is done we'll probably be able to use the fields ofScriptContext
directly (implemented as pattern synonyms, I assume)? Accessing both the datum and redeemer via fields is going to be less efficient than using a dedicated type though, because we'd have to skip the tx info twice for each of them for example, so maybe having a dedicated type is worth it in the end.This issue is for figuring what interface we should provide for accessing the datum and redeemer, as well as implementing that interface.