Skip to content
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

Merged
merged 3 commits into from
Apr 7, 2022

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Apr 6, 2022

Updates the TxOut data type with the ability to specify an inline datum and propagate the changes throughout the api and cli.

@Jimbo4350 Jimbo4350 force-pushed the jordan/update-api-txout-with-inlinedatum branch from ba457eb to 9175e04 Compare April 6, 2022 16:41
@Jimbo4350 Jimbo4350 mentioned this pull request Apr 6, 2022
38 tasks
let ScriptDataHash alonzoDataHash = hashScriptData sd
in SJust alonzoDataHash
toAlonzoTxOutDataHash (TxOutDatumInline inlineDatumSupp _sd) =
case inlineDatumSupp :: InlineDatumSupportedInEra AlonzoEra of {}
Copy link
Contributor

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?

Copy link
Contributor Author

@Jimbo4350 Jimbo4350 Apr 7, 2022

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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
@Jimbo4350 Jimbo4350 force-pushed the jordan/update-api-txout-with-inlinedatum branch from 9175e04 to 877c794 Compare April 7, 2022 21:37
@newhoggy
Copy link
Contributor

newhoggy commented Apr 7, 2022

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 7, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit 08d6031 into master Apr 7, 2022
@iohk-bors iohk-bors bot deleted the jordan/update-api-txout-with-inlinedatum branch April 7, 2022 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants