fix(research): reject --page/--limit and --sort on subcommands that don't support them#442
Merged
Merged
Conversation
…on't support them historical-token-flow-summary silently dropped --page/--limit; it now throws INVALID_PARAMS immediately (endpoint returns a single aggregated row). historical-smart-money-balances silently dropped --sort/--order-by; it now throws INVALID_PARAMS immediately (endpoint does not support ordering). Co-Authored-By: Claude Sonnet 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
Two
nansen researchsubcommands silently dropped flags that they could not honour, giving the caller no feedback that their options were ignored:historical-token-flow-summaryaccepted--page/--limitbut never forwarded pagination to the API. The underlying endpoint (TGMHistoricalTokenFlowSummaryRequest,extra='forbid') has no pagination field — it always returns a single aggregated row.historical-smart-money-balancesaccepted--sort/--order-bybut never forwardedorder_byto the API. The underlying router handler hard-codesorder_by=None— sort is unsupported end-to-end.Fix
Both subcommands now throw
INVALID_PARAMSbefore making any API call when the unsupported flag is present:historical-token-flow-summary+--page/--limit→ error: "does not support --page or --limit (endpoint returns a single aggregated row)"historical-smart-money-balances+--sort/--order-by→ error: "does not support --sort or --order-by (endpoint does not support ordering)"The global help text for
--page/--limitand--sortnow notes the exceptions. Per-subcommand help text already called these out.Test plan
npm test— all 1475 tests pass (2 new regression tests added, one per case)node src/index.js research historical-token-flow-summary --token-address 0x123 --from-date 2026-04-01 --to-date 2026-04-05 --page 2exits non-zero with a clear errornode src/index.js research historical-smart-money-balances --as-of-date 2026-04-05 --sort value_usd:descexits non-zero with a clear error🤖 Generated with Claude Code