From 12b8d544264fbf7614768adcca8f620dd99d506e Mon Sep 17 00:00:00 2001 From: Matthew Fosse <matt@fosse.co> Date: Fri, 1 Mar 2024 14:14:58 -0800 Subject: [PATCH] fiat fixes --- lib/reactions/fiat_rate_update.dart | 9 +++++++++ lib/view_model/dashboard/balance_view_model.dart | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/reactions/fiat_rate_update.dart b/lib/reactions/fiat_rate_update.dart index caaa03a06..4d9722ad0 100644 --- a/lib/reactions/fiat_rate_update.dart +++ b/lib/reactions/fiat_rate_update.dart @@ -60,6 +60,10 @@ Future<void> startFiatRateUpdate( solana!.getSPLTokenCurrencies(appStore.wallet!).where((element) => element.enabled); } + if (appStore.wallet!.type == WalletType.lightning) { + currencies = [CryptoCurrency.btc]; + } + if (currencies != null) { for (final currency in currencies) { () async { @@ -70,6 +74,11 @@ Future<void> startFiatRateUpdate( }.call(); } } + + if (appStore.wallet!.type == WalletType.lightning) { + fiatConversionStore.prices[CryptoCurrency.btcln] = + (fiatConversionStore.prices[CryptoCurrency.btc] ?? 0) / 100000000; + } } catch (e) { print(e); } diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 78ade9d21..ea41e427a 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -63,12 +63,7 @@ abstract class BalanceViewModelBase with Store { @computed double get price { CryptoCurrency currency = appStore.wallet!.currency; - - // the fiat api doesn't correctly get the price of BTCLN - // (as it should just grab the price of BTC) - if (currency == CryptoCurrency.btcln) { - currency = CryptoCurrency.btc; - } + final price = fiatConvertationStore.prices[currency]; if (price == null) { @@ -249,10 +244,6 @@ abstract class BalanceViewModelBase with Store { asset: key, formattedAssetTitle: _formatterAsset(key))); } - // get price of btc because btcln is not supported by the fiat api: - if (key == CryptoCurrency.btcln) { - key = CryptoCurrency.btc; - } final fiatCurrency = settingsStore.fiatCurrency; final price = fiatConvertationStore.prices[key] ?? 0;