Updated on 2026-08-14

This commit is contained in:
Tangem 2023-07-07 11:33:27 +08:00
parent 72163c43f9
commit b327aef89d
84 changed files with 222 additions and 266 deletions

View file

@ -26,6 +26,8 @@ dependencies {
implementation(project(":domain:models")) implementation(project(":domain:models"))
implementation(project(":domain:core")) implementation(project(":domain:core"))
implementation(project(":domain:card")) implementation(project(":domain:card"))
implementation(project(":domain:wallets"))
implementation(project(":domain:wallets:models"))
implementation(project(":common")) implementation(project(":common"))
implementation(project(":core:analytics")) implementation(project(":core:analytics"))
implementation(project(":core:featuretoggles")) implementation(project(":core:featuretoggles"))

View file

@ -12,6 +12,7 @@ import by.kirich1409.viewbindingdelegate.viewBinding
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.tangem.TangemSdk import com.tangem.TangemSdk
import com.tangem.domain.card.ScanCardUseCase import com.tangem.domain.card.ScanCardUseCase
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.features.tester.api.TesterRouter import com.tangem.features.tester.api.TesterRouter
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
import com.tangem.features.wallet.navigation.WalletRouter import com.tangem.features.wallet.navigation.WalletRouter
@ -30,7 +31,6 @@ import com.tangem.tap.common.shop.googlepay.GooglePayService
import com.tangem.tap.common.shop.googlepay.GooglePayService.Companion.LOAD_PAYMENT_DATA_REQUEST_CODE import com.tangem.tap.common.shop.googlepay.GooglePayService.Companion.LOAD_PAYMENT_DATA_REQUEST_CODE
import com.tangem.tap.common.shop.googlepay.GooglePayUtil.createPaymentsClient import com.tangem.tap.common.shop.googlepay.GooglePayUtil.createPaymentsClient
import com.tangem.tap.domain.TangemSdkManager import com.tangem.tap.domain.TangemSdkManager
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation
import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation
import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor

View file

@ -21,6 +21,7 @@ import com.tangem.datasource.config.models.Config
import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.datasource.connection.NetworkConnectionManager
import com.tangem.domain.DomainLayer import com.tangem.domain.DomainLayer
import com.tangem.domain.common.LogConfig import com.tangem.domain.common.LogConfig
import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.feature.learn2earn.domain.api.Learn2earnInteractor import com.tangem.feature.learn2earn.domain.api.Learn2earnInteractor
import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles import com.tangem.features.tokendetails.featuretoggles.TokenDetailsFeatureToggles
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
@ -48,7 +49,6 @@ import com.tangem.tap.domain.walletCurrencies.di.provideDefaultImplementation
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.domain.walletStores.di.provideDefaultImplementation import com.tangem.tap.domain.walletStores.di.provideDefaultImplementation
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
import com.tangem.tap.domain.walletStores.repository.di.provideDefaultImplementation import com.tangem.tap.domain.walletStores.repository.di.provideDefaultImplementation
import com.tangem.tap.domain.walletconnect.WalletConnectRepository import com.tangem.tap.domain.walletconnect.WalletConnectRepository

View file

@ -5,19 +5,19 @@ import com.tangem.common.extensions.isZero
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.data.source.preferences.model.DataSourceTopupInfo import com.tangem.data.source.preferences.model.DataSourceTopupInfo
import com.tangem.data.source.preferences.storage.ToppedUpWalletStorage import com.tangem.data.source.preferences.storage.ToppedUpWalletStorage
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.CardTypesResolver import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.common.util.UserWalletId
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.analytics.converters.TopUpEventConverter import com.tangem.tap.common.analytics.converters.TopUpEventConverter
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.extensions.copy import com.tangem.tap.common.extensions.copy
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletDataModel
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency

View file

@ -1,12 +1,12 @@
package com.tangem.tap.common.extensions package com.tangem.tap.common.extensions
import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.extensions.withMainContext
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.StateDialog import com.tangem.tap.common.redux.StateDialog
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.TapError import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.scope import com.tangem.tap.scope
import com.tangem.tap.store import com.tangem.tap.store
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers

View file

@ -7,19 +7,15 @@ import com.tangem.common.core.TangemError
import com.tangem.datasource.config.ConfigManager import com.tangem.datasource.config.ConfigManager
import com.tangem.datasource.config.models.ChatConfig import com.tangem.datasource.config.models.ChatConfig
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.common.analytics.topup.TopUpController import com.tangem.tap.common.analytics.topup.TopUpController
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.feedback.FeedbackData import com.tangem.tap.common.feedback.FeedbackData
import com.tangem.tap.common.feedback.FeedbackManager import com.tangem.tap.common.feedback.FeedbackManager
import com.tangem.tap.common.redux.DebugErrorAction import com.tangem.tap.common.redux.*
import com.tangem.tap.common.redux.ErrorAction
import com.tangem.tap.common.redux.NotificationAction
import com.tangem.tap.common.redux.StateDialog
import com.tangem.tap.common.redux.ToastNotificationAction
import com.tangem.tap.domain.TapError import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.configurable.warningMessage.WarningMessage
import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.features.details.redux.SecurityOption import com.tangem.tap.features.details.redux.SecurityOption
import org.rekotlin.Action import org.rekotlin.Action

View file

@ -2,13 +2,13 @@ package com.tangem.tap.common.redux.global
import com.tangem.datasource.config.ConfigManager import com.tangem.datasource.config.ConfigManager
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.common.analytics.topup.TopUpController import com.tangem.tap.common.analytics.topup.TopUpController
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.feedback.FeedbackManager import com.tangem.tap.common.feedback.FeedbackManager
import com.tangem.tap.common.redux.StateDialog import com.tangem.tap.common.redux.StateDialog
import com.tangem.tap.domain.TapWalletManager import com.tangem.tap.domain.TapWalletManager
import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager import com.tangem.tap.domain.configurable.warningMessage.WarningMessagesManager
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.features.onboarding.OnboardingManager import com.tangem.tap.features.onboarding.OnboardingManager
import com.tangem.tap.network.exchangeServices.CurrencyExchangeManager import com.tangem.tap.network.exchangeServices.CurrencyExchangeManager
import org.rekotlin.StateType import org.rekotlin.StateType

View file

@ -11,6 +11,7 @@ import com.tangem.datasource.config.ConfigManager
import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.extensions.withMainContext
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.operations.attestation.Attestation import com.tangem.operations.attestation.Attestation
import com.tangem.tap.* import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.Basic import com.tangem.tap.common.analytics.events.Basic
@ -18,7 +19,6 @@ import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.common.extensions.dispatchWithMain import com.tangem.tap.common.extensions.dispatchWithMain
import com.tangem.tap.common.extensions.setContext import com.tangem.tap.common.extensions.setContext
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.WalletStoresError
import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction
import com.tangem.tap.features.disclaimer.createDisclaimer import com.tangem.tap.features.disclaimer.createDisclaimer

View file

@ -1,20 +1,16 @@
package com.tangem.tap.domain.extensions package com.tangem.tap.domain.extensions
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.*
import com.tangem.blockchain.common.DerivationParams
import com.tangem.blockchain.common.DerivationStyle
import com.tangem.blockchain.common.WalletManager
import com.tangem.blockchain.common.WalletManagerFactory
import com.tangem.common.card.EllipticCurve import com.tangem.common.card.EllipticCurve
import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toMapKey import com.tangem.common.extensions.toMapKey
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.isTestCard import com.tangem.domain.common.TapWorkarounds.isTestCard
import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
fun WalletManagerFactory.makeWalletManagerForApp( fun WalletManagerFactory.makeWalletManagerForApp(

View file

@ -3,9 +3,9 @@ package com.tangem.tap.domain.model
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel.WalletRent import com.tangem.tap.domain.model.WalletStoreModel.WalletRent
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import java.math.BigDecimal import java.math.BigDecimal

View file

@ -1,11 +1,11 @@
package com.tangem.tap.domain.model.builders package com.tangem.tap.domain.model.builders
import com.tangem.domain.common.TapWorkarounds.isStart2Coin
import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ProductType
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.common.TapWorkarounds.isStart2Coin import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.userWalletList.GetCardImageUseCase import com.tangem.tap.domain.userWalletList.GetCardImageUseCase
class UserWalletBuilder( class UserWalletBuilder(

View file

@ -3,12 +3,12 @@ package com.tangem.tap.domain.model.builders
import com.tangem.common.extensions.calculateSha256 import com.tangem.common.extensions.calculateSha256
import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.hexToBytes
import com.tangem.crypto.Secp256k1 import com.tangem.crypto.Secp256k1
import com.tangem.domain.common.TapWorkarounds.isTangemTwins
import com.tangem.domain.common.extensions.calculateHmacSha256
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ProductType
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.common.extensions.calculateHmacSha256
import com.tangem.domain.common.util.UserWalletId
class UserWalletIdBuilder private constructor( class UserWalletIdBuilder private constructor(
private val publicKey: ByteArray?, private val publicKey: ByteArray?,

View file

@ -1,18 +1,14 @@
package com.tangem.tap.domain.model.builders package com.tangem.tap.domain.model.builders
import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.*
import com.tangem.blockchain.common.DerivationStyle
import com.tangem.blockchain.common.Token
import com.tangem.blockchain.common.Wallet
import com.tangem.blockchain.common.WalletManager
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.TapWorkarounds.derivationStyle
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletDataModel
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.features.wallet.redux.reducers.createAddressesData import com.tangem.tap.features.wallet.redux.reducers.createAddressesData
import java.math.BigDecimal import java.math.BigDecimal

View file

@ -8,16 +8,12 @@ import com.tangem.common.core.CardSessionRunnable
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.common.core.TangemSdkError import com.tangem.common.core.TangemSdkError
import com.tangem.common.deserialization.WalletDataDeserializer import com.tangem.common.deserialization.WalletDataDeserializer
import com.tangem.common.extensions.ByteArrayKey import com.tangem.common.extensions.*
import com.tangem.common.extensions.guard
import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toByteArray
import com.tangem.common.extensions.toHexString
import com.tangem.common.extensions.toMapKey
import com.tangem.common.tlv.Tlv import com.tangem.common.tlv.Tlv
import com.tangem.common.tlv.TlvDecoder import com.tangem.common.tlv.TlvDecoder
import com.tangem.crypto.CryptoUtils import com.tangem.crypto.CryptoUtils
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.isExcluded import com.tangem.domain.common.TapWorkarounds.isExcluded
import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease
import com.tangem.domain.common.TapWorkarounds.isStart2Coin import com.tangem.domain.common.TapWorkarounds.isStart2Coin
@ -36,10 +32,10 @@ import com.tangem.operations.issuerAndUserData.ReadIssuerDataCommand
import com.tangem.tap.domain.TapSdkError import com.tangem.tap.domain.TapSdkError
import com.tangem.tap.domain.extensions.getPrimaryCurve import com.tangem.tap.domain.extensions.getPrimaryCurve
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.preferencesStorage import com.tangem.tap.preferencesStorage
import com.tangem.tap.scope import com.tangem.tap.scope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.collections.set
class ScanProductTask( class ScanProductTask(
val card: Card? = null, val card: Card? = null,

View file

@ -8,10 +8,10 @@ import com.tangem.datasource.api.tangemTech.TangemTechService
import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.api.tangemTech.models.UserTokensResponse
import com.tangem.datasource.connection.NetworkConnectionManager import com.tangem.datasource.connection.NetworkConnectionManager
import com.tangem.datasource.files.AndroidFileReader import com.tangem.datasource.files.AndroidFileReader
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder
import com.tangem.tap.domain.tokens.converters.CurrencyConverter import com.tangem.tap.domain.tokens.converters.CurrencyConverter
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.demo.DemoHelper
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.features.wallet.models.toBlockchainNetworks import com.tangem.tap.features.wallet.models.toBlockchainNetworks

View file

@ -1,7 +1,8 @@
package com.tangem.tap.domain.userWalletList package com.tangem.tap.domain.userWalletList
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.domain.wallets.models.UserWallet
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOf

View file

@ -5,22 +5,17 @@ import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import com.tangem.common.json.TangemSdkAdapter import com.tangem.common.json.TangemSdkAdapter
import com.tangem.common.services.secure.SecureStorage import com.tangem.common.services.secure.SecureStorage
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.sdk.storage.AndroidSecureStorage import com.tangem.sdk.storage.AndroidSecureStorage
import com.tangem.sdk.storage.createEncryptedSharedPreferences import com.tangem.sdk.storage.createEncryptedSharedPreferences
import com.tangem.tap.domain.TangemSdkManager import com.tangem.tap.domain.TangemSdkManager
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.implementation.BiometricUserWalletsListManager import com.tangem.tap.domain.userWalletList.implementation.BiometricUserWalletsListManager
import com.tangem.tap.domain.userWalletList.implementation.RuntimeUserWalletsListManager import com.tangem.tap.domain.userWalletList.implementation.RuntimeUserWalletsListManager
import com.tangem.tap.domain.userWalletList.repository.implementation.BiometricUserWalletsKeysRepository import com.tangem.tap.domain.userWalletList.repository.implementation.BiometricUserWalletsKeysRepository
import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultSelectedUserWalletRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultSelectedUserWalletRepository
import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsPublicInformationRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsPublicInformationRepository
import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsSensitiveInformationRepository import com.tangem.tap.domain.userWalletList.repository.implementation.DefaultUserWalletsSensitiveInformationRepository
import com.tangem.tap.domain.userWalletList.utils.json.ByteArrayKeyAdapter import com.tangem.tap.domain.userWalletList.utils.json.*
import com.tangem.tap.domain.userWalletList.utils.json.CardBackupStatusAdapter
import com.tangem.tap.domain.userWalletList.utils.json.DerivationPathAdapterWithMigration
import com.tangem.tap.domain.userWalletList.utils.json.ExtendedPublicKeysMapAdapter
import com.tangem.tap.domain.userWalletList.utils.json.ScanResponseDerivedKeysMapAdapter
import com.tangem.tap.domain.userWalletList.utils.json.WalletDerivedKeysMapAdapter
private const val USER_WALLETS_STORAGE_NAME = "user_wallets_storage" private const val USER_WALLETS_STORAGE_NAME = "user_wallets_storage"

View file

@ -2,10 +2,10 @@ package com.tangem.tap.domain.userWalletList.implementation
import com.tangem.common.* import com.tangem.common.*
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.UserWalletsListError import com.tangem.tap.domain.userWalletList.UserWalletsListError
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey
import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository
import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository

View file

@ -2,10 +2,10 @@ package com.tangem.tap.domain.userWalletList.implementation
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.common.catching import com.tangem.common.catching
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.UserWalletsListError import com.tangem.tap.domain.userWalletList.UserWalletsListError
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.* import kotlinx.coroutines.flow.*

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.userWalletList.model package com.tangem.tap.domain.userWalletList.model
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class UserWalletEncryptionKey( internal data class UserWalletEncryptionKey(

View file

@ -3,7 +3,7 @@ package com.tangem.tap.domain.userWalletList.model
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class UserWalletSensitiveInformation( internal data class UserWalletSensitiveInformation(

View file

@ -1,6 +1,6 @@
package com.tangem.tap.domain.userWalletList.repository package com.tangem.tap.domain.userWalletList.repository
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
internal interface SelectedUserWalletRepository { internal interface SelectedUserWalletRepository {
fun get(): UserWalletId? fun get(): UserWalletId?

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.userWalletList.repository package com.tangem.tap.domain.userWalletList.repository
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey
internal interface UserWalletsKeysRepository { internal interface UserWalletsKeysRepository {

View file

@ -1,8 +1,8 @@
package com.tangem.tap.domain.userWalletList.repository package com.tangem.tap.domain.userWalletList.repository
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation
internal interface UserWalletsPublicInformationRepository { internal interface UserWalletsPublicInformationRepository {

View file

@ -1,8 +1,8 @@
package com.tangem.tap.domain.userWalletList.repository package com.tangem.tap.domain.userWalletList.repository
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey
import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation

View file

@ -3,17 +3,12 @@ package com.tangem.tap.domain.userWalletList.repository.implementation
import com.squareup.moshi.JsonAdapter import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.Types import com.squareup.moshi.Types
import com.tangem.common.CompletionResult import com.tangem.common.*
import com.tangem.common.biometric.BiometricManager import com.tangem.common.biometric.BiometricManager
import com.tangem.common.biometric.BiometricStorage import com.tangem.common.biometric.BiometricStorage
import com.tangem.common.core.TangemSdkError import com.tangem.common.core.TangemSdkError
import com.tangem.common.doOnFailure
import com.tangem.common.flatMapOnFailure
import com.tangem.common.fold
import com.tangem.common.map
import com.tangem.common.mapFailure
import com.tangem.common.services.secure.SecureStorage import com.tangem.common.services.secure.SecureStorage
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.UserWalletsListError import com.tangem.tap.domain.userWalletList.UserWalletsListError
import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey
import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository import com.tangem.tap.domain.userWalletList.repository.UserWalletsKeysRepository

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.userWalletList.repository.implementation package com.tangem.tap.domain.userWalletList.repository.implementation
import com.tangem.common.services.secure.SecureStorage import com.tangem.common.services.secure.SecureStorage
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository import com.tangem.tap.domain.userWalletList.repository.SelectedUserWalletRepository
internal class DefaultSelectedUserWalletRepository( internal class DefaultSelectedUserWalletRepository(

View file

@ -7,9 +7,9 @@ import com.tangem.common.CompletionResult
import com.tangem.common.catching import com.tangem.common.catching
import com.tangem.common.flatMap import com.tangem.common.flatMap
import com.tangem.common.services.secure.SecureStorage import com.tangem.common.services.secure.SecureStorage
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.extensions.replaceByOrAdd import com.tangem.tap.common.extensions.replaceByOrAdd
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation
import com.tangem.tap.domain.userWalletList.repository.UserWalletsPublicInformationRepository import com.tangem.tap.domain.userWalletList.repository.UserWalletsPublicInformationRepository
import com.tangem.tap.domain.userWalletList.utils.publicInformation import com.tangem.tap.domain.userWalletList.utils.publicInformation

View file

@ -7,9 +7,9 @@ import com.squareup.moshi.Types
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.common.catching import com.tangem.common.catching
import com.tangem.common.services.secure.SecureStorage import com.tangem.common.services.secure.SecureStorage
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.extensions.filterNotNull import com.tangem.tap.common.extensions.filterNotNull
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey import com.tangem.tap.domain.userWalletList.model.UserWalletEncryptionKey
import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation
import com.tangem.tap.domain.userWalletList.repository.UserWalletsSensitiveInformationRepository import com.tangem.tap.domain.userWalletList.repository.UserWalletsSensitiveInformationRepository

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.userWalletList.utils package com.tangem.tap.domain.userWalletList.utils
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation import com.tangem.tap.domain.userWalletList.model.UserWalletPublicInformation
import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation import com.tangem.tap.domain.userWalletList.model.UserWalletSensitiveInformation

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.walletCurrencies package com.tangem.tap.domain.walletCurrencies
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
interface WalletCurrenciesManager { interface WalletCurrenciesManager {

View file

@ -1,11 +1,11 @@
package com.tangem.tap.domain.walletCurrencies.di package com.tangem.tap.domain.walletCurrencies.di
import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager
import com.tangem.tap.domain.walletCurrencies.implementation.DefaultWalletCurrenciesManager import com.tangem.tap.domain.walletCurrencies.implementation.DefaultWalletCurrenciesManager
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
fun WalletCurrenciesManager.Companion.provideDefaultImplementation( fun WalletCurrenciesManager.Companion.provideDefaultImplementation(

View file

@ -2,17 +2,17 @@ package com.tangem.tap.domain.walletCurrencies.implementation
import com.tangem.blockchain.common.DerivationStyle import com.tangem.blockchain.common.DerivationStyle
import com.tangem.common.* import com.tangem.common.*
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.TapWorkarounds.derivationStyle
import com.tangem.domain.common.util.UserWalletId
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.builders.WalletStoreBuilder import com.tangem.tap.domain.model.builders.WalletStoreBuilder
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager import com.tangem.tap.domain.walletCurrencies.WalletCurrenciesManager
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.features.wallet.models.toBlockchainNetworks import com.tangem.tap.features.wallet.models.toBlockchainNetworks

View file

@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores
import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchain.common.address.AddressType
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow

View file

@ -1,12 +1,12 @@
package com.tangem.tap.domain.walletStores.di package com.tangem.tap.domain.walletStores.di
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.tap.domain.walletStores.implementation.DummyWalletStoresManager
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.domain.walletStores.implementation.DefaultWalletStoresManager import com.tangem.tap.domain.walletStores.implementation.DefaultWalletStoresManager
import com.tangem.tap.domain.walletStores.implementation.DummyWalletStoresManager
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
fun WalletStoresManager.Companion.provideDummyImplementation(): WalletStoresManager { fun WalletStoresManager.Companion.provideDummyImplementation(): WalletStoresManager {

View file

@ -2,22 +2,17 @@ package com.tangem.tap.domain.walletStores.implementation
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchain.common.address.AddressType
import com.tangem.common.CompletionResult import com.tangem.common.*
import com.tangem.common.doOnSuccess import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.common.flatMap import com.tangem.domain.wallets.models.UserWallet
import com.tangem.common.flatMapOnFailure import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.common.fold
import com.tangem.common.map
import com.tangem.domain.common.util.UserWalletId
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.model.builders.WalletStoreBuilder import com.tangem.tap.domain.model.builders.WalletStoreBuilder
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.WalletStoresError
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
import com.tangem.tap.domain.walletStores.repository.implementation.utils.updateSelectedAddress import com.tangem.tap.domain.walletStores.repository.implementation.utils.updateSelectedAddress
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency

View file

@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores.implementation
import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchain.common.address.AddressType
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency

View file

@ -1,8 +1,8 @@
package com.tangem.tap.domain.walletStores.repository package com.tangem.tap.domain.walletStores.repository
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
interface WalletAmountsRepository { interface WalletAmountsRepository {

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.walletStores.repository package com.tangem.tap.domain.walletStores.repository
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow

View file

@ -2,8 +2,8 @@ package com.tangem.tap.domain.walletStores.repository.di
import com.tangem.blockchain.common.WalletManagerFactory import com.tangem.blockchain.common.WalletManagerFactory
import com.tangem.datasource.api.tangemTech.TangemTechService import com.tangem.datasource.api.tangemTech.TangemTechService
import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletManagersRepository import com.tangem.tap.domain.walletStores.repository.implementation.DefaultWalletManagersRepository

View file

@ -10,13 +10,13 @@ import com.tangem.blockchain.extensions.Result.Success
import com.tangem.common.* import com.tangem.common.*
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.datasource.api.tangemTech.TangemTechApi import com.tangem.datasource.api.tangemTech.TangemTechApi
import com.tangem.domain.common.util.UserWalletId
import com.tangem.domain.common.util.hasDerivation import com.tangem.domain.common.util.hasDerivation
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.TestActions import com.tangem.tap.common.TestActions
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.extensions.replaceByOrAdd import com.tangem.tap.common.extensions.replaceByOrAdd
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.WalletStoresError
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
@ -169,7 +169,7 @@ internal class DefaultWalletAmountsRepository(
walletStores.map { walletStore -> walletStores.map { walletStore ->
async { async {
// TODO: Find wallet manager via [com.tangem.tap.domain.walletStores.repository.WalletManagersRepository] // TODO: Find wallet manager via [com.tangem.domain.wallets.legacy.WalletManagersRepository]
val walletManager = walletStore.walletManager val walletManager = walletStore.walletManager
fetchAmountsForWalletStore(userWalletId, scanResponse, walletStore, walletManager) fetchAmountsForWalletStore(userWalletId, scanResponse, walletStore, walletManager)
} }

View file

@ -1,27 +1,22 @@
package com.tangem.tap.domain.walletStores.repository.implementation package com.tangem.tap.domain.walletStores.repository.implementation
import com.tangem.blockchain.common.Amount import com.tangem.blockchain.common.*
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.DerivationParams
import com.tangem.blockchain.common.DerivationStyle
import com.tangem.blockchain.common.WalletManager
import com.tangem.blockchain.common.WalletManagerFactory
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.common.catching import com.tangem.common.catching
import com.tangem.common.doOnSuccess import com.tangem.common.doOnSuccess
import com.tangem.common.mapFailure import com.tangem.common.mapFailure
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.isTestCard import com.tangem.domain.common.TapWorkarounds.isTestCard
import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.common.util.UserWalletId
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.legacy.WalletManagersRepository
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.extensions.makeWalletManagerForApp import com.tangem.tap.domain.extensions.makeWalletManagerForApp
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.domain.walletStores.WalletStoresError import com.tangem.tap.domain.walletStores.WalletStoresError
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.storage.WalletManagerStorage import com.tangem.tap.domain.walletStores.storage.WalletManagerStorage
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.flow.firstOrNull

View file

@ -2,7 +2,7 @@ package com.tangem.tap.domain.walletStores.repository.implementation
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.common.catching import com.tangem.common.catching
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository
import com.tangem.tap.domain.walletStores.repository.implementation.utils.isSameWalletStore import com.tangem.tap.domain.walletStores.repository.implementation.utils.isSameWalletStore

View file

@ -3,7 +3,7 @@ package com.tangem.tap.domain.walletStores.repository.implementation.utils
import com.tangem.blockchain.common.Wallet import com.tangem.blockchain.common.Wallet
import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchain.common.address.AddressType
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import timber.log.Timber import timber.log.Timber

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.walletStores.storage package com.tangem.tap.domain.walletStores.storage
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.SharedFlow

View file

@ -1,6 +1,6 @@
package com.tangem.tap.domain.walletStores.storage package com.tangem.tap.domain.walletStores.storage
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow

View file

@ -16,6 +16,7 @@ import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toDecompressedPublicKey import com.tangem.common.extensions.toDecompressedPublicKey
import com.tangem.common.extensions.toHexString import com.tangem.common.extensions.toHexString
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.operations.sign.SignHashCommand import com.tangem.operations.sign.SignHashCommand
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
@ -24,7 +25,6 @@ import com.tangem.tap.common.analytics.events.Basic.TransactionSent.MemoType
import com.tangem.tap.common.analytics.events.WalletConnect import com.tangem.tap.common.analytics.events.WalletConnect
import com.tangem.tap.common.extensions.safeUpdate import com.tangem.tap.common.extensions.safeUpdate
import com.tangem.tap.common.extensions.toFormattedString import com.tangem.tap.common.extensions.toFormattedString
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTradeOrder import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTradeOrder
import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTransferOrder import com.tangem.tap.domain.walletconnect.BnbHelper.toWCBinanceTransferOrder
import com.tangem.tap.domain.walletconnect2.domain.WcEthereumSignMessage import com.tangem.tap.domain.walletconnect2.domain.WcEthereumSignMessage

View file

@ -10,6 +10,7 @@ import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.common.TapWorkarounds.isTangemTwins
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.* import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.analytics.events.Settings import com.tangem.tap.common.analytics.events.Settings
@ -25,7 +26,6 @@ import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.model.builders.UserWalletBuilder import com.tangem.tap.domain.model.builders.UserWalletBuilder
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder
import com.tangem.tap.domain.scanCard.ScanCardProcessor import com.tangem.tap.domain.scanCard.ScanCardProcessor
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation
import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation import com.tangem.tap.domain.userWalletList.di.provideRuntimeImplementation
import com.tangem.tap.domain.userWalletList.isLockedSync import com.tangem.tap.domain.userWalletList.isLockedSync
@ -33,13 +33,7 @@ import com.tangem.tap.features.demo.DemoHelper
import com.tangem.tap.features.onboarding.products.twins.redux.CreateTwinWalletMode import com.tangem.tap.features.onboarding.products.twins.redux.CreateTwinWalletMode
import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsAction import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsAction
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.foregroundActivityObserver
import com.tangem.tap.preferencesStorage
import com.tangem.tap.scope
import com.tangem.tap.store
import com.tangem.tap.tangemSdkManager import com.tangem.tap.tangemSdkManager
import com.tangem.tap.userWalletsListManager
import com.tangem.tap.walletStoresManager
import com.tangem.wallet.R import com.tangem.wallet.R
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay import kotlinx.coroutines.delay

View file

@ -4,6 +4,7 @@ import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.DerivationStyle import com.tangem.blockchain.common.DerivationStyle
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.TapWorkarounds.derivationStyle
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.common.extensions.toNetworkId import com.tangem.domain.common.extensions.toNetworkId
@ -16,7 +17,6 @@ import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.domain.walletconnect.BnbHelper import com.tangem.tap.domain.walletconnect.BnbHelper
import com.tangem.tap.domain.walletconnect.WalletConnectManager import com.tangem.tap.domain.walletconnect.WalletConnectManager
import com.tangem.tap.domain.walletconnect.WalletConnectNetworkUtils import com.tangem.tap.domain.walletconnect.WalletConnectNetworkUtils

View file

@ -3,20 +3,16 @@ package com.tangem.tap.features.onboarding.products.otherCards.redux
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Blockchain
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.extensions.withMainContext
import com.tangem.tap.DELAY_SDK_DIALOG_CLOSE import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.Onboarding import com.tangem.tap.common.analytics.events.Onboarding
import com.tangem.tap.common.postUi import com.tangem.tap.common.postUi
import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.onboarding.OnboardingHelper import com.tangem.tap.features.onboarding.OnboardingHelper
import com.tangem.tap.features.wallet.models.toCurrencies import com.tangem.tap.features.wallet.models.toCurrencies
import com.tangem.tap.scope
import com.tangem.tap.store
import com.tangem.tap.tangemSdkManager
import com.tangem.tap.userTokensRepository
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.rekotlin.Action import org.rekotlin.Action

View file

@ -6,6 +6,7 @@ import com.tangem.common.CompletionResult
import com.tangem.common.core.TangemSdkError import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.ifNotNull import com.tangem.common.extensions.ifNotNull
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.withMainContext import com.tangem.domain.common.extensions.withMainContext
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
@ -23,7 +24,6 @@ import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.tasks.product.CreateProductWalletTaskResponse import com.tangem.tap.domain.tasks.product.CreateProductWalletTaskResponse
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.demo.DemoHelper import com.tangem.tap.features.demo.DemoHelper
import com.tangem.tap.features.home.redux.HomeAction import com.tangem.tap.features.home.redux.HomeAction
import com.tangem.tap.features.onboarding.OnboardingDialog import com.tangem.tap.features.onboarding.OnboardingDialog

View file

@ -7,6 +7,8 @@ import com.tangem.common.doOnSuccess
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.common.flatMap import com.tangem.common.flatMap
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.analytics.events.MainScreen import com.tangem.tap.common.analytics.events.MainScreen
import com.tangem.tap.common.analytics.events.Onboarding import com.tangem.tap.common.analytics.events.Onboarding
@ -17,16 +19,9 @@ import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.model.builders.UserWalletBuilder import com.tangem.tap.domain.model.builders.UserWalletBuilder
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation import com.tangem.tap.domain.userWalletList.di.provideBiometricImplementation
import com.tangem.tap.domain.userWalletList.isLockable import com.tangem.tap.domain.userWalletList.isLockable
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.foregroundActivityObserver
import com.tangem.tap.preferencesStorage
import com.tangem.tap.scope
import com.tangem.tap.store
import com.tangem.tap.tangemSdkManager
import com.tangem.tap.userWalletsListManager
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.rekotlin.Middleware import org.rekotlin.Middleware
import timber.log.Timber import timber.log.Timber

View file

@ -2,11 +2,11 @@ package com.tangem.tap.features.wallet.models
import com.tangem.blockchain.common.DerivationStyle import com.tangem.blockchain.common.DerivationStyle
import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.api.tangemTech.models.UserTokensResponse
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.common.extensions.toCoinId import com.tangem.domain.common.extensions.toCoinId
import com.tangem.domain.features.addCustomToken.CustomCurrency import com.tangem.domain.features.addCustomToken.CustomCurrency
import com.tangem.tap.common.redux.global.CryptoCurrencyName import com.tangem.tap.common.redux.global.CryptoCurrencyName
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.blockchain.common.Blockchain as SdkBlockchain import com.tangem.blockchain.common.Blockchain as SdkBlockchain
import com.tangem.blockchain.common.Token as SdkToken import com.tangem.blockchain.common.Token as SdkToken

View file

@ -4,17 +4,17 @@ import android.content.Context
import com.tangem.blockchain.common.Amount import com.tangem.blockchain.common.Amount
import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchain.common.address.AddressType
import com.tangem.core.analytics.AnalyticsEvent import com.tangem.core.analytics.AnalyticsEvent
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.redux.NotificationAction import com.tangem.tap.common.redux.NotificationAction
import com.tangem.tap.domain.TapError import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.configurable.warningMessage.WarningMessage import com.tangem.tap.domain.configurable.warningMessage.WarningMessage
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletDataModel
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.features.wallet.redux.models.WalletDialog import com.tangem.tap.features.wallet.redux.models.WalletDialog
import com.tangem.wallet.R import com.tangem.wallet.R

View file

@ -4,6 +4,7 @@ import android.graphics.Bitmap
import com.tangem.blockchain.common.AmountType import com.tangem.blockchain.common.AmountType
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.tap.common.entities.Button import com.tangem.tap.common.entities.Button
import com.tangem.tap.common.redux.global.CryptoCurrencyName import com.tangem.tap.common.redux.global.CryptoCurrencyName
@ -12,7 +13,6 @@ import com.tangem.tap.domain.configurable.warningMessage.WarningMessage
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.domain.model.WalletDataModel
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsState import com.tangem.tap.features.onboarding.products.twins.redux.TwinCardsState
import com.tangem.tap.features.wallet.models.Currency import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.store import com.tangem.tap.store

View file

@ -4,6 +4,7 @@ import com.tangem.common.doOnSuccess
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.common.flatMap import com.tangem.common.flatMap
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.analytics.events.Token.ButtonRemoveToken import com.tangem.tap.common.analytics.events.Token.ButtonRemoveToken
import com.tangem.tap.common.extensions.addContext import com.tangem.tap.common.extensions.addContext
@ -14,7 +15,6 @@ import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.TapError import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.scanCard.ScanCardProcessor import com.tangem.tap.domain.scanCard.ScanCardProcessor
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.features.wallet.redux.WalletState import com.tangem.tap.features.wallet.redux.WalletState

View file

@ -6,12 +6,12 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.common.analytics.converters.ParamCardCurrencyConverter import com.tangem.tap.common.analytics.converters.ParamCardCurrencyConverter
import com.tangem.tap.common.analytics.events.Basic import com.tangem.tap.common.analytics.events.Basic
import com.tangem.tap.common.analytics.events.MainScreen import com.tangem.tap.common.analytics.events.MainScreen
import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.features.wallet.ui.analytics.WalletAnalyticsEventsMapper import com.tangem.tap.features.wallet.ui.analytics.WalletAnalyticsEventsMapper
import com.tangem.tap.store import com.tangem.tap.store

View file

@ -5,10 +5,10 @@ import com.tangem.blockchain.common.AmountType
import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.Token
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.tap.common.TestAction import com.tangem.tap.common.TestAction
import com.tangem.tap.common.TestActions import com.tangem.tap.common.TestActions
import com.tangem.tap.common.extensions.dispatchDebugErrorNotification import com.tangem.tap.common.extensions.dispatchDebugErrorNotification
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.store import com.tangem.tap.store
import java.math.BigDecimal import java.math.BigDecimal

View file

@ -1,6 +1,6 @@
package com.tangem.tap.features.walletSelector.redux package com.tangem.tap.features.walletSelector.redux
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
data class UserWalletModel( data class UserWalletModel(

View file

@ -1,9 +1,9 @@
package com.tangem.tap.features.walletSelector.redux package com.tangem.tap.features.walletSelector.redux
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import org.rekotlin.Action import org.rekotlin.Action

View file

@ -3,8 +3,9 @@ package com.tangem.tap.features.walletSelector.redux
import com.tangem.common.* import com.tangem.common.*
import com.tangem.common.core.TangemSdkError import com.tangem.common.core.TangemSdkError
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.util.UserWalletId
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.* import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.analytics.events.Basic import com.tangem.tap.common.analytics.events.Basic
@ -16,7 +17,6 @@ import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.navigation.AppScreen import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.model.UserWallet
import com.tangem.tap.domain.model.WalletStoreModel import com.tangem.tap.domain.model.WalletStoreModel
import com.tangem.tap.domain.model.builders.UserWalletBuilder import com.tangem.tap.domain.model.builders.UserWalletBuilder
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder

View file

@ -2,9 +2,9 @@ package com.tangem.tap.features.walletSelector.redux
import com.tangem.domain.common.util.cardTypesResolver import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.AppState
import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.domain.model.TotalFiatBalance
import com.tangem.tap.domain.model.UserWallet
import org.rekotlin.Action import org.rekotlin.Action
internal object WalletSelectorReducer { internal object WalletSelectorReducer {

View file

@ -1,7 +1,7 @@
package com.tangem.tap.features.walletSelector.redux package com.tangem.tap.features.walletSelector.redux
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import org.rekotlin.StateType import org.rekotlin.StateType

View file

@ -1,7 +1,7 @@
package com.tangem.tap.features.walletSelector.ui package com.tangem.tap.features.walletSelector.ui
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.features.details.ui.cardsettings.TextReference import com.tangem.tap.features.details.ui.cardsettings.TextReference
import com.tangem.tap.features.walletSelector.ui.model.DialogModel import com.tangem.tap.features.walletSelector.ui.model.DialogModel
import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem

View file

@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.tangem.common.core.TangemError import com.tangem.common.core.TangemError
import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.Analytics
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.analytics.events.MyWallets import com.tangem.tap.common.analytics.events.MyWallets
import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.domain.userWalletList.UserWalletsListError import com.tangem.tap.domain.userWalletList.UserWalletsListError

View file

@ -1,6 +1,6 @@
package com.tangem.tap.features.walletSelector.ui.components package com.tangem.tap.features.walletSelector.ui.components
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState
import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem
import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem

View file

@ -25,7 +25,7 @@ import com.tangem.core.ui.components.SecondaryButtonIconEnd
import com.tangem.core.ui.components.SpacerWMax import com.tangem.core.ui.components.SpacerWMax
import com.tangem.core.ui.components.atoms.Hand import com.tangem.core.ui.components.atoms.Hand
import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemTheme
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState import com.tangem.tap.features.walletSelector.ui.WalletSelectorScreenState
import com.tangem.wallet.R import com.tangem.wallet.R

View file

@ -4,16 +4,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Divider import androidx.compose.material.Divider
import androidx.compose.material.Icon import androidx.compose.material.Icon
@ -39,7 +30,7 @@ import com.tangem.core.ui.components.SpacerH2
import com.tangem.core.ui.components.SpacerW6 import com.tangem.core.ui.components.SpacerW6
import com.tangem.core.ui.components.SpacerW8 import com.tangem.core.ui.components.SpacerW8
import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.res.TangemTheme
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.common.extensions.cardImageData import com.tangem.tap.common.extensions.cardImageData
import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem
import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem

View file

@ -1,6 +1,6 @@
package com.tangem.tap.features.walletSelector.ui.model package com.tangem.tap.features.walletSelector.ui.model
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN
internal sealed interface UserWalletItem { internal sealed interface UserWalletItem {

View file

@ -3,11 +3,11 @@ package com.tangem.tap.proxy
import com.tangem.TangemSdk import com.tangem.TangemSdk
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.tap.common.entities.FiatCurrency import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.redux.AppState import com.tangem.tap.common.redux.AppState
import com.tangem.tap.domain.TangemSdkManager import com.tangem.tap.domain.TangemSdkManager
import com.tangem.tap.domain.tokens.UserTokensRepository import com.tangem.tap.domain.tokens.UserTokensRepository
import com.tangem.tap.domain.userWalletList.UserWalletsListManager
import com.tangem.tap.domain.walletStores.WalletStoresManager import com.tangem.tap.domain.walletStores.WalletStoresManager
import com.tangem.tap.features.wallet.redux.WalletState import com.tangem.tap.features.wallet.redux.WalletState
import org.rekotlin.Store import org.rekotlin.Store

View file

@ -9,6 +9,7 @@ import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.ByteArrayKey import com.tangem.common.extensions.ByteArrayKey
import com.tangem.common.extensions.toMapKey import com.tangem.common.extensions.toMapKey
import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.TapWorkarounds.derivationStyle
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.common.util.hasDerivation import com.tangem.domain.common.util.hasDerivation
@ -23,7 +24,6 @@ import com.tangem.tap.common.extensions.dispatchDebugErrorNotification
import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.TapError import com.tangem.tap.domain.TapError
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.scope import com.tangem.tap.scope
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch

View file

@ -12,6 +12,7 @@ import com.tangem.blockchain.extensions.isNetworkError
import com.tangem.common.core.TangemSdkError import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.hexToBytes
import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.lib.crypto.TransactionManager import com.tangem.lib.crypto.TransactionManager
import com.tangem.lib.crypto.models.* import com.tangem.lib.crypto.models.*
@ -21,7 +22,6 @@ import com.tangem.tap.common.analytics.events.Basic
import com.tangem.tap.common.analytics.events.Basic.TransactionSent.MemoType import com.tangem.tap.common.analytics.events.Basic.TransactionSent.MemoType
import com.tangem.tap.common.redux.global.GlobalAction import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.TangemSigner import com.tangem.tap.domain.TangemSigner
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.tangemSdk import com.tangem.tap.tangemSdk
import java.math.BigDecimal import java.math.BigDecimal
import java.math.BigInteger import java.math.BigInteger

View file

@ -6,6 +6,7 @@ import com.tangem.blockchain.common.Token
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.common.doOnFailure import com.tangem.common.doOnFailure
import com.tangem.common.extensions.guard import com.tangem.common.extensions.guard
import com.tangem.domain.common.BlockchainNetwork
import com.tangem.domain.common.extensions.fromNetworkId import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.common.extensions.toCoinId import com.tangem.domain.common.extensions.toCoinId
import com.tangem.domain.common.extensions.toNetworkId import com.tangem.domain.common.extensions.toNetworkId
@ -17,7 +18,6 @@ import com.tangem.lib.crypto.models.ProxyAmount
import com.tangem.lib.crypto.models.ProxyFiatCurrency import com.tangem.lib.crypto.models.ProxyFiatCurrency
import com.tangem.tap.common.extensions.dispatchOnMain import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder import com.tangem.tap.domain.model.builders.UserWalletIdBuilder
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.userWalletsListManager import com.tangem.tap.userWalletsListManager
import com.tangem.tap.walletCurrenciesManager import com.tangem.tap.walletCurrenciesManager

View file

@ -1,12 +1,12 @@
package com.tangem.tap.domain.tokens.models package com.tangem.domain.common
import com.squareup.moshi.JsonClass import com.squareup.moshi.JsonClass
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.Token
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.common.extensions.calculateHashCode import com.tangem.common.extensions.calculateHashCode
import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.common.TapWorkarounds.derivationStyle import com.tangem.domain.common.TapWorkarounds.derivationStyle
import com.tangem.domain.models.scan.CardDTO
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class BlockchainNetwork( data class BlockchainNetwork(

View file

@ -1,34 +0,0 @@
package com.tangem.domain.common.util
import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toHexString
class UserWalletId(
val stringValue: String,
) {
val value = stringValue.hexToBytes()
constructor(value: ByteArray?) : this(
stringValue = value?.toHexString() ?: "",
)
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is UserWalletId) return false
if (stringValue != other.stringValue) return false
return true
}
override fun hashCode(): Int {
return stringValue.hashCode()
}
@Suppress("MagicNumber")
override fun toString(): String {
return with(stringValue) {
"UserWalletId(${take(3)}...${takeLast(3)})"
}
}
}

1
domain/wallets/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,26 @@
plugins {
alias(deps.plugins.android.library)
alias(deps.plugins.kotlin.android)
id("configuration")
}
android {
namespace = "com.tangem.domain.wallets"
}
dependencies {
// region Domain modules
implementation(project(":domain:legacy"))
implementation(project(":domain:wallets:models"))
// endregion
// region Tangem libraries
implementation(deps.tangem.blockchain) // android-library
implementation(deps.tangem.card.core)
// endregion
// region Other libraries
implementation(deps.kotlin.coroutines)
// endregion
}

1
domain/wallets/models/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

View file

@ -0,0 +1,14 @@
plugins {
alias(deps.plugins.kotlin.jvm)
id("configuration")
}
dependencies {
// region Tangem libraries
implementation(deps.tangem.card.core)
// endregion
// region Domain modules
implementation(project(":domain:models"))
// endregion
}

View file

@ -1,7 +1,6 @@
package com.tangem.tap.domain.model package com.tangem.domain.wallets.models
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.common.util.UserWalletId
/** /**
* Represents user's wallet which stored in app persistence * Represents user's wallet which stored in app persistence

View file

@ -0,0 +1,13 @@
package com.tangem.domain.wallets.models
import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toHexString
data class UserWalletId(val stringValue: String) {
val value = stringValue.hexToBytes()
constructor(value: ByteArray?) : this(stringValue = value?.toHexString() ?: "")
override fun toString() = "UserWalletId(${stringValue.take(n = 3)}...${stringValue.takeLast(n = 3)})"
}

View file

@ -1,34 +1,25 @@
package com.tangem.tap.domain.userWalletList package com.tangem.domain.wallets.legacy
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWalletId
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
interface UserWalletsListManager { interface UserWalletsListManager {
/**
* [Flow] with all saved [UserWallet]s updates /** [Flow] with all saved [UserWallet]s updates */
* */
val userWallets: Flow<List<UserWallet>> val userWallets: Flow<List<UserWallet>>
/** /** [Flow] with selected [UserWallet] updates */
* [Flow] with selected [UserWallet] updates
* */
val selectedUserWallet: Flow<UserWallet> val selectedUserWallet: Flow<UserWallet>
/** /** Selected [UserWallet] */
* Selected [UserWallet]
* */
val selectedUserWalletSync: UserWallet? val selectedUserWalletSync: UserWallet?
/** /** Indicates that the [UserWalletsListManager] contains at least one saved [UserWallet] */
* Indicates that the [UserWalletsListManager] contains at least one saved [UserWallet]
* */
val hasUserWallets: Boolean val hasUserWallets: Boolean
/** /** Count of saved user wallets */
* Count of saved user wallets
*/
val walletsCount: Int val walletsCount: Int
/** /**
@ -36,78 +27,79 @@ interface UserWalletsListManager {
* *
* @param userWalletId [UserWalletId] of [UserWallet] which must be selected * @param userWalletId [UserWalletId] of [UserWallet] which must be selected
* *
* @return [CompletionResult.Success] with selected [UserWallet] * @return [CompletionResult.Success] with selected [UserWallet] or [CompletionResult.Failure] with
* or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found * [NoSuchElementException] if [UserWallet] with [userWalletId] not found
* */ */
suspend fun select(userWalletId: UserWalletId): CompletionResult<UserWallet> suspend fun select(userWalletId: UserWalletId): CompletionResult<UserWallet>
/** /**
* Save provided user wallet and set it as selected * Save provided user wallet and set it as selected
*
* @param userWallet [UserWallet] to save * @param userWallet [UserWallet] to save
* @param canOverride If false, then terminate with [UserWalletsListError.WalletAlreadySaved] when user tries * @param canOverride If false, then terminate with [UserWalletsListError.WalletAlreadySaved] when user tries
* to save an already saved card * to save an already saved card
*
* @return [CompletionResult] of operation * @return [CompletionResult] of operation
*/ */
suspend fun save(userWallet: UserWallet, canOverride: Boolean = false): CompletionResult<Unit> suspend fun save(userWallet: UserWallet, canOverride: Boolean = false): CompletionResult<Unit>
/** /**
* Same as [save] but not change selected user wallet ID * Same as [save] but not change selected user wallet ID and not terminate with
* and not terminate with [UserWalletsListError.WalletAlreadySaved] if [UserWallet] already saved * [UserWalletsListError.WalletAlreadySaved] if [UserWallet] already saved.
* Can terminate with [NoSuchElementException] if unable to find [UserWallet] with provided [UserWalletId].
* *
* Can terminate with [NoSuchElementException] if unable to find [UserWallet] with provided [UserWalletId]
* @param userWalletId update [UserWallet] with that [UserWalletId] * @param userWalletId update [UserWallet] with that [UserWalletId]
* @param update lambda that receives stored [UserWallet] and returns updated [UserWallet] * @param update lambda that receives stored [UserWallet] and returns updated [UserWallet]
* @return [CompletionResult.Success] with updated [UserWallet] *
* or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found * @return [CompletionResult.Success] with updated [UserWallet] or [CompletionResult.Failure] with
* */ * [NoSuchElementException] if [UserWallet] with [userWalletId] not found
*/
suspend fun update( suspend fun update(
userWalletId: UserWalletId, userWalletId: UserWalletId,
update: suspend (UserWallet) -> UserWallet, update: suspend (UserWallet) -> UserWallet,
): CompletionResult<UserWallet> ): CompletionResult<UserWallet>
/** /**
* Delete saved [UserWallet]s with provided [UserWalletId]s * Delete saved [UserWallet]s with provided [UserWalletId]s.
* * Sets [isLocked] as true if [userWallets] is empty or if all [userWallets] are locked.
* Sets [isLocked] as true if [userWallets] is empty or if all [userWallets] are locked
* *
* @param userWalletIds [UserWalletId]s of [UserWallet]s which must be deleted * @param userWalletIds [UserWalletId]s of [UserWallet]s which must be deleted
* *
* @return [CompletionResult] of operation * @return [CompletionResult] of operation
* */ */
suspend fun delete(userWalletIds: List<UserWalletId>): CompletionResult<Unit> suspend fun delete(userWalletIds: List<UserWalletId>): CompletionResult<Unit>
/** /**
* Clear all saved [UserWallet]s and set [isLocked] as true * Clear all saved [UserWallet]s and set [isLocked] as true
* *
* @return [CompletionResult] of operation * @return [CompletionResult] of operation
* */ */
suspend fun clear(): CompletionResult<Unit> suspend fun clear(): CompletionResult<Unit>
/** /**
* Get [UserWallet] with provided [UserWalletId] * Get [UserWallet] with provided [UserWalletId]
* *
* @return [CompletionResult.Success] with found [UserWallet] * @return [CompletionResult.Success] with found [UserWallet] or [CompletionResult.Failure] with
* or [CompletionResult.Failure] with [NoSuchElementException] if [UserWallet] with [userWalletId] not found * [NoSuchElementException] if [UserWallet] with [userWalletId] not found
* */ */
suspend fun get(userWalletId: UserWalletId): CompletionResult<UserWallet> suspend fun get(userWalletId: UserWalletId): CompletionResult<UserWallet>
interface Lockable : UserWalletsListManager { interface Lockable : UserWalletsListManager {
/** /**
* Indicates that all [UserWallet]s is locked * Indicates that all [UserWallet]s is locked
* *
* @see [isLockedSync] * @see [isLockedSync]
* @see [UserWallet.isLocked] * @see [UserWallet.isLocked]
* */ */
val isLocked: Flow<Boolean> val isLocked: Flow<Boolean>
/** /**
* Indicates that all [UserWallet]s is locked * Indicates that all [UserWallet]s is locked. Sync version.
*
* Sync version
* *
* @see [isLocked] * @see [isLocked]
* @see [UserWallet.isLocked] * @see [UserWallet.isLocked]
* */ */
val isLockedSync: Boolean val isLockedSync: Boolean
/** /**
@ -115,12 +107,10 @@ interface UserWalletsListManager {
* *
* @return [CompletionResult] of operation, with selected [UserWallet] * @return [CompletionResult] of operation, with selected [UserWallet]
* or null if there is no selected [UserWallet] * or null if there is no selected [UserWallet]
* */ */
suspend fun unlock(): CompletionResult<UserWallet> suspend fun unlock(): CompletionResult<UserWallet>
/** /** Remove [UserWallet]s from [userWallets] and set [isLocked] as true */
* Remove [UserWallet]s from [userWallets] and set [isLocked] as true
* */
fun lock() fun lock()
} }

View file

@ -1,13 +1,14 @@
package com.tangem.tap.domain.walletStores.repository package com.tangem.domain.wallets.legacy
import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.WalletManager
import com.tangem.common.CompletionResult import com.tangem.common.CompletionResult
import com.tangem.domain.common.util.UserWalletId import com.tangem.domain.common.BlockchainNetwork
import com.tangem.tap.domain.model.UserWallet import com.tangem.domain.wallets.models.UserWallet
import com.tangem.tap.domain.tokens.models.BlockchainNetwork import com.tangem.domain.wallets.models.UserWalletId
interface WalletManagersRepository { interface WalletManagersRepository {
suspend fun findOrMakeMultiCurrencyWalletManager( suspend fun findOrMakeMultiCurrencyWalletManager(
userWallet: UserWallet, userWallet: UserWallet,
blockchainNetwork: BlockchainNetwork, blockchainNetwork: BlockchainNetwork,

View file

@ -77,6 +77,8 @@ include(":domain:legacy")
include(":domain:core") include(":domain:core")
include(":domain:card") include(":domain:card")
include(":domain:wallets")
include(":domain:wallets:models")
// endregion Domain modules // endregion Domain modules
// region Data modules // region Data modules