getCurrentHeight method

Future<int> getCurrentHeight()

Implementation

Future<int> getCurrentHeight() async {
  final resp = await _layer1ApiGet('/blockchain');

  if (resp.statusCode == HttpStatus.ok) {
    final body = json.decode(resp.body);
    final blockchainResp = BlockchainResponse.fromJson(body['data']);
    return blockchainResp.block.height;
  }

  return Future.error(HttpResponseError(resp.statusCode, resp.body));
}