fix: omit ascending param when unset, default to descending#43
Open
mvanhorn wants to merge 1 commit intoPolymarket:mainfrom
Open
fix: omit ascending param when unset, default to descending#43mvanhorn wants to merge 1 commit intoPolymarket:mainfrom
mvanhorn wants to merge 1 commit intoPolymarket:mainfrom
Conversation
…ding When --ascending is not passed, the CLI was sending ascending=false to the API, overriding the server's default sort order. Now we use maybe_ascending to only send the parameter when explicitly requested, letting the API return results in its natural (descending) order. Fixes Polymarket#17 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
--ascendingis not passed, the CLI was sendingascending=falseto the Gamma API, which overrode the server's default descending sort.maybe_ascending()so the parameter is only included when the user explicitly requests ascending orderFixes #17
Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo testpasses (131 tests)polymarket markets listreturns newest markets first (descending)polymarket markets list --ascendingreturns oldest firstThis contribution was developed with AI assistance (Claude Code).
Note
Low Risk
Small, mechanical change to request parameter construction; main risk is behavior change in default sort order for list commands.
Overview
Fixes list endpoints in the CLI to stop sending
ascending=falseby default, which previously overrode the Gamma API’s default (descending) sort.Across comments, events, markets, series, sports teams, and tags list commands, request builders switch from
.ascending(ascending)to.maybe_ascending(...), so theascendingparameter is only included when the user passes--ascending.Written by Cursor Bugbot for commit b6da0e5. This will update automatically on new commits. Configure here.