add tezos rpc node test connection logic

This commit is contained in:
julian 2023-11-21 15:10:58 -06:00
parent f524bc1d87
commit 700943ada4
3 changed files with 25 additions and 4 deletions

View file

@ -30,6 +30,7 @@ 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/wallets/api/tezos/tezos_rpc_api.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
@ -205,9 +206,15 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
case Coin.nano:
case Coin.banano:
case Coin.tezos:
throw UnimplementedError();
//TODO: check network/node
case Coin.tezos:
try {
testPassed = await TezosRpcAPI.testNetworkConnection(
nodeInfo: (host: formData.host!, port: formData.port!),
);
} catch (_) {}
break;
}
if (showFlushBar && mounted) {

View file

@ -29,6 +29,7 @@ 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/wallets/api/tezos/tezos_rpc_api.dart';
import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
@ -173,10 +174,16 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
case Coin.nano:
case Coin.banano:
case Coin.tezos:
// TODO: fix this lacking code
throw UnimplementedError();
//TODO: check network/node
case Coin.tezos:
try {
testPassed = await TezosRpcAPI.testNetworkConnection(
nodeInfo: (host: node!.host, port: node!.port),
);
} catch (_) {}
break;
case Coin.stellar:
case Coin.stellarTestnet:
try {

View file

@ -33,6 +33,7 @@ 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/wallets/api/tezos/tezos_rpc_api.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/expandable.dart';
@ -194,9 +195,15 @@ class _NodeCardState extends ConsumerState<NodeCard> {
case Coin.nano:
case Coin.banano:
case Coin.tezos:
//TODO: check network/node
throw UnimplementedError();
//TODO: check network/node
case Coin.tezos:
try {
testPassed = await TezosRpcAPI.testNetworkConnection(
nodeInfo: (host: node.host, port: node.port),
);
} catch (_) {}
break;
case Coin.stellar:
case Coin.stellarTestnet:
try {