diff --git a/lib/pages/exchange_view/exchange_form.dart b/lib/pages/exchange_view/exchange_form.dart index 76bba50ad..3d4dcfcde 100644 --- a/lib/pages/exchange_view/exchange_form.dart +++ b/lib/pages/exchange_view/exchange_form.dart @@ -149,6 +149,8 @@ class _ExchangeFormState extends ConsumerState { currency.ticker, caseSensitive: false, ) + .and() + .tokenContractEqualTo(currency.tokenContract) .findAll(); final items = [Tuple2(currency.exchangeName, currency)]; @@ -631,6 +633,7 @@ class _ExchangeFormState extends ConsumerState { .getAggregateCurrency( widget.contract == null ? coin!.ticker : widget.contract!.symbol, ExchangeRateType.estimated, + widget.contract == null ? null : widget.contract!.address, ) .then((value) { if (value != null) { diff --git a/lib/services/exchange/exchange_data_loading_service.dart b/lib/services/exchange/exchange_data_loading_service.dart index 8e73e46a9..4eed07504 100644 --- a/lib/services/exchange/exchange_data_loading_service.dart +++ b/lib/services/exchange/exchange_data_loading_service.dart @@ -61,10 +61,12 @@ class ExchangeDataLoadingService { final sendCurrency = await getAggregateCurrency( "BTC", state.exchangeRateType, + null, ); final receiveCurrency = await getAggregateCurrency( "XMR", state.exchangeRateType, + null, ); state.setCurrencies(sendCurrency, receiveCurrency); } @@ -72,7 +74,10 @@ class ExchangeDataLoadingService { } Future getAggregateCurrency( - String ticker, ExchangeRateType rateType) async { + String ticker, + ExchangeRateType rateType, + String? contract, + ) async { final currencies = await ExchangeDataLoadingService.instance.isar.currencies .filter() .group((q) => rateType == ExchangeRateType.fixed @@ -89,6 +94,8 @@ class ExchangeDataLoadingService { ticker, caseSensitive: false, ) + .and() + .tokenContractEqualTo(contract) .findAll(); final items = currencies