Token delete bug fix (#2889)

* Normalize erc20 token addresses and fix duplicate tokens * fix: Error when deleting token on solana and tron

David Adegoke committed Feb 13, 2026 at 07:32 UTC 695829c2d8afaa047413dcf949e3a58e4636813c
2 files changed +8 -5
cw_solana/lib/solana_wallet.dart
+3 -1
@@ -645,7 +645,9 @@ abstract class SolanaWalletBase
645 }
646
647 Future<void> deleteSPLToken(SPLToken token) async {
648 - await token.delete();
648 + if (splTokensBox.isOpen) {
649 + await splTokensBox.delete(token.mintAddress);
650 + }
651
652 balance.remove(token);
653 await _removeTokenTransactionsInHistory(token);
cw_tron/lib/tron_wallet.dart
+5 -4
@@ -313,13 +313,12 @@ abstract class TronWalletBase
313 final hasMultiDestination = outputs.length > 1;
314
315 final transactionCurrency = balance.keys.firstWhere(
316 - (currency) =>
317 - currency.title == tronCredentials.currency.title &&
316 + (currency) =>
317 + currency.title == tronCredentials.currency.title &&
318 currency.tag == tronCredentials.currency.tag,
319 orElse: () => throw Exception(
320 'Currency ${tronCredentials.currency.title} ${tronCredentials.currency.tag} is not accessible in the wallet, try to enable it first.'));
321
322 -
322 final walletBalanceForCurrency = balance[transactionCurrency]!.balance;
323
324 BigInt totalAmount = BigInt.zero;
@@ -590,7 +589,9 @@ abstract class TronWalletBase
589 }
590
591 Future<void> deleteTronToken(TronToken token) async {
593 - await token.delete();
592 + if (tronTokensBox.isOpen) {
593 + await tronTokensBox.delete(token.contractAddress);
594 + }
595
596 balance.remove(token);
597 await _removeTokenTransactionsInHistory(token);