Open lutter opened 2 years ago
does BlockConstraint::Latest
solves it?
does
BlockConstraint::Latest
solves it?
Yes, internally that would be represented as BlockConstraint::Latest
- what this ticket talks about is that it's not possible to express that in the GraphQL. The only way to query the latest block is to not have a block constraint at all. But sometimes it would be good to always have block: { number: $block }
in the query and just set $block
to some special value when you want the latest block rather than a specific block.
Queries can contain a block constraint like
block: { number: 79 }
to execute the query at block 79. It is not possible to express 'give me data for the latest block' with that constraint which forces apps that want to sometime query at a certain block, and sometimes at the latest block, to change the text of their GraphQL query.We should make it possible to always include
block: { number: $block }
in a query, and have a special value that means 'latest block'. Using-1
as that special value would probably be best since some languages support negative array indexes to count from the back, wherearray[-1]
means 'give me the last array entry'.