Set trusted daemon after node connection

OmarHatem committed Oct 20, 2022 at 20:24 UTC 1eb9e65617e85ef2d70d7c324865c8cde8137565
3 files changed +4 -15
cw_haven/lib/haven_wallet.dart
+2 -4
@@ -121,6 +121,8 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
121 password: node.password,
122 useSSL: node.useSSL ?? false,
123 isLightWallet: false); // FIXME: hardcoded value
124 +
125 + haven_wallet.setTrustedDaemon(node.trusted);
126 syncStatus = ConnectedSyncStatus();
127 } catch (e) {
128 syncStatus = FailedSyncStatus();
@@ -394,8 +396,4 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
396 print(e.toString());
397 }
398 }
397 -
398 - void setTrustedDaemon(bool arg) => haven_wallet.setTrustedDaemon(arg);
399 -
400 - Future<bool> trustedDaemon() async => haven_wallet.trustedDaemon();
399 }
cw_monero/lib/monero_wallet.dart
+2 -4
@@ -136,6 +136,8 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
136 password: node.password,
137 useSSL: node.isSSL,
138 isLightWallet: false); // FIXME: hardcoded value
139 +
140 + monero_wallet.setTrustedDaemon(node.trusted);
141 syncStatus = ConnectedSyncStatus();
142 } catch (e) {
143 syncStatus = FailedSyncStatus();
@@ -432,8 +434,4 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
434 print(e.toString());
435 }
436 }
435 -
436 - void setTrustedDaemon(bool arg) => monero_wallet.setTrustedDaemon(arg);
437 -
438 - Future<bool> trustedDaemon() async => monero_wallet.trustedDaemon();
437 }
lib/view_model/node_list/node_create_or_edit_view_model.dart
-7
@@ -1,6 +1,4 @@
1 import 'package:cake_wallet/core/execution_state.dart';
2 -import 'package:cw_haven/haven_wallet.dart';
3 -import 'package:cw_monero/monero_wallet.dart';
2 import 'package:hive/hive.dart';
3 import 'package:mobx/mobx.dart';
4 import 'package:cw_core/wallet_base.dart';
@@ -84,11 +82,6 @@ abstract class NodeCreateOrEditViewModelBase with Store {
82 final node =
83 Node(uri: uri, type: _wallet.type, login: login, password: password,
84 useSSL: useSSL, trusted: trusted);
87 - if (_wallet.type == WalletType.monero) {
88 - (_wallet as MoneroWallet).setTrustedDaemon(trusted);
89 - } else if (_wallet.type == WalletType.haven) {
90 - (_wallet as HavenWallet).setTrustedDaemon(trusted);
91 - }
85 await _nodeSource.add(node);
86 state = ExecutedSuccessfullyState();
87 } catch (e) {