diff --git a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs index fb2ac41761..fb8ef09869 100644 --- a/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs +++ b/cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs @@ -778,7 +778,7 @@ genWitnessesByron = Gen.list (Range.constant 1 10) genByronKeyWitness genTxBody :: ShelleyBasedEra era -> Gen (TxBody era) genTxBody era = do - res <- Api.createAndValidateTransactionBody era <$> genTxBodyContent era + res <- Api.createTransactionBody era <$> genTxBodyContent era case res of Left err -> fail (docToString (prettyError err)) Right txBody -> pure txBody diff --git a/cardano-api/internal/Cardano/Api/Fees.hs b/cardano-api/internal/Cardano/Api/Fees.hs index b6032bf103..59c3de424c 100644 --- a/cardano-api/internal/Cardano/Api/Fees.hs +++ b/cardano-api/internal/Cardano/Api/Fees.hs @@ -290,7 +290,7 @@ estimateBalancedTxBody let maxLovelaceFee = L.Coin (2 ^ (32 :: Integer) - 1) txbody1ForFeeEstimateOnly <- first TxFeeEstimationxBodyError $ -- TODO: impossible to fail now - createAndValidateTransactionBody + createTransactionBody sbe txbodycontent1 { txFee = TxFeeExplicit sbe maxLovelaceFee @@ -332,7 +332,7 @@ estimateBalancedTxBody -- 3. Return and total collateral txbody2 <- first TxFeeEstimationxBodyError $ -- TODO: impossible to fail now - createAndValidateTransactionBody + createTransactionBody sbe txbodycontent1 { txFee = TxFeeExplicit sbe fee @@ -372,7 +372,7 @@ estimateBalancedTxBody first TxFeeEstimationFinalConstructionError $ -- TODO: impossible to fail now. We need to implement a function -- that simply creates a transaction body because we have already -- validated the transaction body earlier within makeTransactionBodyAutoBalance - createAndValidateTransactionBody sbe finalTxBodyContent + createTransactionBody sbe finalTxBodyContent return ( BalancedTxBody finalTxBodyContent @@ -1047,7 +1047,7 @@ makeTransactionBodyAutoBalance -- 4. balance the transaction and update tx change output txbody0 <- first TxBodyError $ - createAndValidateTransactionBody + createTransactionBody sbe txbodycontent { txOuts = @@ -1107,7 +1107,7 @@ makeTransactionBodyAutoBalance let (dummyCollRet, dummyTotColl) = maybeDummyTotalCollAndCollReturnOutput sbe txbodycontent changeaddr txbody1 <- first TxBodyError $ -- TODO: impossible to fail now - createAndValidateTransactionBody + createTransactionBody sbe txbodycontent1 { txFee = TxFeeExplicit sbe maxLovelaceFee @@ -1152,7 +1152,7 @@ makeTransactionBodyAutoBalance -- we need to calculate. txbody2 <- first TxBodyError $ -- TODO: impossible to fail now - createAndValidateTransactionBody + createTransactionBody sbe txbodycontent1 { txFee = TxFeeExplicit sbe fee @@ -1189,7 +1189,7 @@ makeTransactionBodyAutoBalance first TxBodyError $ -- TODO: impossible to fail now. We need to implement a function -- that simply creates a transaction body because we have already -- validated the transaction body earlier within makeTransactionBodyAutoBalance - createAndValidateTransactionBody sbe finalTxBodyContent + createTransactionBody sbe finalTxBodyContent return ( BalancedTxBody finalTxBodyContent diff --git a/cardano-api/internal/Cardano/Api/Tx/Body.hs b/cardano-api/internal/Cardano/Api/Tx/Body.hs index e5146e0105..eb7647b7e3 100644 --- a/cardano-api/internal/Cardano/Api/Tx/Body.hs +++ b/cardano-api/internal/Cardano/Api/Tx/Body.hs @@ -1719,6 +1719,8 @@ maxShelleyTxInIx = fromIntegral $ maxBound @Word16 maxTxOut :: Quantity maxTxOut = fromIntegral (maxBound :: Word64) + +{-# DEPRECATED createAndValidateTransactionBody "Use createTransactionBody instead" #-} createAndValidateTransactionBody :: () => ShelleyBasedEra era @@ -2680,10 +2682,7 @@ makeShelleyTransactionBody convPParamsToScriptIntegrityHash AlonzoEraOnwardsBabbage txProtocolParams redeemers datums languages let txbody = ( mkCommonTxBody sbe txIns txOuts txFee txWithdrawals txAuxData - & A.collateralInputsTxBodyL azOn - .~ case txInsCollateral of - TxInsCollateralNone -> Set.empty - TxInsCollateral _ txins -> Set.fromList (map toShelleyTxIn txins) + & A.collateralInputsTxBodyL azOn .~ convCollateralTxIns txInsCollateral & A.referenceInputsTxBodyL bOn .~ convReferenceInputs txInsReference & A.collateralReturnTxBodyL bOn .~ convReturnCollateral sbe txReturnCollateral & A.totalCollateralTxBodyL bOn .~ convTotalCollateral txTotalCollateral diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index d385afc7cf..25ddf258a7 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -278,6 +278,7 @@ module Cardano.Api -- ** Transaction bodies , TxBody (..) + , createTransactionBody , createAndValidateTransactionBody , makeByronTransactionBody , TxBodyContent (..) diff --git a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs index df5d28a139..85b5b98074 100644 --- a/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs +++ b/cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs @@ -29,7 +29,7 @@ prop_roundtrip_txbodycontent_txouts = let era = ShelleyBasedEraBabbage content <- H.forAll $ genTxBodyContent era -- Create the ledger body & auxiliaries - body <- case createAndValidateTransactionBody era content of + body <- case createTransactionBody era content of Left err -> annotateShow err >> failure Right body -> pure body annotateShow body