Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

#1078 Use correct envelope type when decoding it #1081

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented May 30, 2023

This fixes #1078 by using different TextEnvelopeType when deserializing text envelope.

Repro in cardan-api : IntersectMBO/cardano-api#29

cc: @newhoggy @Jimbo4350

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Formatting, PNG optimization, etc. are updated
    • Important changes are reflected in changelog.d of the affected packages
  • PR
    • Self-reviewed the diff
    • Useful pull request description
    • Reference the ADR in the PR and reference the PR in the ADR (if revelant)
    • Reviewer requested

[ FromCDDLTx "Witnessed Tx AlonzoEra" CddlTx
, FromCDDLTx "Unwitnessed Tx AlonzoEra" CddlTx
, FromCDDLTx "Witnessed Tx BabbageEra" CddlTx
, FromCDDLTx "Unwitnessed Tx BabbageEra" CddlTx
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What other types can we expect here?

@@ -188,6 +188,9 @@ seqToList :: Seq.StrictSeq a -> [a]
seqToList (x Seq.:<| rest) = x : seqToList rest
seqToList Seq.Empty = []

newtype CddlTx = CddlTx { unCddlTx :: InAnyCardanoEra Tx }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why duplicate this type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has a single use case across our repos - to use it as a wrapper in FromCDDLTx. It's not exported from here so it's not usable outside of this module. It seemed easier to just copy it rather than add it to cardano-api and expose it from there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jimbo4350 Is it fine for you? If yes, I'll be happy to merge it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The create-script-context tool fails with TextEnvelopeTypeError
4 participants