diff --git a/app/src/test/kotlin/com/tangem/tap/domain/card/CryptoCurrenciesMocks.kt b/app/src/test/kotlin/com/tangem/tap/domain/card/CryptoCurrenciesMocks.kt index 3ff9b7bf0e..07f96f215c 100644 --- a/app/src/test/kotlin/com/tangem/tap/domain/card/CryptoCurrenciesMocks.kt +++ b/app/src/test/kotlin/com/tangem/tap/domain/card/CryptoCurrenciesMocks.kt @@ -59,6 +59,7 @@ internal class CryptoCurrenciesMocks(private val scanResponse: ScanResponse) { standardType = getNetworkStandardType(blockchain), hasFiatFeeRate = blockchain.feePaidCurrency() !is FeePaidCurrency.FeeResource, canHandleTokens = false, + transactionExtras = Network.TransactionExtras.NONE, ) return factory.createCoin(network = network) @@ -86,6 +87,7 @@ internal class CryptoCurrenciesMocks(private val scanResponse: ScanResponse) { standardType = Network.StandardType.ERC20, hasFiatFeeRate = true, canHandleTokens = true, + transactionExtras = Network.TransactionExtras.NONE, ), name = "NEVER-MIND", symbol = "NEVER-MIND", diff --git a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/mock/MockNetworks.kt b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/mock/MockNetworks.kt index cd410b3487..9d5caf4cb8 100644 --- a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/mock/MockNetworks.kt +++ b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/mock/MockNetworks.kt @@ -23,6 +23,7 @@ internal object MockNetworks { derivationPath = Network.DerivationPath.None, hasFiatFeeRate = true, canHandleTokens = true, + transactionExtras = Network.TransactionExtras.NONE, ) val network2 = Network( @@ -35,6 +36,7 @@ internal object MockNetworks { derivationPath = Network.DerivationPath.None, hasFiatFeeRate = true, canHandleTokens = true, + transactionExtras = Network.TransactionExtras.NONE, ) val network3 = Network( @@ -47,6 +49,7 @@ internal object MockNetworks { derivationPath = Network.DerivationPath.None, hasFiatFeeRate = true, canHandleTokens = true, + transactionExtras = Network.TransactionExtras.NONE, ) val networkStatus1 = NetworkStatus( diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewCustomTokenSelectorComponent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewCustomTokenSelectorComponent.kt index 8f129079e2..9ef76cfa71 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewCustomTokenSelectorComponent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewCustomTokenSelectorComponent.kt @@ -62,6 +62,7 @@ internal class PreviewCustomTokenSelectorComponent( standardType = Network.StandardType.ERC20, hasFiatFeeRate = false, canHandleTokens = false, + transactionExtras = Network.TransactionExtras.NONE, ), name = "Network $index", type = "N$index", diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt index abecdf97cb..b6aab08f17 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewManageTokensComponent.kt @@ -161,6 +161,7 @@ internal class PreviewManageTokensComponent( standardType = Network.StandardType.ERC20, hasFiatFeeRate = false, canHandleTokens = false, + transactionExtras = Network.TransactionExtras.NONE, ), name = "NETWORK$networkIndex", type = "N$networkIndex", diff --git a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt index 3ef520d4ec..af0875c822 100644 --- a/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt +++ b/features/manage-tokens/impl/src/main/kotlin/com/tangem/features/managetokens/component/preview/PreviewOnboardingManageTokensComponent.kt @@ -101,6 +101,7 @@ internal class PreviewOnboardingManageTokensComponent( standardType = Network.StandardType.ERC20, hasFiatFeeRate = false, canHandleTokens = false, + transactionExtras = Network.TransactionExtras.NONE, ), name = "NETWORK$networkIndex", type = "N$networkIndex", diff --git a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt index dc0486d1cc..a89188c0cf 100644 --- a/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt +++ b/features/markets/impl/src/main/kotlin/com/tangem/features/markets/portfolio/impl/model/TokenActionsHandler.kt @@ -16,6 +16,7 @@ import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.onramp.model.OnrampSource import com.tangem.domain.redux.ReduxStateHolder import com.tangem.domain.tokens.legacy.TradeCryptoAction +import com.tangem.domain.tokens.model.Network import com.tangem.domain.tokens.model.TokenActionsState import com.tangem.domain.wallets.models.UserWallet import com.tangem.features.markets.impl.R @@ -109,6 +110,7 @@ internal class TokenActionsHandler @AssistedInject constructor( addresses = networkAddress.availableAddresses .mapToAddressModels(currency) .toImmutableList(), + showMemoDisclaimer = currency.network.transactionExtras != Network.TransactionExtras.NONE, onCopyClick = {}, onShareClick = {}, ), diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/recipient/SendRecipientMemoFieldConverter.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/recipient/SendRecipientMemoFieldConverter.kt index 5b59bbb297..e15ff6d8d0 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/recipient/SendRecipientMemoFieldConverter.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/recipient/SendRecipientMemoFieldConverter.kt @@ -4,9 +4,9 @@ import androidx.annotation.StringRes import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType -import com.tangem.blockchain.common.Blockchain import com.tangem.core.ui.extensions.resourceReference import com.tangem.domain.tokens.model.CryptoCurrencyStatus +import com.tangem.domain.tokens.model.Network import com.tangem.features.send.impl.R import com.tangem.features.send.impl.presentation.state.fields.SendTextField import com.tangem.features.send.impl.presentation.viewmodel.SendClickIntents @@ -22,29 +22,20 @@ internal class SendRecipientMemoFieldConverter( val cryptoCurrency = cryptoCurrencyStatus().currency val memo = memoValue ?: "" - return when (cryptoCurrency.network.id.value) { - Blockchain.XRP.id -> { - convert( - value = Data(memo = memo, label = R.string.send_destination_tag_field), - ) - } - Blockchain.Binance.id, - Blockchain.TON.id, - Blockchain.Cosmos.id, - Blockchain.TerraV1.id, - Blockchain.TerraV2.id, - Blockchain.Stellar.id, - Blockchain.Hedera.id, - Blockchain.Algorand.id, - Blockchain.Sei.id, - Blockchain.InternetComputer.id, - Blockchain.Casper.id, - -> { - convert( - value = Data(memo = memo, label = R.string.send_extras_hint_memo), - ) - } - else -> null + return when (cryptoCurrency.network.transactionExtras) { + Network.TransactionExtras.NONE -> null + Network.TransactionExtras.MEMO -> convert( + value = Data( + memo = memo, + label = R.string.send_extras_hint_memo, + ), + ) + Network.TransactionExtras.DESTINATION_TAG -> convert( + value = Data( + memo = memo, + label = R.string.send_destination_tag_field, + ), + ) } } 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 64b4e3f0b7..613506fa94 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 @@ -248,6 +248,7 @@ internal class TokenDetailsStateFactory( symbol = currency.symbol, network = currency.network.name, addresses = networkAddress.availableAddresses.mapToAddressModels(currency).toImmutableList(), + showMemoDisclaimer = currency.network.transactionExtras != Network.TransactionExtras.NONE, onCopyClick = sendCopyAnalyticsEvent, onShareClick = sendShareAnalyticsEvent, ), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/VisaWalletIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/VisaWalletIntents.kt index b857c555b4..11026c9579 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/VisaWalletIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/VisaWalletIntents.kt @@ -6,6 +6,7 @@ import com.tangem.core.ui.components.bottomsheets.tokenreceive.TokenReceiveBotto import com.tangem.core.ui.components.bottomsheets.tokenreceive.mapToAddressModels import com.tangem.domain.tokens.GetCryptoCurrencyStatusSyncUseCase import com.tangem.domain.tokens.model.CryptoCurrencyStatus +import com.tangem.domain.tokens.model.Network import com.tangem.domain.visa.GetVisaCurrencyUseCase import com.tangem.domain.visa.GetVisaTxDetailsUseCase import com.tangem.domain.wallets.models.UserWalletId @@ -71,6 +72,7 @@ internal class VisaWalletIntentsImplementor @Inject constructor( symbol = currency.symbol, network = currency.network.name, addresses = addresses.mapToAddressModels(currency).toImmutableList(), + showMemoDisclaimer = currency.network.transactionExtras != Network.TransactionExtras.NONE, onCopyClick = { /* no-op */ }, onShareClick = { /* no-op */ }, ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt index 94496713c9..bf1227fb07 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/intents/WalletCurrencyActionsClickIntents.kt @@ -34,10 +34,7 @@ import com.tangem.domain.settings.usercountry.models.UserCountry import com.tangem.domain.staking.model.stakekit.Yield import com.tangem.domain.tokens.* import com.tangem.domain.tokens.legacy.TradeCryptoAction -import com.tangem.domain.tokens.model.CryptoCurrency -import com.tangem.domain.tokens.model.CryptoCurrencyStatus -import com.tangem.domain.tokens.model.NetworkAddress -import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason +import com.tangem.domain.tokens.model.* import com.tangem.domain.tokens.model.analytics.TokenReceiveAnalyticsEvent import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent import com.tangem.domain.walletmanager.WalletManagersFacade @@ -239,6 +236,7 @@ internal class WalletCurrencyActionsClickIntentsImplementor @Inject constructor( symbol = currency.symbol, network = currency.network.name, addresses = addresses.mapToAddressModels(currency).toImmutableList(), + showMemoDisclaimer = currency.network.transactionExtras != Network.TransactionExtras.NONE, onCopyClick = { analyticsEventHandler.send(TokenReceiveAnalyticsEvent.ButtonCopyAddress(currency.symbol)) },