mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
no need for class wide htt client property, and close the client before assigning a new one
This commit is contained in:
parent
49dbf5b77f
commit
bcb39c3906
1 changed files with 14 additions and 6 deletions
|
@ -46,7 +46,6 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
||||||
// ============== Private ====================================================
|
// ============== Private ====================================================
|
||||||
|
|
||||||
stellar.StellarSDK? _stellarSdk;
|
stellar.StellarSDK? _stellarSdk;
|
||||||
HttpClient? _httpClient;
|
|
||||||
|
|
||||||
Future<int> _getBaseFee() async {
|
Future<int> _getBaseFee() async {
|
||||||
final fees = await stellarSdk.feeStats.execute();
|
final fees = await stellarSdk.feeStats.execute();
|
||||||
|
@ -55,6 +54,7 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
||||||
|
|
||||||
void _updateSdk() {
|
void _updateSdk() {
|
||||||
final currentNode = getCurrentNode();
|
final currentNode = getCurrentNode();
|
||||||
|
HttpClient? _httpClient;
|
||||||
|
|
||||||
// TODO [prio=med]: refactor out and call before requests in case Tor is enabled/disabled, listen to prefs change, or similar.
|
// TODO [prio=med]: refactor out and call before requests in case Tor is enabled/disabled, listen to prefs change, or similar.
|
||||||
if (prefs.useTor) {
|
if (prefs.useTor) {
|
||||||
|
@ -63,13 +63,21 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
||||||
|
|
||||||
_httpClient = HttpClient();
|
_httpClient = HttpClient();
|
||||||
SocksTCPClient.assignToHttpClient(
|
SocksTCPClient.assignToHttpClient(
|
||||||
_httpClient!, [ProxySettings(proxyInfo.host, proxyInfo.port)]);
|
_httpClient,
|
||||||
} else {
|
[
|
||||||
_httpClient = null;
|
ProxySettings(
|
||||||
|
proxyInfo.host,
|
||||||
|
proxyInfo.port,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_stellarSdk = stellar.StellarSDK("${currentNode.host}:${currentNode.port}",
|
_stellarSdk?.httpClient.close();
|
||||||
httpClient: _httpClient);
|
_stellarSdk = stellar.StellarSDK(
|
||||||
|
"${currentNode.host}:${currentNode.port}",
|
||||||
|
httpClient: _httpClient,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _accountExists(String accountId) async {
|
Future<bool> _accountExists(String accountId) async {
|
||||||
|
|
Loading…
Reference in a new issue