Updated on 2026-08-14
This commit is contained in:
parent
4ce635eeaa
commit
e2d014420a
10 changed files with 55 additions and 18 deletions
|
|
@ -78,7 +78,7 @@ internal fun RowText(
|
|||
)
|
||||
|
||||
Text(
|
||||
modifier = Modifier.weight(weight = 4f, fill = false),
|
||||
modifier = Modifier.weight(weight = 5f, fill = false),
|
||||
text = secondText,
|
||||
style = TangemTheme.typography.body2,
|
||||
color = if (isEnabled) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.data.common.currency
|
|||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchainsdk.compatibility.l2BlockchainsList
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.blockchainsdk.utils.toCoinId
|
||||
import com.tangem.datasource.api.tangemTech.models.UserTokensResponse
|
||||
|
|
@ -91,22 +92,10 @@ class ResponseCryptoCurrenciesFactory {
|
|||
// get name and symbol from enum Blockchain until backend renamed
|
||||
// [REDACTED_JIRA]
|
||||
Blockchain.Dischain,
|
||||
Blockchain.Arbitrum,
|
||||
Blockchain.ArbitrumTestnet,
|
||||
Blockchain.Aurora,
|
||||
Blockchain.AuroraTestnet,
|
||||
Blockchain.Manta,
|
||||
Blockchain.MantaTestnet,
|
||||
Blockchain.ZkSyncEra,
|
||||
Blockchain.ZkSyncEraTestnet,
|
||||
Blockchain.PolygonZkEVM,
|
||||
Blockchain.PolygonZkEVMTestnet,
|
||||
Blockchain.Base,
|
||||
Blockchain.BaseTestnet,
|
||||
Blockchain.Telos,
|
||||
Blockchain.Cronos,
|
||||
Blockchain.TON,
|
||||
Blockchain.Cyber,
|
||||
in l2BlockchainsList,
|
||||
-> this.fullName
|
||||
else -> responseToken.name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.data.managetokens.utils
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.compatibility.applyL2Compatibility
|
||||
import com.tangem.blockchainsdk.compatibility.getL2CompatibilityTokenComparison
|
||||
import com.tangem.blockchainsdk.compatibility.l2BlockchainsList
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.blockchainsdk.utils.isSupportedInApp
|
||||
import com.tangem.blockchainsdk.utils.toCoinId
|
||||
|
|
@ -121,6 +122,7 @@ internal class ManagedCryptoCurrencyFactory {
|
|||
SourceNetwork.Main(
|
||||
network = network,
|
||||
decimals = blockchain.decimals(),
|
||||
isL2Network = l2BlockchainsList.contains(blockchain),
|
||||
)
|
||||
} else {
|
||||
SourceNetwork.Default(
|
||||
|
|
|
|||
|
|
@ -57,6 +57,14 @@ internal class SdkTransactionHistoryItemConverter(
|
|||
is SdkTransactionHistoryItem.TransactionType.ContractMethod,
|
||||
is SdkTransactionHistoryItem.TransactionType.ContractMethodName,
|
||||
-> mapToInteractionAddressType(destinationType)
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.FreezeBalanceV2Contract ->
|
||||
mapToInteractionAddressType(destinationType) // todo map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.UnfreezeBalanceV2Contract ->
|
||||
mapToInteractionAddressType(destinationType) // todo map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.VoteWitnessContract ->
|
||||
mapToInteractionAddressType(destinationType) // todo map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.WithdrawBalanceContract ->
|
||||
mapToInteractionAddressType(destinationType) // todo map correct [REDACTED_JIRA]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,15 @@ internal class SdkTransactionTypeConverter(
|
|||
getTransactionType(methodName = smartContractMethods[value.id]?.name)
|
||||
is TransactionHistoryItem.TransactionType.ContractMethodName -> getTransactionType(methodName = value.name)
|
||||
is TransactionHistoryItem.TransactionType.Transfer -> TxHistoryItem.TransactionType.Transfer
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.FreezeBalanceV2Contract ->
|
||||
TxHistoryItem.TransactionType.Transfer // TODO map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.UnfreezeBalanceV2Contract ->
|
||||
TxHistoryItem.TransactionType.Transfer // TODO map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.VoteWitnessContract ->
|
||||
TxHistoryItem
|
||||
.TransactionType.Transfer // TODO map correct [REDACTED_JIRA]
|
||||
TransactionHistoryItem.TransactionType.TronStakingTransactionType.WithdrawBalanceContract ->
|
||||
TxHistoryItem.TransactionType.Transfer // TODO map correct [REDACTED_JIRA]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,11 @@ sealed class ManagedCryptoCurrency {
|
|||
|
||||
val typeName: String
|
||||
get() = when (this) {
|
||||
is Main -> MAIN_NETWORK_TYPE_NAME
|
||||
is Main -> if (isL2Network) {
|
||||
MAIN_NETWORK_L2_TYPE_NAME
|
||||
} else {
|
||||
MAIN_NETWORK_TYPE_NAME
|
||||
}
|
||||
is Default -> when (network.standardType) {
|
||||
is Network.StandardType.BEP2,
|
||||
is Network.StandardType.BEP20,
|
||||
|
|
@ -76,6 +80,7 @@ sealed class ManagedCryptoCurrency {
|
|||
data class Main(
|
||||
override val network: Network,
|
||||
override val decimals: Int,
|
||||
val isL2Network: Boolean,
|
||||
) : SourceNetwork()
|
||||
|
||||
data class Default(
|
||||
|
|
@ -86,6 +91,7 @@ sealed class ManagedCryptoCurrency {
|
|||
|
||||
private companion object {
|
||||
const val MAIN_NETWORK_TYPE_NAME = "MAIN"
|
||||
const val MAIN_NETWORK_L2_TYPE_NAME = "MAIN L2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ internal class BlockchainRowUMConverter(
|
|||
return BlockchainRowUM(
|
||||
id = network.networkId,
|
||||
name = blockchainInfo.name,
|
||||
type = if (isMainNetwork) "MAIN" else blockchainInfo.protocolName,
|
||||
type = getNetworkType(network, blockchainInfo),
|
||||
iconResId = if (isEnabled) {
|
||||
if (isSelected) {
|
||||
getActiveIconRes(blockchainInfo.blockchainId)
|
||||
|
|
@ -46,4 +46,21 @@ internal class BlockchainRowUMConverter(
|
|||
isEnabled = isEnabled,
|
||||
)
|
||||
}
|
||||
|
||||
private fun getNetworkType(
|
||||
network: TokenMarketInfo.Network,
|
||||
blockchainInfo: BlockchainUtils.BlockchainInfo,
|
||||
): String {
|
||||
val isMainNetwork = network.contractAddress == null
|
||||
return when {
|
||||
BlockchainUtils.isL2Network(networkId = network.networkId) -> MAIN_NETWORK_L2_TYPE_NAME
|
||||
isMainNetwork -> MAIN_NETWORK_TYPE_NAME
|
||||
else -> blockchainInfo.protocolName
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val MAIN_NETWORK_TYPE_NAME = "MAIN"
|
||||
const val MAIN_NETWORK_L2_TYPE_NAME = "MAIN L2"
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ markdownComposeView = "0.5.4"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-765"
|
||||
tangemBlockchainSdk = "develop-769"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-381"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.tangem.datasource.api.markets.models.response.TokenMarketInfoResponse
|
|||
import com.tangem.datasource.api.tangemTech.models.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.models.UserTokensResponse
|
||||
|
||||
internal val l2BlockchainsList = listOf(
|
||||
val l2BlockchainsList = listOf(
|
||||
Blockchain.Optimism,
|
||||
Blockchain.Arbitrum,
|
||||
Blockchain.ZkSyncEra,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.lib.crypto
|
|||
|
||||
import com.tangem.blockchain.blockchains.xrp.XrpAddressService
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.compatibility.l2BlockchainsList
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.blockchainsdk.utils.isSupportedInApp
|
||||
import com.tangem.lib.crypto.converter.XrpTaggedAddressConverter
|
||||
|
|
@ -98,6 +99,11 @@ object BlockchainUtils {
|
|||
)
|
||||
}
|
||||
|
||||
fun isL2Network(networkId: String): Boolean {
|
||||
val blockchain = Blockchain.fromNetworkId(networkId) ?: return false
|
||||
return l2BlockchainsList.contains(blockchain)
|
||||
}
|
||||
|
||||
private fun getNetworkStandardName(blockchain: Blockchain): String {
|
||||
return when (blockchain) {
|
||||
Blockchain.Ethereum, Blockchain.EthereumTestnet -> "ERC20"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue