diff --git a/lib/wallets/wallet/impl/monero_wallet.dart b/lib/wallets/wallet/impl/monero_wallet.dart index 9ed4b0da7..ce81d1552 100644 --- a/lib/wallets/wallet/impl/monero_wallet.dart +++ b/lib/wallets/wallet/impl/monero_wallet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:math'; import 'package:cw_core/monero_transaction_priority.dart'; @@ -21,6 +22,7 @@ import 'package:isar/isar.dart'; import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; +import 'package:stackwallet/services/tor_service.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackwallet/utilities/logger.dart'; @@ -153,13 +155,18 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { final node = getCurrentNode(); final host = Uri.parse(node.host).host; + ({InternetAddress host, int port})? proxy; + if (prefs.useTor) { + proxy = TorService.sharedInstance.getProxyInfo(); + } await CwBasedInterface.cwWalletBase?.connectToNode( node: Node( uri: "$host:${node.port}", type: WalletType.monero, trusted: node.trusted ?? false, ), - socksProxyAddress: null, + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", ); } diff --git a/lib/wallets/wallet/impl/wownero_wallet.dart b/lib/wallets/wallet/impl/wownero_wallet.dart index 46ad5726a..5c9e481a2 100644 --- a/lib/wallets/wallet/impl/wownero_wallet.dart +++ b/lib/wallets/wallet/impl/wownero_wallet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:math'; import 'package:cw_core/monero_transaction_priority.dart'; @@ -11,7 +12,6 @@ import 'package:cw_core/wallet_credentials.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cw_monero/api/exceptions/creation_transaction_exception.dart'; -import 'package:cw_wownero/api/wallet.dart'; import 'package:cw_wownero/pending_wownero_transaction.dart'; import 'package:cw_wownero/wownero_wallet.dart'; import 'package:decimal/decimal.dart'; @@ -23,6 +23,7 @@ import 'package:isar/isar.dart'; import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; +import 'package:stackwallet/services/tor_service.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackwallet/utilities/logger.dart'; @@ -143,13 +144,18 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { final node = getCurrentNode(); final host = Uri.parse(node.host).host; + ({InternetAddress host, int port})? proxy; + if (prefs.useTor) { + proxy = TorService.sharedInstance.getProxyInfo(); + } await CwBasedInterface.cwWalletBase?.connectToNode( node: Node( uri: "$host:${node.port}", type: WalletType.wownero, trusted: node.trusted ?? false, ), - socksProxyAddress: null, + socksProxyAddress: + proxy == null ? null : "${proxy.host.address}:${proxy.port}", ); } @@ -332,7 +338,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { // days: // 2))); // subtract a couple days to ensure we have a buffer for SWB // TODO(mrcyjanek): implement - final bufferedCreateHeight = + const bufferedCreateHeight = 1; //getSeedHeightSync(wallet!.seed.trim()); await info.updateRestoreHeight(