|
2 | 2 | {-# LANGUAGE GADTs #-} |
3 | 3 | {-# LANGUAGE RankNTypes #-} |
4 | 4 | {-# LANGUAGE ScopedTypeVariables #-} |
5 | | -{-# LANGUAGE TypeApplications #-} |
6 | 5 |
|
7 | 6 | module Cardano.CLI.EraBased.Script.Read.Common |
8 | 7 | ( -- * Plutus Script Related |
@@ -40,20 +39,16 @@ readFileSimpleScript |
40 | 39 | readFileSimpleScript file era = do |
41 | 40 | bs <- readFileCli file |
42 | 41 | case deserialiseFromJSON bs of |
43 | | - Left _ -> case era of |
44 | | - Exp.DijkstraEra -> Exp.obtainCommonConstraints era $ do |
45 | | - -- In addition to the TextEnvelope format, we also try to |
46 | | - -- deserialize the JSON representation of SimpleScripts. |
47 | | - script :: SimpleScript <- fromEitherCli $ Aeson.eitherDecodeStrict' bs |
48 | | - let s :: L.NativeScript (Exp.LedgerEra era) = |
49 | | - Dijkstra.upgradeTimelock (toAllegraTimelock @(Exp.LedgerEra Exp.ConwayEra) script) |
50 | | - return $ Exp.SimpleScript s |
51 | | - Exp.ConwayEra -> Exp.obtainConwayConstraints era $ do |
52 | | - -- In addition to the TextEnvelope format, we also try to |
53 | | - -- deserialize the JSON representation of SimpleScripts. |
54 | | - script :: SimpleScript <- fromEitherCli $ Aeson.eitherDecodeStrict' bs |
55 | | - let s :: L.NativeScript (Exp.LedgerEra era) = obtainCommonConstraints era $ toAllegraTimelock script |
56 | | - 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 |
57 | 52 | Right te -> do |
58 | 53 | let scriptBs = teRawCBOR te |
59 | 54 | obtainCommonConstraints era $ |
|
0 commit comments