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

proto: add extension trait for easier parsing of domain types #4886

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

cronokirby
Copy link
Contributor

Describe your changes

This allows creating domain types for each of the events, e.g. EventBatchSwap, and then doing EventBatchSwap::try_from_event(&event), which makes the pindexer app views much more ergonomic, especially because we can avoid having to duplicate event parsing logic across views.

In subsequent PRs, we should create domain types for each component.

We can probably do this as needed, when we write app views touching particular components.

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    Just an internal refactor to events code, so doubly non breaking.

@cronokirby cronokirby marked this pull request as ready for review October 7, 2024 10:04
@cronokirby
Copy link
Contributor Author

I also tested that, given this trait, you can write AppViews that make use of this parsing mechanism.

Copy link
Contributor

@aubrika aubrika left a comment

Choose a reason for hiding this comment

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

LGTM

@aubrika aubrika merged commit 7694c38 into main Oct 7, 2024
13 checks passed
@aubrika aubrika deleted the rich-event-types branch October 7, 2024 21:00
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