fix interval_count

This commit is contained in:
Serhii 2023-05-09 12:55:34 +03:00
parent 3f967191e5
commit 2f511dc2e7
2 changed files with 11 additions and 10 deletions

View file

@ -58,7 +58,7 @@ Future<double> _fetchHistoricalPrice(Map<String, dynamic> args) async {
final intervalFromNow = DateTime.now().difference(date).inMinutes; final intervalFromNow = DateTime.now().difference(date).inMinutes;
final Map<String, String> queryParams = { final Map<String, String> queryParams = {
'interval_count': '5', 'interval_count': '2',
'base': crypto.toString(), 'base': crypto.toString(),
'quote': fiat.toString(), 'quote': fiat.toString(),
'key': secrets.fiatApiKey, 'key': secrets.fiatApiKey,
@ -93,6 +93,7 @@ Future<double> _fetchHistoricalPrice(Map<String, dynamic> args) async {
if (results.isNotEmpty) { if (results.isNotEmpty) {
price = results.values.first as double; price = results.values.first as double;
} }
print('results.key: ${results.keys.first} results.value: ${results.values.first}');
return price; return price;
} catch (e) { } catch (e) {

View file

@ -34,12 +34,8 @@ abstract class TransactionDetailsViewModelBase with Store {
isRecipientAddressShown = false, isRecipientAddressShown = false,
showRecipientAddress = settingsStore.shouldSaveRecipientAddress, showRecipientAddress = settingsStore.shouldSaveRecipientAddress,
fiatRateListItem = StandartListItem( fiatRateListItem = StandartListItem(
title: settingsStore.showHistoricalFiatRate title: S.current.historical_fiat_rate,
? S.current.historical_fiat_rate value: '${S.current.fetching.toLowerCase()} ...') {
: S.current.fiat_rate,
value: settingsStore.showHistoricalFiatRate
? '${S.current.fetching.toLowerCase()} ...'
: transactionInfo.fiatAmount() + ' ${settingsStore.fiatCurrency}') {
final dateFormat = DateFormatter.withCurrentLocal(); final dateFormat = DateFormatter.withCurrentLocal();
final tx = transactionInfo; final tx = transactionInfo;
@ -62,7 +58,8 @@ abstract class TransactionDetailsViewModelBase with Store {
if (feeFormatted != null) if (feeFormatted != null)
StandartListItem( StandartListItem(
title: S.current.transaction_details_fee, value: feeFormatted), title: S.current.transaction_details_fee, value: feeFormatted),
if (settingsStore.fiatApiMode != FiatApiMode.disabled) if (settingsStore.fiatApiMode != FiatApiMode.disabled &&
settingsStore.showHistoricalFiatRate)
fiatRateListItem, fiatRateListItem,
if (key?.isNotEmpty ?? false) if (key?.isNotEmpty ?? false)
StandartListItem(title: S.current.transaction_key, value: key!) StandartListItem(title: S.current.transaction_key, value: key!)
@ -118,7 +115,8 @@ abstract class TransactionDetailsViewModelBase with Store {
StandartListItem( StandartListItem(
title: S.current.transaction_details_fee, title: S.current.transaction_details_fee,
value: tx.feeFormatted()!), value: tx.feeFormatted()!),
if (settingsStore.fiatApiMode != FiatApiMode.disabled) if (settingsStore.fiatApiMode != FiatApiMode.disabled &&
settingsStore.showHistoricalFiatRate)
fiatRateListItem, fiatRateListItem,
]; ];
@ -140,7 +138,8 @@ abstract class TransactionDetailsViewModelBase with Store {
if (tx.feeFormatted()?.isNotEmpty ?? false) if (tx.feeFormatted()?.isNotEmpty ?? false)
StandartListItem( StandartListItem(
title: S.current.transaction_details_fee, value: tx.feeFormatted()!), title: S.current.transaction_details_fee, value: tx.feeFormatted()!),
if (settingsStore.fiatApiMode != FiatApiMode.disabled) if (settingsStore.fiatApiMode != FiatApiMode.disabled &&
settingsStore.showHistoricalFiatRate)
fiatRateListItem, fiatRateListItem,
]); ]);
} }
@ -228,6 +227,7 @@ abstract class TransactionDetailsViewModelBase with Store {
default: default:
formattedFiatAmount; formattedFiatAmount;
} }
final historicalFiatAmountFormatted = formattedFiatAmount * historicalFiatRate; final historicalFiatAmountFormatted = formattedFiatAmount * historicalFiatRate;
items[fiatRateItemIndex] = StandartListItem( items[fiatRateItemIndex] = StandartListItem(
title: S.current.historical_fiat_rate, title: S.current.historical_fiat_rate,