Skip to content

feat(backend): integrate Stellar transaction history via Horizon API#141

Merged
SudiptaPaul-31 merged 1 commit into
Lumina-eX:mainfrom
nonchalanttee22-lgtm:main
Jun 29, 2026
Merged

feat(backend): integrate Stellar transaction history via Horizon API#141
SudiptaPaul-31 merged 1 commit into
Lumina-eX:mainfrom
nonchalanttee22-lgtm:main

Conversation

@nonchalanttee22-lgtm

Copy link
Copy Markdown

Summary

This PR adds transaction history fetching and display for Stellar transactions associated with contracts, giving clients and freelancers transparency and traceability into on-chain activity. Transactions are fetched from the Horizon API, mapped to contracts, exposed via a paginated endpoint, and returned in a UI-ready schema.

Closes #128


What changed

Backend Service

  • Implemented a service that fetches transactions from the Horizon API for a given Stellar account/contract
  • Each transaction is mapped to its corresponding contract record in the database, enabling lookup by contract ID
  • Added explicit Testnet support — configurable network selection (Testnet/Mainnet) for development and testing without code changes
  • Added error handling for failed Horizon queries (timeouts, rate limits, malformed responses) with clear, actionable error messages surfaced to the API layer rather than raw Horizon errors

API Endpoint

  • New endpoint returning transaction history for a contract, with pagination support (cursor or page-based, matching existing API conventions) to handle large transaction sets performantly
  • Response schema is UI-ready and includes per transaction:
    • hash — unique transaction identifier
    • timestamp — block time of the transaction
    • amount — asset type and value
    • status — reflects actual on-chain state (successful, failed, pending)

Status Mapping

  • Status field is derived directly from the Stellar network's transaction result, not inferred or cached, ensuring it accurately reflects real-time on-chain state

Tests

  • Unit tests for the Horizon-fetching service, including mocked success and failure responses
  • Tests for contract-to-transaction mapping logic
  • Tests for the paginated API endpoint, including boundary cases (empty result set, single page, multi-page)
  • Tests confirming Testnet transactions are fetched and displayed correctly

How to verify

npm test -- --grep transactionHistory
  • Fetch transaction history for a contract with known Testnet transactions and assert hash, timestamp, amount, and status are all correctly populated
  • Request a large transaction set and assert pagination returns consistent, performant results across pages
  • Simulate a Horizon API failure (timeout/error response) and assert a clear, descriptive error is returned rather than a raw exception
  • Assert transaction status in the response matches the actual state reported by the Stellar network (successful/failed/pending)
  • Switch network config to Testnet and confirm transactions resolve correctly in a dev/test environment

Checklist

  • Transaction history fetches correctly for contracts via Horizon API
  • Transactions mapped to associated contracts in the database
  • API endpoint returns paginated, performant results
  • Testnet supported and verified for development/testing
  • Status field reflects real-time transaction state from the Stellar network
  • Clear error messages returned on failed Horizon queries
  • Response schema includes hash, timestamp, amount, and status — UI-ready
  • Unit tests pass for backend logic and API responses
  • Closes [Feature]: Stellar Transaction History Integration #128

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@nonchalanttee22-lgtm Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@SudiptaPaul-31 SudiptaPaul-31 merged commit 6fe69a9 into Lumina-eX:main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Stellar Transaction History Integration

3 participants