Skip to content

Add price validation for market rate fetchers#100

Merged
Sadeequ merged 3 commits intoStellarFlow-Network:mainfrom
Obiajulu-gif:fix/validation-middleware
Mar 29, 2026
Merged

Add price validation for market rate fetchers#100
Sadeequ merged 3 commits intoStellarFlow-Network:mainfrom
Obiajulu-gif:fix/validation-middleware

Conversation

@Obiajulu-gif
Copy link
Copy Markdown
Contributor

This pull request introduces a new validatePrice utility to ensure that all price values used in market rate fetchers are positive numbers. The change improves data integrity by validating external and internal price data before use. The utility is applied throughout the GHS and KES rate fetchers, and comprehensive tests are added to verify its behavior and error handling.

Validation improvements:

  • Added a new validatePrice function in validation.ts to ensure that price values are positive numbers, throwing an error otherwise.
  • Updated both GHSRateFetcher and KESRateFetcher to use validatePrice when handling all incoming rate data, including fallback and placeholder values. [1] [2] [3] [4] [5] [6]

Testing enhancements:

  • Added a new test file validation.test.ts to assert correct and incorrect usages of validatePrice.
  • Expanded ghsFetcher.test.ts to cover scenarios where invalid price data is returned from external APIs, ensuring errors are thrown as expected.

Closes #64

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Obiajulu-gif 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

@Sadeequ
Copy link
Copy Markdown
Contributor

Sadeequ commented Mar 28, 2026

Please resolve all conflicts and also make sure your Types follows the repo standard for the CI check .

@Obiajulu-gif
Copy link
Copy Markdown
Contributor Author

@Sadeequ i have fix it

@Sadeequ Sadeequ merged commit d341042 into StellarFlow-Network:main Mar 29, 2026
1 check failed
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.

[RELIABILITY] Create a "Validation" Middleware

2 participants