Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-08 16:51:34 +03:00
parent 133c89dd7e
commit dffa8b2658
12 changed files with 109 additions and 1 deletions

View file

@ -0,0 +1,9 @@
package com.tangem.domain.hotwallet
import com.tangem.domain.hotwallet.repository.HotWalletRepository
class IsHotWalletCreationSupported(private val hotWalletRepository: HotWalletRepository) {
operator fun invoke(): Boolean = hotWalletRepository.isWalletCreationSupported()
fun getLeastVersionName(): String = hotWalletRepository.getLeastSupportedAndroidVersionName()
}

View file

@ -5,6 +5,10 @@ import kotlinx.coroutines.flow.Flow
interface HotWalletRepository {
fun isWalletCreationSupported(): Boolean
fun getLeastSupportedAndroidVersionName(): String
fun accessCodeSkipped(userWalletId: UserWalletId): Flow<Boolean>
suspend fun setAccessCodeSkipped(userWalletId: UserWalletId, skipped: Boolean)

View file

@ -32,6 +32,7 @@ dependencies {
implementation(projects.domain.wallets.models)
implementation(projects.domain.notifications.models)
implementation(projects.domain.demo.models)
implementation(projects.domain.hotWallet)
// endregion
// region Tangem libraries

View file

@ -3,6 +3,7 @@ package com.tangem.domain.wallets.builder
import com.tangem.blockchain.blockchains.cardano.CardanoUtils
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.derivation.DerivationStyle
import com.tangem.domain.hotwallet.IsHotWalletCreationSupported
import com.tangem.domain.models.MobileWallet
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.wallets.usecase.GenerateWalletNameUseCase
@ -22,9 +23,12 @@ class HotUserWalletBuilder @AssistedInject constructor(
private val hotSdk: TangemHotSdk,
private val generateWalletNameUseCase: GenerateWalletNameUseCase,
private val dispatcherProvider: CoroutineDispatcherProvider,
private val isHotWalletCreationSupported: IsHotWalletCreationSupported,
) {
suspend fun build(): UserWallet.Hot = withContext(dispatcherProvider.default) {
checkHotWalletCreationSupported()
val allNetworks = Blockchain.entries.filter { it.isTestnet().not() }
val curves = allNetworks.map { it.getSupportedCurves() }.flatten().toSet()
val requests = curves.sortedBy { it.ordinal }.map { curve ->
@ -73,6 +77,12 @@ class HotUserWalletBuilder @AssistedInject constructor(
)
}
fun checkHotWalletCreationSupported() {
require(isHotWalletCreationSupported()) {
"Hot wallet creation is supported only from ${isHotWalletCreationSupported.getLeastVersionName()}"
}
}
@AssistedFactory
interface Factory {
fun create(hotWalletId: HotWalletId): HotUserWalletBuilder