From 3e4e7d8da00ba431d299490d90e77060e970217e Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Jul 2025 14:06:24 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../ethereum/WcEthAddNetworkUseCase.kt | 7 +++- .../network/ethereum/WcEthNetwork.kt | 1 + .../network/solana/WcSolanaNetwork.kt | 1 + .../walletconnect/sign/BaseWcSignUseCase.kt | 8 +++- .../WcSignUseCaseDelegateTest.kt | 1 + .../usecase/method/WcMethodBase.kt | 9 +++- .../converter/WcAddressConverter.kt | 24 +++++++++++ .../converter/WcSendTransactionUMConverter.kt | 7 +--- .../converter/WcSignTransactionUMConverter.kt | 1 + .../converter/WcSignTypedDataUMConverter.kt | 10 +---- .../transaction/entity/common/WcAddressUM.kt | 3 ++ .../entity/send/WcSendTransactionUM.kt | 3 +- .../entity/sign/WcSignTransactionUM.kt | 3 +- .../transaction/ui/common/WcAddressItem.kt | 20 ++++++--- .../ui/common/WcSendTransactionItems.kt | 7 ++-- .../send/WcSendTransactionModalBottomSheet.kt | 41 ++++++++++++++++++- ...cSignTransactionModalBottomSheetContent.kt | 8 ++-- 17 files changed, 120 insertions(+), 34 deletions(-) create mode 100644 features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcAddressConverter.kt create mode 100644 features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/common/WcAddressUM.kt diff --git a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthAddNetworkUseCase.kt b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthAddNetworkUseCase.kt index ed0e0bd7d9..0bc201fd7a 100644 --- a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthAddNetworkUseCase.kt +++ b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthAddNetworkUseCase.kt @@ -9,6 +9,7 @@ import com.tangem.domain.walletconnect.model.WcRequestError import com.tangem.domain.walletconnect.model.WcSession import com.tangem.domain.walletconnect.model.sdkcopy.WcSdkSessionRequest import com.tangem.domain.walletconnect.usecase.method.WcAddNetworkUseCase +import com.tangem.domain.walletconnect.usecase.method.WcNetworkDerivationState import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject @@ -25,8 +26,10 @@ internal class WcEthAddNetworkUseCase @AssistedInject constructor( get() = context.rawSdkRequest override val network: Network get() = context.network - override val walletAddress: String - get() = context.accountAddress + override val derivationState: WcNetworkDerivationState = when { + context.networkDerivationsCount > 1 -> WcNetworkDerivationState.Multiple(walletAddress = context.accountAddress) + else -> WcNetworkDerivationState.Single + } override suspend fun approve(): Either { return respondService.respond(rawSdkRequest, "") diff --git a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthNetwork.kt b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthNetwork.kt index 39863e9d02..7b7823fd7f 100644 --- a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthNetwork.kt +++ b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/ethereum/WcEthNetwork.kt @@ -75,6 +75,7 @@ internal class WcEthNetwork( rawSdkRequest = request, network = walletNetwork, accountAddress = accountAddress, + networkDerivationsCount = networksConverter.filterWalletNetworkForRequest(chainId, wallet).size, ) return when (method) { is WcEthMethod.MessageSign -> factories.messageSign.create(context, method) diff --git a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/solana/WcSolanaNetwork.kt b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/solana/WcSolanaNetwork.kt index df7e9839f8..8fa3aa5469 100644 --- a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/solana/WcSolanaNetwork.kt +++ b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/network/solana/WcSolanaNetwork.kt @@ -72,6 +72,7 @@ internal class WcSolanaNetwork( rawSdkRequest = request, network = walletNetwork, accountAddress = accountAddress, + networkDerivationsCount = networksConverter.filterWalletNetworkForRequest(chainId, wallet).size, ) return when (method) { is WcSolanaMethod.SignMessage -> factories.messageSign.create(context, method) diff --git a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/sign/BaseWcSignUseCase.kt b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/sign/BaseWcSignUseCase.kt index a2dfa97c70..e00d81bd61 100644 --- a/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/sign/BaseWcSignUseCase.kt +++ b/data/wallet-connect/src/main/kotlin/com/tangem/data/walletconnect/sign/BaseWcSignUseCase.kt @@ -7,6 +7,7 @@ import com.tangem.domain.walletconnect.WcAnalyticEvents import com.tangem.domain.walletconnect.model.WcSession import com.tangem.domain.walletconnect.model.sdkcopy.WcSdkSessionRequest import com.tangem.domain.walletconnect.usecase.method.WcMethodUseCase +import com.tangem.domain.walletconnect.usecase.method.WcNetworkDerivationState import com.tangem.domain.walletconnect.usecase.method.WcSignState import com.tangem.domain.walletconnect.usecase.method.WcSignUseCase import kotlinx.coroutines.flow.FlowCollector @@ -23,8 +24,12 @@ internal abstract class BaseWcSignUseCase : abstract val context: WcMethodUseCaseContext override val network: Network get() = context.network override val session: WcSession get() = context.session - override val walletAddress: String get() = context.accountAddress override val rawSdkRequest: WcSdkSessionRequest get() = context.rawSdkRequest + override val derivationState: WcNetworkDerivationState + get() = when { + context.networkDerivationsCount > 1 -> WcNetworkDerivationState.Multiple(context.accountAddress) + else -> WcNetworkDerivationState.Single + } protected val delegate by lazy { WcSignUseCaseDelegate( @@ -73,6 +78,7 @@ internal class WcMethodUseCaseContext( val rawSdkRequest: WcSdkSessionRequest, val network: Network, val accountAddress: String, + val networkDerivationsCount: Int, ) internal typealias SignCollector = FlowCollector> \ No newline at end of file diff --git a/data/wallet-connect/src/test/kotlin/com/tangem/domain/walletconnect/WcSignUseCaseDelegateTest.kt b/data/wallet-connect/src/test/kotlin/com/tangem/domain/walletconnect/WcSignUseCaseDelegateTest.kt index 6c2d0161d5..5566aeb4ad 100644 --- a/data/wallet-connect/src/test/kotlin/com/tangem/domain/walletconnect/WcSignUseCaseDelegateTest.kt +++ b/data/wallet-connect/src/test/kotlin/com/tangem/domain/walletconnect/WcSignUseCaseDelegateTest.kt @@ -47,6 +47,7 @@ internal class WcSignUseCaseDelegateTest { network = MockCryptoCurrencyFactory().ethereum.network, accountAddress = "", rawSdkRequest = rawRequestMock, + networkDerivationsCount = 1, session = WcSession( wallet = MockUserWalletFactory.create(), networks = setOf(), diff --git a/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/usecase/method/WcMethodBase.kt b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/usecase/method/WcMethodBase.kt index 27bf7cc6d3..4dc22ce6aa 100644 --- a/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/usecase/method/WcMethodBase.kt +++ b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/usecase/method/WcMethodBase.kt @@ -2,11 +2,11 @@ package com.tangem.domain.walletconnect.usecase.method import arrow.core.Either import com.tangem.domain.models.network.Network +import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.walletconnect.model.WcMethod import com.tangem.domain.walletconnect.model.WcRequestError import com.tangem.domain.walletconnect.model.WcSession import com.tangem.domain.walletconnect.model.sdkcopy.WcSdkSessionRequest -import com.tangem.domain.models.wallet.UserWallet import kotlinx.coroutines.flow.Flow interface WcMethodUseCase @@ -16,10 +16,15 @@ interface WcMethodContext { val rawSdkRequest: WcSdkSessionRequest val network: Network val method: WcMethod - val walletAddress: String + val derivationState: WcNetworkDerivationState val wallet: UserWallet get() = session.wallet } +sealed class WcNetworkDerivationState { + data object Single : WcNetworkDerivationState() + data class Multiple(val walletAddress: String) : WcNetworkDerivationState() +} + /** * Wc Methods that must be signed by Tangem card * [WcSignState] represents signing state diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcAddressConverter.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcAddressConverter.kt new file mode 100644 index 0000000000..cbcc897ce4 --- /dev/null +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcAddressConverter.kt @@ -0,0 +1,24 @@ +package com.tangem.features.walletconnect.transaction.converter + +import com.tangem.domain.walletconnect.usecase.method.WcNetworkDerivationState +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM +import com.tangem.utils.converter.Converter + +private const val ADDRESS_FIRST_PART_LENGTH = 7 +private const val ADDRESS_SECOND_PART_LENGTH = 4 + +internal object WcAddressConverter : Converter { + + override fun convert(value: WcNetworkDerivationState): WcAddressUM? { + return when (value) { + is WcNetworkDerivationState.Single -> null + is WcNetworkDerivationState.Multiple -> WcAddressUM( + fullAddress = value.walletAddress, + shortAddress = value.walletAddress.toShortAddressText(), + ) + } + } + + private fun String.toShortAddressText() = + "${take(ADDRESS_FIRST_PART_LENGTH)}...${takeLast(ADDRESS_SECOND_PART_LENGTH)}" +} \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt index 32e5bda99d..78ba6cc321 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt @@ -3,10 +3,7 @@ package com.tangem.features.walletconnect.transaction.converter import com.tangem.core.ui.extensions.resourceReference import com.tangem.domain.walletconnect.model.WcEthMethod import com.tangem.domain.walletconnect.model.WcSolanaMethod -import com.tangem.domain.walletconnect.usecase.method.WcMutableFee -import com.tangem.domain.walletconnect.usecase.method.WcSignState -import com.tangem.domain.walletconnect.usecase.method.WcSignStep -import com.tangem.domain.walletconnect.usecase.method.WcTransactionUseCase +import com.tangem.domain.walletconnect.usecase.method.* import com.tangem.features.send.v2.api.entity.FeeSelectorUM import com.tangem.features.walletconnect.impl.R import com.tangem.features.walletconnect.transaction.entity.blockaid.WcSendReceiveTransactionCheckResultsUM @@ -41,9 +38,9 @@ internal class WcSendTransactionUMConverter @Inject constructor( feeState = constructFeeState(useCase = value.useCase, actions = value.actions), walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo }, networkInfo = networkInfoUMConverter.convert(value.useCase.network), - address = value.useCase.walletAddress.toShortAddressText(), estimatedWalletChanges = WcSendReceiveTransactionCheckResultsUM(), isLoading = value.signState.domainStep == WcSignStep.Signing, + address = WcAddressConverter.convert(value.useCase.derivationState), ), feeSelectorUM = value.feeSelectorUM ?: FeeSelectorUM.Loading, transactionRequestInfo = WcTransactionRequestInfoUM( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTransactionUMConverter.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTransactionUMConverter.kt index 5fe64fa8b7..333cb72fbc 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTransactionUMConverter.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTransactionUMConverter.kt @@ -30,6 +30,7 @@ internal class WcSignTransactionUMConverter @Inject constructor( walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo }, networkInfo = networkInfoUMConverter.convert(value.useCase.network), isLoading = value.signState.domainStep == WcSignStep.Signing, + address = WcAddressConverter.convert(value.useCase.derivationState), ), transactionRequestInfo = WcTransactionRequestInfoUM( persistentListOf( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTypedDataUMConverter.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTypedDataUMConverter.kt index 063c225cd7..6b70e21d47 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTypedDataUMConverter.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSignTypedDataUMConverter.kt @@ -17,9 +17,6 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList import javax.inject.Inject -private const val ADDRESS_FIRST_PART_LENGTH = 7 -private const val ADDRESS_SECOND_PART_LENGTH = 4 - internal class WcSignTypedDataUMConverter @Inject constructor( private val appInfoContentUMConverter: WcTransactionAppInfoContentUMConverter, private val networkInfoUMConverter: WcNetworkInfoUMConverter, @@ -38,7 +35,7 @@ internal class WcSignTypedDataUMConverter @Inject constructor( ), walletName = value.useCase.session.wallet.name.takeIf { value.useCase.session.showWalletInfo }, networkInfo = networkInfoUMConverter.convert(value.useCase.network), - addressText = value.useCase.walletAddress.toShortAddressText(), + address = WcAddressConverter.convert(value.useCase.derivationState), isLoading = value.signState.domainStep == WcSignStep.Signing, ), transactionRequestInfo = WcTransactionRequestInfoUM( @@ -78,7 +75,4 @@ internal class WcSignTypedDataUMConverter @Inject constructor( val signModel: WcMessageSignUseCase.SignModel, val actions: WcTransactionActionsUM, ) -} - -internal fun String.toShortAddressText() = - "${take(ADDRESS_FIRST_PART_LENGTH)}...${takeLast(ADDRESS_SECOND_PART_LENGTH)}" \ No newline at end of file +} \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/common/WcAddressUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/common/WcAddressUM.kt new file mode 100644 index 0000000000..a43b29458a --- /dev/null +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/common/WcAddressUM.kt @@ -0,0 +1,3 @@ +package com.tangem.features.walletconnect.transaction.entity.common + +data class WcAddressUM(val fullAddress: String, val shortAddress: String) \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt index c08234e85b..b1461cbfd5 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt @@ -4,6 +4,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent import com.tangem.features.send.v2.api.entity.FeeSelectorUM import com.tangem.features.walletconnect.transaction.entity.approve.WcSpendAllowanceUM import com.tangem.features.walletconnect.transaction.entity.blockaid.WcSendReceiveTransactionCheckResultsUM +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM import com.tangem.features.walletconnect.transaction.entity.common.WcCommonTransactionUM import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM @@ -25,6 +26,6 @@ internal data class WcSendTransactionItemUM( val estimatedWalletChanges: WcSendReceiveTransactionCheckResultsUM?, val walletName: String?, val networkInfo: WcNetworkInfoUM, - val address: String? = null, + val address: WcAddressUM?, val isLoading: Boolean = false, ) : TangemBottomSheetConfigContent \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/sign/WcSignTransactionUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/sign/WcSignTransactionUM.kt index 34f67b3039..fd69bf9cb7 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/sign/WcSignTransactionUM.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/sign/WcSignTransactionUM.kt @@ -1,6 +1,7 @@ package com.tangem.features.walletconnect.transaction.entity.sign import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM import com.tangem.features.walletconnect.transaction.entity.common.WcCommonTransactionUM import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM @@ -17,6 +18,6 @@ internal data class WcSignTransactionItemUM( val appInfo: WcTransactionAppInfoContentUM, val walletName: String?, val networkInfo: WcNetworkInfoUM, - val addressText: String? = null, + val address: WcAddressUM?, val isLoading: Boolean = false, ) : TangemBottomSheetConfigContent \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcAddressItem.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcAddressItem.kt index 8e9febc9b2..f14eb7984b 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcAddressItem.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcAddressItem.kt @@ -10,12 +10,14 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextAlign +import com.tangem.core.ui.components.tooltip.TangemTooltip import com.tangem.core.ui.extensions.stringResourceSafe import com.tangem.core.ui.res.TangemTheme import com.tangem.features.walletconnect.impl.R +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM @Composable -internal fun WcAddressItem(addressText: String, modifier: Modifier = Modifier) { +internal fun WcAddressItem(address: WcAddressUM, modifier: Modifier = Modifier) { Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) { Icon( modifier = Modifier.size(TangemTheme.dimens.size24), @@ -31,14 +33,20 @@ internal fun WcAddressItem(addressText: String, modifier: Modifier = Modifier) { style = TangemTheme.typography.body1, color = TangemTheme.colors.text.primary1, ) - Text( + TangemTooltip( modifier = Modifier .padding(start = TangemTheme.dimens.spacing16) .weight(1f), - text = addressText, - textAlign = TextAlign.End, - style = TangemTheme.typography.body1, - color = TangemTheme.colors.text.tertiary, + text = address.fullAddress, + content = { contentModifier -> + Text( + modifier = contentModifier, + text = address.shortAddress, + textAlign = TextAlign.End, + style = TangemTheme.typography.body1, + color = TangemTheme.colors.text.tertiary, + ) + }, ) } } \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcSendTransactionItems.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcSendTransactionItems.kt index 053c6a030c..6b703bf94d 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcSendTransactionItems.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcSendTransactionItems.kt @@ -15,6 +15,7 @@ import com.tangem.core.ui.components.divider.DividerWithPadding import com.tangem.core.ui.extensions.clickableSingle import com.tangem.core.ui.res.TangemTheme import com.tangem.features.send.v2.api.FeeSelectorBlockComponent +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionFeeState @@ -24,8 +25,8 @@ internal fun WcSendTransactionItems( networkInfo: WcNetworkInfoUM, feeState: WcTransactionFeeState, feeSelectorBlockComponent: FeeSelectorBlockComponent?, + address: WcAddressUM?, modifier: Modifier = Modifier, - address: String? = null, ) { val onFeeBlockClicked = remember(feeState) { when (feeState) { @@ -55,11 +56,11 @@ internal fun WcSendTransactionItems( modifier = itemsModifier, networkInfo = networkInfo, ) - if (!address.isNullOrEmpty()) { + if (address != null) { DividerWithPadding(start = 40.dp, end = 12.dp) WcAddressItem( modifier = itemsModifier, - addressText = address, + address = address, ) } if (feeState != WcTransactionFeeState.None) { diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt index 558dfe4f1b..08a5ea45b0 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt @@ -32,6 +32,7 @@ import com.tangem.features.walletconnect.transaction.components.PreviewFeeSelect import com.tangem.features.walletconnect.transaction.entity.blockaid.WcEstimatedWalletChangeUM import com.tangem.features.walletconnect.transaction.entity.blockaid.WcEstimatedWalletChangesUM import com.tangem.features.walletconnect.transaction.entity.blockaid.WcSendReceiveTransactionCheckResultsUM +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionFeeState @@ -191,11 +192,47 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide ), ), ), + isLoading = false, ), walletName = "Tangem 2.0", networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22), feeState = WcTransactionFeeState.Success(null, {}), - address = "0x345FF...34FA", + address = null, + ), + WcSendTransactionItemUM( + onDismiss = {}, + onSend = {}, + appInfo = WcTransactionAppInfoContentUM( + appName = "React App", + appIcon = "", + verifiedState = VerifiedDAppState.Verified {}, + appSubtitle = "react-app.walletconnect.com", + ), + estimatedWalletChanges = WcSendReceiveTransactionCheckResultsUM( + notificationText = TextReference.Str( + "The transaction approves erc20 tokens to a known malicious address", + ), + estimatedWalletChanges = WcEstimatedWalletChangesUM( + items = persistentListOf( + WcEstimatedWalletChangeUM( + iconRes = R.drawable.ic_send_new_24, + title = resourceReference(R.string.common_send), + description = "- 42 USDT", + tokenIconUrl = "https://tangem.com", + ), + WcEstimatedWalletChangeUM( + iconRes = R.drawable.ic_receive_new_24, + title = resourceReference(R.string.common_receive), + description = "+ 1,131.46 MATIC", + tokenIconUrl = "https://tangem.com", + ), + ), + ), + ), + walletName = "Tangem 2.0", + networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22), + feeState = WcTransactionFeeState.Success(null, {}), + address = WcAddressUM("0xdac17f958d2ee523a2206206994597c13d831ec7", "0x345FF...34FA"), ), WcSendTransactionItemUM( onDismiss = {}, @@ -230,7 +267,7 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide walletName = null, networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22), feeState = WcTransactionFeeState.None, - address = "0x345FF...34FA", + address = null, ), ), ) \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/sign/WcSignTransactionModalBottomSheetContent.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/sign/WcSignTransactionModalBottomSheetContent.kt index 2942fcb975..b6aba3ab28 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/sign/WcSignTransactionModalBottomSheetContent.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/sign/WcSignTransactionModalBottomSheetContent.kt @@ -28,6 +28,7 @@ import com.tangem.core.ui.res.TangemThemePreview import com.tangem.features.walletconnect.connections.entity.VerifiedDAppState import com.tangem.features.walletconnect.connections.ui.WcAppInfoItem import com.tangem.features.walletconnect.impl.R +import com.tangem.features.walletconnect.transaction.entity.common.WcAddressUM import com.tangem.features.walletconnect.transaction.entity.common.WcNetworkInfoUM import com.tangem.features.walletconnect.transaction.entity.common.WcTransactionAppInfoContentUM import com.tangem.features.walletconnect.transaction.entity.sign.WcSignTransactionItemUM @@ -124,11 +125,11 @@ private fun WcSignTransactionItems(state: WcSignTransactionItemUM, modifier: Mod modifier = itemsModifier, networkInfo = state.networkInfo, ) - if (!state.addressText.isNullOrEmpty()) { + if (state.address != null) { DividerWithPadding(start = 40.dp, end = 12.dp) WcAddressItem( modifier = itemsModifier, - addressText = state.addressText, + address = state.address, ) } } @@ -182,6 +183,7 @@ private class WcSignTransactionStateProvider : CollectionPreviewParameterProvide ), walletName = "Tangem 2.0", networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22), + address = null, ), WcSignTransactionItemUM( onDismiss = {}, @@ -193,8 +195,8 @@ private class WcSignTransactionStateProvider : CollectionPreviewParameterProvide appSubtitle = "react-app.walletconnect.com", ), walletName = null, - addressText = "0x345FF...34FA", networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22), + address = WcAddressUM("0xdac17f958d2ee523a2206206994597c13d831ec7", "0x345FF...34FA"), ), ), ) \ No newline at end of file