Skip to content

Commit

Permalink
Remove TxBody pattern (used only once in API, and once in CLI)
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Jan 16, 2025
1 parent 63631da commit 52d881e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cardano-api/internal/Cardano/Api/Governance/Poll.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}

-- | An API for driving on-chain poll for SPOs.
--
Expand Down Expand Up @@ -341,12 +340,13 @@ verifyPollAnswer
:: GovernancePoll
-> InAnyShelleyBasedEra Tx
-> Either GovernancePollError [Hash PaymentKey]
verifyPollAnswer poll (InAnyShelleyBasedEra _era (getTxBody -> TxBody body)) = do
verifyPollAnswer poll (InAnyShelleyBasedEra _era tx) = do
answer <- extractPollAnswer (txMetadata body)
answer `hasMatchingHash` hashGovernancePoll poll
answer `isAmongAcceptableChoices` govPollAnswers poll
extraKeyWitnesses (txExtraKeyWits body)
where
body = getTxBodyContent $ getTxBody tx
extractPollAnswer = \case
TxMetadataNone ->
Left ErrGovernancePollNoAnswer
Expand Down
8 changes: 0 additions & 8 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ViewPatterns #-}

-- | Transaction bodies
module Cardano.Api.Tx.Body
( parseTxId

-- * Transaction bodies
, TxBody (.., TxBody)
, createTransactionBody
, createAndValidateTransactionBody
, TxBodyContent (..)
Expand Down Expand Up @@ -2147,11 +2144,6 @@ createAndValidateTransactionBody
-> Either TxBodyError (TxBody era)
createAndValidateTransactionBody = makeShelleyTransactionBody

pattern TxBody :: TxBodyContent ViewTx era -> TxBody era
pattern TxBody txbodycontent <- (getTxBodyContent -> txbodycontent)

{-# COMPLETE TxBody #-}

getTxBodyContent :: TxBody era -> TxBodyContent ViewTx era
getTxBodyContent = \case
ShelleyTxBody sbe body _scripts scriptdata mAux scriptValidity ->
Expand Down

0 comments on commit 52d881e

Please sign in to comment.