From 983a4b7b41c594606b1cec1dccfb06a7924019f3 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 2 Oct 2026 21:05:27 -0500 Subject: [PATCH 1/2] fix(trocador): update the rotated onion address Trocador retired trocadorfyhlu27aefre5u7zri66gudtzdyelymftvr4yjwcxhfaqsid.onion and now serves the API from 65bsisadnxvw4kfz7h7a3jwcyenrhluuj3kd5toslfzxbk5q4m3wy6qd.onion over plain HTTP. Nothing used the constant yet, so this only prepares it. --- lib/services/exchange/trocador/trocador_api.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/exchange/trocador/trocador_api.dart b/lib/services/exchange/trocador/trocador_api.dart index 8ae2ed9b5..704f94401 100644 --- a/lib/services/exchange/trocador/trocador_api.dart +++ b/lib/services/exchange/trocador/trocador_api.dart @@ -31,7 +31,7 @@ const kTrocadorRefCode = "9eHm9BkQfS"; abstract class TrocadorAPI { static const String authority = "api.trocador.app"; static const String onionAuthority = - "trocadorfyhlu27aefre5u7zri66gudtzdyelymftvr4yjwcxhfaqsid.onion"; + "65bsisadnxvw4kfz7h7a3jwcyenrhluuj3kd5toslfzxbk5q4m3wy6qd.onion"; static const String markup = "1"; static const String minKYCRating = "C"; From a8e46a5af3f569b4fdd3b17159c992c8a8dff8a0 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 2 Oct 2026 21:05:27 -0500 Subject: [PATCH 2/2] feat(trocador): use the onion endpoint when Tor is enabled Every caller hard-coded isOnion: false, so Tor users still exited Tor to reach api.trocador.app. Decide the authority in one place from the same condition that selects the SOCKS proxy: when the request goes through Tor it targets the onion, otherwise the clearnet host. --- .../exchange/trocador/trocador_api.dart | 51 +++++-------------- .../exchange/trocador/trocador_exchange.dart | 11 +--- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/lib/services/exchange/trocador/trocador_api.dart b/lib/services/exchange/trocador/trocador_api.dart index 704f94401..8b589e174 100644 --- a/lib/services/exchange/trocador/trocador_api.dart +++ b/lib/services/exchange/trocador/trocador_api.dart @@ -37,12 +37,11 @@ abstract class TrocadorAPI { static const String minKYCRating = "C"; static HTTP client = HTTP(); - static Uri _buildUri({ - required String method, - required bool isOnion, - Map? params, - }) { - return isOnion + static bool get _useTor => + AppConfig.hasFeature(AppFeature.tor) && Prefs.instance.useTor; + + static Uri _buildUri({required String method, Map? params}) { + return _useTor ? Uri.http(onionAuthority, method, params) : Uri.https(authority, method, params); } @@ -57,11 +56,7 @@ abstract class TrocadorAPI { "Content-Type": "application/json", "API-KEY": kTrocadorApiKey, }, - proxyInfo: !AppConfig.hasFeature(AppFeature.tor) - ? null - : Prefs.instance.useTor - ? TorService.sharedInstance.getProxyInfo() - : null, + proxyInfo: _useTor ? TorService.sharedInstance.getProxyInfo() : null, ); code = response.code; @@ -87,14 +82,8 @@ abstract class TrocadorAPI { } /// fetch all supported coins - static Future>> getCoins({ - required bool isOnion, - }) async { - final uri = _buildUri( - isOnion: isOnion, - method: "coins", - params: {"ref": kTrocadorRefCode}, - ); + static Future>> getCoins() async { + final uri = _buildUri(method: "coins", params: {"ref": kTrocadorRefCode}); try { final json = await _makeGetRequest(uri); @@ -122,11 +111,9 @@ abstract class TrocadorAPI { /// get trade info static Future> getTrade({ - required bool isOnion, required String tradeId, }) async { final uri = _buildUri( - isOnion: isOnion, method: "trade", params: {"ref": kTrocadorRefCode, "id": tradeId}, ); @@ -149,7 +136,6 @@ abstract class TrocadorAPI { /// get standard/floating rate static Future> getNewStandardRate({ - required bool isOnion, required String fromTicker, required String fromNetwork, required String toTicker, @@ -168,12 +154,11 @@ abstract class TrocadorAPI { "markup": markup, }; - return await _getNewRate(isOnion: isOnion, params: params); + return await _getNewRate(params: params); } /// get fixed rate/payment rate static Future> getNewPaymentRate({ - required bool isOnion, required String fromTicker, required String fromNetwork, required String toTicker, @@ -192,14 +177,13 @@ abstract class TrocadorAPI { "markup": markup, }; - return await _getNewRate(isOnion: isOnion, params: params); + return await _getNewRate(params: params); } static Future> _getNewRate({ - required bool isOnion, required Map params, }) async { - final uri = _buildUri(isOnion: isOnion, method: "new_rate", params: params); + final uri = _buildUri(method: "new_rate", params: params); try { final json = await _makeGetRequest(uri); @@ -219,7 +203,6 @@ abstract class TrocadorAPI { /// create new floating rate/standard trade static Future> createNewStandardRateTrade({ - required bool isOnion, required String? rateId, required String fromTicker, required String fromNetwork, @@ -255,11 +238,10 @@ abstract class TrocadorAPI { params["id"] = rateId; } - return await _getNewTrade(isOnion: isOnion, params: params); + return await _getNewTrade(params: params); } static Future> createNewPaymentRateTrade({ - required bool isOnion, required String? rateId, required String fromTicker, required String fromNetwork, @@ -295,18 +277,13 @@ abstract class TrocadorAPI { params["id"] = rateId; } - return await _getNewTrade(isOnion: isOnion, params: params); + return await _getNewTrade(params: params); } static Future> _getNewTrade({ - required bool isOnion, required Map params, }) async { - final uri = _buildUri( - isOnion: isOnion, - method: "new_trade", - params: params, - ); + final uri = _buildUri(method: "new_trade", params: params); try { final json = await _makeGetRequest(uri); diff --git a/lib/services/exchange/trocador/trocador_exchange.dart b/lib/services/exchange/trocador/trocador_exchange.dart index 9f9e5f9de..5a4157fd3 100644 --- a/lib/services/exchange/trocador/trocador_exchange.dart +++ b/lib/services/exchange/trocador/trocador_exchange.dart @@ -69,7 +69,6 @@ class TrocadorExchange extends Exchange { }) async { final response = reversed ? await TrocadorAPI.createNewPaymentRateTrade( - isOnion: false, rateId: estimate?.rateId, fromTicker: from.toLowerCase(), fromNetwork: onlySupportedNetwork, @@ -84,7 +83,6 @@ class TrocadorExchange extends Exchange { isFixedRate: fixedRate, ) : await TrocadorAPI.createNewStandardRateTrade( - isOnion: false, rateId: estimate?.rateId, fromTicker: from.toLowerCase(), fromNetwork: onlySupportedNetwork, @@ -139,7 +137,7 @@ class TrocadorExchange extends Exchange { Future>> getAllCurrencies( bool fixedRate, ) async { - _cachedCurrencies ??= (await TrocadorAPI.getCoins(isOnion: false)).value; + _cachedCurrencies ??= (await TrocadorAPI.getCoins()).value; _cachedCurrencies?.removeWhere((e) => e.network != onlySupportedNetwork); @@ -222,7 +220,6 @@ class TrocadorExchange extends Exchange { ) async { final response = reversed ? await TrocadorAPI.getNewPaymentRate( - isOnion: false, fromTicker: from, fromNetwork: onlySupportedNetwork, toTicker: to, @@ -230,7 +227,6 @@ class TrocadorExchange extends Exchange { toAmount: amount.toString(), ) : await TrocadorAPI.getNewStandardRate( - isOnion: false, fromTicker: from, fromNetwork: onlySupportedNetwork, toTicker: to, @@ -367,10 +363,7 @@ class TrocadorExchange extends Exchange { @override Future> updateTrade(Trade trade) async { - final response = await TrocadorAPI.getTrade( - isOnion: false, - tradeId: trade.tradeId, - ); + final response = await TrocadorAPI.getTrade(tradeId: trade.tradeId); if (response.value != null) { final updated = response.value!;