@@ -86,6 +86,8 @@ import Data.Text (Text)
8686import Data.Text qualified as Text
8787import Ledger qualified
8888import Ledger.Ada qualified as Ada
89+ import Ledger.Tx (TxOut (TxOut ))
90+ import Ledger.Tx.CardanoAPI (toCardanoAddressInEra , toCardanoValue )
8991import Ledger.Tx.CardanoAPI qualified as TxApi
9092import Ledger.Validation (Coin (Coin ))
9193import Plutus.Contract.Effects (ChainIndexQuery , ChainIndexResponse )
@@ -294,7 +296,7 @@ calcMinUtxo pabconf txout = do
294296
295297 ctxout <-
296298 mapLeft (Text. pack . show ) $
297- TxApi. toCardanoTxOut netId TxApi. toCardanoTxOutDatumHash txout
299+ toCardanoTxOutForked netId TxApi. toCardanoTxOutDatumHash txout
298300
299301 let (Coin minTxOut) =
300302 evaluateMinLovelaceOutput pparamsInEra $
@@ -305,6 +307,17 @@ calcMinUtxo pabconf txout = do
305307 if missingLovelace > 0
306308 then calcMinUtxo pabconf (txout {Ledger. txOutValue = Ledger. txOutValue txout <> Ada. toValue missingLovelace})
307309 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
308321
309322-- Couldn't use the template haskell makeEffect here, because it caused an OverlappingInstances problem.
310323-- For some reason, we need to manually propagate the @w@ type variable to @send@
0 commit comments