diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart index af6256d23..692e34633 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/add_edit_node_view.dart @@ -194,12 +194,15 @@ class _AddEditNodeViewState extends ConsumerState { try { // await client.getSyncStatus(); } catch (_) {} + break; case Coin.stellar: case Coin.stellarTestnet: try { - testPassed = await testStellarNodeConnection(formData.host!); + testPassed = await testStellarNodeConnection(formData.host!, formData.port!); } catch(_) {} + break; + case Coin.nano: case Coin.banano: diff --git a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart index 59ff1efad..3354ca396 100644 --- a/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart +++ b/lib/pages/settings_views/global_settings_view/manage_nodes_views/node_details_view.dart @@ -26,6 +26,7 @@ import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/test_epic_box_connection.dart'; import 'package:stackwallet/utilities/test_eth_node_connection.dart'; import 'package:stackwallet/utilities/test_monero_node_connection.dart'; +import 'package:stackwallet/utilities/test_stellar_node_connection.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/background.dart'; @@ -170,10 +171,17 @@ class _NodeDetailsViewState extends ConsumerState { } break; - case Coin.nano: - case Coin.banano: case Coin.stellar: case Coin.stellarTestnet: + try { + testPassed = await testStellarNodeConnection(node!.host, node.port); + } catch(_) { + testPassed = false; + } + break; + case Coin.nano: + case Coin.banano: + throw UnimplementedError(); //TODO: check network/node } diff --git a/lib/utilities/test_stellar_node_connection.dart b/lib/utilities/test_stellar_node_connection.dart index 504a81efe..683d946c9 100644 --- a/lib/utilities/test_stellar_node_connection.dart +++ b/lib/utilities/test_stellar_node_connection.dart @@ -3,10 +3,10 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; -Future testStellarNodeConnection(String host) async { +Future testStellarNodeConnection(String host, int port) async { final client = http.Client(); - Uri uri = Uri.parse(host); + Uri uri = Uri.parse("$host:$port"); final response = await client.get( uri, headers: {'Content-Type': 'application/json'}, diff --git a/lib/widgets/node_card.dart b/lib/widgets/node_card.dart index 59e3663b5..81fe62357 100644 --- a/lib/widgets/node_card.dart +++ b/lib/widgets/node_card.dart @@ -196,7 +196,7 @@ class _NodeCardState extends ConsumerState { case Coin.stellar: case Coin.stellarTestnet: try { - testPassed = await testStellarNodeConnection(node.host); + testPassed = await testStellarNodeConnection(node.host, node.port); } catch(_) { testPassed = false; }