Skip to content

Commit

Permalink
Merge pull request #597 from IntersectMBO/jordan/deprecate-createAndV…
Browse files Browse the repository at this point in the history
…alidateTransactionBody

Deprecate createAndValidateTransactionBody
  • Loading branch information
Jimbo4350 committed Aug 23, 2024
2 parents 861fb11 + 5e15672 commit 966462b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 52,847 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 @@ -790,7 +790,7 @@ genValidTxBody sbe =
-- | Partial! This function will throw an error when the generated transaction is invalid.
genTxBody :: HasCallStack => 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 -> error (docToString (prettyError err))
Right txBody -> pure txBody
Expand Down
6 changes: 3 additions & 3 deletions cardano-api/internal/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,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 @@ -336,7 +336,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 @@ -376,7 +376,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
6 changes: 2 additions & 4 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,7 @@ maxShelleyTxInIx = fromIntegral $ maxBound @Word16
maxTxOut :: Quantity
maxTxOut = fromIntegral (maxBound :: Word64)

{-# DEPRECATED createAndValidateTransactionBody "Use createTransactionBody instead" #-}
createAndValidateTransactionBody
:: ()
=> ShelleyBasedEra era
Expand Down Expand Up @@ -2815,10 +2816,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 -> 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 @@ -280,6 +280,7 @@ module Cardano.Api

-- ** Transaction bodies
, TxBody (..)
, createTransactionBody
, createAndValidateTransactionBody
, makeByronTransactionBody
, TxBodyContent (..)
Expand Down
Loading

0 comments on commit 966462b

Please sign in to comment.