From 861616fda2da5006d5ed6efcb32ca45d1f82743e Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Wed, 1 Mar 2023 23:24:52 +0200 Subject: [PATCH] use Http protocol for onion connection --- lib/core/fiat_conversion_service.dart | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/core/fiat_conversion_service.dart b/lib/core/fiat_conversion_service.dart index 95c1e23a4..66997675d 100644 --- a/lib/core/fiat_conversion_service.dart +++ b/lib/core/fiat_conversion_service.dart @@ -12,18 +12,23 @@ Future _fetchPrice(Map args) async { final crypto = args['crypto'] as CryptoCurrency; final fiat = args['fiat'] as FiatCurrency; final torOnly = args['torOnly'] as bool; + + final Map queryParams = { + 'interval_count': '1', + 'base': crypto.toString(), + 'quote': fiat.toString(), + }; + double price = 0.0; try { - final uri = Uri.https( - torOnly ? _fiatApiOnionAuthority : _fiatApiClearNetAuthority, - _fiatApiPath, - { - 'interval_count': '1', - 'base': crypto.toString(), - 'quote': fiat.toString(), - }, - ); + late final Uri uri; + if (torOnly) { + uri = Uri.http(_fiatApiOnionAuthority, _fiatApiPath, queryParams); + } else { + uri = Uri.https(_fiatApiClearNetAuthority, _fiatApiPath, queryParams); + } + final response = await get(uri); if (response.statusCode != 200) {