@@ -21,6 +21,7 @@ import Cardano.CLI.Read (readFileCli)
2121import Cardano.CLI.Type.Common
2222import Cardano.CLI.Type.Error.ScriptDataError
2323import Cardano.Ledger.Core qualified as L
24+ import Cardano.Ledger.Dijkstra.Scripts qualified as Dijkstra
2425
2526import Prelude
2627
@@ -38,14 +39,16 @@ readFileSimpleScript
3839readFileSimpleScript file era = do
3940 bs <- readFileCli file
4041 case deserialiseFromJSON bs of
41- Left _ -> case era of
42- Exp. DijkstraEra -> error " TODO Dijkstra: Simple script not supported"
43- Exp. ConwayEra -> Exp. obtainConwayConstraints era $ do
44- -- In addition to the TextEnvelope format, we also try to
45- -- deserialize the JSON representation of SimpleScripts..
46- script :: SimpleScript <- fromEitherCli $ Aeson. eitherDecodeStrict' bs
47- let s :: L. NativeScript (Exp. LedgerEra era ) = obtainCommonConstraints era $ toAllegraTimelock script
48- return $ Exp. SimpleScript s
42+ Left _ -> do
43+ -- In addition to the TextEnvelope format, we also try to
44+ -- deserialize the JSON representation of SimpleScripts.
45+ script :: SimpleScript <- fromEitherCli $ Aeson. eitherDecodeStrict' bs
46+ let conwayTimelock :: L. NativeScript (Exp. LedgerEra Exp. ConwayEra )
47+ conwayTimelock = toAllegraTimelock script
48+ Exp. obtainCommonConstraints era $
49+ pure . Exp. SimpleScript $ case era of
50+ Exp. DijkstraEra -> Dijkstra. upgradeTimelock conwayTimelock
51+ Exp. ConwayEra -> conwayTimelock
4952 Right te -> do
5053 let scriptBs = teRawCBOR te
5154 obtainCommonConstraints era $
0 commit comments