fiat fixes

This commit is contained in:
Matthew Fosse 2024-03-01 14:14:58 -08:00
parent 7b051206bb
commit 12b8d54426
2 changed files with 10 additions and 10 deletions

View file

@ -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);
}

View file

@ -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;