Merge branch 'flutter-upgrade' of https://github.com/cake-tech/cake_wallet into CW-182-allow-trusted-nodes

 Conflicts:
	cw_core/lib/node.dart
	lib/view_model/node_list/node_create_or_edit_view_model.dart
This commit is contained in:
OmarHatem
2022-10-20 13:18:00 +02:00
507 changed files with 6832 additions and 5981 deletions
@@ -17,6 +17,10 @@ abstract class NodeCreateOrEditViewModelBase with Store {
: state = InitialExecutionState(),
connectionState = InitialExecutionState(),
useSSL = false,
address = '',
port = '',
login = '',
password = '',
trusted = false;
@observable
@@ -45,7 +49,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@computed
bool get isReady =>
(address?.isNotEmpty ?? false) && (port?.isNotEmpty ?? false);
address.isNotEmpty && port.isNotEmpty;
bool get hasAuthCredentials => _wallet.type == WalletType.monero ||
_wallet.type == WalletType.haven;
@@ -53,7 +57,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
String get uri {
var uri = address;
if (port != null && port.isNotEmpty) {
if (port.isNotEmpty) {
uri += ':' + port;
}
@@ -20,7 +20,15 @@ abstract class NodeListViewModelBase with Store {
}
@computed
Node get currentNode => settingsStore.nodes[wallet.type];
Node get currentNode {
final node = settingsStore.nodes[wallet.type];
if (node == null) {
throw Exception('No node for wallet type: ${wallet.type}');
}
return node;
}
final ObservableList<Node> nodes;
final SettingsStore settingsStore;
@@ -34,16 +42,19 @@ abstract class NodeListViewModelBase with Store {
switch (wallet.type) {
case WalletType.bitcoin:
node = getBitcoinDefaultElectrumServer(nodes: _nodeSource);
node = getBitcoinDefaultElectrumServer(nodes: _nodeSource)!;
break;
case WalletType.monero:
node = getMoneroDefaultNode(nodes: _nodeSource);
break;
case WalletType.litecoin:
node = getLitecoinDefaultElectrumServer(nodes: _nodeSource);
node = getLitecoinDefaultElectrumServer(nodes: _nodeSource)!;
break;
case WalletType.haven:
node = getHavenDefaultNode(nodes: _nodeSource)!;
break;
default:
break;
throw Exception('Unexpected wallet type: ${wallet.type}');
}
await setAsCurrent(node);