@@ -86,6 +86,8 @@ import Data.Text (Text)
86
86
import Data.Text qualified as Text
87
87
import Ledger qualified
88
88
import Ledger.Ada qualified as Ada
89
+ import Ledger.Tx (TxOut (TxOut ))
90
+ import Ledger.Tx.CardanoAPI (toCardanoAddressInEra , toCardanoValue )
89
91
import Ledger.Tx.CardanoAPI qualified as TxApi
90
92
import Ledger.Validation (Coin (Coin ))
91
93
import Plutus.Contract.Effects (ChainIndexQuery , ChainIndexResponse )
@@ -294,7 +296,7 @@ calcMinUtxo pabconf txout = do
294
296
295
297
ctxout <-
296
298
mapLeft (Text. pack . show ) $
297
- TxApi. toCardanoTxOut netId TxApi. toCardanoTxOutDatumHash txout
299
+ toCardanoTxOutForked netId TxApi. toCardanoTxOutDatumHash txout
298
300
299
301
let (Coin minTxOut) =
300
302
evaluateMinLovelaceOutput pparamsInEra $
@@ -305,6 +307,17 @@ calcMinUtxo pabconf txout = do
305
307
if missingLovelace > 0
306
308
then calcMinUtxo pabconf (txout {Ledger. txOutValue = Ledger. txOutValue txout <> Ada. toValue missingLovelace})
307
309
else return txout
310
+ where
311
+ -- We need to redefine this to remove error reporting with 0 ada outputs.
312
+ toCardanoTxOutValue value = do
313
+ -- when (Ada.fromValue value == mempty) (Left OutputHasZeroAda)
314
+ CApi. TxOutValue CApi. MultiAssetInBabbageEra <$> toCardanoValue value
315
+
316
+ toCardanoTxOutForked networkId fromHash (TxOut addr value datumHash) =
317
+ CApi. TxOut <$> toCardanoAddressInEra networkId addr
318
+ <*> toCardanoTxOutValue value
319
+ <*> fromHash datumHash
320
+ <*> pure CApi.S. ReferenceScriptNone
308
321
309
322
-- Couldn't use the template haskell makeEffect here, because it caused an OverlappingInstances problem.
310
323
-- For some reason, we need to manually propagate the @w@ type variable to @send@
0 commit comments