diff --git a/cardano-api/internal/Cardano/Api/Convenience/Construction.hs b/cardano-api/internal/Cardano/Api/Convenience/Construction.hs index 95c4a549f9..a932415782 100644 --- a/cardano-api/internal/Cardano/Api/Convenience/Construction.hs +++ b/cardano-api/internal/Cardano/Api/Convenience/Construction.hs @@ -17,6 +17,10 @@ where import Cardano.Api.Address import Cardano.Api.Certificate import Cardano.Api.Eon.ShelleyBasedEra +import Cardano.Api.Eon.ShelleyToAlonzoEra +import Cardano.Api.Eras +import Cardano.Api.Experimental.Eras +import Cardano.Api.Experimental.Tx import Cardano.Api.Fees import Cardano.Api.ProtocolParameters import Cardano.Api.Query @@ -29,6 +33,7 @@ import qualified Cardano.Ledger.Coin as L import qualified Cardano.Ledger.Credential as L import qualified Cardano.Ledger.Keys as L +import Data.Bifunctor import qualified Data.List as List import qualified Data.Map.Strict as Map import Data.Set (Set) @@ -72,7 +77,9 @@ constructBalancedTx stakeDelegDeposits drepDelegDeposits shelleyWitSigningKeys = do - BalancedTxBody _ txbody _txBalanceOutput _fee <- + availableEra <- first TxBodyErrorDeprecatedEra $ sbeToEra sbe + + BalancedTxBody _ unsignedTx _txBalanceOutput _fee <- makeTransactionBodyAutoBalance sbe systemStart @@ -86,8 +93,13 @@ constructBalancedTx changeAddr mOverrideWits - let keyWits = map (makeShelleyKeyWitness sbe txbody) shelleyWitSigningKeys - return $ makeSignedTransaction keyWits txbody + let alternateKeyWits = map (makeKeyWitness availableEra unsignedTx) shelleyWitSigningKeys + signedTx = signTx availableEra [] alternateKeyWits unsignedTx + + caseShelleyToAlonzoOrBabbageEraOnwards + (Left . TxBodyErrorDeprecatedEra . DeprecatedEra . shelleyToAlonzoEraToShelleyBasedEra) + (\w -> return $ ShelleyTx sbe $ obtainShimConstraints w signedTx) + sbe data TxInsExistError = TxInsDoNotExist [TxIn] diff --git a/cardano-api/internal/Cardano/Api/Tx/Body.hs b/cardano-api/internal/Cardano/Api/Tx/Body.hs index 495375057d..6a3bbb051f 100644 --- a/cardano-api/internal/Cardano/Api/Tx/Body.hs +++ b/cardano-api/internal/Cardano/Api/Tx/Body.hs @@ -132,6 +132,28 @@ module Cardano.Api.Tx.Body , scriptDataToInlineDatum -- * Internal conversion functions & types + , convCertificates + , convCollateralTxIns + , convExtraKeyWitnesses + , convLanguages + , convMintValue + , convProposalProcedures + , convReferenceInputs + , convReturnCollateral + , convScripts + , convScriptData + , convTotalCollateral + , convTransactionFee + , convTxIns + , convTxOuts + , convTxUpdateProposal + , convValidityLowerBound + , convValidityUpperBound + , convVotingProcedures + , convWithdrawals + , getScriptIntegrityHash + , mkCommonTxBody + , toAuxiliaryData , toByronTxId , toShelleyTxId , toShelleyTxIn