mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
tor proxy support
This commit is contained in:
parent
7929d49e27
commit
90fca36b77
2 changed files with 17 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cw_core/monero_transaction_priority.dart';
|
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/db/hive/db.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.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/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
@ -153,13 +155,18 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
||||||
final node = getCurrentNode();
|
final node = getCurrentNode();
|
||||||
|
|
||||||
final host = Uri.parse(node.host).host;
|
final host = Uri.parse(node.host).host;
|
||||||
|
({InternetAddress host, int port})? proxy;
|
||||||
|
if (prefs.useTor) {
|
||||||
|
proxy = TorService.sharedInstance.getProxyInfo();
|
||||||
|
}
|
||||||
await CwBasedInterface.cwWalletBase?.connectToNode(
|
await CwBasedInterface.cwWalletBase?.connectToNode(
|
||||||
node: Node(
|
node: Node(
|
||||||
uri: "$host:${node.port}",
|
uri: "$host:${node.port}",
|
||||||
type: WalletType.monero,
|
type: WalletType.monero,
|
||||||
trusted: node.trusted ?? false,
|
trusted: node.trusted ?? false,
|
||||||
),
|
),
|
||||||
socksProxyAddress: null,
|
socksProxyAddress:
|
||||||
|
proxy == null ? null : "${proxy.host.address}:${proxy.port}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cw_core/monero_transaction_priority.dart';
|
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_info.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:cw_monero/api/exceptions/creation_transaction_exception.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/pending_wownero_transaction.dart';
|
||||||
import 'package:cw_wownero/wownero_wallet.dart';
|
import 'package:cw_wownero/wownero_wallet.dart';
|
||||||
import 'package:decimal/decimal.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/db/hive/db.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.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/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
@ -143,13 +144,18 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface {
|
||||||
final node = getCurrentNode();
|
final node = getCurrentNode();
|
||||||
|
|
||||||
final host = Uri.parse(node.host).host;
|
final host = Uri.parse(node.host).host;
|
||||||
|
({InternetAddress host, int port})? proxy;
|
||||||
|
if (prefs.useTor) {
|
||||||
|
proxy = TorService.sharedInstance.getProxyInfo();
|
||||||
|
}
|
||||||
await CwBasedInterface.cwWalletBase?.connectToNode(
|
await CwBasedInterface.cwWalletBase?.connectToNode(
|
||||||
node: Node(
|
node: Node(
|
||||||
uri: "$host:${node.port}",
|
uri: "$host:${node.port}",
|
||||||
type: WalletType.wownero,
|
type: WalletType.wownero,
|
||||||
trusted: node.trusted ?? false,
|
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:
|
// days:
|
||||||
// 2))); // subtract a couple days to ensure we have a buffer for SWB
|
// 2))); // subtract a couple days to ensure we have a buffer for SWB
|
||||||
// TODO(mrcyjanek): implement
|
// TODO(mrcyjanek): implement
|
||||||
final bufferedCreateHeight =
|
const bufferedCreateHeight =
|
||||||
1; //getSeedHeightSync(wallet!.seed.trim());
|
1; //getSeedHeightSync(wallet!.seed.trim());
|
||||||
|
|
||||||
await info.updateRestoreHeight(
|
await info.updateRestoreHeight(
|
||||||
|
|
Loading…
Reference in a new issue