-
Notifications
You must be signed in to change notification settings - Fork 609
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
Add Pagination to Pool With Filter Query #3563
Conversation
@@ -184,14 +175,14 @@ func (q Querier) PoolsWithFilter(ctx context.Context, req *types.QueryPoolsWithF | |||
checks_needed++ | |||
} | |||
|
|||
for _, p := range pools { | |||
var response = []*codectypes.Any{} | |||
pageRes, err := query.FilteredPaginate(poolStore, req.Pagination, func(_, value []byte, accumulate bool) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using FilteredPaginate
instead of Paginate
method allows us to iterate until pagination count has been reached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can backport the fix for that to clean this up a little if we want.
(Or just copy/paste cosmos/cosmos-sdk#12253 into osmoutils)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also checking generic pagination as well! Sad that we don't have it yet. I say we refactor this to use generic pagination later on when it gets backported and for now leave as is
var pool types.PoolI | ||
|
||
err := q.cdc.UnpackAny(p, &pool) | ||
pool, err := q.Keeper.UnmarshalPool(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this value
as the input to UnmarshalPool come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from the FilteredPagination method, where it iterates over the given kv store!
x/gamm/keeper/grpc_query.go
Outdated
return false, err | ||
} | ||
|
||
if accumulate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required for offset
in pagination
* Add Pagination to filter pool query * Use Filtered Pagination * Add logic for offset in pagination * Return false on response * Bug fix * Refactors for clean code * Remove snake cases * Fix typos * Clean more code (cherry picked from commit 1dedc28) # Conflicts: # proto/osmosis/gamm/v1beta1/query.proto # x/gamm/keeper/grpc_query.go # x/gamm/types/query.pb.go
* Add Pagination to filter pool query * Use Filtered Pagination * Add logic for offset in pagination * Return false on response * Bug fix * Refactors for clean code * Remove snake cases * Fix typos * Clean more code (cherry picked from commit 1dedc28)
* Add Pagination to filter pool query * Use Filtered Pagination * Add logic for offset in pagination * Return false on response * Bug fix * Refactors for clean code * Remove snake cases * Fix typos * Clean more code (cherry picked from commit 1dedc28) Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Closes: #XXX
What is the purpose of the change
This PR adds pagination to pools with filter query.
As of right now, pagination is not included in the query for pools with filter, whist pagination is necessary as front end query heavily depends on pagination.
Brief Changelog
PoolsWithFilter
query in gammDocumentation and Release Note
Unreleased
section inCHANGELOG.md
? (yes / no)x/<module>/spec/
) / Osmosis docs repo / not documented)