Closed carlhammann closed 1 year ago
As we discussed live, I'm reluctant to integrate this function to cooked for now because it is the sign of a possible room for improving our design following the v2 changes. Indeed, recreating a type from a utxo means we somehow lose the type information in the process of passing the utxo around, which should be fixed. We could have typed spendable out for instance or something similar, but we might as well wait for v2 to see what would be the best solution.
I agree. We have documented the problem in several issues, and if the rewrite of the auction example contract turns out not to depend on this function, as it does in its current state, there's no immediate need to introduce it.
With #161 merged, this is now part of the library.
This PR contains a very easy function that takes a
SpendableOut
and returnsMaybe
a datum of a given validator type, if there is a datum and if it can be interpreted as something of that type.I think that something like this a useful addition to the recent features we added around
SpendableOut
s.