Implement transaction search and filtering API#112
Open
miss-yusrah wants to merge 2 commits intoSynapse-bridgez:mainfrom
Open
Implement transaction search and filtering API#112miss-yusrah wants to merge 2 commits intoSynapse-bridgez:mainfrom
miss-yusrah wants to merge 2 commits intoSynapse-bridgez:mainfrom
Conversation
- Add GET /transactions/search endpoint with multiple filter support - Support filtering by status, asset_code, amount range, date range, and stellar_account - Implement cursor-based pagination for efficient result traversal - Add database indexes for optimized search performance - Use read replica for search queries to reduce primary DB load - Return total count and paginated results with next_cursor
Resolved conflicts in: - Cargo.toml: Merged dependencies - src/lib.rs: Added all module exports (utils, error, health, metrics, validation) - src/handlers/mod.rs: Added search module alongside health check updates - src/db/queries.rs: Kept search_transactions function and Row import
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.
Closes #98
Transaction Search & Filtering API
Overview
Implements a powerful search and filtering endpoint that allows querying transactions by multiple criteria simultaneously, supporting operations and compliance workflows.
Changes
New Endpoint
Query Parameters
All parameters are optional and combine with AND logic:
status- Filter by transaction status (e.g.,completed,pending,failed)asset_code- Filter by asset code (e.g.,USDC,USD,XLM)min_amount- Minimum transaction amount (inclusive)max_amount- Maximum transaction amount (inclusive)from- Start date for date range filter (ISO 8601 format)to- End date for date range filter (ISO 8601 format)stellar_account- Filter by Stellar account addresslimit- Results per page (default: 50, max: 100)cursor- Pagination cursor from previous responseResponse Format
{ "total": 142, "results": [...], "next_cursor": "eyJjcmVhdGVkX2F0Ij..." }Implementation Details
Files Added
src/handlers/search.rs- Search endpoint handler with parameter validationmigrations/20260222000000_transaction_search_indexes.sql- Database indexes for search optimizationFiles Modified
src/db/queries.rs- Addedsearch_transactions()with dynamic query buildersrc/handlers/mod.rs- Registered search modulesrc/main.rs- Added search route with pool_manager statesrc/utils/mod.rs- Exported cursor modulesrc/db/mod.rs- Exported audit modulesrc/lib.rs- Exported utils moduleDatabase Indexes
Added 6 indexes for optimized search performance:
idx_transactions_asset_code- Asset code filteringidx_transactions_created_status- Date range with statusidx_transactions_amount- Amount range queriesidx_transactions_created_id- Cursor-based paginationidx_transactions_search- Combined status, asset_code, and date queriesSecurity
Performance