Updated on 2026-08-14
This commit is contained in:
parent
6d9c467b20
commit
40f24bd65b
13 changed files with 191 additions and 84 deletions
|
|
@ -18,6 +18,7 @@ import com.tangem.domain.common.extensions.fromNetworkId
|
|||
import com.tangem.domain.common.util.derivationStyleProvider
|
||||
import com.tangem.domain.common.util.hasDerivation
|
||||
import com.tangem.domain.models.scan.ScanResponse
|
||||
import com.tangem.domain.tokens.AddCryptoCurrenciesUseCase
|
||||
import com.tangem.domain.tokens.model.CryptoCurrency
|
||||
import com.tangem.domain.tokens.repository.CurrenciesRepository
|
||||
import com.tangem.domain.tokens.repository.NetworksRepository
|
||||
|
|
@ -46,6 +47,11 @@ class DerivationManagerImpl(
|
|||
private val networksRepository: NetworksRepository,
|
||||
) : DerivationManager {
|
||||
|
||||
// TODO: Move to DI
|
||||
private val addCryptoCurrenciesUseCase by lazy(LazyThreadSafetyMode.NONE) {
|
||||
AddCryptoCurrenciesUseCase(currenciesRepository, networksRepository)
|
||||
}
|
||||
|
||||
override suspend fun deriveMissingBlockchains(currency: Currency) = suspendCoroutine { continuation ->
|
||||
val blockchain = Blockchain.fromNetworkId(currency.networkId)
|
||||
val card = appStateHolder.getActualCard()
|
||||
|
|
@ -164,15 +170,8 @@ class DerivationManagerImpl(
|
|||
derivationPath = derivationPath,
|
||||
derivationStyleProvider = derivationStyleProvider,
|
||||
)
|
||||
currenciesRepository.addCurrencies(
|
||||
userWalletId,
|
||||
listOf(cryptoCurrency),
|
||||
)
|
||||
networksRepository.getNetworkStatusesSync(
|
||||
userWalletId = userWalletId,
|
||||
networks = setOf(cryptoCurrency.network),
|
||||
refresh = true,
|
||||
)
|
||||
|
||||
addCryptoCurrenciesUseCase(userWalletId, cryptoCurrency)
|
||||
}
|
||||
|
||||
private fun convertCurrency(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue