feat: add currency override support in fiat conversion service (#2445)

Konstantin Ullrich committed Aug 11, 2025 at 19:21 UTC d64a58389b55591bc43acf19d25d669307b4cb31
1 file changed +9 -1
lib/core/fiat_conversion_service.dart
+9 -1
@@ -48,11 +48,19 @@ Future<double> _fetchPrice(String crypto, String fiat, bool torOnly) async {
48 }
49 }
50
51 +/// Override specific [CryptoCurrency] to fix its price to the price of another
52 +/// e.g. nDEPS should have the same price as DEPS, but only DEPS is tracked
53 +CryptoCurrency _overrideCryptoCurrency(CryptoCurrency crypto) {
54 + if (crypto.title == CryptoCurrency.ndeps.title)
55 + return CryptoCurrency.deps;
56 + return crypto;
57 +}
58 +
59 class FiatConversionService {
60 static Future<double> fetchPrice({
61 required CryptoCurrency crypto,
62 required FiatCurrency fiat,
63 required bool torOnly,
64 }) async =>
57 - await _fetchPrice(crypto.toString(), fiat.toString(), torOnly);
65 + await _fetchPrice(_overrideCryptoCurrency(crypto).toString(), fiat.toString(), torOnly);
66 }