mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
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:
parent
2ac81250c2
commit
fff77519d9
10 changed files with 54 additions and 40 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue