feat(tor): add Tor endpoints for fiat-api and service-api (#2339)

cyan committed Jun 27, 2025 at 14:05 UTC 73588071ba5065a2df37a4d1bf5a041e4e071048
2 files changed +12 -8
lib/core/fiat_conversion_service.dart
+1 -2
@@ -5,8 +5,7 @@ import 'dart:convert';
5 import 'package:cake_wallet/.secrets.g.dart' as secrets;
6
7 const _fiatApiClearNetAuthority = 'fiat-api.cakewallet.com';
8 -// const _fiatApiOnionAuthority = 'n4z7bdcmwk2oyddxvzaap3x2peqcplh3pzdy7tpkk5ejz5n4mhfvoxqd.onion';
9 -const _fiatApiOnionAuthority = _fiatApiClearNetAuthority;
8 +const _fiatApiOnionAuthority = 'kfkyguqtz5vcnbvar5pjgddkaeawbo4j3r4fj3e22k3tzqageplosiid.onion';
9 const _fiatApiPath = '/v2/rates';
10
11 Future<double> _fetchPrice(String crypto, String fiat, bool torOnly) async {
lib/view_model/dashboard/dashboard_view_model.dart
+11 -6
@@ -1123,13 +1123,18 @@ abstract class DashboardViewModelBase with Store {
1123 Future<ServicesResponse> _getServicesStatus() async {
1124 try {
1125 if (isEnabledBulletinAction) {
1126 - final uri = Uri.https(
1127 - "service-api.cakewallet.com",
1128 - "/v1/active-notices",
1129 - {'key': secrets.fiatApiKey},
1126 + final res = await ProxyWrapper().get(
1127 + clearnetUri: Uri.https(
1128 + "service-api.cakewallet.com",
1129 + "/v1/active-notices",
1130 + {'key': secrets.fiatApiKey},
1131 + ),
1132 + onionUri: Uri.http(
1133 + "jpirgl4lrwzjgdqj2nsv3g7twhp2efzty5d3cnypktyczzqfc5qcwwyd.onion",
1134 + "/v1/active-notices",
1135 + {'key': secrets.fiatApiKey},
1136 + ),
1137 );
1131 -
1132 - final res = await ProxyWrapper().get(clearnetUri: uri);
1138 if (res.statusCode < 200 || res.statusCode >= 300) {
1139 throw res.body;
1140 }