Skip to main content

Limit Property

caution

Every level of the query requires a limit value. If you don't define a limit, your query won’t work.
A limit is required, even if it’s obvious the output will only be one element!

The API is working with a limit property because we want the API to be as fast and efficient as possible:

  • Performance optimization:
    Limiting the amount of data returned results in an improved performance, especially when dealing with large datasets. By limiting the data returned, we're reducing the amount of data that needs to be transmitted, making it faster and more efficient.

  • User-controlled data:
    The limit field allows you to control the amount of data you receive, making it easier to work with and avoiding overwhelming you with too much information.

  • Bandwidth optimization:
    In mobile and low-bandwidth environments, limiting the amount of data returned can reduce the amount of data that needs to be transmitted over the network, improving the performance of the API and reducing the impact on the user's data usage.

  • Pagination and offset:
    By combining the limit field with the offset property, you can implement pagination in your request, breaking down large datasets into smaller, manageable chunks and retrieving specific subsets of data as needed.

Sample Query

If you want to query the historical reward rate of Ethereum pos type before "2023-01-01" and limit it to 5 results, you can use this query.

{
rewardOptions(where: {inputAsset: {symbols: ["ETH"]}, typeKeys: ["pos"]}, limit: 1) {
metrics(where: { metricKeys: ["reward_rate"], createdAt_lt:"2023-01-01"}, limit: 5) {
metricKey
defaultValue
changePercentages
createdAt
}
}
}

Your imagination is the limit

You can also modify the filter to get the top 5 validator by staked amount by adding more filters.
Refer to the Filter Query Results section.