Description — what to implement and the why/impact.
Users incur shared expenses in various fiat currencies and settle in Stellar assets (XLM or USDC). Accurate real-time conversion rates are crucial for fair splits. This issue implements a React Query hook that fetches exchange rates with fallback providers and handles stale-while-revalidate caching.
Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).
Build a custom hook in src/hooks/ using @tanstack/react-query that queries rate APIs and returns normalized conversion ratios. Implement robust error handling and fallback values to prevent UI crashes if pricing APIs experience downtime.
Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.
- Inspect existing hooks in
src/hooks/.
- Add unit tests for rate calculation and fallback behavior in
src/lib/__tests__/ or src/hooks/__tests__/.
Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).
- Write unit tests mocking successful and failing API rate responses.
- Run
npm test to execute tests.
Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium
Description — what to implement and the why/impact.
Users incur shared expenses in various fiat currencies and settle in Stellar assets (XLM or USDC). Accurate real-time conversion rates are crucial for fair splits. This issue implements a React Query hook that fetches exchange rates with fallback providers and handles stale-while-revalidate caching.
Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).
Build a custom hook in
src/hooks/using@tanstack/react-querythat queries rate APIs and returns normalized conversion ratios. Implement robust error handling and fallback values to prevent UI crashes if pricing APIs experience downtime.Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
useExchangeRates.tsinsrc/hooks/.src/lib/types.ts.npm run typecheck,npm run lint, andnpm test.Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.
src/hooks/.src/lib/__tests__/orsrc/hooks/__tests__/.Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).
npm testto execute tests.Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium