getTransaction method
Query the network to find a transaction Returns all informations represent transaction content.
Implementation
Future<Map<String, Transaction>> getTransaction(
List<String> addresses, {
String request = Transaction.kTransactionQueryAllFields,
}) async {
if (addresses.isEmpty) {
return {};
}
final fragment = 'fragment fields on Transaction { $request }';
final body = StringBuffer()..write('query { ');
for (final address in addresses) {
body.write(
' _$address: transaction(address:"$address") { ...fields }',
);
}
body.write('} $fragment');
final result = await _client
.withLogger(
'getTransaction',
logsActivation: logsActivation,
)
.query(
QueryOptions(
document: gql(body.toString()),
parserFn: (json) {
final transactions = json.mapValues(
(value) {
if (value != null) {
return Transaction.fromJson(value as Map<String, dynamic>);
}
},
keysToIgnore: _responseKeysToIgnore,
);
return removeAliasPrefix<Transaction>(transactions) ?? {};
},
),
);
manageLinkException(result);
return result.parsedData ?? {};
}