-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cardano-api's TxOut with inline datum #3773
Conversation
ba457eb
to
9175e04
Compare
let ScriptDataHash alonzoDataHash = hashScriptData sd | ||
in SJust alonzoDataHash | ||
toAlonzoTxOutDataHash (TxOutDatumInline inlineDatumSupp _sd) = | ||
case inlineDatumSupp :: InlineDatumSupportedInEra AlonzoEra of {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, so basically in the AlonzoEra we can have datum hashes or nothing. Whereas in Babbage era we can have inline datums, datum hashes or nothing. Because there is no open type family for datums, I need to define two separate functions that return the correct type based on the era. I've asked the ledger team to define an open type family for datums and they will probably do this after the hardfork. When they do this, we will be able to have a single function that instantiates the correct type based on the ShelleyBasedEra era
we feed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case inlineDatumSupp :: InlineDatumSupportedInEra AlonzoEra of {}
tells the compiler it's not possible to pattern match TxOutDatumInline
because only InlineDatumSupportedInEra BabbageEra
exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Thanks!
intention of that constructor. That is, TxOutDatumInTx' also adds the datum to the tx's datum map Add additional comments to the TxOutDatumInline constructor
9175e04
to
877c794
Compare
bors merge |
Build succeeded: |
Updates the TxOut data type with the ability to specify an inline datum and propagate the changes throughout the api and cli.