Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-27 15:59:27 +07:00
parent 10599d6770
commit 0051a20463
4 changed files with 13 additions and 11 deletions

View file

@ -1,13 +1,14 @@
package com.tangem.datasource.local.accounts
import com.tangem.domain.models.account.AccountName
import com.tangem.domain.models.wallet.UserWalletId
import kotlinx.coroutines.flow.Flow
interface AccountTokenMigrationStore {
fun get(userWalletId: UserWalletId): Flow<Pair<String, String>?>
fun get(userWalletId: UserWalletId): Flow<Pair<AccountName, AccountName>?>
suspend fun store(userWalletId: UserWalletId, value: Pair<String, String>)
suspend fun store(userWalletId: UserWalletId, value: Pair<AccountName, AccountName>)
suspend fun remove(userWalletId: UserWalletId)
}

View file

@ -1,19 +1,20 @@
package com.tangem.datasource.local.accounts
import com.tangem.datasource.local.datastore.RuntimeStateStore
import com.tangem.domain.models.account.AccountName
import com.tangem.domain.models.wallet.UserWalletId
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
internal class DefaultAccountTokenMigrationStore(
private val runtimeStateStore: RuntimeStateStore<Map<UserWalletId, Pair<String, String>>>,
private val runtimeStateStore: RuntimeStateStore<Map<UserWalletId, Pair<AccountName, AccountName>>>,
) : AccountTokenMigrationStore {
override fun get(userWalletId: UserWalletId): Flow<Pair<String, String>?> {
override fun get(userWalletId: UserWalletId): Flow<Pair<AccountName, AccountName>?> {
return runtimeStateStore.get().map { it[userWalletId] }
}
override suspend fun store(userWalletId: UserWalletId, value: Pair<String, String>) {
override suspend fun store(userWalletId: UserWalletId, value: Pair<AccountName, AccountName>) {
runtimeStateStore.update { it + (userWalletId to value) }
}