diff --git a/lib/services/ethereum/ethereum_api.dart b/lib/services/ethereum/ethereum_api.dart index 0f9c42c6c..2e7827d63 100644 --- a/lib/services/ethereum/ethereum_api.dart +++ b/lib/services/ethereum/ethereum_api.dart @@ -427,34 +427,27 @@ abstract class EthereumAPI { } } - static Future> getTokenAbi( - String contractAddress) async { + static Future> getTokenAbi({ + required String name, + required String contractAddress, + }) async { try { final response = await get( Uri.parse( - "$stackBaseServer/abis?addrs=$contractAddress", + "$stackBaseServer/abis?addrs=$contractAddress&verbose=true", ), ); if (response.statusCode == 200) { final json = jsonDecode(response.body)["data"] as List; - // trueblocks api does not contain the `anonymous` value - // web3dart expects it so hack it in - // TODO: fix this if we ever actually need to use contract ABI events - for (final map in json) { - if (map["type"] == "event") { - map["anonymous"] = false; - } - } - return EthereumResponse( jsonEncode(json), null, ); } else { throw EthApiException( - "getTokenAbi($contractAddress) failed with status code: " + "getTokenAbi($name, $contractAddress) failed with status code: " "${response.statusCode}", ); } @@ -465,7 +458,7 @@ abstract class EthereumAPI { ); } catch (e, s) { Logging.instance.log( - "getTokenAbi(): $e\n$s", + "getTokenAbi($name, $contractAddress): $e\n$s", level: LogLevel.Error, ); return EthereumResponse(