price service token tweaks

This commit is contained in:
julian 2023-03-30 10:41:28 -06:00
parent af460b54a6
commit 61894c9e8e
3 changed files with 18 additions and 7 deletions

View file

@ -23,7 +23,7 @@ import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/isar/models/log.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/models.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/models/notification_model.dart';
@ -251,6 +251,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
await ref.read(storageCryptoHandlerProvider).hasPassword();
}
await MainDB.instance.initMainDB();
ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.addAll(
await MainDB.instance.getEthContracts().addressProperty().findAll(),
);
}
Future<void> load() async {

View file

@ -5,7 +5,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/price_service.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -164,10 +163,16 @@ class HiddenSettings extends StatelessWidget {
Consumer(builder: (_, ref, __) {
return GestureDetector(
onTap: () async {
PriceService.tokenContractAddressesToCheck.add(
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
PriceService.tokenContractAddressesToCheck.add(
"0xdAC17F958D2ee523a2206206994597C13D831ec7");
ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.add(
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.add(
"0xdAC17F958D2ee523a2206206994597C13D831ec7");
await ref
.read(priceAnd24hChangeNotifierProvider)
.updatePrice();

View file

@ -9,7 +9,7 @@ import 'package:tuple/tuple.dart';
class PriceService extends ChangeNotifier {
late final String baseTicker;
static Set<String> tokenContractAddressesToCheck = {};
final Set<String> tokenContractAddressesToCheck = {};
final Duration updateInterval = const Duration(seconds: 60);
Timer? _timer;