tweag / cooked-validators

MIT License
39 stars 11 forks source link

Add a function to extract typed data from SpendableOut's #160

Closed carlhammann closed 1 year ago

carlhammann commented 1 year ago

This PR contains a very easy function that takes a SpendableOut and returns Maybe 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 SpendableOuts.

mmontin commented 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.

carlhammann commented 1 year ago

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.

carlhammann commented 1 year ago

With #161 merged, this is now part of the library.