-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add fetch events to network API #749
Conversation
0f847b6
to
4279ba8
Compare
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.
awesome! Just left a few comments :)
75cfa2b
to
cfce649
Compare
cfce649
to
b7c41df
Compare
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.
Very nice! I have a few comments mostly about type safety
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.
Looks great to me! I have some feedback regarding the event types we expose, but that could be addressed elsewhere if we want to get this out quickly
5e92a26
to
8aec801
Compare
Description
This PR supports fetching events from a GraphQL API that implements the following schema. It aims to keep the API functionality as the existing fetch events API.
The following changes have been made:
Mina.Network
function to take in an object that can specify an endpoint to be used for the archive API.fetchEvents
function that is exposed.fetchEvents
function insidezkapp.ts
to filter by block heights instead of slots.Impact
By adding a way to fetch events for SnarkyJS, zkApps can now reliably fetch its event data from a datastore (like the Archive Node). This unlocks many use cases as Events can notify that the state has changed or even as a basic solution to off-chain storage.
Tested
Manual testing uses an internally deployed archive API and matching deployed zkApp to fetch events.
If you wish to test the newly added functionality, run this build and use this script:
Example Output
When fetching events locally, events will look like:
Fetching using the network API, with the script above looks like: