indexer
indexer copied to clipboard
Allow sorting of responses
It would be very helpful if some of the responses could be sorted by arbitrary fields. For example, to have the /transactions endpoint return the latest transactions by the block number, in descending order, so you can get the latest transactions without having to do any pagination.
When filtering by account address results are returned newest to oldest, otherwise, they are returned oldest to newest.
For reference, I implemented this in a prototype while debugging something and we had some discussion: https://github.com/algorand/indexer/pull/283/files#diff-8fbec00be6e6b2f77a294cbe9a3ee8e3fbdcb5eb13be3046e5da8277302264c2L1400
Needs clarification
- Should we support arbitrary fields, start with a specific field, or select some specific fields.
Acceptance Criteria
- Update the ORDER BY part of the SQL query.
- Update the pagination rules so that they take the new order configuration into account.
- Disable this new field by default, because it would require custom indices to be fast.
This should be converted to an epic. In addition to the acceptance criteria above, we would need to add sorting to all the different types of searches:
- transaction
- account
- asset / asset holding
- application / application state / boxes
+1 this feature - in particular I would like to get the oldest transaction for a given account and application. Since I use the account field, the responses are automatically ordered from most recent to oldest and the limit parameter doesn't work as needed.
+1 to this, we've also faced a need to get transactions ordered by desc
+1 to this feature. It would be really helpful if we have sorted by field or at least the latest transactions.
@chaihoang we need to clarify what we should support for this issue.
Hi Team,
Do you have any plans to fix this issue ?
This is a critical requirement for my application (Explorer). https://app.dappflow.org

Attached is the screenshot of the asset overview page. Older transactions pop up first and the user has to navigate back to the last page to look at the recent transactions of the asset.
This is a must-have if we want to build the indexer UI.
@algodesk-io It's not on the roadmap yet, but we are considering it. What are the use cases that would be most beneficial? Is it just sorting by newest transactions?
@algodesk-io It's not on the roadmap yet, but we are considering it. What are the use cases that would be most beneficial? Is it just sorting by newest transactions?
Yes, sorting by newest transactions for an asset, application, account, should solve 50% of the usecase.
remaining includes, Sort by newest assets Sort by newest applications