@@ -203,9 +203,13 @@ runTransactionBuildCmd
203203
204204 requiredSigners <-
205205 mapM (fromEitherIOCli . readRequiredSigner) reqSigners
206- mReturnCollateral <- forM mReturnColl toTxOutInShelleyBasedEra
206+ mReturnCollateral :: Maybe (Exp. TxOut (Exp. LedgerEra era )) <-
207+ forM mReturnColl toTxOutInShelleyBasedEra
207208
208- txOuts <- mapM (toTxOutInAnyEra eon) txouts
209+ txOuts <-
210+ mapM
211+ toTxOutInEra
212+ txouts
209213
210214 -- Conway related
211215 votingProceduresAndMaybeScriptWits :: [(VotingProcedures era , Exp. AnyWitness (Exp. LedgerEra era ))] <-
@@ -367,6 +371,15 @@ runTransactionBuildCmd
367371 then writeTxFileTextEnvelopeCanonical eon fpath noWitTx
368372 else writeTxFileTextEnvelope eon fpath noWitTx
369373
374+ toTxOutInEra
375+ :: Exp. IsEra era
376+ => TxOutAnyEra
377+ -> CIO e (Exp. TxOut (Exp. LedgerEra era ))
378+ toTxOutInEra (TxOutAnyEra addr' val' mDatumHash refScriptFp) = do
379+ let addr = anyAddressInShelleyBasedEra (convert Exp. useEra) addr'
380+ o <- mkTxOut (convert Exp. useEra) addr val' mDatumHash refScriptFp
381+ fromEitherCli $ Exp. fromLegacyTxOut o
382+
370383runTransactionBuildEstimateCmd
371384 :: forall era e
372385 . Exp. IsEra era
@@ -434,7 +447,7 @@ runTransactionBuildEstimateCmd -- TODO change type
434447
435448 mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl
436449
437- txOuts <- mapM (toTxOutInAnyEra sbe) txouts
450+ txOuts <- mapM toTxOutInEra txouts
438451
439452 -- the same collateral input can be used for several plutus scripts
440453 let filteredTxinsc = nubOrd txInsCollateral
@@ -531,7 +544,7 @@ runTransactionBuildEstimateCmd -- TODO change type
531544 txBodyOutFile
532545 $ unsignedToToApiTx unsignedTx
533546
534- unsignedToToApiTx :: forall era . Exp. IsEra era => Exp. UnsignedTx era -> Api. Tx era
547+ unsignedToToApiTx :: forall era . Exp. IsEra era => Exp. UnsignedTx ( Exp. LedgerEra era ) -> Api. Tx era
535548unsignedToToApiTx (Exp. UnsignedTx lTx) =
536549 ShelleyTx (convert $ Exp. useEra @ era ) $ obtainCommonConstraints (Exp. useEra @ era ) lTx
537550
@@ -642,7 +655,7 @@ runTransactionBuildRawCmd
642655
643656 mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl
644657
645- txOuts <- mapM (toTxOutInAnyEra (convert Exp. useEra)) txouts
658+ txOuts <- mapM toTxOutInEra txouts
646659
647660 -- the same collateral input can be used for several plutus scripts
648661 let filteredTxinsc = toList @ (Set _ ) $ fromList txInsCollateral
@@ -664,7 +677,7 @@ runTransactionBuildRawCmd
664677 )
665678 | (CertificateFile certFile, mSwit) <- certFilesAndMaybeScriptWits
666679 ]
667- txBody :: Exp. UnsignedTx era <-
680+ txBody :: Exp. UnsignedTx ( Exp. LedgerEra era ) <-
668681 fromEitherCli $
669682 runTxBuildRaw
670683 mScriptValidity
@@ -687,7 +700,6 @@ runTransactionBuildRawCmd
687700 votingProceduresAndMaybeScriptWits
688701 proposals
689702 currentTreasuryValueAndDonation
690-
691703 let Exp. UnsignedTx lTx = txBody
692704 noWitTx = ShelleyTx (convert eon) lTx
693705 fromEitherIOCli $
@@ -705,18 +717,18 @@ runTxBuildRaw
705717 -- ^ Read only reference inputs
706718 -> [TxIn ]
707719 -- ^ TxIn for collateral
708- -> Maybe (TxOut CtxTx era )
720+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
709721 -- ^ Return collateral
710722 -> Maybe Lovelace
711723 -- ^ Total collateral
712- -> [TxOut CtxTx era ]
724+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
713725 -> Maybe SlotNo
714726 -- ^ Tx lower bound
715727 -> TxValidityUpperBound era
716728 -- ^ Tx upper bound
717729 -> Lovelace
718730 -- ^ Tx fee
719- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
731+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
720732 -- ^ Multi-Asset minted value(s)
721733 -> [(Exp. Certificate (Exp. LedgerEra era ), Exp. AnyWitness (Exp. LedgerEra era ))]
722734 -- ^ Certificate with potential script witness
@@ -729,7 +741,7 @@ runTxBuildRaw
729741 -> [(VotingProcedures era , Exp. AnyWitness (Exp. LedgerEra era ))]
730742 -> [(Proposal era , Exp. AnyWitness (Exp. LedgerEra era ))]
731743 -> Maybe (TxCurrentTreasuryValue , TxTreasuryDonation )
732- -> Either TxCmdError (Exp. UnsignedTx era )
744+ -> Either TxCmdError (Exp. UnsignedTx ( Exp. LedgerEra era ) )
733745runTxBuildRaw
734746 mScriptValidity
735747 inputsAndMaybeScriptWits
@@ -787,17 +799,17 @@ constructTxBodyContent
787799 -- ^ Read only reference inputs
788800 -> [TxIn ]
789801 -- ^ TxIn for collateral
790- -> Maybe (TxOut CtxTx era )
802+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
791803 -- ^ Return collateral
792804 -> Maybe Lovelace
793805 -- ^ Total collateral
794- -> [TxOut CtxTx era ]
806+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
795807 -- ^ Normal outputs
796808 -> Maybe SlotNo
797809 -- ^ Tx lower bound
798810 -> TxValidityUpperBound era
799811 -- ^ Tx upper bound
800- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
812+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
801813 -- ^ Multi-Asset value(s)
802814 -> [(Exp. Certificate (Exp. LedgerEra era ), Exp. AnyWitness (Exp. LedgerEra era ))]
803815 -- ^ Certificate with potential script witness
@@ -850,17 +862,18 @@ constructTxBodyContent
850862 -- TODO The last argument of validateTxInsReference is a datum set from reference inputs
851863 -- Should we allow providing of datum from CLI?
852864 -- TODO: Figure how to expose resolved datums
865+
866+ txRetCollateral :: Maybe (Exp. TxReturnCollateral (Exp. LedgerEra era )) <- case mReturnCollateral of
867+ Just rc -> do
868+ let Exp. TxOut o = rc
869+ Right $ Just $ Exp. TxReturnCollateral (o :: (L. TxOut (Exp. LedgerEra era )))
870+ Nothing -> Right Nothing
871+
853872 let refInputs = Exp. TxInsReference allReferenceInputs Set. empty
854- expTxouts = map Exp. fromLegacyTxOut txouts
855873 auxScripts = case txAuxScripts of
856874 TxAuxScriptsNone -> []
857875 -- TODO: Auxiliary scripts cannot be plutus scripts
858876 TxAuxScripts _ scripts -> mapMaybe scriptInEraToSimpleScript scripts
859- txRetCollateral = case mReturnCollateral of
860- Just rc ->
861- let Exp. TxOut o _ = Exp. fromLegacyTxOut rc
862- in Just $ Exp. TxReturnCollateral (o :: (L. TxOut (Exp. LedgerEra era )))
863- Nothing -> Nothing
864877 txTotCollateral = Exp. TxTotalCollateral <$> (mTotCollateral :: Maybe L. Coin )
865878 expTxMetadata = case txMetadata of
866879 TxMetadataNone -> TxMetadata mempty
@@ -882,7 +895,7 @@ constructTxBodyContent
882895 & Exp. setTxIns inputsAndMaybeScriptWits
883896 & Exp. setTxInsCollateral txinsc
884897 & Exp. setTxInsReference refInputs
885- & Exp. setTxOuts expTxouts
898+ & Exp. setTxOuts txouts
886899 & maybe id Exp. setTxReturnCollateral txRetCollateral
887900 & maybe id Exp. setTxTotalCollateral txTotCollateral
888901 & Exp. setTxFee fee
@@ -940,16 +953,15 @@ runTxBuild
940953 -- ^ TxIn with potential script witness
941954 -> [TxIn ]
942955 -- ^ TxIn for collateral
943- -> Maybe (TxOut CtxTx era )
956+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
944957 -- ^ Return collateral
945958 -> Maybe Lovelace
946959 -- ^ Total collateral
947- -> [TxOut CtxTx era ]
960+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
948961 -- ^ Normal outputs
949962 -> TxOutChangeAddress
950963 -- ^ A change output
951- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))]) -- TODO: Double check why this is a list
952-
964+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
953965 -- ^ Multi-Asset value(s)
954966 -> Maybe SlotNo
955967 -- ^ Tx lower bound
@@ -968,7 +980,7 @@ runTxBuild
968980 -> [(Proposal era , Exp. AnyWitness (Exp. LedgerEra era ))]
969981 -> Maybe (TxCurrentTreasuryValue , TxTreasuryDonation )
970982 -- ^ The current treasury value and the donation.
971- -> ExceptT TxCmdError IO (Exp. UnsignedTx era , Exp. TxBodyContent (Exp. LedgerEra era ))
983+ -> ExceptT TxCmdError IO (Exp. UnsignedTx ( Exp. LedgerEra era ) , Exp. TxBodyContent (Exp. LedgerEra era ))
972984runTxBuild
973985 socketPath
974986 networkId
@@ -1109,7 +1121,7 @@ runTxBuild
11091121
11101122getAllReferenceInputs
11111123 :: [Exp. AnyWitness (Exp. LedgerEra era )]
1112- -> [Exp. AnyWitness (Exp. LedgerEra era )]
1124+ -> [Exp. AnyScriptWitness (Exp. LedgerEra era )]
11131125 -> [Exp. AnyWitness (Exp. LedgerEra era )]
11141126 -- \^ Certificate witnesses
11151127 -> [Exp. AnyWitness (Exp. LedgerEra era )]
@@ -1127,7 +1139,7 @@ getAllReferenceInputs
11271139 propProceduresAnMaybeScriptWits
11281140 readOnlyRefIns = do
11291141 let txinsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput spendingWitnesses
1130- mintingRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput mintWitnesses
1142+ mintingRefInputs = mapMaybe Exp. getAnyScriptWitnessReferenceInput mintWitnesses
11311143 certsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput certScriptWitnesses
11321144 withdrawalsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput withdrawals
11331145 votesWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput votingProceduresAndMaybeScriptWits
@@ -1146,19 +1158,20 @@ getAllReferenceInputs
11461158toTxOutInShelleyBasedEra
11471159 :: Exp. IsEra era
11481160 => TxOutShelleyBasedEra
1149- -> CIO e (TxOut CtxTx era )
1161+ -> CIO e (Exp. TxOut ( Exp. LedgerEra era ) )
11501162toTxOutInShelleyBasedEra (TxOutShelleyBasedEra addr' val' mDatumHash refScriptFp) = do
11511163 let sbe = convert Exp. useEra
11521164 addr = shelleyAddressInEra sbe addr'
1153- mkTxOut sbe addr val' mDatumHash refScriptFp
1165+ o <- mkTxOut sbe addr val' mDatumHash refScriptFp
1166+ fromEitherCli $ Exp. fromLegacyTxOut o
11541167
11551168-- TODO: Currently we specify the policyId with the '--mint' option on the cli
11561169-- and we added a separate '--policy-id' parser that parses the policy id for the
11571170-- given reference input (since we don't have the script in this case). To avoid asking
11581171-- for the policy id twice (in the build command) we can potentially query the UTxO and
11591172-- access the script (and therefore the policy id).
11601173createTxMintValue
1161- :: (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
1174+ :: (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
11621175 -> Either TxCmdError (Exp. TxMintValue (Exp. LedgerEra era ))
11631176createTxMintValue (val, scriptWitnesses) =
11641177 if mempty == val && List. null scriptWitnesses
@@ -1421,16 +1434,16 @@ runTransactionCalculateMinValueCmd
14211434 -> CIO e ()
14221435runTransactionCalculateMinValueCmd
14231436 Cmd. TransactionCalculateMinValueCmdArgs
1424- { era
1437+ { era = era :: Exp. Era era
14251438 , protocolParamsFile
14261439 , txOut
14271440 } = do
1428- pp <-
1441+ pp :: L. PParams (( Exp. LedgerEra era )) <-
14291442 fromExceptTCli @ ProtocolParamsError
14301443 (obtainCommonConstraints era $ readProtocolParameters protocolParamsFile)
14311444 out <- obtainCommonConstraints era $ toTxOutInShelleyBasedEra txOut
14321445
1433- let minValue = calculateMinimumUTxO (convert era) pp out
1446+ let minValue = Exp. calculateMinimumUTxO pp out
14341447 liftIO . IO. print $ minValue
14351448
14361449runTransactionCalculatePlutusScriptCostCmd
0 commit comments