Skip to content

feat: Implement SEP-40 swap rates endpoint#316

Merged
Ceejaytech25 merged 7 commits intoceejaylaboratory:mainfrom
dev-susa:feat/sep40-swap-rates
May 1, 2026
Merged

feat: Implement SEP-40 swap rates endpoint#316
Ceejaytech25 merged 7 commits intoceejaylaboratory:mainfrom
dev-susa:feat/sep40-swap-rates

Conversation

@dev-susa
Copy link
Copy Markdown
Contributor

Description

Implement SEP-40 to provide a standardized way for wallets to request real-time swap rates for on-chain asset pairs managed by the anchor.

Changes

  • Controller: Added with methods to:

    • Get swap rates for specified asset pairs
    • Retrieve all supported asset pairs
    • Update swap rates (for testing/admin)
  • Routes: Added two endpoints:

    • POST /sep40/rates - Get swap rates for specified pairs
    • GET /sep40/pairs - Get all supported asset pairs
  • Tests: Comprehensive unit and integration tests covering:

    • Valid and invalid asset pairs
    • Case-insensitive asset codes
    • Inverse rate calculations
    • Error handling
  • Documentation: Added detailed SEP-40 documentation with:

    • API endpoint specifications
    • Usage examples
    • Implementation details
    • Future enhancement suggestions

Supported Assets

  • XLM (Stellar Lumens)
  • USDC (USD Coin)
  • USDT (Tether)
  • BTC (Bitcoin)
  • ETH (Ethereum)

Testing

All tests pass:

npm test -- sep40.controller.test.ts
npm test -- sep40.route.test.ts

Closes

Closes #229

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 27, 2026

@dev-susa 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

@Ceejaytech25
Copy link
Copy Markdown
Contributor

Nice implementation, lgtm!

@Ceejaytech25 Ceejaytech25 merged commit 73c2bc8 into ceejaylaboratory:main May 1, 2026
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.

Backend: Add support for SEP-40 swap rates

2 participants