Skip to content

Commit

Permalink
Merge pull request #393 from input-output-hk/newhoggy/new-ToJSON-inst…
Browse files Browse the repository at this point in the history
…ance-for-TxValidationErrorInCardanoMode

New `ToJSON` instance for `TxValidationErrorInCardanoMode`
  • Loading branch information
newhoggy authored Dec 4, 2023
2 parents a29d94d + fcc6988 commit 7e90e50
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cardano-api/internal/Cardano/Api/InMode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import Cardano.Api.Modes
import Cardano.Api.Orphans ()
import Cardano.Api.Tx
import Cardano.Api.TxBody
import Cardano.Api.Utils (textShow)

import qualified Cardano.Ledger.Api as L
import qualified Ouroboros.Consensus.Byron.Ledger as Consensus
Expand Down Expand Up @@ -279,6 +280,18 @@ data TxValidationErrorInCardanoMode where

deriving instance Show TxValidationErrorInCardanoMode

instance ToJSON TxValidationErrorInCardanoMode where
toJSON = \case
TxValidationErrorInCardanoMode err ->
Aeson.object
[ "tag" .= Aeson.String "TxValidationErrorInCardanoMode"
, "contents" .= toJSON err
]
TxValidationEraMismatch err ->
Aeson.object
[ "tag" .= Aeson.String "TxValidationEraMismatch"
, "contents" .= toJSON (textShow err)
]

fromConsensusApplyTxErr :: ()
=> Consensus.CardanoBlock L.StandardCrypto ~ block
Expand Down

0 comments on commit 7e90e50

Please sign in to comment.