getTransactionByWallet method
Implementation
Future<List<Transaction>> getTransactionByWallet({
required String address,
required EvmChain chain,
}) async {
final String chainName = EvmChainHelper.getChainName(chaintype: chain);
try {
final response = await _fetch(address, parameters: {"chain": chainName});
final responseData = jsonDecode(response.body);
Constants.logger.d(responseData);
if (response.statusCode != 200) {
Constants.logger.w(responseData["message"]);
throw responseData["message"];
} else {
if (responseData is Map<String, dynamic>) {
final apiResponse = ApiResponse.fromJson(responseData);
final transactions = apiResponse.result;
if (transactions.isNotEmpty) {
return transactions;
}
}
}
} catch (error) {
Constants.logger.w(error);
return [];
}
return [];
}