From 69a75094c12adf800bee30a7604db9f0522de53c Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 10 Oct 2022 15:45:07 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/tap/features/tokens/redux/TokensMiddleware.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensMiddleware.kt b/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensMiddleware.kt index 96f742ec97..9817b4db49 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensMiddleware.kt @@ -278,7 +278,7 @@ class TokensMiddleware { val factory = store.state.globalState.tapWalletManager.walletManagerFactory val derivationStyle = scanResponse.card.derivationStyle - val addActions = currencyList.mapNotNull { currency -> + val addActions = currencyList.mapIndexedNotNull { index, currency -> when (currency) { is Currency.Blockchain -> { val derivationPath = currency.derivationPath?.let { DerivationPath(it) } @@ -293,12 +293,12 @@ class TokensMiddleware { scanResponse = scanResponse, blockchain = currency.blockchain, derivationParams = derivationParams, - ) ?: return@mapNotNull null + ) ?: return@mapIndexedNotNull null val blockchainNetwork = BlockchainNetwork.fromWalletManager(walletManager) WalletAction.MultiWallet.AddBlockchain( blockchain = blockchainNetwork, walletManager = walletManager, - save = true, + save = index == currencyList.lastIndex, ) } is Currency.Token -> { @@ -309,7 +309,7 @@ class TokensMiddleware { WalletAction.MultiWallet.AddToken( token = currency.token, blockchain = blockchainNetwork, - save = true, + save = index == currencyList.lastIndex, ) } }