mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user