Skip to content

Commit

Permalink
Generate TextEnvelope types from era names
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Sep 19, 2024
1 parent edf10b3 commit 2f867e4
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
Expand Down Expand Up @@ -125,6 +126,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import qualified Data.List as List
import Data.String
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text as Text
import qualified Data.Text.Encoding as Text
import qualified Data.Text.Encoding.Error as Text
Expand Down Expand Up @@ -625,13 +627,10 @@ readCddlTx =

txTextEnvelopeTypes :: [Text]
txTextEnvelopeTypes =
[ "TxSignedShelley"
, "Tx AllegraEra"
, "Tx MaryEra"
, "Tx AlonzoEra"
, "Tx BabbageEra"
, "Tx ConwayEra"
]
"TxSignedShelley"
: [ "Tx " <> T.pack (show $ toCardanoEra sbe)
| AnyShelleyBasedEra sbe <- [AnyShelleyBasedEra ShelleyBasedEraAllegra ..]
]

-- Tx witnesses

Expand Down Expand Up @@ -691,12 +690,8 @@ readCddlWitness fp = do

txWitnessTextEnvelopeTypes :: [Text]
txWitnessTextEnvelopeTypes =
[ "TxWitness ShelleyEra"
, "TxWitness AllegraEra"
, "TxWitness MaryEra"
, "TxWitness AlonzoEra"
, "TxWitness BabbageEra"
, "TxWitness ConwayEra"
[ "TxWitness " <> T.pack (show $ toCardanoEra sbe)
| AnyShelleyBasedEra sbe <- [AnyShelleyBasedEra ShelleyBasedEraShelley ..]
]

-- Witness handling
Expand Down

0 comments on commit 2f867e4

Please sign in to comment.