Skip to content

Get events by contract group backend #27

@whittlbc

Description

@whittlbc

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions