Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate createAndValidateTransactionBody #597

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading