fetchNetworkInfo method

Future<NodeInfoResponse> fetchNetworkInfo({
  1. Client? client,
})

Implementation

Future<NodeInfoResponse> fetchNetworkInfo({http.Client? client}) async {
  client ??= http.Client();

  final nodeInfoUri = Uri.parse('${lcdUrl.toString()}/node_info');

  final response = await client.get(nodeInfoUri);

  if (response.statusCode != 200 || response.body.isEmpty) {
    throw Exception(
        'Could not find node info (status ${response.statusCode})');
  }

  return NodeInfoResponse.fromJson(jsonDecode(response.body));
}