Fix calling wrong path

OmarHatem committed Mar 2, 2023 at 21:13 UTC 60f47e5e9fed8d83252014a4814eca045b6fd0b5
1 file changed +7 -6
lib/exchange/trocador/trocador_exchange_provider.dart
+7 -6
@@ -290,22 +290,23 @@ class TrocadorExchangeProvider extends ExchangeProvider {
290 }
291 }
292
293 - Future<Uri> _getUri(String createTradePath, Map<String, String> queryParams) async {
293 + Future<Uri> _getUri(String path, Map<String, String> queryParams) async {
294 if (!supportsOnionAddress) {
295 - return Uri.https(clearNetAuthority, tradePath, queryParams);
295 + return Uri.https(clearNetAuthority, path, queryParams);
296 }
297
298 + final uri = Uri.http(onionApiAuthority, path, queryParams);
299 +
300 if (useTorOnly) {
299 - return Uri.http(onionApiAuthority, tradePath, queryParams);
301 + return uri;
302 }
303
304 try {
303 - final uri = Uri.http(onionApiAuthority, tradePath);
305 await get(uri);
306
306 - return Uri.http(onionApiAuthority, tradePath, queryParams);
307 + return uri;
308 } catch (e) {
308 - return Uri.https(clearNetAuthority, tradePath, queryParams);
309 + return Uri.https(clearNetAuthority, path, queryParams);
310 }
311 }
312 }