mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +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 ====================================================
|
||||
|
||||
stellar.StellarSDK? _stellarSdk;
|
||||
HttpClient? _httpClient;
|
||||
|
||||
Future<int> _getBaseFee() async {
|
||||
final fees = await stellarSdk.feeStats.execute();
|
||||
|
@ -55,6 +54,7 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
|||
|
||||
void _updateSdk() {
|
||||
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.
|
||||
if (prefs.useTor) {
|
||||
|
@ -63,13 +63,21 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
|||
|
||||
_httpClient = HttpClient();
|
||||
SocksTCPClient.assignToHttpClient(
|
||||
_httpClient!, [ProxySettings(proxyInfo.host, proxyInfo.port)]);
|
||||
} else {
|
||||
_httpClient = null;
|
||||
_httpClient,
|
||||
[
|
||||
ProxySettings(
|
||||
proxyInfo.host,
|
||||
proxyInfo.port,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_stellarSdk = stellar.StellarSDK("${currentNode.host}:${currentNode.port}",
|
||||
httpClient: _httpClient);
|
||||
_stellarSdk?.httpClient.close();
|
||||
_stellarSdk = stellar.StellarSDK(
|
||||
"${currentNode.host}:${currentNode.port}",
|
||||
httpClient: _httpClient,
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> _accountExists(String accountId) async {
|
||||
|
|
Loading…
Reference in a new issue