Skip to content

Commit

Permalink
Deprecate createAndValidateTransactionBody
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Jul 26, 2024
1 parent 65cbae3 commit c18de50
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions cardano-api/internal/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1047,7 +1047,7 @@ makeTransactionBodyAutoBalance
-- 4. balance the transaction and update tx change output
txbody0 <-
first TxBodyError $
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent
{ txOuts =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,8 @@ maxShelleyTxInIx = fromIntegral $ maxBound @Word16
maxTxOut :: Quantity
maxTxOut = fromIntegral (maxBound :: Word64)


{-# DEPRECATED createAndValidateTransactionBody "Use createTransactionBody instead" #-}
createAndValidateTransactionBody
:: ()
=> ShelleyBasedEra era
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ module Cardano.Api

-- ** Transaction bodies
, TxBody (..)
, createTransactionBody
, createAndValidateTransactionBody
, makeByronTransactionBody
, TxBodyContent (..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c18de50

Please sign in to comment.