stack_wallet/lib/utilities/test_eth_node_connection.dart
2024-05-27 18:01:41 -06:00

12 lines
305 B
Dart

import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart' as web3;
Future<bool> testEthNodeConnection(String host) async {
final web3.Web3Client client = web3.Web3Client(host, Client());
try {
await client.getBlockNumber();
return true;
} catch (_) {
return false;
}
}