@@ -204,9 +204,13 @@ runTransactionBuildCmd
204204
205205 requiredSigners <-
206206 mapM (fromEitherIOCli . readRequiredSigner) reqSigners
207- mReturnCollateral <- forM mReturnColl toTxOutInShelleyBasedEra
207+ mReturnCollateral :: Maybe (Exp. TxOut (Exp. LedgerEra era )) <-
208+ forM mReturnColl toTxOutInShelleyBasedEra
208209
209- txOuts <- mapM (toTxOutInAnyEra eon) txouts
210+ txOuts <-
211+ mapM
212+ toTxOutInEra
213+ txouts
210214
211215 -- Conway related
212216 votingProceduresAndMaybeScriptWits :: [(VotingProcedures era , Exp. AnyWitness (Exp. LedgerEra era ))] <-
@@ -368,6 +372,15 @@ runTransactionBuildCmd
368372 then writeTxFileTextEnvelopeCanonical eon fpath noWitTx
369373 else writeTxFileTextEnvelope eon fpath noWitTx
370374
375+ toTxOutInEra
376+ :: Exp. IsEra era
377+ => TxOutAnyEra
378+ -> CIO e (Exp. TxOut (Exp. LedgerEra era ))
379+ toTxOutInEra (TxOutAnyEra addr' val' mDatumHash refScriptFp) = do
380+ let addr = anyAddressInShelleyBasedEra (convert Exp. useEra) addr'
381+ o <- mkTxOut (convert Exp. useEra) addr val' mDatumHash refScriptFp
382+ fromEitherCli $ Exp. fromLegacyTxOut o
383+
371384runTransactionBuildEstimateCmd
372385 :: forall era e
373386 . Exp. IsEra era
@@ -435,7 +448,7 @@ runTransactionBuildEstimateCmd -- TODO change type
435448
436449 mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl
437450
438- txOuts <- mapM (toTxOutInAnyEra sbe) txouts
451+ txOuts <- mapM toTxOutInEra txouts
439452
440453 -- the same collateral input can be used for several plutus scripts
441454 let filteredTxinsc = nubOrd txInsCollateral
@@ -532,7 +545,7 @@ runTransactionBuildEstimateCmd -- TODO change type
532545 txBodyOutFile
533546 $ unsignedToToApiTx unsignedTx
534547
535- unsignedToToApiTx :: forall era . Exp. IsEra era => Exp. UnsignedTx era -> Api. Tx era
548+ unsignedToToApiTx :: forall era . Exp. IsEra era => Exp. UnsignedTx ( Exp. LedgerEra era ) -> Api. Tx era
536549unsignedToToApiTx (Exp. UnsignedTx lTx) =
537550 ShelleyTx (convert $ Exp. useEra @ era ) $ obtainCommonConstraints (Exp. useEra @ era ) lTx
538551
@@ -643,7 +656,7 @@ runTransactionBuildRawCmd
643656
644657 mReturnCollateral <- mapM toTxOutInShelleyBasedEra mReturnColl
645658
646- txOuts <- mapM (toTxOutInAnyEra (convert Exp. useEra)) txouts
659+ txOuts <- mapM toTxOutInEra txouts
647660
648661 -- the same collateral input can be used for several plutus scripts
649662 let filteredTxinsc = toList @ (Set _ ) $ fromList txInsCollateral
@@ -665,7 +678,7 @@ runTransactionBuildRawCmd
665678 )
666679 | (CertificateFile certFile, mSwit) <- certFilesAndMaybeScriptWits
667680 ]
668- txBody :: Exp. UnsignedTx era <-
681+ txBody :: Exp. UnsignedTx ( Exp. LedgerEra era ) <-
669682 fromEitherCli $
670683 runTxBuildRaw
671684 mScriptValidity
@@ -688,7 +701,6 @@ runTransactionBuildRawCmd
688701 votingProceduresAndMaybeScriptWits
689702 proposals
690703 currentTreasuryValueAndDonation
691-
692704 let Exp. UnsignedTx lTx = txBody
693705 noWitTx = ShelleyTx (convert eon) lTx
694706 fromEitherIOCli $
@@ -706,18 +718,18 @@ runTxBuildRaw
706718 -- ^ Read only reference inputs
707719 -> [TxIn ]
708720 -- ^ TxIn for collateral
709- -> Maybe (TxOut CtxTx era )
721+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
710722 -- ^ Return collateral
711723 -> Maybe Lovelace
712724 -- ^ Total collateral
713- -> [TxOut CtxTx era ]
725+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
714726 -> Maybe SlotNo
715727 -- ^ Tx lower bound
716728 -> TxValidityUpperBound era
717729 -- ^ Tx upper bound
718730 -> Lovelace
719731 -- ^ Tx fee
720- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
732+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
721733 -- ^ Multi-Asset minted value(s)
722734 -> [(Exp. Certificate (Exp. LedgerEra era ), Exp. AnyWitness (Exp. LedgerEra era ))]
723735 -- ^ Certificate with potential script witness
@@ -730,7 +742,7 @@ runTxBuildRaw
730742 -> [(VotingProcedures era , Exp. AnyWitness (Exp. LedgerEra era ))]
731743 -> [(Proposal era , Exp. AnyWitness (Exp. LedgerEra era ))]
732744 -> Maybe (TxCurrentTreasuryValue , TxTreasuryDonation )
733- -> Either TxCmdError (Exp. UnsignedTx era )
745+ -> Either TxCmdError (Exp. UnsignedTx ( Exp. LedgerEra era ) )
734746runTxBuildRaw
735747 mScriptValidity
736748 inputsAndMaybeScriptWits
@@ -788,17 +800,17 @@ constructTxBodyContent
788800 -- ^ Read only reference inputs
789801 -> [TxIn ]
790802 -- ^ TxIn for collateral
791- -> Maybe (TxOut CtxTx era )
803+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
792804 -- ^ Return collateral
793805 -> Maybe Lovelace
794806 -- ^ Total collateral
795- -> [TxOut CtxTx era ]
807+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
796808 -- ^ Normal outputs
797809 -> Maybe SlotNo
798810 -- ^ Tx lower bound
799811 -> TxValidityUpperBound era
800812 -- ^ Tx upper bound
801- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
813+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
802814 -- ^ Multi-Asset value(s)
803815 -> [(Exp. Certificate (Exp. LedgerEra era ), Exp. AnyWitness (Exp. LedgerEra era ))]
804816 -- ^ Certificate with potential script witness
@@ -851,17 +863,18 @@ constructTxBodyContent
851863 -- TODO The last argument of validateTxInsReference is a datum set from reference inputs
852864 -- Should we allow providing of datum from CLI?
853865 -- TODO: Figure how to expose resolved datums
866+
867+ txRetCollateral :: Maybe (Exp. TxReturnCollateral (Exp. LedgerEra era )) <- case mReturnCollateral of
868+ Just rc -> do
869+ let Exp. TxOut o = rc
870+ Right $ Just $ Exp. TxReturnCollateral (o :: (L. TxOut (Exp. LedgerEra era )))
871+ Nothing -> Right Nothing
872+
854873 let refInputs = Exp. TxInsReference allReferenceInputs Set. empty
855- expTxouts = map Exp. fromLegacyTxOut txouts
856874 auxScripts = case txAuxScripts of
857875 TxAuxScriptsNone -> []
858876 -- TODO: Auxiliary scripts cannot be plutus scripts
859877 TxAuxScripts _ scripts -> mapMaybe scriptInEraToSimpleScript scripts
860- txRetCollateral = case mReturnCollateral of
861- Just rc ->
862- let Exp. TxOut o _ = Exp. fromLegacyTxOut rc
863- in Just $ Exp. TxReturnCollateral (o :: (L. TxOut (Exp. LedgerEra era )))
864- Nothing -> Nothing
865878 txTotCollateral = Exp. TxTotalCollateral <$> (mTotCollateral :: Maybe L. Coin )
866879 expTxMetadata = case txMetadata of
867880 TxMetadataNone -> TxMetadata mempty
@@ -883,7 +896,7 @@ constructTxBodyContent
883896 & Exp. setTxIns inputsAndMaybeScriptWits
884897 & Exp. setTxInsCollateral txinsc
885898 & Exp. setTxInsReference refInputs
886- & Exp. setTxOuts expTxouts
899+ & Exp. setTxOuts txouts
887900 & maybe id Exp. setTxReturnCollateral txRetCollateral
888901 & maybe id Exp. setTxTotalCollateral txTotCollateral
889902 & Exp. setTxFee fee
@@ -941,16 +954,15 @@ runTxBuild
941954 -- ^ TxIn with potential script witness
942955 -> [TxIn ]
943956 -- ^ TxIn for collateral
944- -> Maybe (TxOut CtxTx era )
957+ -> Maybe (Exp. TxOut ( Exp. LedgerEra era ) )
945958 -- ^ Return collateral
946959 -> Maybe Lovelace
947960 -- ^ Total collateral
948- -> [TxOut CtxTx era ]
961+ -> [Exp. TxOut ( Exp. LedgerEra era ) ]
949962 -- ^ Normal outputs
950963 -> TxOutChangeAddress
951964 -- ^ A change output
952- -> (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))]) -- TODO: Double check why this is a list
953-
965+ -> (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
954966 -- ^ Multi-Asset value(s)
955967 -> Maybe SlotNo
956968 -- ^ Tx lower bound
@@ -969,7 +981,7 @@ runTxBuild
969981 -> [(Proposal era , Exp. AnyWitness (Exp. LedgerEra era ))]
970982 -> Maybe (TxCurrentTreasuryValue , TxTreasuryDonation )
971983 -- ^ The current treasury value and the donation.
972- -> ExceptT TxCmdError IO (Exp. UnsignedTx era , Exp. TxBodyContent (Exp. LedgerEra era ))
984+ -> ExceptT TxCmdError IO (Exp. UnsignedTx ( Exp. LedgerEra era ) , Exp. TxBodyContent (Exp. LedgerEra era ))
973985runTxBuild
974986 socketPath
975987 networkId
@@ -1110,7 +1122,7 @@ runTxBuild
11101122
11111123getAllReferenceInputs
11121124 :: [Exp. AnyWitness (Exp. LedgerEra era )]
1113- -> [Exp. AnyWitness (Exp. LedgerEra era )]
1125+ -> [Exp. AnyScriptWitness (Exp. LedgerEra era )]
11141126 -> [Exp. AnyWitness (Exp. LedgerEra era )]
11151127 -- \^ Certificate witnesses
11161128 -> [Exp. AnyWitness (Exp. LedgerEra era )]
@@ -1128,7 +1140,7 @@ getAllReferenceInputs
11281140 propProceduresAnMaybeScriptWits
11291141 readOnlyRefIns = do
11301142 let txinsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput spendingWitnesses
1131- mintingRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput mintWitnesses
1143+ mintingRefInputs = mapMaybe Exp. getAnyScriptWitnessReferenceInput mintWitnesses
11321144 certsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput certScriptWitnesses
11331145 withdrawalsWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput withdrawals
11341146 votesWitByRefInputs = mapMaybe Exp. getAnyWitnessReferenceInput votingProceduresAndMaybeScriptWits
@@ -1147,19 +1159,20 @@ getAllReferenceInputs
11471159toTxOutInShelleyBasedEra
11481160 :: Exp. IsEra era
11491161 => TxOutShelleyBasedEra
1150- -> CIO e (TxOut CtxTx era )
1162+ -> CIO e (Exp. TxOut ( Exp. LedgerEra era ) )
11511163toTxOutInShelleyBasedEra (TxOutShelleyBasedEra addr' val' mDatumHash refScriptFp) = do
11521164 let sbe = convert Exp. useEra
11531165 addr = shelleyAddressInEra sbe addr'
1154- mkTxOut sbe addr val' mDatumHash refScriptFp
1166+ o <- mkTxOut sbe addr val' mDatumHash refScriptFp
1167+ fromEitherCli $ Exp. fromLegacyTxOut o
11551168
11561169-- TODO: Currently we specify the policyId with the '--mint' option on the cli
11571170-- and we added a separate '--policy-id' parser that parses the policy id for the
11581171-- given reference input (since we don't have the script in this case). To avoid asking
11591172-- for the policy id twice (in the build command) we can potentially query the UTxO and
11601173-- access the script (and therefore the policy id).
11611174createTxMintValue
1162- :: (L. MultiAsset , [(PolicyId , Exp. AnyWitness (Exp. LedgerEra era ))])
1175+ :: (L. MultiAsset , [(PolicyId , Exp. AnyScriptWitness (Exp. LedgerEra era ))])
11631176 -> Either TxCmdError (Exp. TxMintValue (Exp. LedgerEra era ))
11641177createTxMintValue (val, scriptWitnesses) =
11651178 if mempty == val && List. null scriptWitnesses
@@ -1181,7 +1194,7 @@ createTxMintValue (val, scriptWitnesses) =
11811194 pure $
11821195 Exp. TxMintValue $
11831196 Map. intersectionWith
1184- (\ assets wit -> (assets, wit) )
1197+ (, )
11851198 policiesWithAssets
11861199 witnessesProvidedMap
11871200 where
@@ -1422,16 +1435,16 @@ runTransactionCalculateMinValueCmd
14221435 -> CIO e ()
14231436runTransactionCalculateMinValueCmd
14241437 Cmd. TransactionCalculateMinValueCmdArgs
1425- { era
1438+ { era = era :: Exp. Era era
14261439 , protocolParamsFile
14271440 , txOut
14281441 } = do
1429- pp <-
1442+ pp :: L. PParams ( Exp. LedgerEra era ) <-
14301443 fromExceptTCli @ ProtocolParamsError
14311444 (obtainCommonConstraints era $ readProtocolParameters protocolParamsFile)
14321445 out <- obtainCommonConstraints era $ toTxOutInShelleyBasedEra txOut
14331446
1434- let minValue = calculateMinimumUTxO (convert era) pp out
1447+ let minValue = Exp. calculateMinimumUTxO pp out
14351448 liftIO . IO. print $ minValue
14361449
14371450runTransactionCalculatePlutusScriptCostCmd
0 commit comments