Implement GET /v1/trades/tx/{tx_hash} endpoint#39
Closed
findolor wants to merge 4 commits into2026-02-17-implement-swap-calldatafrom
Closed
Implement GET /v1/trades/tx/{tx_hash} endpoint#39findolor wants to merge 4 commits into2026-02-17-implement-swap-calldatafrom
findolor wants to merge 4 commits into2026-02-17-implement-swap-calldatafrom
Conversation
… fix Includes get_trades_for_transaction with polling, pub order_operations, and fix for nested transaction filter in SgTransactionTradesQuery.
Maps to HTTP 202 with code NOT_YET_INDEXED, logged at info level since it represents an expected transient state during indexing.
Queries all configured orderbooks for trades in a transaction, looks up order owners by hash, computes IO ratios and totals using Float math. Distinguishes 404 (no trades) vs 202 (not yet indexed). Converts trades.rs to module directory with get_by_tx and get_by_address sub-modules following the swap module pattern.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Feb 18, 2026
Collaborator
Author
|
This is implemented properly in PR #50. |
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.
Chained PRs
Motivation
See issues:
Implements issue #28 (GET /v1/trades/tx/{tx_hash}) from the v1 route handlers tracking issue. This endpoint retrieves all trades associated with a given transaction hash, including per-trade IO ratios and aggregate totals.
Solution
tradesmodule from a single file into a directory withget_by_txandget_by_addresssubmodules for better separation of concernsget_trades_by_txhandler that queries all configured orderbook subgraphs for trades matching a transaction hash, fetches associated order data for owner addresses, and computes per-trade and aggregate IO ratios usingrain-math-floatNotYetIndexederror variant (ApiError::NotYetIndexed) returning 202 Accepted when the subgraph hasn't indexed the transaction yetrain.orderbooksubmodule to includeget_trades_for_transactionsupport and subgraph fixesTradesTxDataSourcetrait for testability, with comprehensive unit tests using mock data sourcesfuturescrate for concurrent order lookupsChecks
By submitting this for review, I'm confirming I've done the following:
fix #28