Skip to content

Commit

Permalink
Update src/Cooked/Output.hs
Browse files Browse the repository at this point in the history
Co-authored-by: Florent C. <florentc@users.noreply.github.com>
  • Loading branch information
mmontin and florentc authored Jun 19, 2024
1 parent 136e71c commit fc22f6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Cooked/Output.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ isScriptOutput _ = Nothing

-- | Test if the owner of an output is a specific script
isScriptOutputFrom :: (IsTxInfoOutput out, ToScriptHash s) => s -> out -> Maybe (ConcreteOutput s (DatumType out) (ValueType out) (ReferenceScriptType out))
isScriptOutputFrom validator out = isScriptOutput out >>= (\x -> if toScriptHash validator == x ^. outputOwnerL then Just (x {concreteOutputOwner = validator}) else Nothing)
isScriptOutputFrom validator out = do
x <- isScriptOutput out
if toScriptHash validator == x ^. outputOwnerL
then Just (x {concreteOutputOwner = validator})
else Nothing

-- Test if the owner of an output is a public key
isPKOutput :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput Api.PubKeyHash (DatumType out) (ValueType out) (ReferenceScriptType out))
Expand Down

0 comments on commit fc22f6b

Please sign in to comment.