From 095c75536209a4a8ba6591ac75745c6699c5be84 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Jul 2025 17:48:38 +0300 Subject: [PATCH] Updated on 2026-08-14 --- app/build.gradle.kts | 4 + app/src/main/assets/tangem-app-config | 2 +- .../converters/ParamCardCurrencyConverter.kt | 2 +- .../CardContextInterceptor.kt | 2 +- .../tangem/tap/di/domain/CardDomainModule.kt | 3 +- .../tap/di/domain/TransactionDomainModule.kt | 2 +- .../di/domain/WalletManagersFacadeModule.kt | 37 --- .../domain/card/MissedDerivationsFinder.kt | 4 +- .../com/tangem/tap/domain/model/Currency.kt | 16 -- .../domain/scanCard/LegacyScanProcessor.kt | 2 +- .../chains/CheckForOnboardingChain.kt | 2 +- .../sdk/impl/DefaultTangemSdkManager.kt | 4 +- .../tasks/product/CreateProductWalletTask.kt | 8 +- .../domain/tasks/product/DerivationsFinder.kt | 4 +- .../domain/tasks/product/ScanProductTask.kt | 18 +- .../tasks/visa/VisaCardActivationTask.kt | 2 +- .../visa/VisaCustomerWalletApproveTask.kt | 8 +- .../tap/domain/visa/VisaCardScanHandler.kt | 2 +- .../tangem/tap/features/demo/DemoHelper.kt | 2 +- .../tap/features/demo/DemoMiddleware.kt | 2 +- .../model/AccessCodeRecoveryModel.kt | 2 +- .../cardsettings/model/CardSettingsModel.kt | 6 +- .../ui/common/utils/AccessCodeRecovery.kt | 2 +- .../details/ui/common/utils/ResetToFactory.kt | 2 +- .../ui/common/utils/SecurityOptionsUtils.kt | 2 +- .../ui/resetcard/model/ResetCardModel.kt | 2 +- .../securitymode/model/SecurityModeModel.kt | 2 +- .../com/tangem/tap/features/home/HomeModel.kt | 2 +- .../tap/features/home/redux/HomeMiddleware.kt | 2 +- .../features/onboarding/OnboardingHelper.kt | 4 +- .../welcome/redux/WelcomeMiddleware.kt | 2 +- .../moonpay/MoonPayService.kt | 2 +- .../card/DefaultDerivationsRepositoryTest.kt | 4 +- .../card/MissedDerivationsFinderTest.kt | 8 +- .../BiometricUserWalletsListManagerTest.kt | 2 +- common/test/build.gradle.kts | 1 + .../domain/card/MockScanResponseFactory.kt | 6 +- .../domain/token/MockCryptoCurrencyFactory.kt | 6 +- .../domain/wallet/MockUserWalletFactory.kt | 4 +- common/ui/build.gradle.kts | 1 + .../converter/UserWalletItemUMConverter.kt | 2 +- data/common/build.gradle.kts | 1 + .../DefaultCardCryptoCurrencyFactory.kt | 6 +- .../ResponseCryptoCurrenciesFactory.kt | 2 +- .../tangem/data/common/di/DataCommonModule.kt | 2 +- .../data/common/network/NetworkFactory.kt | 6 +- .../DefaultCardCryptoCurrencyFactoryTest.kt | 6 +- .../data/common/network/NetworkFactoryTest.kt | 8 +- data/feedback/build.gradle.kts | 1 + .../feedback/converters/CardInfoConverter.kt | 6 +- data/manage-tokens/build.gradle.kts | 1 + .../DefaultCustomTokensRepository.kt | 6 +- .../DefaultManageTokensRepository.kt | 12 +- .../utils/ManagedCryptoCurrencyFactory.kt | 6 +- data/networks/build.gradle.kts | 2 + .../DefaultMultiNetworkStatusProducerTest.kt | 2 +- data/nft/build.gradle.kts | 2 + .../tangem/data/nft/DefaultNFTRepository.kt | 5 +- data/onramp/build.gradle.kts | 2 + .../data/onramp/DefaultHotCryptoRepository.kt | 6 +- data/staking/build.gradle.kts | 2 + .../data/staking/DefaultStakingRepository.kt | 2 +- data/tokens/build.gradle.kts | 2 + ...faultMultiWalletCryptoCurrenciesFetcher.kt | 2 +- ...ultiWalletCryptoCurrenciesFetcherModule.kt | 2 +- .../repository/DefaultCurrenciesRepository.kt | 6 +- ...tMultiWalletCryptoCurrenciesFetcherTest.kt | 2 +- ...MultiWalletCryptoCurrenciesProducerTest.kt | 2 +- data/transaction/build.gradle.kts | 1 + data/txhistory/build.gradle.kts | 1 + data/visa/build.gradle.kts | 1 + .../tangem/data/visa/DefaultVisaRepository.kt | 2 +- .../data/visa/utils/VisaApiRequestMaker.kt | 2 +- .../data/visa/utils/VisaCurrencyFactory.kt | 2 +- data/wallet-connect/build.gradle.kts | 1 + data/wallet-manager/.gitignore | 1 + data/wallet-manager/build.gradle.kts | 53 ++++ .../DefaultWalletManagersFacade.kt | 24 +- .../UpdateWalletManagerResultFactory.kt | 71 +++--- .../walletmanager}/WalletManagerFactory.kt | 10 +- .../walletmanager/di/WalletManagerModule.kt | 18 ++ .../extensions/WalletManagerFactory.kt | 12 +- .../utils/CryptoCurrencyTypeConverter.kt | 2 +- .../utils/SdkAddressToAddressConverter.kt | 2 +- .../SdkRequirementsConditionConverter.kt | 2 +- .../walletmanager/utils/SdkTokenConverter.kt | 2 +- .../SdkTransactionHistoryItemConverter.kt | 2 +- .../SdkTransactionHistoryStateConverter.kt | 2 +- .../utils/SdkTransactionTypeConverter.kt | 2 +- ...TransactionDataToTxHistoryItemConverter.kt | 2 +- .../UpdateWalletManagerResultFactoryTest.kt | 239 +++++++++++++----- domain/card/build.gradle.kts | 11 + .../tangem/domain/card}/CardTypesResolver.kt | 2 +- .../domain/card}/DerivationStyleProvider.kt | 5 +- .../card/NetworkHasDerivationUseCase.kt | 21 -- .../domain/card}/TangemCardTypesResolver.kt | 25 +- .../domain/card}/common/TapWorkarounds.kt | 6 +- .../tangem/domain/card/common/TwinsHelper.kt | 90 +++++++ .../domain/card}/common/extensions/CardSdk.kt | 18 +- .../card}/common/util/ScanResponseExt.kt | 36 ++- .../domain/card}/common/util/UserWalletExt.kt | 2 +- .../domain/card}/common/visa/VisaUtilities.kt | 2 +- .../common/visa/VisaWalletPublicKeyUtility.kt | 2 +- .../tangem/domain/card}/configs/CardConfig.kt | 2 +- .../configs/EdSingleCurrencyCardConfig.kt | 2 +- .../domain/card}/configs/GenericCardConfig.kt | 2 +- .../card}/configs/MultiWalletCardConfig.kt | 2 +- .../domain/card}/configs/Wallet2CardConfig.kt | 2 +- .../tangem/domain/card}/TwinsHelperTest.kt | 3 +- .../card}/configs/Wallet2CardConfigTest.kt | 2 +- domain/demo/build.gradle.kts | 2 + domain/demo/models/.gitignore | 1 + domain/demo/models/build.gradle.kts | 14 + .../tangem/domain/demo/models}/DemoConfig.kt | 3 +- .../tangem/domain/demo/IsDemoCardUseCase.kt | 2 + .../tangem/domain/common/BlockchainNetwork.kt | 40 --- domain/manage-tokens/build.gradle.kts | 1 + ...FilterAvailableNetworksForWalletUseCase.kt | 4 +- domain/staking/build.gradle.kts | 1 + domain/tokens/build.gradle.kts | 2 + .../tokens/GetNetworkCoinStatusUseCase.kt | 2 +- .../tokens/repository/CurrenciesRepository.kt | 2 +- .../repository/MockCurrenciesRepository.kt | 2 +- .../tokens/wallet/WalletBalanceFetcherTest.kt | 2 +- domain/transaction/build.gradle.kts | 1 + .../transaction/usecase/EstimateFeeUseCase.kt | 2 +- .../transaction/usecase/GetFeeUseCase.kt | 2 +- .../usecase/PrepareForSendUseCase.kt | 2 +- .../usecase/SendTransactionUseCase.kt | 6 +- .../domain/transaction/usecase/SignUseCase.kt | 2 +- domain/wallet-manager/.gitignore | 1 + domain/wallet-manager/build.gradle.kts | 44 ++++ domain/wallet-manager/models/.gitignore | 1 + domain/wallet-manager/models/build.gradle.kts | 17 ++ .../domain/walletmanager/model/RentData.kt | 0 .../model/SmartContractMethod.kt | 0 .../domain/walletmanager/model/TokenInfo.kt | 0 .../walletmanager/WalletManagersFacade.kt | 1 - .../walletmanager/utils/SdkPageConverter.kt | 0 domain/wallets/build.gradle.kts | 2 + .../wallets/builder/ColdUserWalletBuilder.kt | 2 +- .../wallets/builder/UserWalletIdBuilder.kt | 2 +- .../wallets/extension/UserWalletExtensions.kt | 30 +++ .../usecase/NetworkHasDerivationUseCase.kt | 16 ++ .../features/details/model/DetailsModel.kt | 2 +- .../entry/impl/model/OnboardingEntryModel.kt | 2 +- .../model/Wallet1ChooseOptionModel.kt | 2 +- .../child/finalize/model/BackupValidator.kt | 2 +- .../model/MultiWalletFinalizeModel.kt | 2 +- .../model/Wallet1ScanPrimaryModel.kt | 2 +- .../impl/DefaultOnboardingStepperComponent.kt | 2 +- .../v2/twin/impl/model/OnboardingTwinModel.kt | 2 +- .../v2/visa/impl/model/OnboardingVisaModel.kt | 4 +- features/referral/impl/build.gradle.kts | 1 + .../DefaultReferralDeepLinkHandler.kt | 2 +- features/send-v2/impl/build.gradle.kts | 1 + .../features/send/v2/send/model/SendModel.kt | 2 +- .../send/v2/sendnft/model/NFTSendModel.kt | 2 +- features/swap-v2/impl/build.gradle.kts | 1 + .../sendviaswap/model/SendWithSwapModel.kt | 2 +- features/swap/data/build.gradle.kts | 1 + .../DefaultTokenDetailsDeepLinkHandler.kt | 2 +- .../tokendetails/model/TokenDetailsModel.kt | 4 +- .../TokenDetailsSkeletonStateConverter.kt | 2 +- .../state/factory/TokenDetailsStateFactory.kt | 4 +- features/txhistory/impl/build.gradle.kts | 1 + .../txhistory/model/TxHistoryModel.kt | 2 +- .../wallet-settings/impl/build.gradle.kts | 1 + .../model/WalletSettingsModel.kt | 2 +- features/wallet/impl/build.gradle.kts | 1 + .../wallet/child/wallet/model/WalletModel.kt | 2 +- .../model/WalletsUpdateActionResolver.kt | 2 +- .../model/intents/WalletClickIntents.kt | 2 +- .../wallet/domain/BackupValidator.kt | 2 +- .../domain/GetMultiWalletWarningsFactory.kt | 4 +- .../domain/GetSingleWalletWarningsFactory.kt | 4 +- .../HasSingleWalletSignedHashesUseCase.kt | 4 +- .../domain/WalletAdditionalInfoFactory.kt | 4 +- .../wallet/domain/WalletImageResolver.kt | 6 +- .../loaders/WalletContentLoaderFactory.kt | 2 +- .../InitializeWalletsTransformer.kt | 2 +- .../SetCryptoCurrencyActionsTransformer.kt | 2 +- .../SetTokenListErrorTransformer.kt | 2 +- .../SetTxHistoryCountErrorTransformer.kt | 2 +- .../transformers/SetVisaInfoTransformer.kt | 2 +- .../UpdateWalletCardsCountTransformer.kt | 2 +- .../MultiWalletCardStateConverter.kt | 2 +- .../MultiWalletCurrencyActionsConverter.kt | 2 +- .../SingleWalletCardStateConverter.kt | 2 +- .../converter/TokenListStateConverter.kt | 2 +- .../state/utils/UserWalletConverterExt.kt | 2 +- .../state/utils/WalletLoadingStateFactory.kt | 2 +- .../wallet/subscribers/TxHistorySubscriber.kt | 2 +- settings.gradle.kts | 4 + 194 files changed, 830 insertions(+), 473 deletions(-) delete mode 100644 app/src/main/java/com/tangem/tap/di/domain/WalletManagersFacadeModule.kt create mode 100644 data/wallet-manager/.gitignore create mode 100644 data/wallet-manager/build.gradle.kts rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/DefaultWalletManagersFacade.kt (97%) rename {domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils => data/wallet-manager/src/main/java/com/tangem/data/walletmanager}/UpdateWalletManagerResultFactory.kt (68%) rename {domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils => data/wallet-manager/src/main/java/com/tangem/data/walletmanager}/WalletManagerFactory.kt (91%) create mode 100644 data/wallet-manager/src/main/java/com/tangem/data/walletmanager/di/WalletManagerModule.kt rename {domain/legacy/src/main/java/com/tangem/domain/common => data/wallet-manager/src/main/java/com/tangem/data/walletmanager}/extensions/WalletManagerFactory.kt (93%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/CryptoCurrencyTypeConverter.kt (94%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkAddressToAddressConverter.kt (93%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkRequirementsConditionConverter.kt (97%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkTokenConverter.kt (92%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkTransactionHistoryItemConverter.kt (99%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkTransactionHistoryStateConverter.kt (94%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/SdkTransactionTypeConverter.kt (98%) rename {domain/legacy/src/main/java/com/tangem/domain => data/wallet-manager/src/main/java/com/tangem/data}/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt (98%) rename {domain/legacy/src/test/java/com/tangem/domain/walletmanager/utils => data/wallet-manager/src/test/java/com/tangem/data/walletmanager}/UpdateWalletManagerResultFactoryTest.kt (75%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/CardTypesResolver.kt (96%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/DerivationStyleProvider.kt (86%) delete mode 100644 domain/card/src/main/kotlin/com/tangem/domain/card/NetworkHasDerivationUseCase.kt rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/TangemCardTypesResolver.kt (84%) rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/TapWorkarounds.kt (95%) create mode 100644 domain/card/src/main/kotlin/com/tangem/domain/card/common/TwinsHelper.kt rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/extensions/CardSdk.kt (91%) rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/util/ScanResponseExt.kt (71%) rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/util/UserWalletExt.kt (92%) rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/visa/VisaUtilities.kt (95%) rename domain/{legacy/src/main/java/com/tangem/domain => card/src/main/kotlin/com/tangem/domain/card}/common/visa/VisaWalletPublicKeyUtility.kt (98%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/configs/CardConfig.kt (96%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/configs/EdSingleCurrencyCardConfig.kt (93%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/configs/GenericCardConfig.kt (95%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/configs/MultiWalletCardConfig.kt (96%) rename domain/{legacy/src/main/java/com/tangem/domain/common => card/src/main/kotlin/com/tangem/domain/card}/configs/Wallet2CardConfig.kt (99%) rename domain/{legacy/src/test/java/com/tangem/domain/common => card/src/test/java/com/tangem/domain/card}/TwinsHelperTest.kt (95%) rename domain/{legacy/src/test/java/com/tangem/domain/common => card/src/test/java/com/tangem/domain/card}/configs/Wallet2CardConfigTest.kt (99%) create mode 100644 domain/demo/models/.gitignore create mode 100644 domain/demo/models/build.gradle.kts rename domain/demo/{src/main/java/com/tangem/domain/demo => models/src/main/kotlin/com/tangem/domain/demo/models}/DemoConfig.kt (99%) delete mode 100644 domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt create mode 100644 domain/wallet-manager/.gitignore create mode 100644 domain/wallet-manager/build.gradle.kts create mode 100644 domain/wallet-manager/models/.gitignore create mode 100644 domain/wallet-manager/models/build.gradle.kts rename domain/{legacy/src/main/java => wallet-manager/models/src/main/kotlin}/com/tangem/domain/walletmanager/model/RentData.kt (100%) rename domain/{legacy/src/main/java => wallet-manager/models/src/main/kotlin}/com/tangem/domain/walletmanager/model/SmartContractMethod.kt (100%) rename domain/{legacy/src/main/java => wallet-manager/models/src/main/kotlin}/com/tangem/domain/walletmanager/model/TokenInfo.kt (100%) rename domain/{legacy/src/main/java => wallet-manager/src/main/kotlin}/com/tangem/domain/walletmanager/WalletManagersFacade.kt (99%) rename domain/{legacy/src/main/java => wallet-manager/src/main/kotlin}/com/tangem/domain/walletmanager/utils/SdkPageConverter.kt (100%) create mode 100644 domain/wallets/src/main/java/com/tangem/domain/wallets/extension/UserWalletExtensions.kt create mode 100644 domain/wallets/src/main/java/com/tangem/domain/wallets/usecase/NetworkHasDerivationUseCase.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 037d6c2a83..040b46b637 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -84,6 +84,7 @@ dependencies { implementation(projects.domain.core) implementation(projects.domain.card) implementation(projects.domain.demo) + implementation(projects.domain.demo.models) implementation(projects.domain.wallets) implementation(projects.domain.wallets.models) implementation(projects.domain.settings) @@ -121,6 +122,8 @@ dependencies { implementation(projects.domain.notifications.toggles) implementation(projects.domain.swap.models) implementation(projects.domain.swap) + implementation(projects.domain.walletManager) + implementation(projects.domain.walletManager.models) implementation(projects.common) implementation(projects.common.routing) @@ -167,6 +170,7 @@ dependencies { implementation(projects.data.blockaid) implementation(projects.data.notifications) implementation(projects.data.swap) + implementation(projects.data.walletManager) /** Features */ implementation(projects.features.referral.impl) diff --git a/app/src/main/assets/tangem-app-config b/app/src/main/assets/tangem-app-config index 02dca1e527..91f870957a 160000 --- a/app/src/main/assets/tangem-app-config +++ b/app/src/main/assets/tangem-app-config @@ -1 +1 @@ -Subproject commit 02dca1e527f2695b69a9a1d01fc88880a0661486 +Subproject commit 91f870957a6c36c5bf6dcd6e769648f6c7b7abd7 diff --git a/app/src/main/java/com/tangem/tap/common/analytics/converters/ParamCardCurrencyConverter.kt b/app/src/main/java/com/tangem/tap/common/analytics/converters/ParamCardCurrencyConverter.kt index 303dcf3b25..c5c7e0ea3c 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/converters/ParamCardCurrencyConverter.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/converters/ParamCardCurrencyConverter.kt @@ -1,7 +1,7 @@ package com.tangem.tap.common.analytics.converters import com.tangem.blockchain.common.Blockchain -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.utils.converter.Converter import com.tangem.core.analytics.models.AnalyticsParam as CoreAnalyticsParam diff --git a/app/src/main/java/com/tangem/tap/common/analytics/paramsInterceptor/CardContextInterceptor.kt b/app/src/main/java/com/tangem/tap/common/analytics/paramsInterceptor/CardContextInterceptor.kt index f0f3326917..654dbe07ca 100644 --- a/app/src/main/java/com/tangem/tap/common/analytics/paramsInterceptor/CardContextInterceptor.kt +++ b/app/src/main/java/com/tangem/tap/common/analytics/paramsInterceptor/CardContextInterceptor.kt @@ -2,7 +2,7 @@ package com.tangem.tap.common.analytics.paramsInterceptor import com.tangem.core.analytics.api.ParamsInterceptor import com.tangem.core.analytics.models.AnalyticsEvent -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.wallets.builder.UserWalletIdBuilder diff --git a/app/src/main/java/com/tangem/tap/di/domain/CardDomainModule.kt b/app/src/main/java/com/tangem/tap/di/domain/CardDomainModule.kt index 789f56e454..fc0942279a 100644 --- a/app/src/main/java/com/tangem/tap/di/domain/CardDomainModule.kt +++ b/app/src/main/java/com/tangem/tap/di/domain/CardDomainModule.kt @@ -3,11 +3,12 @@ package com.tangem.tap.di.domain import com.tangem.domain.card.* import com.tangem.domain.card.repository.CardRepository import com.tangem.domain.card.repository.DerivationsRepository -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.domain.wallets.usecase.IsNeedToBackupUseCase +import com.tangem.domain.wallets.usecase.NetworkHasDerivationUseCase import com.tangem.sdk.api.TangemSdkManager import com.tangem.tap.domain.card.DefaultDeleteSavedAccessCodesUseCase import com.tangem.tap.domain.card.DefaultResetCardUseCase diff --git a/app/src/main/java/com/tangem/tap/di/domain/TransactionDomainModule.kt b/app/src/main/java/com/tangem/tap/di/domain/TransactionDomainModule.kt index c426af9672..eb56a8d16c 100644 --- a/app/src/main/java/com/tangem/tap/di/domain/TransactionDomainModule.kt +++ b/app/src/main/java/com/tangem/tap/di/domain/TransactionDomainModule.kt @@ -1,7 +1,7 @@ package com.tangem.tap.di.domain import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.networks.single.SingleNetworkStatusFetcher import com.tangem.domain.networks.single.SingleNetworkStatusSupplier import com.tangem.domain.tokens.MultiWalletCryptoCurrenciesSupplier diff --git a/app/src/main/java/com/tangem/tap/di/domain/WalletManagersFacadeModule.kt b/app/src/main/java/com/tangem/tap/di/domain/WalletManagersFacadeModule.kt deleted file mode 100644 index a54c6ecc0c..0000000000 --- a/app/src/main/java/com/tangem/tap/di/domain/WalletManagersFacadeModule.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.tangem.tap.di.domain - -import com.tangem.blockchainsdk.BlockchainSDKFactory -import com.tangem.datasource.asset.loader.AssetLoader -import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.datasource.local.walletmanager.WalletManagersStore -import com.tangem.domain.walletmanager.DefaultWalletManagersFacade -import com.tangem.domain.walletmanager.WalletManagersFacade -import com.tangem.utils.coroutines.CoroutineDispatcherProvider -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -internal object WalletManagersFacadeModule { - - @Provides - @Singleton - fun provideWalletManagersFacade( - walletManagersStore: WalletManagersStore, - userWalletsStore: UserWalletsStore, - assetLoader: AssetLoader, - blockchainSDKFactory: BlockchainSDKFactory, - dispatchers: CoroutineDispatcherProvider, - ): WalletManagersFacade { - return DefaultWalletManagersFacade( - walletManagersStore = walletManagersStore, - userWalletsStore = userWalletsStore, - assetLoader = assetLoader, - dispatchers = dispatchers, - blockchainSDKFactory = blockchainSDKFactory, - ) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/card/MissedDerivationsFinder.kt b/app/src/main/java/com/tangem/tap/domain/card/MissedDerivationsFinder.kt index 9bbb08d575..7e740159e5 100644 --- a/app/src/main/java/com/tangem/tap/domain/card/MissedDerivationsFinder.kt +++ b/app/src/main/java/com/tangem/tap/domain/card/MissedDerivationsFinder.kt @@ -7,8 +7,8 @@ import com.tangem.common.card.EllipticCurve import com.tangem.common.extensions.ByteArrayKey import com.tangem.common.extensions.toMapKey import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.configs.CardConfig -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.configs.CardConfig +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.scan.KeyWalletPublicKey diff --git a/app/src/main/java/com/tangem/tap/domain/model/Currency.kt b/app/src/main/java/com/tangem/tap/domain/model/Currency.kt index 5992c61d6a..1155c698d4 100644 --- a/app/src/main/java/com/tangem/tap/domain/model/Currency.kt +++ b/app/src/main/java/com/tangem/tap/domain/model/Currency.kt @@ -1,6 +1,5 @@ package com.tangem.tap.domain.model -import com.tangem.domain.common.BlockchainNetwork import com.tangem.domain.features.addCustomToken.CustomCurrency import com.tangem.tap.common.redux.global.CryptoCurrencyName import com.tangem.blockchain.common.Blockchain as SdkBlockchain @@ -32,21 +31,6 @@ sealed interface Currency { } companion object { - fun fromBlockchainNetwork(blockchainNetwork: BlockchainNetwork, token: SdkToken? = null): Currency { - return if (token != null) { - Token( - token = token, - blockchain = blockchainNetwork.blockchain, - derivationPath = blockchainNetwork.derivationPath, - ) - } else { - Blockchain( - blockchain = blockchainNetwork.blockchain, - derivationPath = blockchainNetwork.derivationPath, - ) - } - } - fun fromCustomCurrency(customCurrency: CustomCurrency): Currency { return when (customCurrency) { is CustomCurrency.CustomBlockchain -> Blockchain( diff --git a/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt b/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt index 5ce4d8f38e..386cddb495 100644 --- a/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt +++ b/app/src/main/java/com/tangem/tap/domain/scanCard/LegacyScanProcessor.kt @@ -19,7 +19,7 @@ import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.toWrappedList import com.tangem.core.ui.message.dialog.Dialogs import com.tangem.domain.common.extensions.withMainContext -import com.tangem.domain.common.util.twinsIsTwinned +import com.tangem.domain.card.common.util.twinsIsTwinned import com.tangem.domain.feedback.models.FeedbackEmailType import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.wallets.builder.UserWalletIdBuilder diff --git a/app/src/main/java/com/tangem/tap/domain/scanCard/chains/CheckForOnboardingChain.kt b/app/src/main/java/com/tangem/tap/domain/scanCard/chains/CheckForOnboardingChain.kt index 0912058b65..f632d90194 100644 --- a/app/src/main/java/com/tangem/tap/domain/scanCard/chains/CheckForOnboardingChain.kt +++ b/app/src/main/java/com/tangem/tap/domain/scanCard/chains/CheckForOnboardingChain.kt @@ -5,7 +5,7 @@ import arrow.core.right import com.tangem.common.routing.AppRoute import com.tangem.core.analytics.Analytics import com.tangem.domain.card.ScanCardException -import com.tangem.domain.common.util.twinsIsTwinned +import com.tangem.domain.card.common.util.twinsIsTwinned import com.tangem.domain.core.chain.Chain import com.tangem.domain.core.chain.ResultChain import com.tangem.domain.models.scan.ScanResponse diff --git a/app/src/main/java/com/tangem/tap/domain/sdk/impl/DefaultTangemSdkManager.kt b/app/src/main/java/com/tangem/tap/domain/sdk/impl/DefaultTangemSdkManager.kt index b9ed35b393..83c7a9c1fb 100644 --- a/app/src/main/java/com/tangem/tap/domain/sdk/impl/DefaultTangemSdkManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/sdk/impl/DefaultTangemSdkManager.kt @@ -19,8 +19,8 @@ import com.tangem.crypto.bip39.DefaultMnemonic import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.bip32.ExtendedPublicKey import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWalletId diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt index 198afbd041..acd5a2e14a 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/CreateProductWalletTask.kt @@ -13,10 +13,10 @@ import com.tangem.common.extensions.toMapKey import com.tangem.common.map import com.tangem.crypto.bip39.Mnemonic import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.configs.CardConfig +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.configs.CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.operations.backup.PrimaryCard import com.tangem.operations.backup.StartPrimaryCardLinkingCommand diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt index 9f45ceacff..6e6a912b0d 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/DerivationsFinder.kt @@ -6,8 +6,8 @@ import com.tangem.blockchain.common.derivation.DerivationStyle import com.tangem.blockchainsdk.utils.fromNetworkId import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.datasource.local.token.UserTokensResponseStore -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.wallets.builder.UserWalletIdBuilder diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt index fdc3898fbf..90275890f2 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/product/ScanProductTask.kt @@ -14,16 +14,16 @@ import com.tangem.common.tlv.Tlv import com.tangem.common.tlv.TlvDecoder import com.tangem.crypto.CryptoUtils import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.TapWorkarounds.isExcluded -import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease -import com.tangem.domain.common.TapWorkarounds.isStart2Coin -import com.tangem.domain.common.TapWorkarounds.isTangemTwins -import com.tangem.domain.common.TapWorkarounds.isVisa +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.TapWorkarounds.isExcluded +import com.tangem.domain.card.common.TapWorkarounds.isNotSupportedInThatRelease +import com.tangem.domain.card.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins +import com.tangem.domain.card.common.TapWorkarounds.isVisa import com.tangem.domain.common.TwinsHelper -import com.tangem.domain.common.configs.CardConfig -import com.tangem.domain.common.util.derivationStyleProvider -import com.tangem.domain.common.visa.VisaUtilities +import com.tangem.domain.card.common.util.derivationStyleProvider +import com.tangem.domain.card.common.visa.VisaUtilities +import com.tangem.domain.card.configs.CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO.Companion.RING_BATCH_IDS import com.tangem.domain.models.scan.CardDTO.Companion.RING_BATCH_PREFIX diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt index 758979cd91..74ed0d0827 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCardActivationTask.kt @@ -17,7 +17,7 @@ import com.tangem.datasource.local.visa.VisaAuthTokenStorage import com.tangem.datasource.local.visa.VisaOTPStorage import com.tangem.datasource.local.visa.VisaOtpData import com.tangem.datasource.local.visa.hasSavedOTP -import com.tangem.domain.common.visa.VisaWalletPublicKeyUtility +import com.tangem.domain.card.common.visa.VisaWalletPublicKeyUtility import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.visa.error.VisaActivationError import com.tangem.domain.visa.model.* diff --git a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt index dc7b40ea9b..3ef65f5c16 100644 --- a/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt +++ b/app/src/main/java/com/tangem/tap/domain/tasks/visa/VisaCustomerWalletApproveTask.kt @@ -16,10 +16,10 @@ import com.tangem.common.extensions.toHexString import com.tangem.core.error.ext.tangemError import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.bip32.ExtendedPublicKey -import com.tangem.domain.common.util.derivationStyleProvider -import com.tangem.domain.common.visa.VisaUtilities -import com.tangem.domain.common.visa.VisaWalletPublicKeyUtility -import com.tangem.domain.common.visa.VisaWalletPublicKeyUtility.findKeyWithoutDerivation +import com.tangem.domain.card.common.util.derivationStyleProvider +import com.tangem.domain.card.common.visa.VisaUtilities +import com.tangem.domain.card.common.visa.VisaWalletPublicKeyUtility +import com.tangem.domain.card.common.visa.VisaWalletPublicKeyUtility.findKeyWithoutDerivation import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.visa.error.VisaActivationError import com.tangem.domain.visa.model.VisaDataForApprove diff --git a/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt b/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt index 4d9a809e11..c439ee3d5b 100644 --- a/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt +++ b/app/src/main/java/com/tangem/tap/domain/visa/VisaCardScanHandler.kt @@ -9,7 +9,7 @@ import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toHexString import com.tangem.core.error.ext.tangemError import com.tangem.datasource.local.visa.VisaAuthTokenStorage -import com.tangem.domain.common.visa.VisaWalletPublicKeyUtility +import com.tangem.domain.card.common.visa.VisaWalletPublicKeyUtility import com.tangem.domain.visa.error.VisaActivationError import com.tangem.domain.visa.error.VisaApiError import com.tangem.domain.visa.error.VisaCardScanError diff --git a/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt b/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt index 8427ef3c2f..0ba699bde1 100644 --- a/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt +++ b/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt @@ -2,7 +2,7 @@ package com.tangem.tap.features.demo import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.message.DialogMessage -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.scan.ScanResponse import com.tangem.tap.common.extensions.inject import com.tangem.tap.common.redux.AppState diff --git a/app/src/main/java/com/tangem/tap/features/demo/DemoMiddleware.kt b/app/src/main/java/com/tangem/tap/features/demo/DemoMiddleware.kt index 4f46273749..4ddd62e7f3 100644 --- a/app/src/main/java/com/tangem/tap/features/demo/DemoMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/demo/DemoMiddleware.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.demo -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.scan.ScanResponse import org.rekotlin.Action diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt index 2d90ffa871..298d2ac7d7 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/coderecovery/model/AccessCodeRecoveryModel.kt @@ -6,7 +6,7 @@ import com.tangem.common.routing.AppRouter import com.tangem.core.analytics.Analytics import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.sdk.api.TangemSdkManager import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.Settings diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt index 49d7e42d4c..e71a54fcdd 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/model/CardSettingsModel.kt @@ -10,11 +10,11 @@ import com.tangem.core.analytics.Analytics import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.card.ScanCardProcessor import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.getBackupCardsCount +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.getBackupCardsCount import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.requireColdWallet diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt index c08b50c4e5..73af54606b 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/AccessCodeRecovery.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.details.ui.common.utils -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.models.scan.CardDTO internal fun isAccessCodeRecoveryAllowed(typeResolver: CardTypesResolver): Boolean = typeResolver.isWallet2() diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/ResetToFactory.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/ResetToFactory.kt index b269ee6352..cc27cf74c8 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/ResetToFactory.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/ResetToFactory.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.details.ui.common.utils -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.tap.features.details.ui.cardsettings.TextReference import com.tangem.wallet.R diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/SecurityOptionsUtils.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/SecurityOptionsUtils.kt index 0a62abe82e..f002281c37 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/SecurityOptionsUtils.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/utils/SecurityOptionsUtils.kt @@ -1,6 +1,6 @@ package com.tangem.tap.features.details.ui.common.utils -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.models.scan.CardDTO import com.tangem.tap.features.details.redux.SecurityOption import java.util.EnumSet diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt index f0b4bd8e02..34e073bf69 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/resetcard/model/ResetCardModel.kt @@ -11,7 +11,7 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.domain.card.DeleteSavedAccessCodesUseCase import com.tangem.domain.card.ResetCardUseCase import com.tangem.domain.card.ResetCardUserCodeParams -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.requireColdWallet import com.tangem.domain.wallets.legacy.UserWalletsListManager import com.tangem.domain.wallets.legacy.asLockable diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt index 8f4cf86296..ee9cf3dd51 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/securitymode/model/SecurityModeModel.kt @@ -8,7 +8,7 @@ import com.tangem.core.analytics.api.AnalyticsErrorHandler import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.sdk.api.TangemSdkManager import com.tangem.tap.common.analytics.events.AnalyticsParam import com.tangem.tap.common.analytics.events.Settings diff --git a/app/src/main/java/com/tangem/tap/features/home/HomeModel.kt b/app/src/main/java/com/tangem/tap/features/home/HomeModel.kt index 3c580e42fd..6110c7ff0c 100644 --- a/app/src/main/java/com/tangem/tap/features/home/HomeModel.kt +++ b/app/src/main/java/com/tangem/tap/features/home/HomeModel.kt @@ -15,7 +15,7 @@ import com.tangem.core.decompose.navigation.Router import com.tangem.core.navigation.url.UrlOpener import com.tangem.domain.card.ScanCardProcessor import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.settings.repositories.SettingsRepository import com.tangem.domain.settings.usercountry.GetUserCountryUseCase diff --git a/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt b/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt index c2882e49f7..e66b7f8c84 100644 --- a/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/home/redux/HomeMiddleware.kt @@ -9,7 +9,7 @@ import com.tangem.common.routing.AppRoute import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.models.AnalyticsParam import com.tangem.core.analytics.models.Basic -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse import com.tangem.tap.common.analytics.converters.ParamCardCurrencyConverter import com.tangem.tap.common.analytics.events.IntroductionProcess diff --git a/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt b/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt index 0f3997d317..231ce5256e 100644 --- a/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt +++ b/app/src/main/java/com/tangem/tap/features/onboarding/OnboardingHelper.kt @@ -1,7 +1,7 @@ package com.tangem.tap.features.onboarding -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.twinsIsTwinned +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.twinsIsTwinned import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.visa.model.VisaCardActivationStatus diff --git a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt index 71e1887062..ebbc8b2fc6 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/redux/WelcomeMiddleware.kt @@ -11,7 +11,7 @@ import com.tangem.common.routing.utils.popTo import com.tangem.core.analytics.Analytics import com.tangem.core.analytics.models.AnalyticsParam import com.tangem.core.analytics.models.Basic -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.wallets.legacy.UserWalletsListManager.Lockable.UnlockType diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt index 36b06ad6e9..f57f247e74 100644 --- a/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt +++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/moonpay/MoonPayService.kt @@ -6,7 +6,7 @@ import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.common.services.Result import com.tangem.common.services.performRequest import com.tangem.datasource.api.common.createRetrofitInstance -import com.tangem.domain.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.card.common.TapWorkarounds.isStart2Coin import com.tangem.domain.common.extensions.withIOContext import com.tangem.domain.core.utils.lceContent import com.tangem.domain.core.utils.lceError diff --git a/app/src/test/kotlin/com/tangem/tap/domain/card/DefaultDerivationsRepositoryTest.kt b/app/src/test/kotlin/com/tangem/tap/domain/card/DefaultDerivationsRepositoryTest.kt index 0d4ece518c..f5484b4b50 100644 --- a/app/src/test/kotlin/com/tangem/tap/domain/card/DefaultDerivationsRepositoryTest.kt +++ b/app/src/test/kotlin/com/tangem/tap/domain/card/DefaultDerivationsRepositoryTest.kt @@ -9,8 +9,8 @@ import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory import com.tangem.data.common.network.NetworkFactory import com.tangem.datasource.local.userwallet.UserWalletsStore import com.tangem.domain.card.ScanCardException -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.configs.MultiWalletCardConfig +import com.tangem.domain.card.configs.GenericCardConfig +import com.tangem.domain.card.configs.MultiWalletCardConfig import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.operations.derivation.DerivationTaskResponse diff --git a/app/src/test/kotlin/com/tangem/tap/domain/card/MissedDerivationsFinderTest.kt b/app/src/test/kotlin/com/tangem/tap/domain/card/MissedDerivationsFinderTest.kt index 31c1d12582..f623b13c56 100644 --- a/app/src/test/kotlin/com/tangem/tap/domain/card/MissedDerivationsFinderTest.kt +++ b/app/src/test/kotlin/com/tangem/tap/domain/card/MissedDerivationsFinderTest.kt @@ -10,10 +10,10 @@ import com.tangem.common.test.domain.card.MockScanResponseFactory import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory import com.tangem.common.test.domain.wallet.MockUserWalletFactory import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.configs.MultiWalletCardConfig -import com.tangem.domain.common.configs.Wallet2CardConfig -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.configs.GenericCardConfig +import com.tangem.domain.card.configs.MultiWalletCardConfig +import com.tangem.domain.card.configs.Wallet2CardConfig +import com.tangem.domain.card.common.util.derivationStyleProvider import org.junit.Test /** diff --git a/app/src/test/kotlin/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManagerTest.kt b/app/src/test/kotlin/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManagerTest.kt index 60354a079c..3d7fa216d8 100644 --- a/app/src/test/kotlin/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManagerTest.kt +++ b/app/src/test/kotlin/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManagerTest.kt @@ -2,7 +2,7 @@ package com.tangem.tap.domain.userWalletList.implementation import com.google.common.truth.Truth import com.tangem.common.test.domain.card.MockScanResponseFactory -import com.tangem.domain.common.configs.GenericCardConfig +import com.tangem.domain.card.configs.GenericCardConfig import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import io.mockk.mockk diff --git a/common/test/build.gradle.kts b/common/test/build.gradle.kts index d0c4c8fd00..951909ed58 100644 --- a/common/test/build.gradle.kts +++ b/common/test/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation(projects.domain.legacy) implementation(projects.domain.models) + implementation(projects.domain.card) implementation(projects.domain.staking.models) implementation(projects.domain.tokens.models) implementation(projects.domain.txhistory.models) diff --git a/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt index 54108f07a9..53527291ff 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/card/MockScanResponseFactory.kt @@ -2,7 +2,11 @@ package com.tangem.common.test.domain.card import com.tangem.common.card.CardWallet import com.tangem.common.card.FirmwareVersion -import com.tangem.domain.common.configs.* +import com.tangem.domain.card.configs.CardConfig +import com.tangem.domain.card.configs.EdSingleCurrencyCardConfig +import com.tangem.domain.card.configs.GenericCardConfig +import com.tangem.domain.card.configs.MultiWalletCardConfig +import com.tangem.domain.card.configs.Wallet2CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.KeyWalletPublicKey import com.tangem.domain.models.scan.ProductType diff --git a/common/test/src/main/java/com/tangem/common/test/domain/token/MockCryptoCurrencyFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/token/MockCryptoCurrencyFactory.kt index e847a09f0c..6592071c92 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/token/MockCryptoCurrencyFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/token/MockCryptoCurrencyFactory.kt @@ -8,9 +8,9 @@ import com.tangem.blockchainsdk.utils.toNetworkId import com.tangem.common.test.domain.card.MockScanResponseFactory import com.tangem.common.test.domain.wallet.MockUserWalletFactory import com.tangem.data.common.currency.CryptoCurrencyFactory -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.util.derivationStyleProvider +import com.tangem.domain.card.configs.GenericCardConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.wallet.UserWallet diff --git a/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt b/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt index d1a8cbd148..5f86c429c3 100644 --- a/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt +++ b/common/test/src/main/java/com/tangem/common/test/domain/wallet/MockUserWalletFactory.kt @@ -1,8 +1,8 @@ package com.tangem.common.test.domain.wallet import com.tangem.common.test.domain.card.MockScanResponseFactory -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.configs.GenericCardConfig import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.wallets.builder.UserWalletIdBuilder diff --git a/common/ui/build.gradle.kts b/common/ui/build.gradle.kts index 4cbc5cccfb..f6f607f75a 100644 --- a/common/ui/build.gradle.kts +++ b/common/ui/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { implementation(projects.domain.appCurrency.models) implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.staking.models) implementation(projects.domain.staking) implementation(projects.domain.tokens.models) diff --git a/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt index e29d82bb40..7244b4d23a 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/userwallet/converter/UserWalletItemUMConverter.kt @@ -8,7 +8,7 @@ import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.ArtworkModel import com.tangem.domain.models.StatusSource import com.tangem.domain.models.TotalFiatBalance diff --git a/data/common/build.gradle.kts b/data/common/build.gradle.kts index bf01e8fb80..6402820dd1 100644 --- a/data/common/build.gradle.kts +++ b/data/common/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { /* Domain */ implementation(projects.domain.demo) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.models) implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) diff --git a/data/common/src/main/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactory.kt b/data/common/src/main/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactory.kt index 4a6b0670f8..f0e538b4f9 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactory.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactory.kt @@ -6,9 +6,9 @@ import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.blockchainsdk.utils.toNetworkId import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.wallet.UserWallet diff --git a/data/common/src/main/kotlin/com/tangem/data/common/currency/ResponseCryptoCurrenciesFactory.kt b/data/common/src/main/kotlin/com/tangem/data/common/currency/ResponseCryptoCurrenciesFactory.kt index ab68b00d77..9bba514a03 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/currency/ResponseCryptoCurrenciesFactory.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/currency/ResponseCryptoCurrenciesFactory.kt @@ -6,7 +6,7 @@ import com.tangem.blockchainsdk.utils.fromNetworkId import com.tangem.blockchainsdk.utils.toCoinId import com.tangem.data.common.network.NetworkFactory import com.tangem.datasource.api.tangemTech.models.UserTokensResponse -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.wallet.UserWallet import timber.log.Timber diff --git a/data/common/src/main/kotlin/com/tangem/data/common/di/DataCommonModule.kt b/data/common/src/main/kotlin/com/tangem/data/common/di/DataCommonModule.kt index 1e3876029c..2e6266a009 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/di/DataCommonModule.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/di/DataCommonModule.kt @@ -7,7 +7,7 @@ import com.tangem.data.common.quote.QuotesFetcher import com.tangem.datasource.api.tangemTech.TangemTechApi import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.networks.multi.MultiNetworkStatusSupplier import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles import com.tangem.domain.wallets.repository.WalletsRepository diff --git a/data/common/src/main/kotlin/com/tangem/data/common/network/NetworkFactory.kt b/data/common/src/main/kotlin/com/tangem/data/common/network/NetworkFactory.kt index 94ad70a15a..bd48e9cea2 100644 --- a/data/common/src/main/kotlin/com/tangem/data/common/network/NetworkFactory.kt +++ b/data/common/src/main/kotlin/com/tangem/data/common/network/NetworkFactory.kt @@ -6,9 +6,9 @@ import com.tangem.blockchain.common.FeePaidCurrency import com.tangem.blockchainsdk.utils.ExcludedBlockchains import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.blockchainsdk.utils.toNetworkId -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.extensions.canHandleToken -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.extensions.canHandleToken +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.network.Network import com.tangem.domain.models.wallet.UserWallet import timber.log.Timber diff --git a/data/common/src/test/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactoryTest.kt b/data/common/src/test/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactoryTest.kt index 1b124480bc..b5b8ad9269 100644 --- a/data/common/src/test/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactoryTest.kt +++ b/data/common/src/test/kotlin/com/tangem/data/common/currency/DefaultCardCryptoCurrencyFactoryTest.kt @@ -12,9 +12,9 @@ import com.tangem.data.common.network.NetworkFactory import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.card.configs.GenericCardConfig +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.scan.ProductType diff --git a/data/common/src/test/kotlin/com/tangem/data/common/network/NetworkFactoryTest.kt b/data/common/src/test/kotlin/com/tangem/data/common/network/NetworkFactoryTest.kt index c038f9e27f..766643ffe0 100644 --- a/data/common/src/test/kotlin/com/tangem/data/common/network/NetworkFactoryTest.kt +++ b/data/common/src/test/kotlin/com/tangem/data/common/network/NetworkFactoryTest.kt @@ -7,10 +7,10 @@ import com.tangem.common.test.domain.card.MockScanResponseFactory import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory import com.tangem.common.test.domain.wallet.MockUserWalletFactory import com.tangem.common.test.utils.ProvideTestModels -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.configs.GenericCardConfig -import com.tangem.domain.common.configs.MultiWalletCardConfig -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.configs.GenericCardConfig +import com.tangem.domain.card.configs.MultiWalletCardConfig +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.network.Network import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet diff --git a/data/feedback/build.gradle.kts b/data/feedback/build.gradle.kts index 96623a4d50..9826df2814 100644 --- a/data/feedback/build.gradle.kts +++ b/data/feedback/build.gradle.kts @@ -41,6 +41,7 @@ dependencies { implementation(projects.domain.feedback) implementation(projects.domain.feedback.models) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.models) implementation(projects.domain.wallets) implementation(projects.domain.wallets.models) diff --git a/data/feedback/src/main/java/com/tangem/data/feedback/converters/CardInfoConverter.kt b/data/feedback/src/main/java/com/tangem/data/feedback/converters/CardInfoConverter.kt index c60840c86a..1b17450f2d 100644 --- a/data/feedback/src/main/java/com/tangem/data/feedback/converters/CardInfoConverter.kt +++ b/data/feedback/src/main/java/com/tangem/data/feedback/converters/CardInfoConverter.kt @@ -1,8 +1,8 @@ package com.tangem.data.feedback.converters -import com.tangem.domain.common.TapWorkarounds.isStart2Coin -import com.tangem.domain.common.TapWorkarounds.isVisa -import com.tangem.domain.common.util.getBackupCardsCount +import com.tangem.domain.card.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.card.common.TapWorkarounds.isVisa +import com.tangem.domain.card.common.util.getBackupCardsCount import com.tangem.domain.feedback.models.CardInfo import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse diff --git a/data/manage-tokens/build.gradle.kts b/data/manage-tokens/build.gradle.kts index f0e57105f8..c0da8f1be9 100644 --- a/data/manage-tokens/build.gradle.kts +++ b/data/manage-tokens/build.gradle.kts @@ -18,6 +18,7 @@ dependencies { implementation(projects.domain.demo) implementation(projects.domain.models) implementation(projects.domain.manageTokens) + implementation(projects.domain.card) implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) implementation(projects.domain.legacy) diff --git a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultCustomTokensRepository.kt b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultCustomTokensRepository.kt index 2ea117696f..d311b44167 100644 --- a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultCustomTokensRepository.kt +++ b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultCustomTokensRepository.kt @@ -14,9 +14,9 @@ import com.tangem.datasource.api.common.response.getOrThrow import com.tangem.datasource.api.tangemTech.TangemTechApi import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.extensions.canHandleBlockchain -import com.tangem.domain.common.extensions.supportedBlockchains -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.extensions.canHandleBlockchain +import com.tangem.domain.card.common.extensions.supportedBlockchains +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.managetokens.model.AddCustomTokenForm import com.tangem.domain.managetokens.model.ManagedCryptoCurrency import com.tangem.domain.managetokens.repository.CustomTokensRepository diff --git a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultManageTokensRepository.kt b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultManageTokensRepository.kt index 636c23516d..20cdc81e55 100644 --- a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultManageTokensRepository.kt +++ b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/DefaultManageTokensRepository.kt @@ -19,12 +19,12 @@ import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.local.config.testnet.TestnetTokensStorage import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.extensions.canHandleBlockchain -import com.tangem.domain.common.extensions.canHandleToken -import com.tangem.domain.common.extensions.supportedBlockchains -import com.tangem.domain.common.extensions.supportedTokens -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.common.extensions.canHandleBlockchain +import com.tangem.domain.card.common.extensions.canHandleToken +import com.tangem.domain.card.common.extensions.supportedBlockchains +import com.tangem.domain.card.common.extensions.supportedTokens +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.managetokens.model.* import com.tangem.domain.managetokens.model.ManagedCryptoCurrency.SourceNetwork import com.tangem.domain.managetokens.repository.ManageTokensRepository diff --git a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/utils/ManagedCryptoCurrencyFactory.kt b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/utils/ManagedCryptoCurrencyFactory.kt index db42a9fcb2..444a4b5bb6 100644 --- a/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/utils/ManagedCryptoCurrencyFactory.kt +++ b/data/manage-tokens/src/main/kotlin/com/tangem/data/managetokens/utils/ManagedCryptoCurrencyFactory.kt @@ -13,9 +13,9 @@ import com.tangem.data.common.network.NetworkFactory import com.tangem.datasource.api.tangemTech.models.CoinsResponse import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.local.config.testnet.models.TestnetTokensConfig -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.extensions.canHandleToken -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.extensions.canHandleToken +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.managetokens.model.ManagedCryptoCurrency import com.tangem.domain.managetokens.model.ManagedCryptoCurrency.SourceNetwork import com.tangem.domain.models.currency.CryptoCurrency diff --git a/data/networks/build.gradle.kts b/data/networks/build.gradle.kts index 29b5a5ce2d..d5f03f3e85 100644 --- a/data/networks/build.gradle.kts +++ b/data/networks/build.gradle.kts @@ -25,6 +25,8 @@ dependencies { // region Project - Domain implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) + implementation(projects.domain.card) api(projects.domain.models) implementation(projects.domain.networks) // endregion diff --git a/data/networks/src/test/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusProducerTest.kt b/data/networks/src/test/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusProducerTest.kt index d929ff58fe..715522ea79 100644 --- a/data/networks/src/test/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusProducerTest.kt +++ b/data/networks/src/test/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusProducerTest.kt @@ -11,7 +11,7 @@ import com.tangem.data.networks.models.SimpleNetworkStatus import com.tangem.data.networks.store.NetworksStatusesStore import com.tangem.data.networks.toSimple import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.configs.GenericCardConfig +import com.tangem.domain.card.configs.GenericCardConfig import com.tangem.domain.models.network.NetworkStatus import com.tangem.domain.networks.multi.MultiNetworkStatusProducer import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider diff --git a/data/nft/build.gradle.kts b/data/nft/build.gradle.kts index 63ceb134a2..64d14695e9 100644 --- a/data/nft/build.gradle.kts +++ b/data/nft/build.gradle.kts @@ -23,6 +23,8 @@ dependencies { implementation(projects.domain.wallets.models) implementation(projects.domain.tokens.models) implementation(projects.domain.nft) + implementation(projects.domain.walletManager) + implementation(projects.domain.card) implementation(projects.domain.nft.models) /** Project - Utils */ diff --git a/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt b/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt index d67c8e61b4..585b0a640a 100644 --- a/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt +++ b/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt @@ -16,8 +16,8 @@ import com.tangem.datasource.local.nft.converter.NFTSdkAssetSalePriceConverter import com.tangem.datasource.local.nft.converter.NFTSdkCollectionConverter import com.tangem.datasource.local.nft.converter.NFTSdkCollectionIdentifierConverter import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.extensions.canHandleToken -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.extensions.canHandleToken +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.StatusSource import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network @@ -542,6 +542,7 @@ internal class DefaultNFTRepository @Inject constructor( } private fun Network.canHandleNFTs(userWalletId: UserWalletId): Boolean { + // TODO [REDACTED_TASK_KEY] val scanResponse = userWalletsStore.getSyncStrict(userWalletId).requireColdWallet().scanResponse val blockchain = Blockchain.fromNetworkId(backendId) ?: return false diff --git a/data/onramp/build.gradle.kts b/data/onramp/build.gradle.kts index 82c038ad68..47909aa6bf 100644 --- a/data/onramp/build.gradle.kts +++ b/data/onramp/build.gradle.kts @@ -25,6 +25,8 @@ dependencies { /** Domain modules */ implementation(projects.domain.onramp) implementation(projects.domain.legacy) + implementation(projects.domain.card) + implementation(projects.domain.walletManager) implementation(projects.domain.appTheme.models) implementation(projects.domain.models) diff --git a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultHotCryptoRepository.kt b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultHotCryptoRepository.kt index ce52e49063..8cda8c8835 100644 --- a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultHotCryptoRepository.kt +++ b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultHotCryptoRepository.kt @@ -20,9 +20,9 @@ import com.tangem.datasource.local.preferences.PreferencesKeys import com.tangem.datasource.local.preferences.utils.getObject import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.extensions.canHandleBlockchain -import com.tangem.domain.common.extensions.canHandleToken -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.extensions.canHandleBlockchain +import com.tangem.domain.card.common.extensions.canHandleToken +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.onramp.model.HotCryptoCurrency diff --git a/data/staking/build.gradle.kts b/data/staking/build.gradle.kts index 6ca20ef8a8..1ec5e094f8 100644 --- a/data/staking/build.gradle.kts +++ b/data/staking/build.gradle.kts @@ -32,6 +32,8 @@ dependencies { implementation(projects.domain.wallets) implementation(projects.domain.wallets.models) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) + implementation(projects.domain.card) implementation(projects.domain.models) /** Feature Api modules */ diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt index 38ebbd2901..3f04117797 100644 --- a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt +++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt @@ -34,7 +34,7 @@ import com.tangem.datasource.api.stakekit.models.response.model.transaction.tron import com.tangem.datasource.local.token.StakingYieldsStore import com.tangem.datasource.local.token.converter.StakingNetworkTypeConverter import com.tangem.datasource.local.token.converter.TokenConverter -import com.tangem.domain.common.TapWorkarounds.isWallet2 +import com.tangem.domain.card.common.TapWorkarounds.isWallet2 import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.wallet.UserWallet diff --git a/data/tokens/build.gradle.kts b/data/tokens/build.gradle.kts index ac23666c4d..f35bd35737 100644 --- a/data/tokens/build.gradle.kts +++ b/data/tokens/build.gradle.kts @@ -27,6 +27,8 @@ dependencies { implementation(projects.domain.core) implementation(projects.domain.demo) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) + implementation(projects.domain.card) implementation(projects.domain.models) implementation(projects.domain.staking) implementation(projects.domain.staking.models) diff --git a/data/tokens/src/main/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcher.kt b/data/tokens/src/main/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcher.kt index f0e9d92ba6..a05b79077f 100644 --- a/data/tokens/src/main/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcher.kt +++ b/data/tokens/src/main/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcher.kt @@ -15,7 +15,7 @@ import com.tangem.datasource.exchangeservice.swap.ExpressServiceLoader import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore import com.tangem.domain.core.utils.catchOn -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.isMultiCurrency import com.tangem.domain.models.wallet.requireColdWallet diff --git a/data/tokens/src/main/kotlin/com/tangem/data/tokens/di/MultiWalletCryptoCurrenciesFetcherModule.kt b/data/tokens/src/main/kotlin/com/tangem/data/tokens/di/MultiWalletCryptoCurrenciesFetcherModule.kt index 93689fc896..eea90a597e 100644 --- a/data/tokens/src/main/kotlin/com/tangem/data/tokens/di/MultiWalletCryptoCurrenciesFetcherModule.kt +++ b/data/tokens/src/main/kotlin/com/tangem/data/tokens/di/MultiWalletCryptoCurrenciesFetcherModule.kt @@ -8,7 +8,7 @@ import com.tangem.datasource.api.tangemTech.TangemTechApi import com.tangem.datasource.exchangeservice.swap.ExpressServiceLoader import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.tokens.MultiWalletCryptoCurrenciesFetcher import com.tangem.utils.coroutines.CoroutineDispatcherProvider import dagger.Module diff --git a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt index d76edbeb55..6687fab2f7 100644 --- a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt +++ b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrenciesRepository.kt @@ -17,10 +17,10 @@ import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.exchangeservice.swap.ExpressServiceLoader import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.core.error.DataError -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.wallet.* diff --git a/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcherTest.kt b/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcherTest.kt index ca5c2a141a..f335e3d006 100644 --- a/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcherTest.kt +++ b/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesFetcherTest.kt @@ -18,7 +18,7 @@ import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.exchangeservice.swap.ExpressServiceLoader import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.isMultiCurrency diff --git a/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesProducerTest.kt b/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesProducerTest.kt index 70575d68d5..1d677e50ef 100644 --- a/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesProducerTest.kt +++ b/data/tokens/src/test/kotlin/com/tangem/data/tokens/DefaultMultiWalletCryptoCurrenciesProducerTest.kt @@ -10,7 +10,7 @@ import com.tangem.data.common.currency.ResponseCryptoCurrenciesFactory import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.datasource.local.token.UserTokensResponseStore import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.configs.GenericCardConfig +import com.tangem.domain.card.configs.GenericCardConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.isMultiCurrency diff --git a/data/transaction/build.gradle.kts b/data/transaction/build.gradle.kts index 0426e68bbc..47cc934a90 100644 --- a/data/transaction/build.gradle.kts +++ b/data/transaction/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { /** Domain */ implementation(projects.domain.transaction) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.libs.blockchainSdk) implementation(projects.domain.wallets.models) implementation(projects.domain.tokens.models) diff --git a/data/txhistory/build.gradle.kts b/data/txhistory/build.gradle.kts index f367b1ae8b..d7bceabb15 100644 --- a/data/txhistory/build.gradle.kts +++ b/data/txhistory/build.gradle.kts @@ -16,6 +16,7 @@ dependencies { implementation(projects.core.datasource) implementation(projects.core.pagination) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.libs.blockchainSdk) implementation(projects.domain.models) implementation(projects.domain.tokens.models) diff --git a/data/visa/build.gradle.kts b/data/visa/build.gradle.kts index 6740dd9dde..05af092bd5 100644 --- a/data/visa/build.gradle.kts +++ b/data/visa/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { /** Project - Domain */ implementation(projects.domain.visa) + implementation(projects.domain.card) implementation(projects.domain.models) implementation(projects.domain.wallets.models) implementation(projects.domain.appCurrency.models) diff --git a/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt b/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt index 7e01d443a1..3acbfdd607 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/visa/DefaultVisaRepository.kt @@ -17,7 +17,7 @@ import com.tangem.data.visa.utils.* import com.tangem.datasource.api.pay.TangemPayApi import com.tangem.datasource.api.pay.models.response.VisaTxHistoryResponse import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.requireColdWallet diff --git a/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaApiRequestMaker.kt b/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaApiRequestMaker.kt index 823c4ee800..7eb6f6e5fb 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaApiRequestMaker.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaApiRequestMaker.kt @@ -8,7 +8,7 @@ import com.tangem.datasource.api.common.response.getOrThrow import com.tangem.datasource.api.pay.TangemPayApi import com.tangem.datasource.api.pay.models.request.RefreshTokenByCardWalletRequest import com.tangem.datasource.local.userwallet.UserWalletsStore -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.requireColdWallet diff --git a/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaCurrencyFactory.kt b/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaCurrencyFactory.kt index 56d96ec917..f4a46dab61 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaCurrencyFactory.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/visa/utils/VisaCurrencyFactory.kt @@ -3,7 +3,7 @@ package com.tangem.data.visa.utils import com.tangem.blockchain.common.Blockchain import com.tangem.data.common.currency.CryptoCurrencyFactory import com.tangem.data.common.network.NetworkFactory -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.NetworkAddress import com.tangem.domain.models.wallet.UserWallet diff --git a/data/wallet-connect/build.gradle.kts b/data/wallet-connect/build.gradle.kts index 8b9e7e791c..bed46fd58b 100644 --- a/data/wallet-connect/build.gradle.kts +++ b/data/wallet-connect/build.gradle.kts @@ -22,6 +22,7 @@ dependencies { implementation(projects.domain.tokens.models) implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.libs.blockchainSdk) implementation(projects.data.common) diff --git a/data/wallet-manager/.gitignore b/data/wallet-manager/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/data/wallet-manager/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/wallet-manager/build.gradle.kts b/data/wallet-manager/build.gradle.kts new file mode 100644 index 0000000000..9a21d4c8a3 --- /dev/null +++ b/data/wallet-manager/build.gradle.kts @@ -0,0 +1,53 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) + alias(deps.plugins.hilt.android) + id("configuration") +} + +android { + namespace = "com.tangem.data.walletmanager" +} + +dependencies { + /** Tangem libraries */ + implementation(tangemDeps.blockchain) + implementation(tangemDeps.card.core) + + /** Core */ + implementation(projects.core.datasource) + implementation(projects.core.utils) + implementation(projects.core.error) + implementation(projects.core.error.ext) + + /** Domain */ + implementation(projects.domain.wallets) + implementation(projects.domain.walletManager) + implementation(projects.domain.demo) + implementation(projects.domain.card) + api(projects.domain.models) + + /** Domain models */ + implementation(projects.domain.wallets.models) + implementation(projects.domain.tokens.models) + implementation(projects.domain.txhistory.models) + implementation(projects.domain.transaction.models) + + /** DI */ + implementation(deps.hilt.android) + kapt(deps.hilt.kapt) + + /** Other deps */ + implementation(projects.libs.blockchainSdk) + implementation(deps.androidx.datastore) + implementation(deps.arrow.core) + implementation(deps.timber) + + /** Testing libraries */ + testImplementation(deps.test.junit5) + testRuntimeOnly(deps.test.junit5.engine) + testImplementation(deps.test.mockk) + testImplementation(deps.test.truth) + testImplementation(projects.common.test) +} \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/DefaultWalletManagersFacade.kt similarity index 97% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/DefaultWalletManagersFacade.kt index 1944a6ad03..4999c1b188 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/DefaultWalletManagersFacade.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/DefaultWalletManagersFacade.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager +package com.tangem.data.walletmanager import arrow.core.Either import arrow.core.raise.either @@ -23,11 +23,11 @@ import com.tangem.blockchainsdk.BlockchainSDKFactory import com.tangem.blockchainsdk.models.UpdateWalletManagerResult import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.data.walletmanager.utils.* import com.tangem.datasource.asset.loader.AssetLoader import com.tangem.datasource.local.userwallet.UserWalletsStore import com.tangem.datasource.local.walletmanager.WalletManagersStore -import com.tangem.domain.common.util.hasDerivation -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.network.TxInfo @@ -36,11 +36,12 @@ import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.transaction.models.AssetRequirementsCondition import com.tangem.domain.txhistory.models.PaginationWrapper import com.tangem.domain.txhistory.models.TxHistoryState +import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.domain.walletmanager.model.RentData import com.tangem.domain.walletmanager.model.SmartContractMethod import com.tangem.domain.walletmanager.model.TokenInfo -import com.tangem.domain.walletmanager.utils.* -import com.tangem.domain.walletmanager.utils.WalletManagerFactory +import com.tangem.domain.walletmanager.utils.SdkPageConverter +import com.tangem.domain.wallets.extension.hasDerivation import com.tangem.utils.coroutines.CoroutineDispatcherProvider import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.sync.Mutex @@ -49,11 +50,10 @@ import kotlinx.coroutines.withContext import timber.log.Timber import java.math.BigDecimal import java.util.EnumSet +import javax.inject.Inject @Suppress("LargeClass", "TooManyFunctions") -// FIXME: Move to its own module and make internal -@Deprecated("Inject the WalletManagerFacade interface using DI instead") -class DefaultWalletManagersFacade( +internal class DefaultWalletManagersFacade @Inject constructor( private val walletManagersStore: WalletManagersStore, private val userWalletsStore: UserWalletsStore, private val assetLoader: AssetLoader, @@ -163,8 +163,7 @@ class DefaultWalletManagersFacade( val derivationPath = network.derivationPath.value if (derivationPath != null && - userWallet is UserWallet.Cold && - !userWallet.scanResponse.hasDerivation(blockchain, derivationPath) + !userWallet.hasDerivation(blockchain, derivationPath) ) { Timber.w("Derivation missed for: $blockchain") return UpdateWalletManagerResult.MissedDerivation @@ -289,10 +288,7 @@ class DefaultWalletManagersFacade( derivationPath: String?, extraTokens: Set, ): UpdateWalletManagerResult { - if (derivationPath != null && - userWallet is UserWallet.Cold && - !userWallet.scanResponse.hasDerivation(blockchain, derivationPath) - ) { + if (derivationPath != null && !userWallet.hasDerivation(blockchain, derivationPath)) { Timber.w("Derivation missed for: $blockchain") return UpdateWalletManagerResult.MissedDerivation } diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactory.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactory.kt similarity index 68% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactory.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactory.kt index 4a129303ad..0d7e463bb3 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactory.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactory.kt @@ -1,25 +1,31 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager -import com.tangem.blockchain.common.* +import com.tangem.blockchain.common.Amount +import com.tangem.blockchain.common.AmountType +import com.tangem.blockchain.common.Token +import com.tangem.blockchain.common.TransactionData +import com.tangem.blockchain.common.TransactionStatus +import com.tangem.blockchain.common.WalletManager +import com.tangem.blockchain.common.address.Address import com.tangem.blockchainsdk.models.UpdateWalletManagerResult -import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.* import com.tangem.blockchainsdk.utils.amountToCreateAccount +import com.tangem.data.walletmanager.utils.SdkAddressToAddressConverter +import com.tangem.data.walletmanager.utils.TransactionDataToTxHistoryItemConverter import com.tangem.domain.models.currency.CryptoCurrency import timber.log.Timber import java.math.BigDecimal -import com.tangem.blockchain.common.address.Address as SdkAddress -/** Factory for creating [UpdateWalletManagerResult] */ +/** Factory for creating [com.tangem.blockchainsdk.models.UpdateWalletManagerResult] */ internal class UpdateWalletManagerResultFactory { - /** Get [Verified] result for [walletManager] */ - fun getResult(walletManager: WalletManager): Verified { + /** Get [com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Verified] result for [walletManager] */ + fun getResult(walletManager: WalletManager): UpdateWalletManagerResult.Verified { val wallet = walletManager.wallet val addresses = getAvailableAddresses(wallet.addresses) val feePaidCurrency = wallet.blockchain.feePaidCurrency() val txHistoryItemConverter = TransactionDataToTxHistoryItemConverter(addresses, feePaidCurrency) - return Verified( + return UpdateWalletManagerResult.Verified( selectedAddress = wallet.address, addresses = addresses, currenciesAmounts = getTokensAmounts(wallet.amounts.values.toSet()), @@ -28,18 +34,18 @@ internal class UpdateWalletManagerResultFactory { } /** - * Get demo [Verified] result + * Get demo [UpdateWalletManagerResult.Verified] result * * @param walletManager wallet manager * @param demoAmount amount that will be used for demo result */ - fun getDemoResult(walletManager: WalletManager, demoAmount: Amount): Verified { + fun getDemoResult(walletManager: WalletManager, demoAmount: Amount): UpdateWalletManagerResult.Verified { val wallet = walletManager.wallet val addresses = getAvailableAddresses(wallet.addresses) val feePaidCurrency = wallet.blockchain.feePaidCurrency() val txHistoryItemConverter = TransactionDataToTxHistoryItemConverter(addresses, feePaidCurrency) - return Verified( + return UpdateWalletManagerResult.Verified( selectedAddress = wallet.address, addresses = addresses, currenciesAmounts = getDemoTokensAmounts(demoAmount, walletManager.cardTokens), @@ -48,8 +54,8 @@ internal class UpdateWalletManagerResultFactory { } /** - * Get [NoAccount] result. - * If unable to get required amount for creating account, [Unreachable] result will be returned. + * Get [UpdateWalletManagerResult.NoAccount] result. + * If unable to get required amount for creating account, [UpdateWalletManagerResult.Unreachable] result will be returned. * * @param walletManager wallet manager * @param customMessage custom error message @@ -67,12 +73,12 @@ internal class UpdateWalletManagerResultFactory { return if (amount == null) { Timber.w("Unable to get required amount to create account for: $blockchain") - Unreachable( + UpdateWalletManagerResult.Unreachable( selectedAddress = wallet.address, addresses = getAvailableAddresses(wallet.addresses), ) } else { - NoAccount( + UpdateWalletManagerResult.NoAccount( selectedAddress = wallet.address, addresses = getAvailableAddresses(wallet.addresses), amountToCreateAccount = amount, @@ -81,30 +87,30 @@ internal class UpdateWalletManagerResultFactory { } } - /** Get [Unreachable] result for [walletManager] */ - fun getUnreachableResult(walletManager: WalletManager): Unreachable { + /** Get [UpdateWalletManagerResult.Unreachable] result for [walletManager] */ + fun getUnreachableResult(walletManager: WalletManager): UpdateWalletManagerResult.Unreachable { val wallet = walletManager.wallet - return Unreachable( + return UpdateWalletManagerResult.Unreachable( selectedAddress = wallet.address, addresses = getAvailableAddresses(wallet.addresses), ) } - private fun getAvailableAddresses(addresses: Set): Set
{ + private fun getAvailableAddresses(addresses: Set
): Set { return SdkAddressToAddressConverter.convertList(addresses).toSet() } - private fun getTokensAmounts(amounts: Set): Set { + private fun getTokensAmounts(amounts: Set): Set { return amounts.mapNotNullTo(hashSetOf(), ::createCurrencyAmount) } - private fun createCurrencyAmount(amount: Amount): CryptoCurrencyAmount? { + private fun createCurrencyAmount(amount: Amount): UpdateWalletManagerResult.CryptoCurrencyAmount? { return when (val type = amount.type) { is AmountType.Token -> { val value = getCurrencyAmountValue(amount) ?: return null - CryptoCurrencyAmount.Token( + UpdateWalletManagerResult.CryptoCurrencyAmount.Token( currencyRawId = type.token.id?.let(CryptoCurrency::RawID), contractAddress = type.token.contractAddress, value = value, @@ -113,7 +119,7 @@ internal class UpdateWalletManagerResultFactory { is AmountType.Coin -> { val value = getCurrencyAmountValue(amount) ?: return null - CryptoCurrencyAmount.Coin(value = value) + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = value) } is AmountType.FeeResource, is AmountType.Reserve, @@ -131,12 +137,17 @@ internal class UpdateWalletManagerResultFactory { return value } - private fun getDemoTokensAmounts(demoAmount: Amount, tokens: Set): Set { + private fun getDemoTokensAmounts( + demoAmount: Amount, + tokens: Set, + ): Set { val amountValue = demoAmount.value ?: BigDecimal.ZERO - val demoAmounts = hashSetOf(CryptoCurrencyAmount.Coin(amountValue)) + val demoAmounts = hashSetOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(amountValue), + ) return tokens.mapTo(demoAmounts) { token -> - CryptoCurrencyAmount.Token( + UpdateWalletManagerResult.CryptoCurrencyAmount.Token( currencyRawId = token.id?.let(CryptoCurrency::RawID), contractAddress = token.contractAddress, value = amountValue, @@ -147,7 +158,7 @@ internal class UpdateWalletManagerResultFactory { private fun getCurrentTransactions( txHistoryItemConverter: TransactionDataToTxHistoryItemConverter, recentTransactions: Set, - ): Set { + ): Set { val unconfirmedTransactions = recentTransactions.filter { it.status == TransactionStatus.Unconfirmed } return unconfirmedTransactions.mapNotNullTo(hashSetOf()) { @@ -161,17 +172,17 @@ internal class UpdateWalletManagerResultFactory { private fun createCurrencyTransaction( txHistoryItemConverter: TransactionDataToTxHistoryItemConverter, data: TransactionData.Uncompiled, - ): CryptoCurrencyTransaction? { + ): UpdateWalletManagerResult.CryptoCurrencyTransaction? { return when (val type = data.amount.type) { is AmountType.Coin -> { val txHistoryItem = txHistoryItemConverter.convert(data) ?: return null - CryptoCurrencyTransaction.Coin(txInfo = txHistoryItem) + UpdateWalletManagerResult.CryptoCurrencyTransaction.Coin(txInfo = txHistoryItem) } is AmountType.Token -> { val txHistoryItem = txHistoryItemConverter.convert(data) ?: return null - CryptoCurrencyTransaction.Token( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Token( tokenId = type.token.id, contractAddress = type.token.contractAddress, txInfo = txHistoryItem, diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/WalletManagerFactory.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/WalletManagerFactory.kt similarity index 91% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/WalletManagerFactory.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/WalletManagerFactory.kt index 3e0a6a1c8b..01e9213ddc 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/WalletManagerFactory.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/WalletManagerFactory.kt @@ -1,14 +1,14 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.DerivationParams import com.tangem.blockchain.common.WalletManager import com.tangem.blockchainsdk.BlockchainSDKFactory import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.DerivationStyleProvider -import com.tangem.domain.common.extensions.makePublicKey -import com.tangem.domain.common.extensions.makeWalletManagerForApp -import com.tangem.domain.common.util.derivationStyleProvider +import com.tangem.data.walletmanager.extensions.makePublicKey +import com.tangem.data.walletmanager.extensions.makeWalletManagerForApp +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.common.util.derivationStyleProvider import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet import timber.log.Timber diff --git a/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/di/WalletManagerModule.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/di/WalletManagerModule.kt new file mode 100644 index 0000000000..fb8a33abed --- /dev/null +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/di/WalletManagerModule.kt @@ -0,0 +1,18 @@ +package com.tangem.data.walletmanager.di + +import dagger.Binds +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton +import com.tangem.data.walletmanager.DefaultWalletManagersFacade +import com.tangem.domain.walletmanager.WalletManagersFacade + +@Module +@InstallIn(SingletonComponent::class) +internal interface WalletManagerModule { + + @Binds + @Singleton + fun bindWalletManagerFacade(impl: DefaultWalletManagersFacade): WalletManagersFacade +} \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/WalletManagerFactory.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/extensions/WalletManagerFactory.kt similarity index 93% rename from domain/legacy/src/main/java/com/tangem/domain/common/extensions/WalletManagerFactory.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/extensions/WalletManagerFactory.kt index cdf757a38a..b9dc8edf78 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/WalletManagerFactory.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/extensions/WalletManagerFactory.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.extensions +package com.tangem.data.walletmanager.extensions import com.tangem.blockchain.blockchains.cardano.CardanoUtils import com.tangem.blockchain.common.* @@ -8,11 +8,11 @@ import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toMapKey import com.tangem.crypto.hdWallet.DerivationPath import com.tangem.crypto.hdWallet.bip32.ExtendedPublicKey -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation -import com.tangem.domain.common.configs.CardConfig -import com.tangem.domain.common.configs.Wallet2CardConfig -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.common.TapWorkarounds.useOldStyleDerivation +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.configs.CardConfig +import com.tangem.domain.card.configs.Wallet2CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/CryptoCurrencyTypeConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/CryptoCurrencyTypeConverter.kt similarity index 94% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/CryptoCurrencyTypeConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/CryptoCurrencyTypeConverter.kt index 957612c905..c343e6305c 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/CryptoCurrencyTypeConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/CryptoCurrencyTypeConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.common.CryptoCurrencyType import com.tangem.blockchain.common.Token diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkAddressToAddressConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkAddressToAddressConverter.kt similarity index 93% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkAddressToAddressConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkAddressToAddressConverter.kt index 997a9186a5..aa7c83a325 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkAddressToAddressConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkAddressToAddressConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkRequirementsConditionConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkRequirementsConditionConverter.kt similarity index 97% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkRequirementsConditionConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkRequirementsConditionConverter.kt index f2cb03313a..3f7c354657 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkRequirementsConditionConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkRequirementsConditionConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.domain.transaction.models.AssetRequirementsCondition import com.tangem.utils.converter.Converter diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTokenConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTokenConverter.kt similarity index 92% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTokenConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTokenConverter.kt index 2f89f29ed5..e7304e8058 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTokenConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTokenConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.utils.converter.Converter diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryItemConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryItemConverter.kt similarity index 99% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryItemConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryItemConverter.kt index e9fe9ace39..40e874e14e 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryItemConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryItemConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.transactionhistory.models.TransactionHistoryItem import com.tangem.domain.models.network.TxInfo diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryStateConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryStateConverter.kt similarity index 94% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryStateConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryStateConverter.kt index 6532b6338f..3babdd8a12 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionHistoryStateConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionHistoryStateConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.transactionhistory.TransactionHistoryState import com.tangem.domain.txhistory.models.TxHistoryState diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionTypeConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionTypeConverter.kt similarity index 98% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionTypeConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionTypeConverter.kt index 82b1bd2dbb..f5f82ef61d 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkTransactionTypeConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/SdkTransactionTypeConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.transactionhistory.models.TransactionHistoryItem.TransactionType import com.tangem.domain.models.network.TxInfo diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt similarity index 98% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt rename to data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt index b37857431d..6d1b520c2f 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt +++ b/data/wallet-manager/src/main/java/com/tangem/data/walletmanager/utils/TransactionDataToTxHistoryItemConverter.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager.utils import com.tangem.blockchain.common.* import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address diff --git a/domain/legacy/src/test/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactoryTest.kt b/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt similarity index 75% rename from domain/legacy/src/test/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactoryTest.kt rename to data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt index 5b6b9271d5..9df3c38d66 100644 --- a/domain/legacy/src/test/java/com/tangem/domain/walletmanager/utils/UpdateWalletManagerResultFactoryTest.kt +++ b/data/wallet-manager/src/test/java/com/tangem/data/walletmanager/UpdateWalletManagerResultFactoryTest.kt @@ -1,12 +1,17 @@ -package com.tangem.domain.walletmanager.utils +package com.tangem.data.walletmanager import com.google.common.truth.Truth -import com.tangem.blockchain.common.* +import com.tangem.blockchain.common.Amount +import com.tangem.blockchain.common.AmountType +import com.tangem.blockchain.common.Blockchain +import com.tangem.blockchain.common.Token +import com.tangem.blockchain.common.TransactionData +import com.tangem.blockchain.common.TransactionStatus +import com.tangem.blockchain.common.Wallet +import com.tangem.blockchain.common.WalletManager import com.tangem.blockchain.common.address.Address import com.tangem.blockchain.common.address.AddressType import com.tangem.blockchainsdk.models.UpdateWalletManagerResult -import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.* -import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address.Type import com.tangem.common.test.domain.walletmanager.MockUpdateWalletManagerResultFactory import com.tangem.common.test.utils.ProvideTestModels import com.tangem.domain.models.currency.CryptoCurrency @@ -62,9 +67,14 @@ internal class UpdateWalletManagerResultFactoryTest { addresses = setOf(Address(value = "0x1", type = AddressType.Default)), transactions = emptyList(), ), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), currenciesAmounts = emptySet(), currentTransactions = emptySet(), ), @@ -80,10 +90,17 @@ internal class UpdateWalletManagerResultFactoryTest { ), transactions = emptyList(), ), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), - currenciesAmounts = setOf(CryptoCurrencyAmount.Coin(value = BigDecimal.ONE)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), + currenciesAmounts = setOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), + ), currentTransactions = emptySet(), ), ), @@ -106,12 +123,19 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), ), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), - currenciesAmounts = setOf(CryptoCurrencyAmount.Coin(value = BigDecimal.ONE)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), + currenciesAmounts = setOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), + ), currentTransactions = setOf( - CryptoCurrencyTransaction.Coin( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Coin( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.ONE, @@ -150,22 +174,28 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), ), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), - Address(value = "0x11", type = Type.Secondary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + UpdateWalletManagerResult.Address( + value = "0x11", + type = UpdateWalletManagerResult.Address.Type.Secondary, + ), ), currenciesAmounts = setOf( - CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), - CryptoCurrencyAmount.Token( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), + UpdateWalletManagerResult.CryptoCurrencyAmount.Token( value = BigDecimal.ZERO, currencyRawId = usdtToken.id?.let(CryptoCurrency::RawID), contractAddress = usdtToken.contractAddress, ), ), currentTransactions = setOf( - CryptoCurrencyTransaction.Token( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Token( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.TEN, @@ -180,7 +210,7 @@ internal class UpdateWalletManagerResultFactoryTest { ) } - data class GetResultTestModel(val wallet: Wallet, val expected: Verified) + data class GetResultTestModel(val wallet: Wallet, val expected: UpdateWalletManagerResult.Verified) @Nested @TestInstance(TestInstance.Lifecycle.PER_CLASS) @@ -211,13 +241,16 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = null, blockchain = Blockchain.Ethereum), cardTokens = emptySet(), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), ), currenciesAmounts = setOf( - CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), // default for demo + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), // default for demo ), currentTransactions = emptySet(), ), @@ -230,13 +263,16 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = BigDecimal.ONE, blockchain = Blockchain.Ethereum), cardTokens = emptySet(), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), ), currenciesAmounts = setOf( - CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), // used demo amount + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ONE), // used demo amount ), currentTransactions = emptySet(), ), @@ -254,15 +290,17 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = null, blockchain = Blockchain.Ethereum), cardTokens = emptySet(), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address( + UpdateWalletManagerResult.Address( value = "0x1", - type = Type.Primary, + type = UpdateWalletManagerResult.Address.Type.Primary, ), ), - currenciesAmounts = setOf(CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO)), + currenciesAmounts = setOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), + ), currentTransactions = emptySet(), ), ), @@ -276,15 +314,17 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = BigDecimal.TEN, blockchain = Blockchain.Ethereum), cardTokens = emptySet(), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address( + UpdateWalletManagerResult.Address( value = "0x1", - type = Type.Primary, + type = UpdateWalletManagerResult.Address.Type.Primary, ), ), - currenciesAmounts = setOf(CryptoCurrencyAmount.Coin(value = BigDecimal.TEN)), + currenciesAmounts = setOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.TEN), + ), currentTransactions = emptySet(), ), ), @@ -309,14 +349,19 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = BigDecimal.TEN, blockchain = Blockchain.Ethereum), cardTokens = emptySet(), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), + currenciesAmounts = setOf( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.TEN), ), - currenciesAmounts = setOf(CryptoCurrencyAmount.Coin(value = BigDecimal.TEN)), currentTransactions = setOf( - CryptoCurrencyTransaction.Coin( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Coin( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.ONE, @@ -357,22 +402,28 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = null, blockchain = Blockchain.Ethereum), cardTokens = setOf(usdtToken), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), - Address(value = "0x11", type = Type.Secondary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + UpdateWalletManagerResult.Address( + value = "0x11", + type = UpdateWalletManagerResult.Address.Type.Secondary, + ), ), currenciesAmounts = setOf( - CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), - CryptoCurrencyAmount.Token( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.ZERO), + UpdateWalletManagerResult.CryptoCurrencyAmount.Token( value = BigDecimal.ZERO, currencyRawId = usdtToken.id?.let(CryptoCurrency::RawID), contractAddress = usdtToken.contractAddress, ), ), currentTransactions = setOf( - CryptoCurrencyTransaction.Token( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Token( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.TEN, @@ -412,22 +463,28 @@ internal class UpdateWalletManagerResultFactoryTest { ), demoAmount = Amount(value = BigDecimal.TEN, blockchain = Blockchain.Ethereum), cardTokens = setOf(usdtToken), - expected = Verified( + expected = UpdateWalletManagerResult.Verified( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), - Address(value = "0x11", type = Type.Secondary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + UpdateWalletManagerResult.Address( + value = "0x11", + type = UpdateWalletManagerResult.Address.Type.Secondary, + ), ), currenciesAmounts = setOf( - CryptoCurrencyAmount.Coin(value = BigDecimal.TEN), - CryptoCurrencyAmount.Token( + UpdateWalletManagerResult.CryptoCurrencyAmount.Coin(value = BigDecimal.TEN), + UpdateWalletManagerResult.CryptoCurrencyAmount.Token( value = BigDecimal.TEN, currencyRawId = usdtToken.id?.let(CryptoCurrency::RawID), contractAddress = usdtToken.contractAddress, ), ), currentTransactions = setOf( - CryptoCurrencyTransaction.Token( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Token( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.TEN, @@ -435,7 +492,7 @@ internal class UpdateWalletManagerResultFactoryTest { tokenId = "0x3", contractAddress = "0x4", ), - CryptoCurrencyTransaction.Coin( + UpdateWalletManagerResult.CryptoCurrencyTransaction.Coin( txInfo = createTxInfo( status = TxInfo.TransactionStatus.Unconfirmed, amount = BigDecimal.ONE, @@ -453,7 +510,7 @@ internal class UpdateWalletManagerResultFactoryTest { val wallet: Wallet, val demoAmount: Amount, val cardTokens: Set, - val expected: Verified, + val expected: UpdateWalletManagerResult.Verified, ) @Nested @@ -487,9 +544,14 @@ internal class UpdateWalletManagerResultFactoryTest { ), customMessage = "", amountToCreateAccount = null, - expected = Unreachable( + expected = UpdateWalletManagerResult.Unreachable( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), ), ), // endregion @@ -518,9 +580,14 @@ internal class UpdateWalletManagerResultFactoryTest { ), customMessage = "custom message", amountToCreateAccount = BigDecimal.ONE, - expected = NoAccount( + expected = UpdateWalletManagerResult.NoAccount( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), amountToCreateAccount = BigDecimal.ONE, errorMessage = "custom message", ), @@ -546,9 +613,14 @@ internal class UpdateWalletManagerResultFactoryTest { ), customMessage = "", amountToCreateAccount = BigDecimal.ZERO, - expected = NoAccount( + expected = UpdateWalletManagerResult.NoAccount( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), amountToCreateAccount = BigDecimal.ZERO, errorMessage = "", ), @@ -585,11 +657,17 @@ internal class UpdateWalletManagerResultFactoryTest { ), customMessage = "", amountToCreateAccount = BigDecimal.ZERO, - expected = NoAccount( + expected = UpdateWalletManagerResult.NoAccount( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), - Address(value = "0x11", type = Type.Secondary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + UpdateWalletManagerResult.Address( + value = "0x11", + type = UpdateWalletManagerResult.Address.Type.Secondary, + ), ), amountToCreateAccount = BigDecimal.ZERO, errorMessage = "", @@ -631,9 +709,14 @@ internal class UpdateWalletManagerResultFactoryTest { addresses = setOf(Address(value = "0x1", type = AddressType.Default)), transactions = emptyList(), ), - expected = Unreachable( + expected = UpdateWalletManagerResult.Unreachable( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), ), ), // endregion @@ -647,9 +730,14 @@ internal class UpdateWalletManagerResultFactoryTest { ), transactions = emptyList(), ), - expected = Unreachable( + expected = UpdateWalletManagerResult.Unreachable( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), ), ), // endregion @@ -671,9 +759,14 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), ), - expected = Unreachable( + expected = UpdateWalletManagerResult.Unreachable( selectedAddress = "0x1", - addresses = setOf(Address(value = "0x1", type = Type.Primary)), + addresses = setOf( + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + ), ), ), // endregion @@ -706,11 +799,17 @@ internal class UpdateWalletManagerResultFactoryTest { ), ), ), - expected = Unreachable( + expected = UpdateWalletManagerResult.Unreachable( selectedAddress = "0x1", addresses = setOf( - Address(value = "0x1", type = Type.Primary), - Address(value = "0x11", type = Type.Secondary), + UpdateWalletManagerResult.Address( + value = "0x1", + type = UpdateWalletManagerResult.Address.Type.Primary, + ), + UpdateWalletManagerResult.Address( + value = "0x11", + type = UpdateWalletManagerResult.Address.Type.Secondary, + ), ), ), ), diff --git a/domain/card/build.gradle.kts b/domain/card/build.gradle.kts index a5aa3d005f..8fd9a047e4 100644 --- a/domain/card/build.gradle.kts +++ b/domain/card/build.gradle.kts @@ -10,19 +10,30 @@ android { dependencies { implementation(projects.core.analytics.models) + implementation(projects.core.error) + implementation(projects.core.error.ext) implementation(projects.domain.demo) implementation(projects.domain.core) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) // TODO refactor to use from data module implementation(projects.libs.blockchainSdk) // TODO: Remove after new card scan result was implemented implementation(projects.domain.models) implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) + implementation(deps.timber) + implementation(tangemDeps.card.core) implementation(tangemDeps.blockchain) { exclude(module = "joda-time") } + /** Testing libraries */ + testImplementation(deps.test.junit5) + testRuntimeOnly(deps.test.junit5.engine) + testImplementation(deps.test.mockk) + testImplementation(deps.test.truth) + testImplementation(projects.common.test) } \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/CardTypesResolver.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/CardTypesResolver.kt similarity index 96% rename from domain/legacy/src/main/java/com/tangem/domain/common/CardTypesResolver.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/CardTypesResolver.kt index a42c4a5b8d..625da3f339 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/CardTypesResolver.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/CardTypesResolver.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common +package com.tangem.domain.card import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Token diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/DerivationStyleProvider.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/DerivationStyleProvider.kt similarity index 86% rename from domain/legacy/src/main/java/com/tangem/domain/common/DerivationStyleProvider.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/DerivationStyleProvider.kt index 5c0fbdcc83..36267e8d35 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/DerivationStyleProvider.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/DerivationStyleProvider.kt @@ -1,7 +1,7 @@ -package com.tangem.domain.common +package com.tangem.domain.card import com.tangem.blockchain.common.derivation.DerivationStyle -import com.tangem.domain.common.TapWorkarounds.isWallet2 +import com.tangem.domain.card.common.TapWorkarounds.isWallet2 import com.tangem.domain.models.scan.CardDTO interface DerivationStyleProvider { @@ -25,6 +25,7 @@ internal class TangemDerivationStyleProvider( } } +// TODO remove this class [REDACTED_TASK_KEY] internal class TangemHotDerivationStyleProvider : DerivationStyleProvider { override fun getDerivationStyle(): DerivationStyle? = DerivationStyle.V3 } \ No newline at end of file diff --git a/domain/card/src/main/kotlin/com/tangem/domain/card/NetworkHasDerivationUseCase.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/NetworkHasDerivationUseCase.kt deleted file mode 100644 index e544b5b725..0000000000 --- a/domain/card/src/main/kotlin/com/tangem/domain/card/NetworkHasDerivationUseCase.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.tangem.domain.card - -import arrow.core.Either -import com.tangem.blockchainsdk.utils.toBlockchain -import com.tangem.domain.common.util.hasDerivation -import com.tangem.domain.models.network.Network -import com.tangem.domain.models.wallet.UserWallet - -class NetworkHasDerivationUseCase { - - operator fun invoke(userWallet: UserWallet, network: Network): Either = Either.catch { - when (userWallet) { - is UserWallet.Cold -> { - val blockchain = network.toBlockchain() - val derivationPath = network.derivationPath.value - derivationPath != null && userWallet.scanResponse.hasDerivation(blockchain, derivationPath) - } - is UserWallet.Hot -> true - } - } -} \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/TangemCardTypesResolver.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/TangemCardTypesResolver.kt similarity index 84% rename from domain/legacy/src/main/java/com/tangem/domain/common/TangemCardTypesResolver.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/TangemCardTypesResolver.kt index 5b997342b9..f98a8ed3a7 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/TangemCardTypesResolver.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/TangemCardTypesResolver.kt @@ -1,15 +1,16 @@ -package com.tangem.domain.common +package com.tangem.domain.card import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Token import com.tangem.common.card.EllipticCurve import com.tangem.common.card.FirmwareVersion import com.tangem.common.card.WalletData -import com.tangem.domain.common.TapWorkarounds.getTangemNoteBlockchain -import com.tangem.domain.common.TapWorkarounds.isStart2Coin -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.TapWorkarounds.isWallet2 -import com.tangem.domain.common.visa.VisaUtilities +import com.tangem.domain.card.common.TapWorkarounds.getTangemNoteBlockchain +import com.tangem.domain.card.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.common.TapWorkarounds.isWallet2 +import com.tangem.domain.card.common.getTwinCardIdForUser +import com.tangem.domain.card.common.visa.VisaUtilities import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ProductType import com.tangem.operations.attestation.Attestation @@ -25,15 +26,15 @@ internal class TangemCardTypesResolver( override fun isTangemWallet(): Boolean { return card.settings.isBackupAllowed && card.settings.isHDWalletAllowed && - card.firmwareVersion >= FirmwareVersion.MultiWalletAvailable + card.firmwareVersion >= FirmwareVersion.Companion.MultiWalletAvailable } override fun isShibaWallet(): Boolean { - return card.firmwareVersion.compareTo(FirmwareVersion.KeysImportAvailable) == 0 + return card.firmwareVersion.compareTo(FirmwareVersion.Companion.KeysImportAvailable) == 0 } override fun isWhiteWallet(): Boolean { - return walletData == null && card.firmwareVersion <= FirmwareVersion.HDWalletAvailable + return walletData == null && card.firmwareVersion <= FirmwareVersion.Companion.HDWalletAvailable } override fun isWallet2(): Boolean = card.isWallet2 @@ -62,7 +63,7 @@ internal class TangemCardTypesResolver( (multiWalletAvailable() || card.wallets.firstOrNull()?.curve == EllipticCurve.Secp256k1) } - private fun multiWalletAvailable() = card.firmwareVersion >= FirmwareVersion.MultiWalletAvailable + private fun multiWalletAvailable() = card.firmwareVersion >= FirmwareVersion.Companion.MultiWalletAvailable override fun getBlockchain(): Blockchain { return when (productType) { @@ -75,7 +76,7 @@ internal class TangemCardTypesResolver( } else { return Blockchain.Unknown } - Blockchain.fromBlockchainName(blockchainName) + Blockchain.Companion.fromBlockchainName(blockchainName) } } } @@ -126,7 +127,7 @@ internal class TangemCardTypesResolver( Blockchain.Cardano } else -> { - Blockchain.fromId(blockchainName) + fromId(blockchainName) } } } diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/TapWorkarounds.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/TapWorkarounds.kt similarity index 95% rename from domain/legacy/src/main/java/com/tangem/domain/common/TapWorkarounds.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/TapWorkarounds.kt index 493d724f8b..2790b54665 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/TapWorkarounds.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/TapWorkarounds.kt @@ -1,9 +1,9 @@ -package com.tangem.domain.common +package com.tangem.domain.card.common import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.FirmwareVersion -import com.tangem.domain.common.visa.VisaUtilities -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.card.common.visa.VisaUtilities +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.scan.CardDTO import java.util.Locale diff --git a/domain/card/src/main/kotlin/com/tangem/domain/card/common/TwinsHelper.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/TwinsHelper.kt new file mode 100644 index 0000000000..c22cbb5a52 --- /dev/null +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/TwinsHelper.kt @@ -0,0 +1,90 @@ +package com.tangem.domain.card.common + +import com.tangem.crypto.CryptoUtils +import com.tangem.domain.models.scan.CardDTO + +object TwinsHelper { + + /** + * Card compatibility + * cb61 <-> cb62 + * cb64 <-> cb65 + * + */ + private const val FIRST_CARD_FIRST_SERIES = "CB61" + private const val SECOND_CARD_FIRST_SERIES = "CB62" + private const val FIRST_CARD_SECOND_SERIES = "CB64" + private const val SECOND_CARD_SECOND_SERIES = "CB65" + + @Suppress("MagicNumber") + fun verifyTwinPublicKey(issuerData: ByteArray, cardWalletPublicKey: ByteArray?): Boolean { + if (issuerData.size < 65 || cardWalletPublicKey == null) return false + + val publicKey = issuerData.sliceArray(0 until 65) + val signedKey = issuerData.sliceArray(65 until issuerData.size) + return CryptoUtils.verify(cardWalletPublicKey, publicKey, signedKey) + } + + fun getTwinCardNumber(cardId: String): TwinCardNumber? { + val isFirstCard = cardId.startsWith(FIRST_CARD_FIRST_SERIES) || + cardId.startsWith(FIRST_CARD_SECOND_SERIES) + if (isFirstCard) return TwinCardNumber.First + + val isSecondCard = cardId.startsWith(SECOND_CARD_FIRST_SERIES) || + cardId.startsWith(SECOND_CARD_SECOND_SERIES) + if (isSecondCard) return TwinCardNumber.Second + return null + } + + @Suppress("MagicNumber") + fun getTwinCardIdForUser(cardId: String): String { + if (cardId.length < 16) return cardId + + val twinCardId = cardId.substring(11..14) + val twinCardNumber = getTwinCardNumber(cardId)?.number ?: 1 + return "$twinCardId #$twinCardNumber" + } + + /** + * Twins compatibility + * cb61 <-> cb62 + * cb64 <-> cb65 + */ + fun isTwinsCompatible(firstCardId: String, secondCardId: String): Boolean { + return secondCardId.startsWith(getCompatibleTwinCardId(firstCardId)) + } + + private fun getCompatibleTwinCardId(cardId: String): String { + return when { + cardId.startsWith(FIRST_CARD_FIRST_SERIES) -> SECOND_CARD_FIRST_SERIES + cardId.startsWith(FIRST_CARD_SECOND_SERIES) -> SECOND_CARD_SECOND_SERIES + cardId.startsWith(SECOND_CARD_FIRST_SERIES) -> FIRST_CARD_FIRST_SERIES + cardId.startsWith(SECOND_CARD_SECOND_SERIES) -> FIRST_CARD_SECOND_SERIES + else -> { + "unknown" + } + } + } +} + +enum class TwinCardNumber(val number: Int) { + First(1), Second(2); + + fun pairNumber(): TwinCardNumber = when (this) { + First -> Second + Second -> First + } +} + +@Deprecated("Use ScanResponse.isTangemTwin") +fun CardDTO.isTangemTwin(): Boolean { + return TwinsHelper.getTwinCardNumber(cardId) != null +} + +fun CardDTO.getTwinCardNumber(): TwinCardNumber? { + return TwinsHelper.getTwinCardNumber(this.cardId) +} + +fun CardDTO.getTwinCardIdForUser(): String { + return TwinsHelper.getTwinCardIdForUser(this.cardId) +} \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt similarity index 91% rename from domain/legacy/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt index 5cc1924fd1..32bc4a3ecc 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/extensions/CardSdk.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/extensions/CardSdk.kt @@ -1,17 +1,17 @@ -package com.tangem.domain.common.extensions +package com.tangem.domain.card.common.extensions import com.tangem.blockchain.common.Blockchain import com.tangem.blockchainsdk.utils.ExcludedBlockchains import com.tangem.common.card.EllipticCurve import com.tangem.common.card.FirmwareVersion -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.configs.CardConfig -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.configs.CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.wallet.UserWallet -// TODO: refactor [REDACTED_JIRA] +// TODO: refactor [REDACTED_JIRA]\ /** [REDACTED_AUTHOR] @@ -28,7 +28,7 @@ fun UserWallet.supportedBlockchains(excludedBlockchains: ExcludedBlockchains): L ) } is UserWallet.Hot -> { - Blockchain.entries.filter { it !in excludedBlockchains } + Blockchain.entries.filter { it.isTestnet().not() && it !in excludedBlockchains } } } } @@ -94,7 +94,9 @@ fun UserWallet.canHandleToken(blockchain: Blockchain, excludedBlockchains: Exclu ) } - is UserWallet.Hot -> blockchain !in excludedBlockchains + is UserWallet.Hot -> blockchain.isTestnet().not() && + blockchain !in excludedBlockchains && + blockchain.canHandleTokens() } } diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/util/ScanResponseExt.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/util/ScanResponseExt.kt similarity index 71% rename from domain/legacy/src/main/java/com/tangem/domain/common/util/ScanResponseExt.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/util/ScanResponseExt.kt index 1187fe5617..6fb8c34eb4 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/util/ScanResponseExt.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/util/ScanResponseExt.kt @@ -1,14 +1,19 @@ -package com.tangem.domain.common.util +package com.tangem.domain.card.common.util +import com.tangem.blockchain.blockchains.cardano.CardanoUtils import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve import com.tangem.common.extensions.toMapKey import com.tangem.crypto.hdWallet.DerivationPath -import com.tangem.domain.common.* -import com.tangem.domain.common.TapWorkarounds.isTangemTwins -import com.tangem.domain.common.TapWorkarounds.isTestCard -import com.tangem.domain.common.configs.CardConfig -import com.tangem.domain.common.configs.Wallet2CardConfig +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.DerivationStyleProvider +import com.tangem.domain.card.TangemCardTypesResolver +import com.tangem.domain.card.TangemDerivationStyleProvider +import com.tangem.domain.card.TangemHotDerivationStyleProvider +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins +import com.tangem.domain.card.common.TapWorkarounds.isTestCard +import com.tangem.domain.card.configs.CardConfig +import com.tangem.domain.card.configs.Wallet2CardConfig import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet @@ -47,27 +52,36 @@ private fun ScanResponse.hasDerivation(blockchain: Blockchain, derivationPath: D return if (config is Wallet2CardConfig) { // new logic for wallet2 val primaryCurve = config.primaryCurve(blockchain) - primaryCurve?.let { hasDerivation(it, derivationPath) } == true + primaryCurve?.let { hasDerivation(blockchain, it, derivationPath) } == true } else { // leave logic for legacy wallets when { Blockchain.secp256k1Blockchains(isTestnet).contains(blockchain) -> { - hasDerivation(EllipticCurve.Secp256k1, derivationPath) + hasDerivation(blockchain, EllipticCurve.Secp256k1, derivationPath) } Blockchain.ed25519Blockchains(isTestnet).contains(blockchain) -> { - hasDerivation(EllipticCurve.Ed25519, derivationPath) + hasDerivation(blockchain, EllipticCurve.Ed25519, derivationPath) } else -> false } } } -private fun ScanResponse.hasDerivation(curve: EllipticCurve, derivationPath: DerivationPath): Boolean { +private fun ScanResponse.hasDerivation( + blockchain: Blockchain, + curve: EllipticCurve, + derivationPath: DerivationPath, +): Boolean { val foundWallet = card.wallets.firstOrNull { it.curve == curve } ?: return false val extendedPublicKeysMap = derivedKeys[foundWallet.publicKey.toMapKey()] ?: return false val extendedPublicKey = extendedPublicKeysMap[derivationPath] - return extendedPublicKey != null + return if (blockchain == Blockchain.Cardano) { + // Cardano uses extended derivation path + extendedPublicKey != null && extendedPublicKeysMap[CardanoUtils.extendedDerivationPath(derivationPath)] != null + } else { + extendedPublicKey != null + } } /** diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletExt.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/util/UserWalletExt.kt similarity index 92% rename from domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletExt.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/util/UserWalletExt.kt index 621401faba..72bcbb34d8 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/util/UserWalletExt.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/util/UserWalletExt.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.util +package com.tangem.domain.card.common.util import com.tangem.domain.models.wallet.UserWallet diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaUtilities.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaUtilities.kt similarity index 95% rename from domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaUtilities.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaUtilities.kt index fbd488d355..101ec1b9a4 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaUtilities.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaUtilities.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.visa +package com.tangem.domain.card.common.visa import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.derivation.DerivationStyle diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaWalletPublicKeyUtility.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaWalletPublicKeyUtility.kt similarity index 98% rename from domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaWalletPublicKeyUtility.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaWalletPublicKeyUtility.kt index 758ec7a589..ca5acb8d15 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/visa/VisaWalletPublicKeyUtility.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/common/visa/VisaWalletPublicKeyUtility.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.visa +package com.tangem.domain.card.common.visa import arrow.core.Either import arrow.core.raise.catch diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/configs/CardConfig.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/CardConfig.kt similarity index 96% rename from domain/legacy/src/main/java/com/tangem/domain/common/configs/CardConfig.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/configs/CardConfig.kt index 8099ff7d09..7c450c04cf 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/configs/CardConfig.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/CardConfig.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/configs/EdSingleCurrencyCardConfig.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/EdSingleCurrencyCardConfig.kt similarity index 93% rename from domain/legacy/src/main/java/com/tangem/domain/common/configs/EdSingleCurrencyCardConfig.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/configs/EdSingleCurrencyCardConfig.kt index 6792eeff3e..37ee742b77 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/configs/EdSingleCurrencyCardConfig.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/EdSingleCurrencyCardConfig.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/configs/GenericCardConfig.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/GenericCardConfig.kt similarity index 95% rename from domain/legacy/src/main/java/com/tangem/domain/common/configs/GenericCardConfig.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/configs/GenericCardConfig.kt index e75ff6da09..099c93ed10 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/configs/GenericCardConfig.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/GenericCardConfig.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/configs/MultiWalletCardConfig.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/MultiWalletCardConfig.kt similarity index 96% rename from domain/legacy/src/main/java/com/tangem/domain/common/configs/MultiWalletCardConfig.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/configs/MultiWalletCardConfig.kt index 414d7a528a..8e661fffee 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/configs/MultiWalletCardConfig.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/MultiWalletCardConfig.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/configs/Wallet2CardConfig.kt b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/Wallet2CardConfig.kt similarity index 99% rename from domain/legacy/src/main/java/com/tangem/domain/common/configs/Wallet2CardConfig.kt rename to domain/card/src/main/kotlin/com/tangem/domain/card/configs/Wallet2CardConfig.kt index b9fbfffbf3..346a09dc81 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/configs/Wallet2CardConfig.kt +++ b/domain/card/src/main/kotlin/com/tangem/domain/card/configs/Wallet2CardConfig.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/legacy/src/test/java/com/tangem/domain/common/TwinsHelperTest.kt b/domain/card/src/test/java/com/tangem/domain/card/TwinsHelperTest.kt similarity index 95% rename from domain/legacy/src/test/java/com/tangem/domain/common/TwinsHelperTest.kt rename to domain/card/src/test/java/com/tangem/domain/card/TwinsHelperTest.kt index 2fc624d9b8..76e2291eac 100644 --- a/domain/legacy/src/test/java/com/tangem/domain/common/TwinsHelperTest.kt +++ b/domain/card/src/test/java/com/tangem/domain/card/TwinsHelperTest.kt @@ -1,5 +1,6 @@ -package com.tangem.domain.common +package com.tangem.domain.card +import com.tangem.domain.common.TwinsHelper import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test diff --git a/domain/legacy/src/test/java/com/tangem/domain/common/configs/Wallet2CardConfigTest.kt b/domain/card/src/test/java/com/tangem/domain/card/configs/Wallet2CardConfigTest.kt similarity index 99% rename from domain/legacy/src/test/java/com/tangem/domain/common/configs/Wallet2CardConfigTest.kt rename to domain/card/src/test/java/com/tangem/domain/card/configs/Wallet2CardConfigTest.kt index b97e91d9d1..152e79a017 100644 --- a/domain/legacy/src/test/java/com/tangem/domain/common/configs/Wallet2CardConfigTest.kt +++ b/domain/card/src/test/java/com/tangem/domain/card/configs/Wallet2CardConfigTest.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.common.configs +package com.tangem.domain.card.configs import com.tangem.blockchain.common.Blockchain import com.tangem.common.card.EllipticCurve diff --git a/domain/demo/build.gradle.kts b/domain/demo/build.gradle.kts index 83c77bfc66..b5eb557c1a 100644 --- a/domain/demo/build.gradle.kts +++ b/domain/demo/build.gradle.kts @@ -9,6 +9,8 @@ android { } dependencies { + api(projects.domain.demo.models) + implementation(tangemDeps.blockchain) implementation(tangemDeps.card.core) } \ No newline at end of file diff --git a/domain/demo/models/.gitignore b/domain/demo/models/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/domain/demo/models/.gitignore @@ -0,0 +1 @@ +/build diff --git a/domain/demo/models/build.gradle.kts b/domain/demo/models/build.gradle.kts new file mode 100644 index 0000000000..f383bb8e3e --- /dev/null +++ b/domain/demo/models/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + id("configuration") +} + +android { + namespace = "com.tangem.domain.demo.models" +} + +dependencies { + implementation(tangemDeps.blockchain) + implementation(tangemDeps.card.core) +} \ No newline at end of file diff --git a/domain/demo/src/main/java/com/tangem/domain/demo/DemoConfig.kt b/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt similarity index 99% rename from domain/demo/src/main/java/com/tangem/domain/demo/DemoConfig.kt rename to domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt index 0c43c9717c..95693247f1 100644 --- a/domain/demo/src/main/java/com/tangem/domain/demo/DemoConfig.kt +++ b/domain/demo/models/src/main/kotlin/com/tangem/domain/demo/models/DemoConfig.kt @@ -1,10 +1,9 @@ -package com.tangem.domain.demo +package com.tangem.domain.demo.models import com.tangem.blockchain.common.Amount import com.tangem.blockchain.common.Blockchain import java.math.BigDecimal -// FIXME: Move to :domain:demo:models @Suppress("LargeClass") class DemoConfig { diff --git a/domain/demo/src/main/java/com/tangem/domain/demo/IsDemoCardUseCase.kt b/domain/demo/src/main/java/com/tangem/domain/demo/IsDemoCardUseCase.kt index 209d7984ba..edef866883 100644 --- a/domain/demo/src/main/java/com/tangem/domain/demo/IsDemoCardUseCase.kt +++ b/domain/demo/src/main/java/com/tangem/domain/demo/IsDemoCardUseCase.kt @@ -1,5 +1,7 @@ package com.tangem.domain.demo +import com.tangem.domain.demo.models.DemoConfig + class IsDemoCardUseCase(private val config: DemoConfig) { operator fun invoke(cardId: String): Boolean = config.isDemoCardId(cardId) diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt b/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt deleted file mode 100644 index a1a8cd1f18..0000000000 --- a/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.tangem.domain.common - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass -import com.tangem.blockchain.common.Blockchain -import com.tangem.blockchain.common.Token -import com.tangem.common.extensions.calculateHashCode - -@JsonClass(generateAdapter = true) -@Deprecated("Use Network model") -data class BlockchainNetwork( - @Json(name = "blockchain") - val blockchain: Blockchain, - @Json(name = "derivationPath") - val derivationPath: String?, - @Json(name = "tokens") - val tokens: List, -) { - - constructor(blockchain: Blockchain, derivationStyleProvider: DerivationStyleProvider) : this( - blockchain = blockchain, - derivationPath = blockchain.derivationPath(derivationStyleProvider.getDerivationStyle())?.rawPath, - tokens = emptyList(), - ) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BlockchainNetwork - - if (blockchain != other.blockchain) return false - return derivationPath == other.derivationPath - } - - override fun hashCode(): Int = calculateHashCode( - blockchain.hashCode(), - derivationPath?.hashCode() ?: 0, - ) -} \ No newline at end of file diff --git a/domain/manage-tokens/build.gradle.kts b/domain/manage-tokens/build.gradle.kts index cff1f6e9aa..c60557ebe2 100644 --- a/domain/manage-tokens/build.gradle.kts +++ b/domain/manage-tokens/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { api(projects.domain.manageTokens.models) api(projects.domain.networks) api(projects.domain.quotes) + api(projects.domain.walletManager) implementation(projects.domain.wallets.models) implementation(projects.domain.tokens.models) implementation(projects.domain.staking) diff --git a/domain/markets/src/main/java/com/tangem/domain/markets/FilterAvailableNetworksForWalletUseCase.kt b/domain/markets/src/main/java/com/tangem/domain/markets/FilterAvailableNetworksForWalletUseCase.kt index 98e9d6ffee..7d01fd1314 100644 --- a/domain/markets/src/main/java/com/tangem/domain/markets/FilterAvailableNetworksForWalletUseCase.kt +++ b/domain/markets/src/main/java/com/tangem/domain/markets/FilterAvailableNetworksForWalletUseCase.kt @@ -3,8 +3,8 @@ package com.tangem.domain.markets import com.tangem.blockchain.common.Blockchain import com.tangem.blockchainsdk.utils.ExcludedBlockchains import com.tangem.blockchainsdk.utils.fromNetworkId -import com.tangem.domain.common.extensions.supportedBlockchains -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.extensions.supportedBlockchains +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.wallets.legacy.UserWalletsListManager diff --git a/domain/staking/build.gradle.kts b/domain/staking/build.gradle.kts index 7e1c431b94..efe7186cb3 100644 --- a/domain/staking/build.gradle.kts +++ b/domain/staking/build.gradle.kts @@ -19,6 +19,7 @@ dependencies { implementation(deps.jodatime) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) // TODO refactor to use from data module implementation(projects.domain.models) implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) diff --git a/domain/tokens/build.gradle.kts b/domain/tokens/build.gradle.kts index 3091a9623f..2bcbd75a88 100644 --- a/domain/tokens/build.gradle.kts +++ b/domain/tokens/build.gradle.kts @@ -18,6 +18,8 @@ dependencies { api(projects.domain.core) implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) + implementation(projects.domain.card) implementation(projects.domain.staking) implementation(projects.libs.blockchainSdk) implementation(projects.domain.tokens.models) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetNetworkCoinStatusUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetNetworkCoinStatusUseCase.kt index 58ead21fd3..5179b54d12 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetNetworkCoinStatusUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetNetworkCoinStatusUseCase.kt @@ -1,7 +1,7 @@ package com.tangem.domain.tokens import arrow.core.Either -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.network.Network import com.tangem.domain.tokens.error.CurrencyStatusError import com.tangem.domain.tokens.error.mapper.mapToCurrencyError diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt index afa75d9c9a..28522fdc9d 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/repository/CurrenciesRepository.kt @@ -1,6 +1,6 @@ package com.tangem.domain.tokens.repository -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.core.error.DataError import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network diff --git a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt index 7113ad91a3..b408c3975e 100644 --- a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt +++ b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockCurrenciesRepository.kt @@ -2,7 +2,7 @@ package com.tangem.domain.tokens.repository import arrow.core.Either import arrow.core.getOrElse -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.core.error.DataError import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network diff --git a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/wallet/WalletBalanceFetcherTest.kt b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/wallet/WalletBalanceFetcherTest.kt index 0b54f8b959..d5d5f14816 100644 --- a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/wallet/WalletBalanceFetcherTest.kt +++ b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/wallet/WalletBalanceFetcherTest.kt @@ -4,7 +4,7 @@ import arrow.core.left import arrow.core.right import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory import com.tangem.common.test.utils.assertEither -import com.tangem.domain.common.CardTypesResolver +import com.tangem.domain.card.CardTypesResolver import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.networks.multi.MultiNetworkStatusFetcher import com.tangem.domain.quotes.multi.MultiQuoteStatusFetcher diff --git a/domain/transaction/build.gradle.kts b/domain/transaction/build.gradle.kts index 30cedbb7c9..50f4bce71d 100644 --- a/domain/transaction/build.gradle.kts +++ b/domain/transaction/build.gradle.kts @@ -28,6 +28,7 @@ dependencies { implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.domain.wallets.models) implementation(projects.domain.tokens) implementation(projects.domain.tokens.models) diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/EstimateFeeUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/EstimateFeeUseCase.kt index e6b8de0c1c..0a7a430a35 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/EstimateFeeUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/EstimateFeeUseCase.kt @@ -8,7 +8,7 @@ import com.tangem.blockchain.common.AmountType import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.transaction.TransactionFee import com.tangem.blockchain.extensions.Result -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.demo.DemoTransactionSender import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.transaction.error.GetFeeError diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/GetFeeUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/GetFeeUseCase.kt index 6ed9b29fda..b78313fd30 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/GetFeeUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/GetFeeUseCase.kt @@ -7,7 +7,7 @@ import com.tangem.blockchain.common.AmountType import com.tangem.blockchain.common.Token import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.extensions.Result -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.demo.DemoTransactionSender import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/PrepareForSendUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/PrepareForSendUseCase.kt index b5fca39142..36f6ad081d 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/PrepareForSendUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/PrepareForSendUseCase.kt @@ -6,9 +6,9 @@ import arrow.core.right import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.TransactionSigner import com.tangem.blockchain.extensions.Result +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins import com.tangem.domain.card.models.TwinKey import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.models.network.Network import com.tangem.domain.transaction.TransactionRepository import com.tangem.domain.transaction.error.SendTransactionError diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SendTransactionUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SendTransactionUseCase.kt index c7eecef034..3f2e7aeaf6 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SendTransactionUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SendTransactionUseCase.kt @@ -12,11 +12,11 @@ import com.tangem.blockchain.extensions.Result import com.tangem.blockchain.network.ResultChecker import com.tangem.core.ui.format.bigdecimal.format import com.tangem.core.ui.format.bigdecimal.simple +import com.tangem.domain.card.common.TapWorkarounds.isStart2Coin +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins import com.tangem.domain.card.models.TwinKey import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.TapWorkarounds.isStart2Coin -import com.tangem.domain.common.TapWorkarounds.isTangemTwins -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.demo.DemoTransactionSender import com.tangem.domain.models.network.Network import com.tangem.domain.networks.single.SingleNetworkStatusFetcher diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SignUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SignUseCase.kt index c08c786a6f..ec98b2d43c 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SignUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/SignUseCase.kt @@ -5,9 +5,9 @@ import arrow.core.left import arrow.core.right import com.tangem.common.CompletionResult import com.tangem.common.core.TangemError +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins import com.tangem.domain.card.models.TwinKey import com.tangem.domain.card.repository.CardSdkConfigRepository -import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.models.network.Network import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.domain.models.wallet.UserWallet diff --git a/domain/wallet-manager/.gitignore b/domain/wallet-manager/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/domain/wallet-manager/.gitignore @@ -0,0 +1 @@ +/build diff --git a/domain/wallet-manager/build.gradle.kts b/domain/wallet-manager/build.gradle.kts new file mode 100644 index 0000000000..c1b69e1b4c --- /dev/null +++ b/domain/wallet-manager/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + alias(deps.plugins.android.library) + alias(deps.plugins.kotlin.android) + alias(deps.plugins.ksp) + id("configuration") +} + +android { + namespace = "com.tangem.domain.walletmanager" +} + +dependencies { + /** Domain models */ + api(projects.domain.walletManager.models) + + /** Project - Domain */ + implementation(projects.core.utils) + implementation(projects.core.error) + api(projects.domain.models) + implementation(projects.domain.core) + implementation(projects.domain.demo.models) + implementation(projects.domain.wallets.models) + implementation(projects.domain.tokens.models) + implementation(projects.domain.appCurrency.models) + implementation(projects.domain.transaction.models) + implementation(projects.domain.txhistory.models) + + /** Tangem libs */ + implementation(tangemDeps.card.core) + + /** Libs - Other */ + implementation(projects.libs.blockchainSdk) + implementation(tangemDeps.blockchain) + implementation(deps.moshi) + implementation(deps.moshi.kotlin) + ksp(deps.moshi.kotlin.codegen) + + /** Testing libraries */ + testImplementation(deps.test.junit5) + testRuntimeOnly(deps.test.junit5.engine) + testImplementation(deps.test.mockk) + testImplementation(deps.test.truth) + testImplementation(projects.common.test) +} \ No newline at end of file diff --git a/domain/wallet-manager/models/.gitignore b/domain/wallet-manager/models/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/domain/wallet-manager/models/.gitignore @@ -0,0 +1 @@ +/build diff --git a/domain/wallet-manager/models/build.gradle.kts b/domain/wallet-manager/models/build.gradle.kts new file mode 100644 index 0000000000..b02c2d05dc --- /dev/null +++ b/domain/wallet-manager/models/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + alias(deps.plugins.kotlin.jvm) + alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.ksp) + id("configuration") +} + +dependencies { + implementation(projects.domain.models) + + implementation(deps.moshi.kotlin) + ksp(deps.moshi.kotlin.codegen) + implementation(deps.moshi.adapters) + implementation(deps.kotlin.serialization) + implementation(deps.jodatime) + implementation(projects.core.error) +} \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/RentData.kt b/domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/RentData.kt similarity index 100% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/RentData.kt rename to domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/RentData.kt diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/SmartContractMethod.kt b/domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/SmartContractMethod.kt similarity index 100% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/SmartContractMethod.kt rename to domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/SmartContractMethod.kt diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/TokenInfo.kt b/domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/TokenInfo.kt similarity index 100% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/model/TokenInfo.kt rename to domain/wallet-manager/models/src/main/kotlin/com/tangem/domain/walletmanager/model/TokenInfo.kt diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/WalletManagersFacade.kt b/domain/wallet-manager/src/main/kotlin/com/tangem/domain/walletmanager/WalletManagersFacade.kt similarity index 99% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/WalletManagersFacade.kt rename to domain/wallet-manager/src/main/kotlin/com/tangem/domain/walletmanager/WalletManagersFacade.kt index bef17c3a90..744e98f336 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/WalletManagersFacade.kt +++ b/domain/wallet-manager/src/main/kotlin/com/tangem/domain/walletmanager/WalletManagersFacade.kt @@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.Flow import java.math.BigDecimal import java.util.EnumSet -// TODO: Move to its own module /** * A facade for managing wallets. */ diff --git a/domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkPageConverter.kt b/domain/wallet-manager/src/main/kotlin/com/tangem/domain/walletmanager/utils/SdkPageConverter.kt similarity index 100% rename from domain/legacy/src/main/java/com/tangem/domain/walletmanager/utils/SdkPageConverter.kt rename to domain/wallet-manager/src/main/kotlin/com/tangem/domain/walletmanager/utils/SdkPageConverter.kt diff --git a/domain/wallets/build.gradle.kts b/domain/wallets/build.gradle.kts index 6a6f7db261..8fbf7b49dd 100644 --- a/domain/wallets/build.gradle.kts +++ b/domain/wallets/build.gradle.kts @@ -20,10 +20,12 @@ dependencies { // region Domain modules api(projects.domain.core) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.libs.blockchainSdk) implementation(projects.libs.tangemSdkApi) implementation(projects.domain.models) implementation(projects.domain.tokens) + implementation(projects.domain.card) implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) implementation(projects.domain.notifications.models) diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/ColdUserWalletBuilder.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/ColdUserWalletBuilder.kt index d547057f33..b1298548e6 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/ColdUserWalletBuilder.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/ColdUserWalletBuilder.kt @@ -1,6 +1,6 @@ package com.tangem.domain.wallets.builder -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/UserWalletIdBuilder.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/UserWalletIdBuilder.kt index 3f4e75ca6c..c5c27a618b 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/UserWalletIdBuilder.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/builder/UserWalletIdBuilder.kt @@ -3,7 +3,7 @@ package com.tangem.domain.wallets.builder import com.tangem.common.extensions.calculateSha256 import com.tangem.common.extensions.hexToBytes import com.tangem.crypto.Secp256k1 -import com.tangem.domain.common.TapWorkarounds.isTangemTwins +import com.tangem.domain.card.common.TapWorkarounds.isTangemTwins import com.tangem.domain.common.extensions.calculateHmacSha256 import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ProductType diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/extension/UserWalletExtensions.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/extension/UserWalletExtensions.kt new file mode 100644 index 0000000000..99348982ad --- /dev/null +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/extension/UserWalletExtensions.kt @@ -0,0 +1,30 @@ +package com.tangem.domain.wallets.extension + +import com.tangem.blockchain.blockchains.cardano.CardanoUtils +import com.tangem.blockchain.common.Blockchain +import com.tangem.crypto.hdWallet.DerivationPath +import com.tangem.domain.card.common.util.hasDerivation +import com.tangem.domain.card.configs.Wallet2CardConfig +import com.tangem.domain.models.wallet.UserWallet +import kotlin.collections.first +import kotlin.collections.orEmpty + +fun UserWallet.hasDerivation(blockchain: Blockchain, derivationPath: String): Boolean { + return when (this) { + is UserWallet.Cold -> scanResponse.hasDerivation(blockchain, derivationPath) + is UserWallet.Hot -> { + val primaryCurve = Wallet2CardConfig.primaryCurve(blockchain) // TODO [REDACTED_TASK_KEY]: handle hot wallet config + val list = if (blockchain == Blockchain.Cardano) { + listOf( + CardanoUtils.extendedDerivationPath(DerivationPath(derivationPath)), + DerivationPath(derivationPath), + ) + } else { + listOf(DerivationPath(derivationPath)) + } + list.all { dp -> + wallets.orEmpty().first { it.curve == primaryCurve }.derivedKeys.keys.any { it == dp } + } + } + } +} \ No newline at end of file diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/usecase/NetworkHasDerivationUseCase.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/usecase/NetworkHasDerivationUseCase.kt new file mode 100644 index 0000000000..822d187b73 --- /dev/null +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/usecase/NetworkHasDerivationUseCase.kt @@ -0,0 +1,16 @@ +package com.tangem.domain.wallets.usecase + +import arrow.core.Either +import com.tangem.blockchainsdk.utils.toBlockchain +import com.tangem.domain.models.network.Network +import com.tangem.domain.models.wallet.UserWallet +import com.tangem.domain.wallets.extension.hasDerivation + +class NetworkHasDerivationUseCase { + + operator fun invoke(userWallet: UserWallet, network: Network): Either = Either.catch { + val blockchain = network.toBlockchain() + val derivationPath = network.derivationPath.value + derivationPath != null && userWallet.hasDerivation(blockchain, derivationPath) + } +} \ No newline at end of file diff --git a/features/details/impl/src/main/kotlin/com/tangem/features/details/model/DetailsModel.kt b/features/details/impl/src/main/kotlin/com/tangem/features/details/model/DetailsModel.kt index 91ddf209b9..a5b029fa67 100644 --- a/features/details/impl/src/main/kotlin/com/tangem/features/details/model/DetailsModel.kt +++ b/features/details/impl/src/main/kotlin/com/tangem/features/details/model/DetailsModel.kt @@ -10,7 +10,7 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.navigation.Router import com.tangem.core.navigation.url.UrlOpener import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig -import com.tangem.domain.common.TapWorkarounds.isVisa +import com.tangem.domain.card.common.TapWorkarounds.isVisa import com.tangem.domain.feedback.GetCardInfoUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase import com.tangem.domain.feedback.models.CardInfo diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt index 979700765e..ac205fd637 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/entry/impl/model/OnboardingEntryModel.kt @@ -12,7 +12,7 @@ import com.tangem.core.decompose.navigation.Router import com.tangem.core.decompose.ui.UiMessageSender import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.settings.repositories.SettingsRepository import com.tangem.domain.wallets.legacy.UserWalletsListManager diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/chooseoption/model/Wallet1ChooseOptionModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/chooseoption/model/Wallet1ChooseOptionModel.kt index 926f60ca7f..e17f81fcdb 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/chooseoption/model/Wallet1ChooseOptionModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/chooseoption/model/Wallet1ChooseOptionModel.kt @@ -5,8 +5,8 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer +import com.tangem.domain.card.common.TapWorkarounds.canSkipBackup import com.tangem.domain.card.repository.CardRepository -import com.tangem.domain.common.TapWorkarounds.canSkipBackup import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.wallets.builder.ColdUserWalletBuilder import com.tangem.domain.models.wallet.UserWallet diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/BackupValidator.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/BackupValidator.kt index 1b59b2922d..8069228b78 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/BackupValidator.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/BackupValidator.kt @@ -1,7 +1,7 @@ package com.tangem.features.onboarding.v2.multiwallet.impl.child.finalize.model import com.tangem.common.card.EllipticCurve -import com.tangem.domain.common.configs.CardConfig +import com.tangem.domain.card.configs.CardConfig import com.tangem.domain.models.scan.CardDTO import javax.inject.Inject diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/MultiWalletFinalizeModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/MultiWalletFinalizeModel.kt index db53071fb6..23b2dbb674 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/MultiWalletFinalizeModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/finalize/model/MultiWalletFinalizeModel.kt @@ -8,7 +8,7 @@ import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.ui.UiMessageSender import com.tangem.domain.card.repository.CardRepository -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.feedback.GetCardInfoUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase import com.tangem.domain.feedback.models.FeedbackEmailType diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/scanprimary/model/Wallet1ScanPrimaryModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/scanprimary/model/Wallet1ScanPrimaryModel.kt index 621279a14b..fc8ee3fd60 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/scanprimary/model/Wallet1ScanPrimaryModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/multiwallet/impl/child/scanprimary/model/Wallet1ScanPrimaryModel.kt @@ -5,7 +5,7 @@ import com.tangem.common.CompletionResult import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.features.onboarding.v2.impl.R import com.tangem.features.onboarding.v2.multiwallet.impl.child.MultiWalletChildParams import com.tangem.sdk.api.BackupServiceHolder diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/stepper/impl/DefaultOnboardingStepperComponent.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/stepper/impl/DefaultOnboardingStepperComponent.kt index 5bedacb9ee..6a15db448c 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/stepper/impl/DefaultOnboardingStepperComponent.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/stepper/impl/DefaultOnboardingStepperComponent.kt @@ -9,7 +9,7 @@ import com.arkivanov.essenty.instancekeeper.getOrCreateSimple import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.analytics.models.AnalyticsEvent import com.tangem.core.decompose.context.AppComponentContext -import com.tangem.domain.common.TapWorkarounds.isVisa +import com.tangem.domain.card.common.TapWorkarounds.isVisa import com.tangem.domain.feedback.GetCardInfoUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase import com.tangem.domain.feedback.models.FeedbackEmailType diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/twin/impl/model/OnboardingTwinModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/twin/impl/model/OnboardingTwinModel.kt index a5e4b014ea..fa3a235361 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/twin/impl/model/OnboardingTwinModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/twin/impl/model/OnboardingTwinModel.kt @@ -24,10 +24,10 @@ import com.tangem.core.ui.extensions.toWrappedList import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.format import com.tangem.datasource.local.config.issuers.IssuersConfigStorage +import com.tangem.domain.card.common.util.twinsIsTwinned import com.tangem.domain.card.repository.CardRepository import com.tangem.domain.common.TwinCardNumber import com.tangem.domain.common.getTwinCardNumber -import com.tangem.domain.common.util.twinsIsTwinned import com.tangem.domain.feedback.SendFeedbackEmailUseCase import com.tangem.domain.feedback.models.FeedbackEmailType import com.tangem.domain.models.network.Network diff --git a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/model/OnboardingVisaModel.kt b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/model/OnboardingVisaModel.kt index c46a2767c4..65fc1a9b0f 100644 --- a/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/model/OnboardingVisaModel.kt +++ b/features/onboarding-v2/impl/src/main/kotlin/com/tangem/features/onboarding/v2/visa/impl/model/OnboardingVisaModel.kt @@ -8,8 +8,8 @@ import com.arkivanov.decompose.router.stack.replaceAll import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer -import com.tangem.domain.common.visa.VisaUtilities -import com.tangem.domain.common.visa.VisaWalletPublicKeyUtility +import com.tangem.domain.card.common.visa.VisaUtilities +import com.tangem.domain.card.common.visa.VisaWalletPublicKeyUtility import com.tangem.domain.visa.model.VisaActivationRemoteState import com.tangem.domain.visa.model.VisaCardActivationStatus import com.tangem.domain.visa.model.VisaCardWalletDataToSignRequest diff --git a/features/referral/impl/build.gradle.kts b/features/referral/impl/build.gradle.kts index 67ca47e02f..962fdc6a20 100644 --- a/features/referral/impl/build.gradle.kts +++ b/features/referral/impl/build.gradle.kts @@ -40,6 +40,7 @@ dependencies { implementation(projects.domain.demo) implementation(projects.domain.wallets) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.wallets.models) implementation(projects.domain.notifications.models) implementation(projects.features.referral.domain) diff --git a/features/referral/impl/src/main/java/com/tangem/feature/referral/deeplink/DefaultReferralDeepLinkHandler.kt b/features/referral/impl/src/main/java/com/tangem/feature/referral/deeplink/DefaultReferralDeepLinkHandler.kt index b7e23991fb..cd54552b79 100644 --- a/features/referral/impl/src/main/java/com/tangem/feature/referral/deeplink/DefaultReferralDeepLinkHandler.kt +++ b/features/referral/impl/src/main/java/com/tangem/feature/referral/deeplink/DefaultReferralDeepLinkHandler.kt @@ -2,7 +2,7 @@ package com.tangem.feature.referral.deeplink import com.tangem.common.routing.AppRoute import com.tangem.common.routing.AppRouter -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase import com.tangem.feature.referral.api.deeplink.ReferralDeepLinkHandler diff --git a/features/send-v2/impl/build.gradle.kts b/features/send-v2/impl/build.gradle.kts index 0f6bc47557..ef4d10fe2d 100644 --- a/features/send-v2/impl/build.gradle.kts +++ b/features/send-v2/impl/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { /** Domain */ implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.tokens.models) implementation(projects.domain.tokens) implementation(projects.domain.wallets.models) diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt index a0e2d3dec6..308a504271 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt @@ -16,7 +16,7 @@ import com.tangem.core.ui.utils.parseBigDecimalOrNull import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.feedback.GetCardInfoUseCase import com.tangem.domain.feedback.SaveBlockchainErrorUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt index 7bf5522ffc..6bc41ea384 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt @@ -13,7 +13,7 @@ import com.tangem.core.decompose.navigation.Router import com.tangem.datasource.local.nft.converter.NFTSdkAssetConverter import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.feedback.GetCardInfoUseCase import com.tangem.domain.feedback.SaveBlockchainErrorUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase diff --git a/features/swap-v2/impl/build.gradle.kts b/features/swap-v2/impl/build.gradle.kts index 4fbb34b684..c1d107eaf9 100644 --- a/features/swap-v2/impl/build.gradle.kts +++ b/features/swap-v2/impl/build.gradle.kts @@ -47,6 +47,7 @@ dependencies { implementation(projects.domain.wallets) implementation(projects.domain.tokens.models) implementation(projects.domain.tokens) + implementation(projects.domain.card) implementation(projects.domain.appCurrency.models) implementation(projects.domain.appCurrency) implementation(projects.domain.express.models) diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt index d5ced02adb..f2c7bde219 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/model/SendWithSwapModel.kt @@ -10,7 +10,7 @@ import com.tangem.core.decompose.navigation.Router import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.express.models.ExpressError import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.swap.models.SwapDirection diff --git a/features/swap/data/build.gradle.kts b/features/swap/data/build.gradle.kts index 0134f08d66..9c2a64eebe 100644 --- a/features/swap/data/build.gradle.kts +++ b/features/swap/data/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { /** Domain */ implementation(projects.domain.tokens.models) implementation(projects.domain.legacy) + implementation(projects.domain.walletManager) implementation(projects.libs.blockchainSdk) implementation(projects.domain.models) implementation(projects.domain.wallets) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt index aae2257f8b..a88858e751 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/deeplink/DefaultTokenDetailsDeepLinkHandler.kt @@ -9,7 +9,7 @@ import com.tangem.common.routing.deeplink.DeeplinkConst.TRANSACTION_ID_KEY import com.tangem.common.routing.deeplink.DeeplinkConst.TYPE_KEY import com.tangem.common.routing.deeplink.DeeplinkConst.WALLET_ID_KEY import com.tangem.core.analytics.api.AnalyticsEventHandler -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.notifications.models.NotificationType diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt index 27844effa5..186939ab0a 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt @@ -34,8 +34,7 @@ import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase import com.tangem.domain.card.GetExtendedPublicKeyForCurrencyUseCase -import com.tangem.domain.card.NetworkHasDerivationUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.NetworkAddress @@ -72,6 +71,7 @@ import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.wallets.usecase.GetExploreUrlUseCase import com.tangem.domain.wallets.usecase.GetUserWalletUseCase +import com.tangem.domain.wallets.usecase.NetworkHasDerivationUseCase import com.tangem.feature.tokendetails.deeplink.TokenDetailsDeepLinkActionListener import com.tangem.feature.tokendetails.presentation.router.InnerTokenDetailsRouter import com.tangem.feature.tokendetails.presentation.tokendetails.analytics.TokenDetailsCurrencyStatusAnalyticsSender diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt index aea67681cf..ac4a41d6a3 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsSkeletonStateConverter.kt @@ -9,12 +9,12 @@ import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.networkIconResId import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.res.TangemTheme -import com.tangem.domain.card.NetworkHasDerivationUseCase import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.staking.GetStakingIntegrationIdUseCase import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.wallets.usecase.GetUserWalletUseCase +import com.tangem.domain.wallets.usecase.NetworkHasDerivationUseCase import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents import com.tangem.feature.tokendetails.presentation.tokendetails.state.* import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.TokenDetailsActionButton diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt index 2ccdf9fa2b..16726e8a98 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt @@ -13,8 +13,7 @@ import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.res.TangemTheme import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.card.NetworkHasDerivationUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network import com.tangem.domain.models.network.NetworkAddress @@ -32,6 +31,7 @@ import com.tangem.domain.txhistory.models.TxHistoryStateError import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.wallets.usecase.GetUserWalletUseCase +import com.tangem.domain.wallets.usecase.NetworkHasDerivationUseCase import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenBalanceSegmentedButtonConfig import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsAppBarMenuConfig diff --git a/features/txhistory/impl/build.gradle.kts b/features/txhistory/impl/build.gradle.kts index b0cc54f7ef..c3b3021014 100644 --- a/features/txhistory/impl/build.gradle.kts +++ b/features/txhistory/impl/build.gradle.kts @@ -27,6 +27,7 @@ dependencies { /* Project - Domain */ implementation(projects.domain.models) implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.txhistory) implementation(projects.domain.txhistory.models) implementation(projects.domain.wallets) diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt index a5865493ef..1cf9437129 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt @@ -7,7 +7,7 @@ import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.navigation.url.UrlOpener import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.tokens.GetSingleCryptoCurrencyStatusUseCase import com.tangem.domain.tokens.error.CurrencyStatusError import com.tangem.domain.tokens.model.CryptoCurrencyStatus diff --git a/features/wallet-settings/impl/build.gradle.kts b/features/wallet-settings/impl/build.gradle.kts index 0adf247700..f327a964d5 100644 --- a/features/wallet-settings/impl/build.gradle.kts +++ b/features/wallet-settings/impl/build.gradle.kts @@ -32,6 +32,7 @@ dependencies { /* Project - Domain */ implementation(projects.domain.legacy) + implementation(projects.domain.card) implementation(projects.domain.models) implementation(projects.domain.wallets) implementation(projects.domain.wallets.models) diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt index 66ddccbfa3..520d031d69 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt @@ -19,7 +19,7 @@ import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.message.DialogMessage import com.tangem.core.ui.message.EventMessageAction import com.tangem.core.ui.message.SnackbarMessage -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse diff --git a/features/wallet/impl/build.gradle.kts b/features/wallet/impl/build.gradle.kts index c2ec06c4c3..6899c4cad4 100644 --- a/features/wallet/impl/build.gradle.kts +++ b/features/wallet/impl/build.gradle.kts @@ -70,6 +70,7 @@ dependencies { implementation(projects.domain.balanceHiding) implementation(projects.domain.balanceHiding.models) implementation(projects.domain.card) + implementation(projects.domain.walletManager) implementation(projects.domain.demo) implementation(projects.domain.feedback) implementation(projects.domain.feedback.models) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt index ede1b6a618..2202b93333 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt @@ -10,7 +10,7 @@ import com.tangem.core.analytics.models.event.MainScreenAnalyticsEvent import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.nft.ObserveAndClearNFTCacheIfNeedUseCase import com.tangem.domain.settings.* import com.tangem.domain.tokens.FetchCurrencyStatusUseCase diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletsUpdateActionResolver.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletsUpdateActionResolver.kt index 1b1e5f6711..48ee23027a 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletsUpdateActionResolver.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletsUpdateActionResolver.kt @@ -2,7 +2,7 @@ package com.tangem.feature.wallet.child.wallet.model import arrow.core.getOrElse import com.tangem.core.decompose.di.ModelScoped -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.isLocked diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletClickIntents.kt index a60c907714..a7454d94db 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletClickIntents.kt @@ -3,7 +3,7 @@ package com.tangem.feature.wallet.child.wallet.model.intents import com.tangem.core.decompose.di.ModelScoped import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.extenstions.unwrap -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.exchange.RampStateManager import com.tangem.domain.onramp.FetchHotCryptoUseCase import com.tangem.domain.settings.NeverToShowWalletsScrollPreview diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/BackupValidator.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/BackupValidator.kt index d83e759503..3f31e4730b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/BackupValidator.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/BackupValidator.kt @@ -1,7 +1,7 @@ package com.tangem.feature.wallet.presentation.wallet.domain import com.tangem.common.card.EllipticCurve -import com.tangem.domain.common.configs.CardConfig +import com.tangem.domain.card.configs.CardConfig import com.tangem.domain.models.scan.CardDTO import javax.inject.Inject diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt index 34026a5f37..2e1f9c25f6 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt @@ -1,8 +1,8 @@ package com.tangem.feature.wallet.presentation.wallet.domain import com.tangem.core.decompose.di.ModelScoped -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.core.lce.Lce import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.models.StatusSource diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetSingleWalletWarningsFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetSingleWalletWarningsFactory.kt index 92d72c5743..ab95132fed 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetSingleWalletWarningsFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetSingleWalletWarningsFactory.kt @@ -2,8 +2,8 @@ package com.tangem.feature.wallet.presentation.wallet.domain import arrow.core.Either import com.tangem.core.decompose.di.ModelScoped -import com.tangem.domain.common.CardTypesResolver -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.CardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.models.StatusSource import com.tangem.domain.settings.IsReadyToShowRateAppUseCase diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/HasSingleWalletSignedHashesUseCase.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/HasSingleWalletSignedHashesUseCase.kt index adbdeee9fb..03862438ff 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/HasSingleWalletSignedHashesUseCase.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/HasSingleWalletSignedHashesUseCase.kt @@ -2,8 +2,8 @@ package com.tangem.feature.wallet.presentation.wallet.domain import com.tangem.core.decompose.di.ModelScoped import com.tangem.domain.card.repository.CardRepository -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.network.Network import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.domain.models.wallet.UserWallet diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletAdditionalInfoFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletAdditionalInfoFactory.kt index 498716403b..134e5086fd 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletAdditionalInfoFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletAdditionalInfoFactory.kt @@ -6,8 +6,8 @@ import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.extensions.wrappedList import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.format -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.wallet.UserWallet import com.tangem.feature.wallet.impl.R import com.tangem.feature.wallet.presentation.wallet.state.model.WalletAdditionalInfo diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletImageResolver.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletImageResolver.kt index a9c270c289..3c52f6108d 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletImageResolver.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/WalletImageResolver.kt @@ -1,9 +1,9 @@ package com.tangem.feature.wallet.presentation.wallet.domain import androidx.annotation.DrawableRes -import com.tangem.domain.common.util.cardTypesResolver -import com.tangem.domain.common.util.getCardsCount -import com.tangem.domain.demo.DemoConfig +import com.tangem.domain.card.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.getCardsCount +import com.tangem.domain.demo.models.DemoConfig import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.wallets.repository.WalletsRepository import com.tangem.feature.wallet.impl.R diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/WalletContentLoaderFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/WalletContentLoaderFactory.kt index 678a408aed..cf2fb14a9d 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/WalletContentLoaderFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/WalletContentLoaderFactory.kt @@ -1,7 +1,7 @@ package com.tangem.feature.wallet.presentation.wallet.loaders import com.tangem.core.decompose.di.ModelScoped -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.isMultiCurrency import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/InitializeWalletsTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/InitializeWalletsTransformer.kt index 1a3fd52a75..8cac86072f 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/InitializeWalletsTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/InitializeWalletsTransformer.kt @@ -1,6 +1,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.isLocked import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetCryptoCurrencyActionsTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetCryptoCurrencyActionsTransformer.kt index 39b66705f4..43f812b0dd 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetCryptoCurrencyActionsTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetCryptoCurrencyActionsTransformer.kt @@ -1,6 +1,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason import com.tangem.domain.tokens.model.TokenActionsState import com.tangem.domain.models.wallet.UserWallet diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTokenListErrorTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTokenListErrorTransformer.kt index 49cbde42ea..c6c5958170 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTokenListErrorTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTokenListErrorTransformer.kt @@ -3,7 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.tokens.error.TokenListError import com.tangem.domain.models.wallet.UserWallet import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountErrorTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountErrorTransformer.kt index 1d6aad9ca0..3b5dfff91c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountErrorTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetTxHistoryCountErrorTransformer.kt @@ -2,7 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers import com.tangem.blockchain.common.Blockchain import com.tangem.core.ui.components.transactions.state.TxHistoryState -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.network.TxInfo import com.tangem.domain.txhistory.models.TxHistoryStateError import com.tangem.domain.models.wallet.UserWallet diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetVisaInfoTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetVisaInfoTransformer.kt index db52a1a7b5..1201f8807a 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetVisaInfoTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/SetVisaInfoTransformer.kt @@ -8,7 +8,7 @@ import com.tangem.core.ui.extensions.stringReference import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.tokens.model.CryptoCurrencyStatus import com.tangem.domain.visa.exception.RefreshTokenExpiredException import com.tangem.domain.visa.model.VisaCurrency diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/UpdateWalletCardsCountTransformer.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/UpdateWalletCardsCountTransformer.kt index 1d3b50d602..5099b4e6b9 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/UpdateWalletCardsCountTransformer.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/UpdateWalletCardsCountTransformer.kt @@ -1,6 +1,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.requireColdWallet import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCardStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCardStateConverter.kt index 8d5e281a6e..be47b83287 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCardStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCardStateConverter.kt @@ -3,7 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers.convert import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.StatusSource import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.wallet.UserWallet diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt index 32bca822d8..98c83885fa 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/MultiWalletCurrencyActionsConverter.kt @@ -2,7 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers.convert import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason import com.tangem.domain.tokens.model.CryptoCurrencyStatus import com.tangem.domain.tokens.model.TokenActionsState diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/SingleWalletCardStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/SingleWalletCardStateConverter.kt index 65e60d46db..4df4316649 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/SingleWalletCardStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/SingleWalletCardStateConverter.kt @@ -3,7 +3,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers.convert import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.getCardsCount +import com.tangem.domain.card.common.util.getCardsCount import com.tangem.domain.models.StatusSource import com.tangem.domain.tokens.model.CryptoCurrencyStatus import com.tangem.domain.models.wallet.UserWallet diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TokenListStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TokenListStateConverter.kt index 6ce07e486a..9a3c8407b4 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TokenListStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/transformers/converter/TokenListStateConverter.kt @@ -5,7 +5,7 @@ import com.tangem.core.ui.components.tokenlist.state.TokensListItemUM import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.wrappedList import com.tangem.domain.appcurrency.model.AppCurrency -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.tokens.model.CryptoCurrencyStatus diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/UserWalletConverterExt.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/UserWalletConverterExt.kt index 2aa6aab8d4..0fd91d7df0 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/UserWalletConverterExt.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/UserWalletConverterExt.kt @@ -1,6 +1,6 @@ package com.tangem.feature.wallet.presentation.wallet.state.utils -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/WalletLoadingStateFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/WalletLoadingStateFactory.kt index b38fb4af6c..9307b4c066 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/WalletLoadingStateFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/utils/WalletLoadingStateFactory.kt @@ -4,7 +4,7 @@ import com.tangem.core.analytics.models.event.MainScreenAnalyticsEvent.Companion import com.tangem.core.ui.components.containers.pullToRefresh.PullToRefreshConfig import com.tangem.core.ui.components.marketprice.MarketPriceBlockState import com.tangem.core.ui.components.transactions.state.TxHistoryState -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.wallet.UserWallet import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/subscribers/TxHistorySubscriber.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/subscribers/TxHistorySubscriber.kt index 8c361a53f1..df61988921 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/subscribers/TxHistorySubscriber.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/subscribers/TxHistorySubscriber.kt @@ -4,7 +4,7 @@ import androidx.paging.PagingData import androidx.paging.cachedIn import androidx.paging.map import arrow.core.Either -import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.card.common.util.cardTypesResolver import com.tangem.domain.models.network.TxInfo import com.tangem.domain.tokens.GetSingleCryptoCurrencyStatusUseCase import com.tangem.domain.tokens.model.CryptoCurrencyStatus diff --git a/settings.gradle.kts b/settings.gradle.kts index a2fe4ee7b6..0550f19562 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -276,6 +276,7 @@ include(":domain:legacy") include(":domain:card") include(":domain:core") include(":domain:demo") +include(":domain:demo:models") include(":domain:settings") include(":domain:tokens") include(":domain:tokens:models") @@ -324,6 +325,8 @@ include(":domain:express") include(":domain:express:models") include(":domain:swap") include(":domain:swap:models") +include(":domain:wallet-manager") +include(":domain:wallet-manager:models") // endregion Domain modules // region Data modules @@ -355,4 +358,5 @@ include(":data:notifications") include(":data:blockaid") include(":data:swap") include(":data:express") +include(":data:wallet-manager") // endregion Data modules \ No newline at end of file