Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-10 19:50:01 +04:00
parent 06d1f35002
commit 6ed1946ac3
16 changed files with 191 additions and 220 deletions

View file

@ -10,6 +10,10 @@ android {
namespace = "com.tangem.data.wallet"
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
dependencies {
implementation(projects.data.common)
@ -47,9 +51,7 @@ dependencies {
implementation(deps.timber)
/** tests */
testImplementation(projects.test.core)
testImplementation(projects.common.test)
testImplementation(deps.test.junit)
testImplementation(deps.test.coroutine)
testImplementation(deps.test.truth)
testImplementation(deps.test.mockk)
testRuntimeOnly(deps.test.junit5.engine)
}

View file

@ -9,7 +9,7 @@ import com.tangem.datasource.api.tangemTech.models.BindWalletsByReferralCodeBody
import com.tangem.datasource.local.preferences.AppPreferencesStore
import com.tangem.datasource.local.preferences.utils.getObjectSyncOrNull
import com.tangem.datasource.local.preferences.utils.storeObject
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.wallets.models.AppsFlyerConversionData
import com.tangem.domain.wallets.repository.WalletsPromoRepository
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
@ -19,7 +19,7 @@ import timber.log.Timber
internal class DefaultWalletsPromoRepository(
private val appPreferencesStore: AppPreferencesStore,
private val tangemTechApi: TangemTechApi,
private val userWalletsStore: UserWalletsStore,
private val userWalletsListRepository: UserWalletsListRepository,
private val dispatchers: CoroutineDispatcherProvider,
) : WalletsPromoRepository {
@ -60,7 +60,7 @@ internal class DefaultWalletsPromoRepository(
}
private suspend fun bind(refcode: String, campaign: String?) {
val walletIds = userWalletsStore.userWalletsSync.map { it.walletId.stringValue }
val walletIds = userWalletsListRepository.userWallets.value.orEmpty().map { it.walletId.stringValue }
val result = tangemTechApi.bindWalletsByReferralCode(
body = BindWalletsByReferralCodeBody(walletIds = walletIds, refcode = refcode, campaign = campaign),

View file

@ -24,8 +24,8 @@ import com.tangem.datasource.local.preferences.utils.getObjectMap
import com.tangem.datasource.local.preferences.utils.getSyncOrDefault
import com.tangem.datasource.local.preferences.utils.getSyncOrNull
import com.tangem.datasource.local.preferences.utils.store
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.account.featuretoggle.AccountsFeatureToggles
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.wallets.models.SeedPhraseNotificationsStatus
@ -47,7 +47,7 @@ typealias SeedPhraseNotificationsStatuses = Map<UserWalletId, SeedPhraseNotifica
internal class DefaultWalletsRepository(
private val appPreferencesStore: AppPreferencesStore,
private val tangemTechApi: TangemTechApi,
private val userWalletsStore: UserWalletsStore,
private val userWalletsListRepository: UserWalletsListRepository,
private val seedPhraseNotificationVisibilityStore: RuntimeStateStore<SeedPhraseNotificationsStatuses>,
private val dispatchers: CoroutineDispatcherProvider,
private val authProvider: AuthProvider,
@ -151,7 +151,7 @@ internal class DefaultWalletsRepository(
}
private suspend fun fetchSeedPhraseNotificationStatus(userWalletId: UserWalletId) {
val userWallet = userWalletsStore.getSyncOrNull(key = userWalletId)
val userWallet = userWalletsListRepository.getSyncOrNull(id = userWalletId)
if (userWallet != null && userWallet !is UserWallet.Cold) {
updateNotificationVisibility(id = userWalletId, value = SeedPhraseNotificationsStatus.NOT_NEEDED)
@ -323,7 +323,7 @@ internal class DefaultWalletsRepository(
}
override suspend fun setWalletName(walletId: UserWalletId, walletName: String) = withContext(dispatchers.io) {
val userWallet = userWalletsStore.getSyncOrNull(key = walletId)
val userWallet = userWalletsListRepository.getSyncOrNull(id = walletId)
tangemTechApi.updateWallet(
walletId = walletId.stringValue,
@ -332,7 +332,7 @@ internal class DefaultWalletsRepository(
}
override suspend fun upgradeWallet(walletId: UserWalletId) = withContext(dispatchers.io) {
val userWallet = userWalletsStore.getSyncStrict(key = walletId)
val userWallet = userWalletsListRepository.getSyncStrict(id = walletId)
tangemTechApi.updateWallet(
walletId = walletId.stringValue,

View file

@ -1,9 +1,9 @@
package com.tangem.data.wallets.derivations
import com.tangem.common.CompletionResult
import arrow.core.getOrElse
import com.tangem.common.extensions.ByteArrayKey
import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.models.account.DerivationIndex
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.network.Network
@ -16,16 +16,22 @@ import com.tangem.domain.wallets.usecase.BackendId
import com.tangem.operations.derivation.ExtendedPublicKeysMap
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.withContext
import timber.log.Timber
import javax.inject.Inject
internal class DefaultDerivationsRepository @Inject constructor(
private val userWalletsStore: UserWalletsStore,
private val userWalletsListRepository: UserWalletsListRepository,
private val hotDerivationsRepository: HotMapDerivationsRepository,
private val coldDerivationsRepository: ColdMapDerivationsRepository,
private val dispatchers: CoroutineDispatcherProvider,
) : DerivationsRepository {
override suspend fun derivePublicKeys(userWalletId: UserWalletId, currencies: List<CryptoCurrency>) {
if (currencies.isEmpty()) {
Timber.d("Nothing to derive")
return
}
derivePublicKeysByNetworks(userWalletId = userWalletId, networks = currencies.map(CryptoCurrency::network))
}
@ -34,7 +40,7 @@ internal class DefaultDerivationsRepository @Inject constructor(
networkIds: List<Network.RawID>,
accountIndex: DerivationIndex,
) {
val userWallet = userWalletsStore.getSyncStrict(userWalletId)
val userWallet = userWalletsListRepository.getSyncStrict(userWalletId)
when (userWallet) {
is UserWallet.Cold -> coldDerivationsRepository.derivePublicKeysByNetworkIds(userWallet, networkIds)
is UserWallet.Hot -> {
@ -46,7 +52,7 @@ internal class DefaultDerivationsRepository @Inject constructor(
}
override suspend fun derivePublicKeysByNetworks(userWalletId: UserWalletId, networks: List<Network>) {
val userWallet = userWalletsStore.getSyncStrict(userWalletId)
val userWallet = userWalletsListRepository.getSyncStrict(userWalletId)
when (userWallet) {
is UserWallet.Cold -> coldDerivationsRepository.derivePublicKeysByNetworks(userWallet, networks)
is UserWallet.Hot -> hotDerivationsRepository.derivePublicKeysByNetworks(userWallet, networks)
@ -59,7 +65,7 @@ internal class DefaultDerivationsRepository @Inject constructor(
userWalletId: UserWalletId,
derivations: Map<ByteArrayKey, List<DerivationPath>>,
): Map<ByteArrayKey, ExtendedPublicKeysMap> {
val userWallet = userWalletsStore.getSyncStrict(userWalletId)
val userWallet = userWalletsListRepository.getSyncStrict(userWalletId)
return when (userWallet) {
is UserWallet.Cold -> coldDerivationsRepository.derivePublicKeys(userWallet, derivations)
is UserWallet.Hot -> hotDerivationsRepository.derivePublicKeys(userWallet, derivations)
@ -73,7 +79,7 @@ internal class DefaultDerivationsRepository @Inject constructor(
userWalletId: UserWalletId,
networksWithDerivationPath: Map<BackendId, String?>,
): Boolean {
return when (val userWallet = userWalletsStore.getSyncStrict(userWalletId)) {
return when (val userWallet = userWalletsListRepository.getSyncStrict(userWalletId)) {
is UserWallet.Cold -> coldDerivationsRepository.hasMissedDerivations(userWallet, networksWithDerivationPath)
is UserWallet.Hot -> hotDerivationsRepository.hasMissedDerivations(userWallet, networksWithDerivationPath)
}
@ -88,14 +94,7 @@ internal class DefaultDerivationsRepository @Inject constructor(
return@withContext // No update needed
}
val updateResult = userWalletsStore.update(
userWalletId = newUserWallet.walletId,
update = { userWalletToUpdate -> newUserWallet },
)
when (updateResult) {
is CompletionResult.Failure -> throw updateResult.error
is CompletionResult.Success -> updateResult.data
}
userWalletsListRepository.saveWithoutLock(userWallet = newUserWallet, canOverride = true)
.getOrElse { throw IllegalStateException("Unable to update user wallet: $it") }
}
}

View file

@ -15,8 +15,8 @@ import com.tangem.datasource.di.NetworkMoshi
import com.tangem.datasource.local.appsflyer.AppsFlyerStore
import com.tangem.datasource.local.datastore.RuntimeStateStore
import com.tangem.datasource.local.preferences.AppPreferencesStore
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.account.featuretoggle.AccountsFeatureToggles
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.wallets.derivations.ColdMapDerivationsRepository
import com.tangem.domain.wallets.derivations.DerivationsRepository
import com.tangem.domain.wallets.derivations.HotMapDerivationsRepository
@ -41,7 +41,7 @@ internal object WalletsDataModule {
fun providesWalletsRepository(
appPreferencesStore: AppPreferencesStore,
tangemTechApi: TangemTechApi,
userWalletsStore: UserWalletsStore,
userWalletsListRepository: UserWalletsListRepository,
dispatchers: CoroutineDispatcherProvider,
authProvider: AuthProvider,
walletServerBinder: WalletServerBinder,
@ -52,7 +52,7 @@ internal object WalletsDataModule {
return DefaultWalletsRepository(
appPreferencesStore = appPreferencesStore,
tangemTechApi = tangemTechApi,
userWalletsStore = userWalletsStore,
userWalletsListRepository = userWalletsListRepository,
seedPhraseNotificationVisibilityStore = RuntimeStateStore(defaultValue = emptyMap()),
dispatchers = dispatchers,
authProvider = authProvider,
@ -74,13 +74,13 @@ internal object WalletsDataModule {
fun provideWalletsPromoRepository(
appPreferencesStore: AppPreferencesStore,
tangemTechApi: TangemTechApi,
userWalletsStore: UserWalletsStore,
userWalletsListRepository: UserWalletsListRepository,
dispatchers: CoroutineDispatcherProvider,
): WalletsPromoRepository {
return DefaultWalletsPromoRepository(
appPreferencesStore = appPreferencesStore,
tangemTechApi = tangemTechApi,
userWalletsStore = userWalletsStore,
userWalletsListRepository = userWalletsListRepository,
dispatchers = dispatchers,
)
}

View file

@ -7,7 +7,7 @@ import com.tangem.common.extensions.toMapKey
import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.data.common.network.NetworkFactory
import com.tangem.data.wallets.derivations.MissedDerivationsFinder
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.models.account.DerivationIndex
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.network.Network
@ -23,7 +23,7 @@ import timber.log.Timber
import javax.inject.Inject
internal class DefaultHotMapDerivationsRepository @Inject constructor(
private val userWalletsStore: UserWalletsStore,
private val userWalletsListRepository: UserWalletsListRepository,
private val networkFactory: NetworkFactory,
private val hotWalletAccessor: HotWalletAccessor,
private val dispatchers: CoroutineDispatcherProvider,
@ -90,7 +90,7 @@ internal class DefaultHotMapDerivationsRepository @Inject constructor(
// Get the updated user wallet from the store to ensure we have the latest data
// in case it was modified during the derive operation
val updatedUserWallet = userWalletsStore.getSyncStrict(userWallet.walletId) as UserWallet.Hot
val updatedUserWallet = userWalletsListRepository.getSyncStrict(userWallet.walletId) as UserWallet.Hot
val newKeys =
result.responses.associate { ByteArrayKey(it.seedKey.publicKey) to ExtendedPublicKeysMap(it.publicKeys) }

View file

@ -54,7 +54,7 @@ class DefaultWalletsRepositoryTest {
repository = DefaultWalletsRepository(
appPreferencesStore = appPreferenceStore,
tangemTechApi = tangemTechApi,
userWalletsStore = mockk(),
userWalletsListRepository = mockk(),
seedPhraseNotificationVisibilityStore = mockk(),
dispatchers = dispatchers,
authProvider = mockk(),
@ -222,7 +222,7 @@ class DefaultWalletsRepositoryTest {
repository = DefaultWalletsRepository(
appPreferencesStore = appPreferenceStore,
tangemTechApi = tangemTechApi,
userWalletsStore = mockk(),
userWalletsListRepository = mockk(),
seedPhraseNotificationVisibilityStore = mockk(),
dispatchers = dispatchers,
authProvider = authProvider,

View file

@ -1,44 +1,36 @@
package com.tangem.data.wallets.derivations
import android.annotation.SuppressLint
import arrow.core.right
import com.google.common.truth.Truth
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
import com.tangem.common.CompletionResult
import com.tangem.common.test.domain.card.MockScanResponseFactory
import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
import com.tangem.data.common.network.NetworkFactory
import com.tangem.data.wallets.cold.DefaultColdMapDerivationsRepository
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.card.ScanCardException
import com.tangem.domain.card.configs.GenericCardConfig
import com.tangem.domain.card.configs.MultiWalletCardConfig
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.operations.derivation.DerivationTaskResponse
import com.tangem.sdk.api.TangemSdkManager
import com.tangem.domain.wallets.derivations.ColdMapDerivationsRepository
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.mockk
import io.mockk.*
import kotlinx.coroutines.test.runTest
import org.junit.Test
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
/**
[REDACTED_AUTHOR]
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class DefaultDerivationsRepositoryTest {
private val tangemSdkManager = mockk<TangemSdkManager>()
private val userWalletsStore = mockk<UserWalletsStore>()
private val userWalletsListRepository = mockk<UserWalletsListRepository>()
private val coldDerivationsRepository: ColdMapDerivationsRepository = mockk()
private val repository = DefaultDerivationsRepository(
userWalletsStore = userWalletsStore,
dispatchers = TestingCoroutineDispatcherProvider(),
userWalletsListRepository = userWalletsListRepository,
hotDerivationsRepository = mockk(),
coldDerivationsRepository = DefaultColdMapDerivationsRepository(
tangemSdkManager = tangemSdkManager,
networkFactory = NetworkFactory(excludedBlockchains = ExcludedBlockchains()),
dispatchers = TestingCoroutineDispatcherProvider(),
),
coldDerivationsRepository = coldDerivationsRepository,
dispatchers = TestingCoroutineDispatcherProvider(),
)
private val defaultUserWalletId = UserWalletId("011")
@ -51,127 +43,94 @@ internal class DefaultDerivationsRepositoryTest {
hasBackupError = false,
)
@AfterEach
fun tearDown() {
clearMocks(userWalletsListRepository, coldDerivationsRepository)
}
@Test
fun `error if userWalletId not found`() = runTest {
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } throws IllegalStateException()
val currencies = MockCryptoCurrencyFactory(defaultUserWallet).ethereum.let(::listOf)
coEvery { userWalletsListRepository.getSyncStrict(defaultUserWalletId) } throws IllegalStateException()
runCatching {
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = emptyList())
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = currencies)
}
.onSuccess { error("Should throws exception") }
.onFailure { Truth.assertThat(it).isInstanceOf(IllegalStateException::class.java) }
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(inverse = true) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(inverse = true) { userWalletsStore.update(defaultUserWalletId, any()) }
coVerify(exactly = 1) { userWalletsListRepository.getSyncStrict(defaultUserWalletId) }
coVerify(inverse = true) {
coldDerivationsRepository.derivePublicKeysByNetworks(any(), any())
userWalletsListRepository.saveWithoutLock(any(), any())
}
}
@SuppressLint("CheckResult")
@Test
fun `success if card is not supported derivations`() = runTest {
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } returns defaultUserWallet
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = emptyList())
runCatching { }
.onSuccess { Truth.assertThat(it) }
.onFailure {
error("Should returns success")
}
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(inverse = true) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(inverse = true) { userWalletsStore.update(defaultUserWalletId, any()) }
}
@SuppressLint("CheckResult")
@Test
fun `success if currencies is empty`() = runTest {
val userWallet = defaultUserWallet.copy(
scanResponse = MockScanResponseFactory.create(cardConfig = MultiWalletCardConfig, derivedKeys = emptyMap()),
)
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } returns userWallet
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = emptyList())
runCatching { repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = emptyList()) }
.onSuccess { Truth.assertThat(it) }
.onFailure { error("Should returns success") }
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(inverse = true) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(inverse = true) { userWalletsStore.update(defaultUserWalletId, any()) }
}
@SuppressLint("CheckResult")
@Test
fun `success if card already has derivations`() = runTest {
val userWallet = defaultUserWallet.copy(
scanResponse = MockScanResponseFactory.create(
cardConfig = MultiWalletCardConfig,
derivedKeys = DerivedKeysMocks.ethereumDerivedKeys,
),
)
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } returns userWallet
runCatching {
repository.derivePublicKeys(
userWalletId = defaultUserWalletId,
currencies = MockCryptoCurrencyFactory(userWallet).ethereum.let(::listOf),
)
coVerify(inverse = true) {
userWalletsListRepository.getSyncStrict(any())
coldDerivationsRepository.derivePublicKeysByNetworks(any(), any())
userWalletsListRepository.saveWithoutLock(any(), any())
}
.onSuccess { Truth.assertThat(it) }
.onFailure { error("Should returns success") }
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(inverse = true) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(inverse = true) { userWalletsStore.update(defaultUserWalletId, any()) }
}
@Test
fun `error if tangemSdkManager throws exception`() = runTest {
val userWallet = defaultUserWallet.copy(
scanResponse = MockScanResponseFactory.create(cardConfig = MultiWalletCardConfig, derivedKeys = emptyMap()),
)
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } returns userWallet
coEvery { tangemSdkManager.derivePublicKeys(null, any(), any()) } throws ScanCardException.UserCancelled()
fun `error if coldDerivationsRepository throws exception`() = runTest {
val currencies = MockCryptoCurrencyFactory(defaultUserWallet).ethereum.let(::listOf)
coEvery { userWalletsListRepository.getSyncStrict(defaultUserWalletId) } returns defaultUserWallet
coEvery {
coldDerivationsRepository.derivePublicKeysByNetworks(
userWallet = defaultUserWallet,
networks = any(),
)
} throws IllegalStateException()
runCatching {
repository.derivePublicKeys(
userWalletId = defaultUserWalletId,
currencies = MockCryptoCurrencyFactory(userWallet).ethereum.let(::listOf),
)
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = currencies)
}
.onSuccess { error("Should throws exception") }
.onFailure { Truth.assertThat(it).isInstanceOf(ScanCardException.UserCancelled::class.java) }
.onFailure { Truth.assertThat(it).isInstanceOf(IllegalStateException::class.java) }
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(exactly = 1) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(inverse = true) { userWalletsStore.update(defaultUserWalletId, any()) }
}
@SuppressLint("CheckResult")
@Test
fun `success case`() = runTest {
val userWallet = defaultUserWallet.copy(
scanResponse = MockScanResponseFactory.create(cardConfig = MultiWalletCardConfig, derivedKeys = emptyMap()),
)
coEvery { userWalletsStore.getSyncStrict(defaultUserWalletId) } returns userWallet
coEvery { tangemSdkManager.derivePublicKeys(null, any(), any()) } returns CompletionResult.Success(
DerivationTaskResponse(DerivedKeysMocks.ethereumDerivedKeys),
)
coEvery { userWalletsStore.update(defaultUserWalletId, any()) } returns CompletionResult.Success(userWallet)
runCatching {
repository.derivePublicKeys(
userWalletId = defaultUserWalletId,
currencies = MockCryptoCurrencyFactory(userWallet).ethereum.let(::listOf),
coVerifyOrder {
userWalletsListRepository.getSyncStrict(defaultUserWalletId)
coldDerivationsRepository.derivePublicKeysByNetworks(
userWallet = defaultUserWallet,
networks = currencies.map(CryptoCurrency.Coin::network),
)
}
.onSuccess { Truth.assertThat(it) }
.onFailure { error("Should returns success but $it") }
coVerify(exactly = 1) { userWalletsStore.getSyncStrict(defaultUserWalletId) }
coVerify(exactly = 1) { tangemSdkManager.derivePublicKeys(null, any(), any()) }
coVerify(exactly = 1) { userWalletsStore.update(defaultUserWalletId, any()) }
coVerify(inverse = true) { userWalletsListRepository.saveWithoutLock(any(), any()) }
}
@Test
fun `success case`() = runTest {
val currencies = MockCryptoCurrencyFactory(defaultUserWallet).ethereum.let(::listOf)
val updatedWallet = defaultUserWallet.copy(cardsInWallet = setOf("AC01"))
coEvery { userWalletsListRepository.getSyncStrict(defaultUserWalletId) } returns defaultUserWallet
coEvery {
coldDerivationsRepository.derivePublicKeysByNetworks(
userWallet = defaultUserWallet,
networks = currencies.map(CryptoCurrency.Coin::network),
)
} returns updatedWallet
coEvery {
userWalletsListRepository.saveWithoutLock(updatedWallet, true)
} returns updatedWallet.right()
repository.derivePublicKeys(userWalletId = defaultUserWalletId, currencies = currencies)
coVerifyOrder {
userWalletsListRepository.getSyncStrict(defaultUserWalletId)
coldDerivationsRepository.derivePublicKeysByNetworks(
userWallet = defaultUserWallet,
networks = currencies.map(CryptoCurrency.Coin::network),
)
userWalletsListRepository.saveWithoutLock(updatedWallet, true)
}
}
}