Skip to content

Commit

Permalink
Adapt to tx supplemental data changes
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Nov 14, 2024
1 parent a85bc65 commit cb2f488
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ toTxAlonzoDatum supp cliDatum =
pure (TxOutDatumHash supp $ hashScriptDataBytes sData)
TxOutDatumByValue sDataOrFile -> do
sData <- firstExceptT TxCmdScriptDataError $ readScriptDataOrFile sDataOrFile
pure (TxOutDatumInTx supp sData)
pure (TxOutSupplementalDatum supp sData)
TxOutInlineDatumByValue sDataOrFile -> do
let cEra = toCardanoEra supp
forEraInEon cEra (txFeatureMismatch cEra TxFeatureInlineDatums) $ \babbageOnwards -> do
Expand Down
17 changes: 1 addition & 16 deletions cardano-cli/src/Cardano/CLI/Json/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ friendlyTxBodyImpl
txValidityUpperBound
txMetadata
txAuxScripts
txSupplementalData
txExtraKeyWits
_txProtocolParams
txWithdrawals
Expand Down Expand Up @@ -252,10 +251,6 @@ friendlyTxBodyImpl
era
(`getRedeemerDetails` tb)
)
++ ( monoidForEraInEon @AlonzoEraOnwards
era
(`friendlySupplementalDatums` txSupplementalData)
)
++ ( monoidForEraInEon @ConwayEraOnwards
era
( \cOnwards ->
Expand Down Expand Up @@ -293,16 +288,6 @@ friendlyTxBodyImpl
friendlyLedgerProposals cOnwards proposalProcedures =
Array $ fromList $ map (friendlyLedgerProposal cOnwards) proposalProcedures

-- | API doesn't yet show that supplemental datums are alonzo onwards. So we do it in this function prototype,
-- even if we don't use the witness.
friendlySupplementalDatums
:: AlonzoEraOnwards era -> BuildTxWith build (TxSupplementalDatums era) -> [Aeson.Pair]
friendlySupplementalDatums _era = \case
ViewTx -> []
BuildTxWith TxSupplementalDataNone -> []
BuildTxWith (TxSupplementalDatums hashableScriptDatas) ->
["supplemental datums" .= toJSON hashableScriptDatas]

friendlyLedgerProposal
:: ConwayEraOnwards era -> L.ProposalProcedure (ShelleyLedgerEra era) -> Aeson.Value
friendlyLedgerProposal cOnwards proposalProcedure = object $ friendlyProposalImpl cOnwards (Proposal proposalProcedure)
Expand Down Expand Up @@ -483,7 +468,7 @@ friendlyTxOut era (TxOut addr amount mdatum script) =
renderDatum = \case
TxOutDatumNone -> Nothing
TxOutDatumHash _ h -> Just $ toJSON h
TxOutDatumInTx _ sData -> Just $ scriptDataToJson ScriptDataJsonDetailedSchema sData
TxOutSupplementalDatum _ sData -> Just $ scriptDataToJson ScriptDataJsonDetailedSchema sData
TxOutDatumInline _ sData -> Just $ scriptDataToJson ScriptDataJsonDetailedSchema sData

friendlyStakeReference :: StakeAddressReference -> Aeson.Value
Expand Down

0 comments on commit cb2f488

Please sign in to comment.