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

Get events by contract group backend #27

Open
whittlbc opened this issue Jul 11, 2023 · 0 comments
Open

Get events by contract group backend #27

whittlbc opened this issue Jul 11, 2023 · 0 comments
Assignees

Comments

@whittlbc
Copy link
Member

whittlbc commented Jul 11, 2023

Overview

We need a backend route that gets all events for a particular contract group, across all chains that contract group is associated with.

Route

GET /contract/group/events

Input Payload Example

{ 
    "group": "allo.ProjectRegistry"
}

Payload Validation

  • group should exist and pass isValidContractGroup

Success Response

[
    {
        "name": "OwnerAdded",
        "version": "0xab7a51f59a55e3b65bbabf99457f8955ff12366d20e368988c35d2eab9bd8df9",
        "chainIds": ["1", "5"]
    },
    ...
]

Empty Response

If there are no events found for the given group, or the group doesn't exist, just return an empty array with a 200.

Strategy

We should be able to do this in a single DB query to EventVersion without any joins, since we are already denormalizing the namespace associated with an event version. See EventVersion.nsp for more, but you should be able to do a simple, where-in query on the nsp column for all possible chain namespaces for the given contract group. The nsp column of the matching results can then be used to deduce the chain id for each event version, and the results can then uniquely be grouped by name+version.

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

No branches or pull requests

2 participants