stack_wallet/lib/utilities/test_eth_node_connection.dart

13 lines
305 B
Dart
Raw Normal View History

2023-05-30 16:38:47 +00:00
import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart' as web3;
Future<bool> testEthNodeConnection(String host) async {
2024-05-27 23:56:22 +00:00
final web3.Web3Client client = web3.Web3Client(host, Client());
2023-05-30 16:38:47 +00:00
try {
await client.getBlockNumber();
return true;
} catch (_) {
return false;
}
}