Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! Add getTransactionBodyContent
Browse files Browse the repository at this point in the history
  • Loading branch information
cblp committed May 5, 2021
1 parent 4e724d4 commit 2f46d62
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions cardano-api/src/Cardano/Api/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ getAllegraTxBodyContent
case auxData of
Nothing -> TxAuxScriptsNone
Just s ->
let (_, ss) = fromAllegraAuxiliaryData s
let (_, ss) = fromAllegraBasedAuxiliaryData ShelleyBasedEraAllegra s
in case ss of
[] -> TxAuxScriptsNone
_ -> TxAuxScripts AuxScriptsInAllegraEra ss
Expand Down Expand Up @@ -1559,7 +1559,7 @@ getMaryTxBodyContent
case auxData of
Nothing -> TxAuxScriptsNone
Just s ->
let (_, ss) = fromMaryAuxiliaryData s
let (_, ss) = fromAllegraBasedAuxiliaryData ShelleyBasedEraMary s
in case ss of
[] -> TxAuxScriptsNone
_ -> TxAuxScripts AuxScriptsInMaryEra ss
Expand Down Expand Up @@ -1626,22 +1626,19 @@ toAllegraAuxiliaryData m ss =
(toShelleyMetadata m)
(Seq.fromList (map toShelleyScript ss))


fromAllegraAuxiliaryData
:: Ledger.AuxiliaryData (ShelleyLedgerEra AllegraEra)
-> (Map Word64 TxMetadataValue, [ScriptInEra AllegraEra])
fromAllegraAuxiliaryData (Allegra.AuxiliaryData ms ss) =
( fromShelleyMetadata ms
, fromShelleyBasedScript ShelleyBasedEraAllegra <$> toList ss
)


fromMaryAuxiliaryData :: Ledger.AuxiliaryData (ShelleyLedgerEra MaryEra)
-> (Map Word64 TxMetadataValue, [ScriptInEra MaryEra])
fromMaryAuxiliaryData (Mary.AuxiliaryData ms ss) =
( fromShelleyMetadata ms
, fromShelleyBasedScript ShelleyBasedEraMary <$> toList ss
)
fromAllegraBasedAuxiliaryData
:: forall era ledgerera
. ( ShelleyLedgerEra era ~ ledgerera
, Ledger.AuxiliaryData ledgerera ~ Allegra.AuxiliaryData ledgerera
, FromCBOR (CBOR.Annotator (Ledger.Script ledgerera))
, ToCBOR (Ledger.Script ledgerera)
, Ord (Ledger.Script ledgerera)
)
=> ShelleyBasedEra era
-> Ledger.AuxiliaryData (ShelleyLedgerEra era)
-> (Map Word64 TxMetadataValue, [ScriptInEra era])
fromAllegraBasedAuxiliaryData era (Allegra.AuxiliaryData ms ss) =
(fromShelleyMetadata ms, fromShelleyBasedScript era <$> toList ss)


-- ----------------------------------------------------------------------------
Expand Down

0 comments on commit 2f46d62

Please sign in to comment.