@@ -21,7 +21,7 @@ import BotPlutusInterface.Effects (
2121import BotPlutusInterface.Files (DummyPrivKey (FromSKey , FromVKey ))
2222import BotPlutusInterface.Files qualified as Files
2323import BotPlutusInterface.Types (ContractEnvironment (.. ), LogLevel (Debug , Warn ), Tip (block , slot ))
24- import Cardano.Api (AsType (.. ), EraInMode (.. ))
24+ import Cardano.Api (AsType (.. ), EraInMode (.. ), Tx ( Tx ) )
2525import Control.Lens (preview , (^.) )
2626import Control.Monad (join , void , when )
2727import Control.Monad.Freer (Eff , Member , interpret , reinterpret , runM , subsume , type (~> ))
@@ -250,6 +250,12 @@ writeBalancedTx contractEnv (Right tx) = do
250250
251251 void $ newEitherT $ CardanoCLI. buildTx @ w pabConf privKeys tx
252252
253+ -- TODO: This whole part is hacky and we should remove it.
254+ let path = Text. unpack $ Files. txFilePath pabConf " raw" (Tx. txId tx)
255+ -- We read back the tx from file as tx currently has the wrong id (but the one we create with cardano-cli is correct)
256+ alonzoBody <- firstEitherT (Text. pack . show ) $ newEitherT $ readFileTextEnvelope @ w (AsTxBody AsAlonzoEra ) path
257+ let cardanoTx = Tx. SomeTx (Tx alonzoBody [] ) AlonzoEraInCardanoMode
258+
253259 if signable
254260 then newEitherT $ CardanoCLI. signTx @ w pabConf tx requiredSigners
255261 else
@@ -259,13 +265,6 @@ writeBalancedTx contractEnv (Right tx) = do
259265 , " Signatories (pkh): " <> Text. unwords (map pkhToText requiredSigners)
260266 ]
261267
262- -- TODO: This whole part is hacky and we should remove it.
263- let ext = if signable then " signed" else " raw"
264- path = Text. unpack $ Files. txFilePath pabConf ext (Tx. txId tx)
265- -- We read back the tx from file as tx currently has the wrong id (but the one we create with cardano-cli is correct)
266- alonxoTx <- firstEitherT (Text. pack . show ) $ newEitherT $ readFileTextEnvelope @ w (AsTx AsAlonzoEra ) path
267- let cardanoTx = Tx. SomeTx alonxoTx AlonzoEraInCardanoMode
268-
269268 when (not pabConf. pcDryRun && signable) $ do
270269 newEitherT $ CardanoCLI. submitTx @ w pabConf tx
271270
0 commit comments