getTransactionIndex function

dynamic getTransactionIndex(
  1. String address,
  2. String endpoint
)

Implementation

dynamic getTransactionIndex(String address, String endpoint) async {
  final Map<String, String> requestHeaders = {
    'Content-type': 'application/json',
    'Accept': 'application/json',
  };

  http.Response responseHttp = await http.post(Uri.parse(endpoint + "/api"),
      body: json.encode("{query: 'query {lastTransaction(address: " +
          address +
          ") {chainLength}}'"),
      headers: requestHeaders);

  return json.decode(responseHttp.body);
}