When converting my UnbalancedTx
to an ExportTx
using the export
function, I get this error:
Left (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))
What is very strange is that when I submit the unbalanced transaction with submitUnbalancedTx
in the emulator it works and the transaction gets executed. So it should be fine. I feel like this is a bug but I could also be missing something. Before digging deeper, I wanted to post this issue to see if someone can help me. Does anybody see what could be the reason for this issue ?
The error comes probably from function toCardanoMintValue
on line 531 here: https://github.com/input-output-hk/plutus-apps/blob/main/plutus-ledger/src/Ledger/Tx/CardanoAPI.hs
The contract that I have looks like this:
buyTokensTx :: forall w s. TokenPool -> BuyTokensParams -> Contract w s Text (Either ToCardanoError ExportTx)
buyTokensTx pool param = do
m <- findTokenPool pool
case m of
Nothing -> do
logInfo @String $ "no token pool found with nft: " <> show (nft pool)
return (Left $ TxBodyError "Error: cannot find token pool")
Just (oref, o, state) -> do
logInfo @String $ "found token pool with nft: " <> show (nft pool)
let lookups = ...
let txc = ...
case Constraints.mkTx @TokenPool lookups txc of
Right ut -> do
let unbalTx = Constraints.adjustUnbalancedTx ut
return (export def myNetworkId unbalTx)
Left err -> return (Left $ TxBodyError $ "UnbalancedTx error:" <> show err)
Left (Tag \"toCardanoPolicyId\" (Tag \"1 bytes\" DeserialisationError))
Thank you so much for the solution ;)