diff --git a/cardano-simple/cardano-simple.cabal b/cardano-simple/cardano-simple.cabal index 123ab16..ea8b977 100644 --- a/cardano-simple/cardano-simple.cabal +++ b/cardano-simple/cardano-simple.cabal @@ -45,6 +45,7 @@ common lang LambdaCase MultiParamTypeClasses NumericUnderscores + OverloadedRecordDot OverloadedStrings RecordWildCards ScopedTypeVariables diff --git a/cardano-simple/src/Cardano/Simple/Cardano/Babbage.hs b/cardano-simple/src/Cardano/Simple/Cardano/Babbage.hs index 8124ae8..ec89e6b 100644 --- a/cardano-simple/src/Cardano/Simple/Cardano/Babbage.hs +++ b/cardano-simple/src/Cardano/Simple/Cardano/Babbage.hs @@ -57,23 +57,23 @@ type Era = BabbageEra StandardCrypto instance IsCardanoTx Era where getTxBody = C.body - toCardanoTx n p e tx = toBabbageTx (Plutus.txScripts tx) n p e tx + toCardanoTx = toBabbageTx toTxOut = toBabbageTxOut toBabbageTx :: - Map P.ScriptHash (C.Versioned P.Script) -> Network -> C.BabbagePParams Era -> P.Extra -> Plutus.Tx -> Either ToCardanoError (C.AlonzoTx Era) -toBabbageTx scriptMap network params extra tx = do +toBabbageTx network params extra tx = do body <- getBody wits <- toWits (hashAnnotated body) extra tx let isValid = C.IsValid True -- TODO or maybe False auxData = C.SNothing pure $ C.AlonzoTx body wits isValid auxData where + scriptMap = Plutus.txScripts tx getBody = do spendInputs <- getInputsBy Plutus.txInputs tx collateralInputs <- getInputsBy Plutus.txCollateral tx diff --git a/psm/src/Plutus/Model/Mock.hs b/psm/src/Plutus/Model/Mock.hs index 2218a59..85a966e 100644 --- a/psm/src/Plutus/Model/Mock.hs +++ b/psm/src/Plutus/Model/Mock.hs @@ -587,16 +587,12 @@ checkSingleTx params extra tx = do checkBalance = do utxos <- gets mockUtxos network <- gets $ mockConfigNetworkId . mockConfig - balance <- case txBalance @era utxos params network tx extra of + case txBalance @era utxos params network tx extra of Left err -> throwError $ FailToCardano err - case txBalance @era utxos params network tx extra of - Left err -> throwError $ FailToCardano err - Right bal -> when + Right bal -> + when (bal /= mempty) (throwError $ NotBalancedTx $ fromCardanoValue bal) - when - (balance /= mempty) - (throwError $ NotBalancedTx $ fromCardanoValue balance) evalScripts :: Validate Alonzo.ExUnits evalScripts = do