Skip to content

Move the Solana trades endpoint to the paginated v2 contract - #4884

Merged
squadgazzz merged 4 commits into
mainfrom
solana-orderbook/trades-pagination
Sep 11, 2026
Merged

Move the Solana trades endpoint to the paginated v2 contract#4884
squadgazzz merged 4 commits into
mainfrom
solana-orderbook/trades-pagination

Conversation

@squadgazzz

@squadgazzz squadgazzz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Description

EVM deprecated /api/v1/trades in favor of the paginated /api/v2/trades. The Solana trades route mirrored the deprecated shape: unpaginated, every fill of a busy owner in one response. Nobody has integrated it yet, so it moves straight to the v2 contract, /api/v2/trades with offset and limit, matching the EVM path and semantics.

Changes

  • The trades route moves to GET /api/v2/trades and accepts offset and limit with the EVM defaults and bounds (0 and 10, limit 1 to 1000), rejecting a bad limit with InvalidLimit
  • The trades query pages in SQL and returns newest first, like EVM v2
  • The openapi spec documents the new path and parameters

How to test

Updated unit and database tests.

@github-actions

Copy link
Copy Markdown

Reminder: Please consider backward compatibility when modifying the API specification.
If breaking changes are unavoidable, ensure:

  • You explicitly pointed out breaking changes.
  • You communicate the changes to affected teams (at least Frontend team and SAFE team).
  • You provide proper versioning and migration mechanisms.

Caused by:

@squadgazzz squadgazzz changed the title Paginate the Solana trades endpoint Move the Solana trades endpoint to the paginated v2 contract Sep 11, 2026
@squadgazzz
squadgazzz marked this pull request as ready for review September 11, 2026 08:48
@squadgazzz
squadgazzz requested a review from a team as a code owner September 11, 2026 08:48
@claude

claude Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Claude finished @squadgazzz's task in 1m 24s —— View job


PR Review

  • Read changed files and gather context
  • Compared against the EVM v2 trades implementation (get_trades_v2.rs / EVM openapi)
  • Reviewed the trades route, DB query, openapi, and tests
  • Posted inline findings

Verdict: Clean, well-scoped change that faithfully mirrors the EVM /api/v2/trades contract. Defaults/bounds (0, 10, 1..=1000), the InvalidLimit error message, validation ordering (short-circuit before DB access), the safe u64→i64 offset clamping, and SQL OFFSET/LIMIT on a deterministic ORDER BY all look correct. Tests cover both the paging behavior and the invalid-limit rejection. Since the v1 route was never integrated, moving straight to v2 is a reasonable non-breaking choice.

One minor, optional note posted inline:

  • openapi.yml documents the limit bounds only in prose; the EVM v2 spec also encodes minimum: 1 / maximum: 1000 in the schema. Adding them keeps the machine-readable contract in parity.

Nothing blocking. 👍
· solana-orderbook/trades-pagination

Comment thread crates/solana-orderbook/openapi.yml
@squadgazzz
squadgazzz added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit 69c578b Sep 11, 2026
23 checks passed
@squadgazzz
squadgazzz deleted the solana-orderbook/trades-pagination branch September 11, 2026 09:31
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants