feat: add pagination and new filters to query orders#313
Merged
pablocampogo merged 2 commits intomainfrom Feb 19, 2026
Merged
Conversation
rem1niscence
requested changes
Feb 19, 2026
| } | ||
|
|
||
| // ordersParams is a helper function to abstract common workflows around a callback requiring a state machine and orders request | ||
| func (s *Server) ordersParams(w http.ResponseWriter, r *http.Request, callback func(s *fsm.StateMachine, request *ordersRequest) (any, lib.ErrorI)) { |
Collaborator
There was a problem hiding this comment.
this function is the exact same one as the one above orderParams but with a different struct, there are multiple implementations like this on this file (likely AI generated) but is unmaintainable long term as it is requiring a different function for every different struct, this is a perfect example to use generics or use any/type-casting to minimize this issue, no further actions based on this, just documenting for future refactors
rem1niscence
approved these changes
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the
/v1/query/ordersRPC endpoint with filtering capabilities and pagination support for efficiently querying sell orders at scale.Changes
New Features
committeefilter parameter to query orders for a specific committeesellersSendAddressfilter parameter with a secondary index for efficient O(log n) lookupspageNumber,perPage) with standard Page response formatStorage Layer (
fsm/)orderBySellerPrefixkey prefix for the seller address secondary indexOrderBySellerPrefix,OrderBySellerAndChainPrefix, andKeyForOrderBySellerkey functionsSetOrder()to write to both primary store and secondary indexDeleteOrder()to clean up both primary and secondary index entriesGetOrdersPaginated()with helper methods for all filter combinationsGetOrdersBySeller()for non-paginated seller address queriesRPC Layer (
cmd/rpc/)SellOrderstype implementingPageableinterface for pagination supportordersRequestto includecommittee,sellersSendAddress, andPageParamsOrdershandler to use paginated queries with filter supportordersParamshelper functionDocumentation
Filter Combinations
committeeonlysellersSendAddressonly