From 3568b89b118e3db0b3f6060ed15ee27fe5760b3b Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Wed, 28 Aug 2024 12:28:03 -0400 Subject: [PATCH] Include datums and redeemers in makeUnsignedTx --- cardano-api/internal/Cardano/Api/Experimental/Tx.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cardano-api/internal/Cardano/Api/Experimental/Tx.hs b/cardano-api/internal/Cardano/Api/Experimental/Tx.hs index 865b647f55..6cecdffcd3 100644 --- a/cardano-api/internal/Cardano/Api/Experimental/Tx.hs +++ b/cardano-api/internal/Cardano/Api/Experimental/Tx.hs @@ -89,7 +89,9 @@ makeUnsignedTx era bc = obtainCommonConstraints era $ do scripts = convScripts apiScriptWitnesses languages = convLanguages apiScriptWitnesses sData = convScriptData sbe apiTxOuts apiScriptWitnesses - + (datums, redeemers) = case sData of + TxBodyScriptData _ ds rs -> (ds, rs) + TxBodyNoScriptData -> (mempty, L.Redeemers mempty) let setMint = convMintValue apiMintValue setReqSignerHashes = convExtraKeyWitnesses apiExtraKeyWitnesses ledgerTxBody = @@ -117,6 +119,9 @@ makeUnsignedTx era bc = obtainCommonConstraints era $ do [ (L.hashScript sw, sw) | sw <- scripts ] + & L.datsTxWitsL .~ datums + & L.rdmrsTxWitsL .~ redeemers + eraSpecificTxBody <- eraSpecificLedgerTxBody era ledgerTxBody bc return . UnsignedTx $