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