Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-11 17:53:32 +04:00
parent d83dda4f3a
commit 947c5e44e6
6 changed files with 374 additions and 11 deletions

View file

@ -3,12 +3,13 @@ package com.tangem.data.account.repository
import arrow.core.Option
import arrow.core.Option.Companion.catch
import arrow.core.none
import arrow.core.raise.option
import com.tangem.datasource.local.datastore.RuntimeSharedStore
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.account.models.AccountList
import com.tangem.domain.account.models.ArchivedAccount
import com.tangem.domain.account.repository.AccountsCRUDRepository
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.account.AccountId
import com.tangem.domain.models.account.*
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.utils.extensions.addOrReplace
@ -35,6 +36,17 @@ internal class DefaultAccountsCRUDRepository(
?: return none()
}
override suspend fun getArchivedAccount(accountId: AccountId): Option<ArchivedAccount> = option {
ArchivedAccount(
accountId = accountId,
name = AccountName("Archived Account").getOrNull()!!,
icon = CryptoPortfolioIcon.ofDefaultCustomAccount(),
derivationIndex = DerivationIndex(value = 1000).getOrNull()!!,
tokensCount = 2,
networksCount = 1,
)
}
override suspend fun saveAccounts(accountList: AccountList) {
runtimeStore.update(emptyList()) {
it.addOrReplace(accountList) { it.userWallet.walletId == accountList.userWallet.walletId }