diff --git a/lib/bloc/app_bloc_root.dart b/lib/bloc/app_bloc_root.dart index 2475734b66..cc5c732256 100644 --- a/lib/bloc/app_bloc_root.dart +++ b/lib/bloc/app_bloc_root.dart @@ -193,8 +193,10 @@ class AppBlocRoot extends StatelessWidget { )..add(CoinsStarted()), ), BlocProvider( - create: (context) => PriceChartBloc(binanceRepository) - ..add( + create: (context) => PriceChartBloc( + binanceRepository, + komodoDefiSdk, + )..add( const PriceChartStarted( symbols: ['KMD'], period: Duration(days: 30), diff --git a/lib/bloc/cex_market_data/price_chart/price_chart_bloc.dart b/lib/bloc/cex_market_data/price_chart/price_chart_bloc.dart index b20a7f89d3..84dc4bc4fa 100644 --- a/lib/bloc/cex_market_data/price_chart/price_chart_bloc.dart +++ b/lib/bloc/cex_market_data/price_chart/price_chart_bloc.dart @@ -1,5 +1,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:komodo_cex_market_data/komodo_cex_market_data.dart'; +import 'package:komodo_defi_sdk/komodo_defi_sdk.dart'; import 'package:web_dex/shared/utils/utils.dart'; import 'models/price_chart_data.dart'; @@ -7,13 +8,15 @@ import 'price_chart_event.dart'; import 'price_chart_state.dart'; class PriceChartBloc extends Bloc { - PriceChartBloc(this.cexPriceRepository) : super(const PriceChartState()) { + PriceChartBloc(this.cexPriceRepository, this.sdk) + : super(const PriceChartState()) { on(_onStarted); on(_onIntervalChanged); on(_onSymbolChanged); } final BinanceRepository cexPriceRepository; + final KomodoDefiSdk sdk; final KomodoPriceRepository _komodoPriceRepository = KomodoPriceRepository( cexPriceProvider: KomodoPriceProvider(), ); @@ -30,6 +33,11 @@ class PriceChartBloc extends Bloc { if (state.availableCoins.isEmpty) { final coins = (await cexPriceRepository.getCoinList()) .where((coin) => coin.currencies.contains('USDT')) + // `cexPriceRepository.getCoinList()` returns coins from a CEX + // (e.g. Binance), some of which are not in our known/available + // assets/coins list. This filter ensures that we only attempt to + // fetch and display data for supported coins + .where((coin) => sdk.assets.assetsFromTicker(coin.id).length >= 1) .map((coin) async { double? dayChangePercent = coinPrices[coin.symbol]?.change24h; diff --git a/lib/router/navigators/app_router_delegate.dart b/lib/router/navigators/app_router_delegate.dart index d59a02c6dd..90f70b0f4d 100644 --- a/lib/router/navigators/app_router_delegate.dart +++ b/lib/router/navigators/app_router_delegate.dart @@ -37,7 +37,9 @@ class AppRouterDelegate extends RouterDelegate materialPageContext = context; return GestureDetector( onTap: () => runDropdownDismiss(context), - child: const MainLayout(), + child: MainLayout( + key: ValueKey('${routingState.selectedMenu}'), + ), ); }, ), diff --git a/packages/komodo_ui_kit/pubspec.lock b/packages/komodo_ui_kit/pubspec.lock index cee3945cd7..13075d3978 100644 --- a/packages/komodo_ui_kit/pubspec.lock +++ b/packages/komodo_ui_kit/pubspec.lock @@ -95,7 +95,7 @@ packages: description: path: "packages/komodo_defi_rpc_methods" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -104,7 +104,7 @@ packages: description: path: "packages/komodo_defi_types" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -113,7 +113,7 @@ packages: description: path: "packages/komodo_ui" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" diff --git a/pubspec.lock b/pubspec.lock index 183d93a51e..326d373f46 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -666,7 +666,7 @@ packages: description: path: "packages/komodo_coins" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -675,7 +675,7 @@ packages: description: path: "packages/komodo_defi_framework" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0" @@ -684,7 +684,7 @@ packages: description: path: "packages/komodo_defi_local_auth" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -693,7 +693,7 @@ packages: description: path: "packages/komodo_defi_rpc_methods" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -702,7 +702,7 @@ packages: description: path: "packages/komodo_defi_sdk" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -711,7 +711,7 @@ packages: description: path: "packages/komodo_defi_types" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -727,7 +727,7 @@ packages: description: path: "packages/komodo_ui" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0" @@ -743,7 +743,7 @@ packages: description: path: "packages/komodo_wallet_build_transformer" ref: dev - resolved-ref: "9c75bb7b2d3a556cec4119ad29fdb7fa93fe599e" + resolved-ref: afcdfd97b909b6f7cbd9f04c25f57a11031bcaf6 url: "https://github.com/KomodoPlatform/komodo-defi-sdk-flutter.git" source: git version: "0.2.0+0"