Implementation
Future<TransactionChainResponse> getTransactions(
String address, String endpoint) async {
final Map<String, String> requestHeaders = {
'Content-type': 'application/json',
'Accept': 'application/json',
};
final String _json = json.encode('query {' +
' transactionChain(address: ' +
address +
') {' +
' address,' +
' timestamp,' +
' type,' +
' data {' +
' ledger {' +
' uco {' +
' transfers {' +
' amount,' +
' to' +
' }' +
' },' +
' nft {' +
' transfers {' +
' amount,' +
' to,' +
' nft' +
' }' +
' }' +
' }' +
' }' +
' }' +
'}');
final http.Response responseHttp = await http
.post(Uri.parse(endpoint + '/api'), body: _json, headers: requestHeaders);
final Completer<TransactionChainResponse> _completer =
Completer<TransactionChainResponse>();
TransactionChainResponse? transactionChainResponse;
if (responseHttp.statusCode == 200) {
transactionChainResponse =
transactionChainResponseFromJson(responseHttp.body);
}
_completer.complete(transactionChainResponse!);
return _completer.future;
}