feat: add transaction history endpoint#163
Merged
salazarsebas merged 3 commits intoHarmonia-Development:mainfrom Oct 6, 2025
Merged
feat: add transaction history endpoint#163salazarsebas merged 3 commits intoHarmonia-Development:mainfrom
salazarsebas merged 3 commits intoHarmonia-Development:mainfrom
Conversation
- Add function to retrieve all transactions for a given user - Orders results by id DESC (newest first) - Returns TransactionRow[] with full transaction details
- Implement JWT-protected endpoint to fetch user transaction history - Validate user_id and verify JWT authorization (403 on mismatch) - Enrich transactions with Horizon data (timestamp, amount, destination) - Use Promise.all for parallel Horizon API calls - Handle edge cases: empty transactions, invalid user_id, Horizon errors - Return 200 with enriched transaction list or empty array
- Add 10 test cases covering success and error scenarios - Mock Horizon API calls (transactions and operations endpoints) - Test validation: invalid/negative/zero user_id - Test authorization: JWT mismatch (403), invalid JWT (401) - Test error handling: Horizon failures (500) - Test edge cases: empty transactions, no payment operations - Achieve 100% coverage for new endpoint
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.
🛠️ Issue
Closes #139
📖 Description
This PR implements a new endpoint to retrieve transaction history for Stellar wallets on Testnet. The endpoint fetches transactions from the local SQLite database and enriches them with detailed information from the Horizon API, including timestamps, amounts, and destination addresses.
✅ Changes Made
getTransactionsByUserId()helper function to query user transactions ordered by newest firstGET /wallet/transactions/:user_idwith JWT authenticationPromise.allfor parallel Horizon API calls to optimize performance🖼️ Media (screenshots/videos)