Token delete bug fix (#2889)

* Normalize erc20 token addresses and fix duplicate tokens

* fix: Error when deleting token on solana and tron
This commit is contained in:
David Adegoke
2026-02-13 07:32:21 +01:00
committed by GitHub
parent d528da7778
commit 695829c2d8
2 changed files with 8 additions and 5 deletions
+3 -1
View File
@@ -645,7 +645,9 @@ abstract class SolanaWalletBase
}
Future<void> deleteSPLToken(SPLToken token) async {
await token.delete();
if (splTokensBox.isOpen) {
await splTokensBox.delete(token.mintAddress);
}
balance.remove(token);
await _removeTokenTransactionsInHistory(token);
+5 -4
View File
@@ -313,13 +313,12 @@ abstract class TronWalletBase
final hasMultiDestination = outputs.length > 1;
final transactionCurrency = balance.keys.firstWhere(
(currency) =>
currency.title == tronCredentials.currency.title &&
(currency) =>
currency.title == tronCredentials.currency.title &&
currency.tag == tronCredentials.currency.tag,
orElse: () => throw Exception(
'Currency ${tronCredentials.currency.title} ${tronCredentials.currency.tag} is not accessible in the wallet, try to enable it first.'));
final walletBalanceForCurrency = balance[transactionCurrency]!.balance;
BigInt totalAmount = BigInt.zero;
@@ -590,7 +589,9 @@ abstract class TronWalletBase
}
Future<void> deleteTronToken(TronToken token) async {
await token.delete();
if (tronTokensBox.isOpen) {
await tronTokensBox.delete(token.contractAddress);
}
balance.remove(token);
await _removeTokenTransactionsInHistory(token);