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

[feature request] latest known blockHeight #111

Open
Hebilicious opened this issue Dec 15, 2024 · 1 comment · May be fixed by #113
Open

[feature request] latest known blockHeight #111

Hebilicious opened this issue Dec 15, 2024 · 1 comment · May be fixed by #113

Comments

@Hebilicious
Copy link

Hebilicious commented Dec 15, 2024

Issue

When running the events or actions query, there is no way to know what is the latest blockHeight currently in the database when the results set is empty.

This information is present within the SQL queries (height = (SELECT max(height) FROM blocks)) but it's not directly exposed by the graphql server (only distanceFromMaxBlockHeight is)

It could be helpful to know what is the maxBlockHeight when the query return an empty set of results.

Proposed solution :

One way would be to return a parent type from the events and actions query.

union Output = EventOutput | ActionOutput
type QueryResult {
	currentBlockInfo: BlockInfo
	output: [Output]!
}
type Query {
  events(input: EventFilterOptionsInput!): [QueryResult]!
  actions(input: ActionFilterOptionsInput!): [QueryResult]!
}

Since that would be a breaking change, it might be easier to add a separated query :

type Query {
  events(input: EventFilterOptionsInput!): [EventOutput]!
  actions(input: ActionFilterOptionsInput!): [ActionOutput]!
  currentBlockInfo: BlockInfo!
}
@45930
Copy link
Contributor

45930 commented Dec 17, 2024

We probably won't get around to this this week, then we are taking a week off. I think this is a good idea though. I will take a look in the new year!

@boray boray linked a pull request Jan 9, 2025 that will close this issue
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 a pull request may close this issue.

2 participants