diff --git a/cardano-api/internal/Cardano/Api/TxBody.hs b/cardano-api/internal/Cardano/Api/TxBody.hs index 19c1f08a6a..0f6fd568ad 100644 --- a/cardano-api/internal/Cardano/Api/TxBody.hs +++ b/cardano-api/internal/Cardano/Api/TxBody.hs @@ -1803,26 +1803,26 @@ createTransactionBody :: () => ShelleyBasedEra era -> TxBodyContent BuildTx era -> Either TxBodyError (TxBody era) -createTransactionBody sbe txBodyContent = +createTransactionBody sbe bc = shelleyBasedEraConstraints sbe $ do - let apiTxOuts = txOuts txBodyContent - apiScriptWitnesses = collectTxBodyScriptWitnesses sbe txBodyContent - apiScriptValidity = txScriptValidity txBodyContent - apiMintValue = txMintValue txBodyContent - apiProtocolParameters = txProtocolParams txBodyContent - apiCollateralTxIns = txInsCollateral txBodyContent - apiReferenceInputs = txInsReference txBodyContent - apiExtraKeyWitnesses = txExtraKeyWits txBodyContent - apiReturnCollateral = txReturnCollateral txBodyContent - apiTotalCollateral = txTotalCollateral txBodyContent + let apiTxOuts = txOuts bc + apiScriptWitnesses = collectTxBodyScriptWitnesses sbe bc + apiScriptValidity = txScriptValidity bc + apiMintValue = txMintValue bc + apiProtocolParameters = txProtocolParams bc + apiCollateralTxIns = txInsCollateral bc + apiReferenceInputs = txInsReference bc + apiExtraKeyWitnesses = txExtraKeyWits bc + apiReturnCollateral = txReturnCollateral bc + apiTotalCollateral = txTotalCollateral bc -- Ledger types collTxIns = convCollateralTxIns apiCollateralTxIns refTxIns = convReferenceInputs apiReferenceInputs returnCollateral = convReturnCollateral sbe apiReturnCollateral totalCollateral = convTotalCollateral apiTotalCollateral - certs = convCertificates sbe $ txCertificates txBodyContent - txAuxData = toAuxiliaryData sbe (txMetadata txBodyContent) (txAuxScripts txBodyContent) + certs = convCertificates sbe $ txCertificates bc + txAuxData = toAuxiliaryData sbe (txMetadata bc) (txAuxScripts bc) scripts = convScripts apiScriptWitnesses languages = convLanguages apiScriptWitnesses sData = convScriptData sbe apiTxOuts apiScriptWitnesses @@ -1831,7 +1831,7 @@ createTransactionBody sbe txBodyContent = modifiesLedgerTxBody sbe $ caseShelleyToBabbageOrConwayEraOnwards (\w -> do - update <- convTxUpdateProposal sbe (txUpdateProposal txBodyContent) + update <- convTxUpdateProposal sbe (txUpdateProposal bc) pure $ L.apiUpdateTxBodyL w .~ update) (const $ pure id) sbe @@ -1840,7 +1840,7 @@ createTransactionBody sbe txBodyContent = modifiesLedgerTxBody sbe $ pure $ caseShelleyEraOnlyOrAllegraEraOnwards (const id) - (\aOn -> L.invalidBeforeTxBodyL aOn .~ convValidityLowerBound (txValidityLowerBound txBodyContent)) + (\aOn -> L.invalidBeforeTxBodyL aOn .~ convValidityLowerBound (txValidityLowerBound bc)) sbe setMint <- @@ -1892,23 +1892,10 @@ createTransactionBody sbe txBodyContent = (const $ L.totalCollateralTxBodyL .~ totalCollateral) sbe - let mkTxBody :: () - => ShelleyBasedEra era - -> TxBodyContent BuildTx era - -> Maybe (L.TxAuxData (ShelleyLedgerEra era)) - -> L.TxBody (ShelleyLedgerEra era) - mkTxBody sbe' bc = - mkCommonTxBody - sbe' - (txIns bc) - (txOuts bc) - (txFee bc) - (txWithdrawals bc) - let ledgerTxBody = - mkTxBody sbe txBodyContent txAuxData + mkCommonTxBody sbe (txIns bc) (txOuts bc) (txFee bc) (txWithdrawals bc) txAuxData & L.certsTxBodyL .~ certs - & L.invalidHereAfterTxBodyL sbe .~ convValidityUpperBound sbe (txValidityUpperBound txBodyContent) + & L.invalidHereAfterTxBodyL sbe .~ convValidityUpperBound sbe (txValidityUpperBound bc) & setUpdateProposal & setInvalidBefore & setMint