Skip to content

solana-orderbook: account orders endpoint - #4876

Merged
squadgazzz merged 4 commits into
mainfrom
solana-orderbook/account-orders
Sep 11, 2026
Merged

solana-orderbook: account orders endpoint#4876
squadgazzz merged 4 commits into
mainfrom
solana-orderbook/account-orders

Conversation

@squadgazzz

@squadgazzz squadgazzz commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Front-end requested to implement the GET /api/v1/account/{owner}/orders endpoint already for the demo. The Solana version serves the same shape: one owner's orders with their fill state, newest first, offset/limit pagination with the EVM defaults and bounds, and the verbatim LIMIT_OUT_OF_BOUNDS rejection.

Deliberate differences: the owner is a base58 public key (InvalidOwner in the API's error shape on a malformed one), and each order carries the fill state from solana.order_pda, same as the single-order endpoint. The query rides the existing solana_orders_user_creation index.

Changes

  • GET /api/v1/account/{owner}/orders with EVM pagination semantics
  • orders_by_owner read in the db layer, newest first with the fill-state join

How to test

New ignored postgres test for the pagination and a unit test for the parameter rejections.

Related issues

BE-259

@linear-code

linear-code Bot commented Sep 7, 2026

Copy link
Copy Markdown

BE-259

@github-actions

github-actions Bot commented Sep 7, 2026

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 marked this pull request as ready for review September 7, 2026 11:27
@squadgazzz
squadgazzz requested a review from a team as a code owner September 7, 2026 11:27
@claude

claude Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

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


PR Review: account orders endpoint

  • Read diff and surrounding conventions
  • Compare against the EVM get_user_orders endpoint for parity
  • Verify DB query, index usage, and error handling
  • Verify tests and OpenAPI schema references

Overall: Clean, well-scoped PR that mirrors the EVM endpoint closely. The DB query rides the solana_orders_user_creation index (owner, creation_timestamp DESC), reuses the single-order fill-state join and dto::Order::new, and the OpenAPI Order/Pubkey/Error refs all resolve. The pagination test correctly asserts newest-first ordering, owner isolation, and the fill-state join; the API test covers both parameter rejections. Bind order (LIMIT $2 OFFSET $3 ↔ owner/limit/offset) is correct.

One non-blocking parity note posted inline:

  • offset/limit are i64 here vs u64 in the EVM endpoint; a negative offset is silently clamped to 0 instead of being rejected. Switching to u64 would make the contract identical and drop the .max(0).

Nothing blocking from my side.
· solana-orderbook/account-orders

Comment thread crates/solana-orderbook/src/infra/api/routes/account/mod.rs Outdated
@squadgazzz
squadgazzz requested a review from tilacog September 7, 2026 13:02
return Err(error::reply(
StatusCode::BAD_REQUEST,
"LIMIT_OUT_OF_BOUNDS",
"The pagination limit is [1,1000].",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could reference the constants to never go out of sync with them.

@squadgazzz
squadgazzz force-pushed the solana-orderbook/account-orders branch from a234509 to ec0d658 Compare September 11, 2026 09:50
@squadgazzz
squadgazzz disabled auto-merge September 11, 2026 09:56
@squadgazzz
squadgazzz added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit 2debb00 Sep 11, 2026
23 checks passed
@squadgazzz
squadgazzz deleted the solana-orderbook/account-orders branch September 11, 2026 10:11
@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