Generic Fixes: Support Errors and others (#1394)

* fix: Crypto amout formatting when calculating fiat amount

* fix: Issue with some token symbols coming up with a dollar sign

* feat: Split transactions to display on history screen token byh token

* fix: Remove restriction on balance length

* fix: error when a particular token is not available

* fix: Remove token transactions when a token is deleted

* fix: Revert previous change

* make added spl tokens enabled by default
fix issue when entering invalid contract address

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Adegoke David 2024-04-25 02:14:53 +01:00 committed by GitHub
parent 2ac81250c2
commit fff77519d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 54 additions and 40 deletions

View file

@ -234,14 +234,17 @@ abstract class EVMChainClient {
final decodedResponse = jsonDecode(response.body)[0] as Map<String, dynamic>;
final symbol = (decodedResponse['symbol'] ?? '') as String;
String filteredSymbol = symbol.replaceFirst(RegExp('^\\\$'), '');
final name = decodedResponse['name'] ?? '';
final symbol = decodedResponse['symbol'] ?? '';
final decimal = decodedResponse['decimals'] ?? '0';
final iconPath = decodedResponse['logo'] ?? '';
return Erc20Token(
name: name,
symbol: symbol,
symbol: filteredSymbol,
contractAddress: contractAddress,
decimal: int.tryParse(decimal) ?? 0,
iconPath: iconPath,

View file

@ -468,9 +468,15 @@ abstract class EVMChainWalletBase
await token.delete();
balance.remove(token);
await _removeTokenTransactionsInHistory(token);
_updateBalance();
}
Future<void> _removeTokenTransactionsInHistory(Erc20Token token) async {
transactionHistory.transactions.removeWhere((key, value) => value.tokenSymbol == token.title);
await transactionHistory.save();
}
Future<Erc20Token?> getErc20Token(String contractAddress, String chainName) async =>
await _client.getErc20Token(contractAddress, chainName);