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

index-node endpoint to get a hash from a block number #3942

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

neysofu
Copy link
Member

@neysofu neysofu commented Sep 15, 2022

This new endpoint fills a need that several services (namely EBO and indexer agent) that rely on graph-node have, i.e. to fetch a block hash starting from the number. The underlying implementation bridges over to the configured data ingestor for the requested network, allowing these services to get this data directly from graph-node.

I've used some declarative macro idiosyncracy to quickly abstract over BlockchainMap items with different concrete types.

# Query example
{
  blockHashFromNumber(network: "mainnet", blockNumber: 15239780)
}

We're marking the GraphQL resolver for scalar values as async, like
some other resolvers are already. This is needed to .await some calls in
the new `index-node` endpoint.
@neysofu
Copy link
Member Author

neysofu commented Sep 15, 2022

Closes #3911.

Copy link
Contributor

@evaporei evaporei left a comment

Choose a reason for hiding this comment

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

LGTM

Smart idea to put a match on the Blockchain enum 👏

@neysofu neysofu merged commit 1435fce into master Sep 16, 2022
@neysofu neysofu deleted the filippo/hash-endpoint branch September 16, 2022 12:39
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