Updated on 2026-08-14

This commit is contained in:
Tangem 2023-02-20 22:34:10 +03:00
parent 99244e87a6
commit 2f936ad2f3
4 changed files with 9 additions and 3 deletions

View file

@ -26,7 +26,6 @@ import com.tangem.lib.crypto.models.transactions.SendTxResult
import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.TangemSigner
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.tangemSdk
import java.math.BigDecimal
@ -109,8 +108,6 @@ class TransactionManagerImpl(
FirebaseCrashlytics.getInstance().recordException(ex)
return SendTxResult.UnknownError(ex)
}
// workaround, should update wallet after transaction
appStateHolder.mainStore?.dispatch(WalletAction.LoadData.Refresh)
return handleSendResult(sendResult)
}

View file

@ -113,6 +113,7 @@ class UserWalletManagerImpl(
val action = addNonNativeTokenToWalletAction(currency, card, blockchain)
val mainStore = requireNotNull(appStateHolder.mainStore) { "mainStore is null" }
mainStore.dispatchOnMain(action)
delay(DELAY_UPDATE_WALLET)
}
}
@ -238,6 +239,11 @@ class UserWalletManagerImpl(
)
}
override fun refreshWallet() {
// workaround, should update wallet after transaction
appStateHolder.mainStore?.dispatchOnMain(WalletAction.LoadData.Refresh)
}
private fun createDerivationParams(derivationStyle: DerivationStyle?): DerivationParams? {
// todo clarify if its need to add Custom
return derivationStyle?.let { DerivationParams.Default(derivationStyle) }

View file

@ -218,6 +218,7 @@ internal class SwapInteractorImpl @Inject constructor(
return when (result) {
is SendTxResult.Success -> {
userWalletManager.addToken(cryptoCurrencyConverter.convert(currencyToGet))
userWalletManager.refreshWallet()
TxState.TxSent(
fromAmount = amountFormatter.formatSwapAmountToUI(swapData.fromTokenAmount, currencyToSend.symbol),
toAmount = amountFormatter.formatSwapAmountToUI(swapData.toTokenAmount, currencyToGet.symbol),

View file

@ -39,6 +39,8 @@ interface UserWalletManager {
@Throws(IllegalStateException::class)
suspend fun addToken(currency: Currency)
fun refreshWallet()
/**
* Returns wallet public address for token
*