mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
fix: missing eth case
This commit is contained in:
parent
243994ff45
commit
774bfe517e
4 changed files with 39 additions and 0 deletions
|
@ -14,6 +14,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/test_epic_box_connection.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_monero_node_connection.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
@ -150,6 +151,14 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Coin.ethereum:
|
||||||
|
try {
|
||||||
|
testPassed = await testEthNodeConnection(node!.host);
|
||||||
|
} catch (_) {
|
||||||
|
testPassed = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPassed) {
|
if (testPassed) {
|
||||||
|
|
12
lib/utilities/test_eth_node_connection.dart
Normal file
12
lib/utilities/test_eth_node_connection.dart
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
import 'package:web3dart/web3dart.dart' as web3;
|
||||||
|
|
||||||
|
Future<bool> testEthNodeConnection(String host) async {
|
||||||
|
web3.Web3Client client = web3.Web3Client(host, Client());
|
||||||
|
try {
|
||||||
|
await client.getBlockNumber();
|
||||||
|
return true;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/test_epic_box_connection.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_monero_node_connection.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
@ -172,6 +173,14 @@ class _NodeCardState extends ConsumerState<NodeCard> {
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Coin.ethereum:
|
||||||
|
try {
|
||||||
|
testPassed = await testEthNodeConnection(node.host);
|
||||||
|
} catch (_) {
|
||||||
|
testPassed = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPassed) {
|
if (testPassed) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/test_epic_box_connection.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_monero_node_connection.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
@ -155,6 +156,14 @@ class NodeOptionsSheet extends ConsumerWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Coin.ethereum:
|
||||||
|
try {
|
||||||
|
testPassed = await testEthNodeConnection(node.host);
|
||||||
|
} catch (_) {
|
||||||
|
testPassed = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPassed) {
|
if (testPassed) {
|
||||||
|
|
Loading…
Reference in a new issue