Conversation
The blockchain.info ticker API returns these currencies but they were missing from the supported fiat list.
📝 WalkthroughWalkthroughThis pull request adds support for two new fiat currencies: GHS (Ghanaian cedi) and NGN (Nigerian naira). The changes extend the currency enum, update the decimal places configuration to assign both currencies 2 decimal places, update the blockchain.info API consumer to parse and map these currencies, and document the additions in the README. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/currency/fiat.rs (1)
62-88: Consider adding explicit precision regression tests forGHSandNGN.This will guard against accidental remapping in future enum edits.
Proposed test addition
#[cfg(test)] mod tests { use super::*; use std::time::Instant; + #[test] + fn decimal_places_for_new_fiats_are_two() { + assert_eq!(Fiat::GHS.decimal_places(), 2); + assert_eq!(Fiat::NGN.decimal_places(), 2); + } + #[test] fn test_exchange_rate_caching() { let start = Instant::now();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/currency/fiat.rs` around lines 62 - 88, Add regression unit tests to assert that Fiat::GHS.decimal_places() and Fiat::NGN.decimal_places() return 2 to prevent accidental remapping of those variants; create tests in the fiat.rs test module (or existing currency tests) that call the decimal_places() method on the Fiat enum for GHS and NGN and assert_eq!(..., 2) so future edits to the Fiat variants or match in fn decimal_places() will fail the build if these precisions change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/currency/fiat.rs`:
- Around line 62-88: Add regression unit tests to assert that
Fiat::GHS.decimal_places() and Fiat::NGN.decimal_places() return 2 to prevent
accidental remapping of those variants; create tests in the fiat.rs test module
(or existing currency tests) that call the decimal_places() method on the Fiat
enum for GHS and NGN and assert_eq!(..., 2) so future edits to the Fiat variants
or match in fn decimal_places() will fail the build if these precisions change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fbb08664-8f03-4128-bf2b-bdc19296c11a
📒 Files selected for processing (3)
README.mdsrc/currency/fiat.rssrc/fiat_rates/blockchain_info_consumer.rs
Add Ghanaian cedi (GHS) and Nigerian naira (NGN) to supported fiat currencies, matching what the blockchain.info ticker API already provides.
Summary by CodeRabbit
New Features
Documentation