This pull request integrates a Nigerian Naira (NGN) exchange rate fetcher into the StellarFlow backend. It allows the system to provide real-time NGN/XLM market rates by aggregating data from multiple reliable sources.
- New NGNRateFetcher: Added
src/services/marketRate/ngnFetcher.tswhich implements theMarketRateFetcherinterface. It uses a tiered strategy for robustness:- Binance P2P: Primary source for direct XLM/NGN or XLM/USDT * USDT/NGN cross rates.
- CoinGecko: Reliable aggregator for XLM/NGN.
- ExchangeRate API: Fallback source for USD/NGN cross-conversion.
- Service Registration: Updated
src/services/marketRate/index.tsandsrc/services/marketRate/marketRateService.tsto include and register theNGNRateFetcher. - Fault Tolerance: The new fetcher includes a
CircuitBreakerand exponential backoff retry logic to handle transient API failures.
- Verified the API interaction logic using a standalone test script.
- Successful data retrieval confirmed for CoinGecko and ExchangeRate API.
- Unit tests added in
test/ngnFetcher.test.ts.
issue #3