Skip to content

Commit

Permalink
Deprecate eras prior to BabbageEra in constructBalancedTx
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Jul 31, 2024
1 parent 79679a9 commit b0c6dd0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cardano-api/internal/Cardano/Api/Convenience/Construction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ where
import Cardano.Api.Address
import Cardano.Api.Certificate
import Cardano.Api.Eon.ShelleyBasedEra
import Cardano.Api.Eon.ShelleyToAlonzoEra
import Cardano.Api.Eras
import Cardano.Api.Experimental.Eras
import Cardano.Api.Experimental.Tx
import Cardano.Api.Fees
import Cardano.Api.ProtocolParameters
import Cardano.Api.Query
Expand All @@ -29,6 +33,7 @@ import qualified Cardano.Ledger.Coin as L
import qualified Cardano.Ledger.Credential as L
import qualified Cardano.Ledger.Keys as L

import Data.Bifunctor
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Set (Set)
Expand Down Expand Up @@ -72,7 +77,9 @@ constructBalancedTx
stakeDelegDeposits
drepDelegDeposits
shelleyWitSigningKeys = do
BalancedTxBody _ txbody _txBalanceOutput _fee <-
availableEra <- first TxBodyErrorDeprecatedEra $ sbeToEra sbe

BalancedTxBody _ unsignedTx _txBalanceOutput _fee <-
makeTransactionBodyAutoBalance
sbe
systemStart
Expand All @@ -86,8 +93,13 @@ constructBalancedTx
changeAddr
mOverrideWits

let keyWits = map (makeShelleyKeyWitness sbe txbody) shelleyWitSigningKeys
return $ makeSignedTransaction keyWits txbody
let alternateKeyWits = map (makeKeyWitness availableEra unsignedTx) shelleyWitSigningKeys
signedTx = signTx availableEra [] alternateKeyWits unsignedTx

caseShelleyToAlonzoOrBabbageEraOnwards
(Left . TxBodyErrorDeprecatedEra . DeprecatedEra . shelleyToAlonzoEraToShelleyBasedEra)
(\w -> return $ ShelleyTx sbe $ obtainShimConstraints w signedTx)
sbe

data TxInsExistError
= TxInsDoNotExist [TxIn]
Expand Down
22 changes: 22 additions & 0 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,28 @@ module Cardano.Api.Tx.Body
, scriptDataToInlineDatum

-- * Internal conversion functions & types
, convCertificates
, convCollateralTxIns
, convExtraKeyWitnesses
, convLanguages
, convMintValue
, convProposalProcedures
, convReferenceInputs
, convReturnCollateral
, convScripts
, convScriptData
, convTotalCollateral
, convTransactionFee
, convTxIns
, convTxOuts
, convTxUpdateProposal
, convValidityLowerBound
, convValidityUpperBound
, convVotingProcedures
, convWithdrawals
, getScriptIntegrityHash
, mkCommonTxBody
, toAuxiliaryData
, toByronTxId
, toShelleyTxId
, toShelleyTxIn
Expand Down

0 comments on commit b0c6dd0

Please sign in to comment.