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.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.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/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/models.dart';
import 'package:stackwallet/models/node_model.dart'; import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/models/notification_model.dart'; import 'package:stackwallet/models/notification_model.dart';
@ -251,6 +251,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
await ref.read(storageCryptoHandlerProvider).hasPassword(); await ref.read(storageCryptoHandlerProvider).hasPassword();
} }
await MainDB.instance.initMainDB(); await MainDB.instance.initMainDB();
ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.addAll(
await MainDB.instance.getEthContracts().addressProperty().findAll(),
);
} }
Future<void> load() async { 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/notifications/show_flush_bar.dart';
import 'package:stackwallet/providers/global/debug_service_provider.dart'; import 'package:stackwallet/providers/global/debug_service_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/price_service.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -164,9 +163,15 @@ class HiddenSettings extends StatelessWidget {
Consumer(builder: (_, ref, __) { Consumer(builder: (_, ref, __) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
PriceService.tokenContractAddressesToCheck.add( ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.add(
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"); "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
PriceService.tokenContractAddressesToCheck.add( ref
.read(priceAnd24hChangeNotifierProvider)
.tokenContractAddressesToCheck
.add(
"0xdAC17F958D2ee523a2206206994597C13D831ec7"); "0xdAC17F958D2ee523a2206206994597C13D831ec7");
await ref await ref
.read(priceAnd24hChangeNotifierProvider) .read(priceAnd24hChangeNotifierProvider)

View file

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