refactor: Switch preference to moralis when fetching token data for newly added token; allows us get the token iconpath (#3149)

This commit is contained in:
David Adegoke
2026-04-01 12:13:22 +02:00
committed by GitHub
parent 2c7f8d1368
commit a22935a474
2 changed files with 6 additions and 8 deletions
+3 -6
View File
@@ -90,7 +90,6 @@ class EVMChainClient {
if (totalNet < BigInt.zero) {
mergedMap[key]!['from'] = address;
} else {
mergedMap[key]!['to'] = address;
mergedMap[key]!['from'] = '';
}
@@ -118,7 +117,6 @@ class EVMChainClient {
}
}
BigInt getNetFlow(Map<String, dynamic> txData, String address) {
final val = BigInt.parse(txData['value'] ?? '0');
final isIncoming = txData['to']?.toLowerCase() == address.toLowerCase();
@@ -129,7 +127,6 @@ class EVMChainClient {
return BigInt.zero;
}
Future<List<EVMChainTransactionModel>> fetchInternalTransactions(String address) async {
try {
if (secrets.etherScanApiKey.isEmpty) {
@@ -544,16 +541,16 @@ class EVMChainClient {
Future<Erc20Token?> getErc20Token(String contractAddress, String chainName) async {
try {
final token = await getErcTokenInfoFromNode(contractAddress, chainName);
final token = await getErc20TokenFromMoralis(contractAddress, chainName);
if (token == null || token.name.isEmpty || token.symbol.isEmpty) {
return await getErc20TokenFromMoralis(contractAddress, chainName);
return await getErcTokenInfoFromNode(contractAddress, chainName);
}
return token;
} catch (e) {
try {
return await getErc20TokenFromMoralis(contractAddress, chainName);
return await getErcTokenInfoFromNode(contractAddress, chainName);
} catch (e) {
return null;
}
+3 -2
View File
@@ -3,6 +3,7 @@
import 'dart:math';
import 'package:cake_wallet/entities/seed_type.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/src/widgets/search_bar_widget.dart';
import 'package:cake_wallet/themes/core/theme_extension.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
@@ -497,8 +498,8 @@ class _PickerState<Item> extends State<Picker<Item>> {
Widget? _getItemIcon(Item item) {
if (item is Currency) {
if (item.iconPath != null) {
return Image.asset(
item.iconPath!,
return CakeImageWidget(
imageUrl: item.iconPath!,
height: 20.0,
width: 20.0,
);