Updated on 2026-08-14
This commit is contained in:
commit
1e736a9cbc
10 changed files with 21 additions and 20 deletions
|
|
@ -3,15 +3,16 @@ package com.tangem.tap.common.extensions
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.common.extensions.remove
|
||||
|
||||
fun Blockchain.getNetworkName(): String {
|
||||
fun Blockchain.getNetworkStandardName(): String {
|
||||
return when (this) {
|
||||
Blockchain.Ethereum, Blockchain.EthereumTestnet -> "ERC20"
|
||||
Blockchain.BSC, Blockchain.BSCTestnet -> "BEP20"
|
||||
Blockchain.Binance, Blockchain.BinanceTestnet -> "BEP2"
|
||||
Blockchain.Tron, Blockchain.TronTestnet -> "TRC20"
|
||||
Blockchain.TON -> "TON"
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
val Blockchain.fullNameWithoutTestnet
|
||||
get() = this.fullName.remove(" Testnet")
|
||||
val Blockchain.networkNameWithoutTestnet
|
||||
get() = this.getNetworkName().remove(" Testnet")
|
||||
|
|
@ -25,7 +25,7 @@ internal class DefaultCustomTokenRouter : CustomTokenRouter {
|
|||
val alert = AppDialog.SimpleOkDialogRes(
|
||||
headerId = R.string.common_warning,
|
||||
messageId = R.string.alert_manage_tokens_unsupported_curve_message,
|
||||
args = listOf(blockchain.fullName),
|
||||
args = listOf(blockchain.getNetworkName()),
|
||||
)
|
||||
store.dispatchDialogShow(alert)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ internal class AddCustomTokenViewModel @Inject constructor(
|
|||
)
|
||||
DerivationPathSelectorType.BLOCKCHAIN -> SelectorItem.TitleWithSubtitle(
|
||||
title = TextReference.Str(derivationPath),
|
||||
subtitle = TextReference.Str(blockchain.fullName),
|
||||
subtitle = TextReference.Str(blockchain.getNetworkName()),
|
||||
blockchain = blockchain,
|
||||
)
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ internal class AddCustomTokenViewModel @Inject constructor(
|
|||
)
|
||||
} else {
|
||||
SelectorItem.Title(
|
||||
title = TextReference.Str(blockchain.fullName),
|
||||
title = TextReference.Str(blockchain.getNetworkName()),
|
||||
blockchain = blockchain,
|
||||
)
|
||||
}
|
||||
|
|
@ -501,7 +501,7 @@ internal class AddCustomTokenViewModel @Inject constructor(
|
|||
|
||||
return buildSet {
|
||||
if (!isSupportedToken && !isContractAddressFieldEmpty) {
|
||||
add(AddCustomTokenWarning.UnsupportedToken(networkSelectorValue.fullName))
|
||||
add(AddCustomTokenWarning.UnsupportedToken(networkSelectorValue.getNetworkName()))
|
||||
}
|
||||
if (isCustomTokenAlreadyAdded()) {
|
||||
add(AddCustomTokenWarning.TokenAlreadyAdded)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ internal class DefaultTokensListRouter : TokensListRouter {
|
|||
val alert = AppDialog.SimpleOkDialogRes(
|
||||
headerId = R.string.common_warning,
|
||||
messageId = R.string.alert_manage_tokens_unsupported_curve_message,
|
||||
args = listOf(blockchain.fullName),
|
||||
args = listOf(blockchain.getNetworkName()),
|
||||
)
|
||||
store.dispatchDialogShow(alert)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import com.tangem.domain.tokens.AddCryptoCurrenciesUseCase
|
|||
import com.tangem.domain.tokens.GetCryptoCurrenciesUseCase
|
||||
import com.tangem.domain.tokens.TokenWithBlockchain
|
||||
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
|
||||
import com.tangem.tap.common.extensions.fullNameWithoutTestnet
|
||||
import com.tangem.tap.common.extensions.getNetworkName
|
||||
import com.tangem.tap.common.extensions.networkNameWithoutTestnet
|
||||
import com.tangem.tap.common.extensions.getNetworkStandardName
|
||||
import com.tangem.tap.features.customtoken.impl.presentation.models.SupportBlockchainType
|
||||
import com.tangem.tap.features.tokens.impl.domain.TokensListInteractor
|
||||
import com.tangem.tap.features.tokens.impl.domain.models.Token
|
||||
|
|
@ -185,7 +185,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
|
||||
private fun createManageNetworkContent(network: Network): NetworkItemState.ManageContent {
|
||||
return NetworkItemState.ManageContent(
|
||||
name = network.blockchain.fullNameWithoutTestnet.uppercase(),
|
||||
name = network.blockchain.networkNameWithoutTestnet.uppercase(),
|
||||
protocolName = getNetworkProtocolName(network),
|
||||
iconResId = mutableIntStateOf(value = getNetworkIconResId(network.address, network.blockchain)),
|
||||
isMainNetwork = isMainNetwork(network),
|
||||
|
|
@ -214,7 +214,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
|
||||
private fun createReadNetworkContent(network: Network): NetworkItemState.ReadContent {
|
||||
return NetworkItemState.ReadContent(
|
||||
name = network.blockchain.fullNameWithoutTestnet.uppercase(),
|
||||
name = network.blockchain.networkNameWithoutTestnet.uppercase(),
|
||||
protocolName = getNetworkProtocolName(network),
|
||||
iconResId = mutableIntStateOf(value = getNetworkIconResId(network.address, network.blockchain)),
|
||||
isMainNetwork = isMainNetwork(network),
|
||||
|
|
@ -227,7 +227,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
return if (network.address == null) {
|
||||
MAIN_NETWORK_LABEL
|
||||
} else {
|
||||
network.blockchain.getNetworkName().uppercase()
|
||||
network.blockchain.getNetworkStandardName().uppercase()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
router.openUnableHideMainTokenAlert(
|
||||
tokenName = blockchain.name,
|
||||
tokenSymbol = blockchain.currency,
|
||||
networkName = blockchain.fullName,
|
||||
networkName = blockchain.getNetworkName(),
|
||||
)
|
||||
} else if (isAddedOnMainScreen) {
|
||||
router.openRemoveWalletAlert(
|
||||
|
|
@ -431,7 +431,7 @@ internal class TokensListViewModel @Inject constructor(
|
|||
} else {
|
||||
when (isUnsupportedToken(token.blockchain)) {
|
||||
SupportTokensState.NetworkTokensUnsupported -> {
|
||||
router.openNetworkTokensNotSupportAlert(token.blockchain.fullName)
|
||||
router.openNetworkTokensNotSupportAlert(token.blockchain.getNetworkName())
|
||||
}
|
||||
SupportTokensState.SupportedToken -> {
|
||||
analyticsSender.sendWhenTokenAdded(token.token)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ internal class CryptoCurrenciesMocks(private val scanResponse: ScanResponse) {
|
|||
network = Network(
|
||||
id = Network.ID(value = blockchain.id),
|
||||
backendId = "NEVER-MIND",
|
||||
name = blockchain.fullName,
|
||||
name = blockchain.getNetworkName(),
|
||||
currencySymbol = "NEVER-MIND",
|
||||
derivationPath = Network.DerivationPath.Custom(
|
||||
value = derivationBlockchain.derivationPath(
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ internal object CoinsResponseConverter : Converter<CoinsData, List<Token>> {
|
|||
Token.Network(
|
||||
networkId = network.networkId,
|
||||
standardType = getNetworkStandardType(blockchain).name,
|
||||
name = blockchain.fullName,
|
||||
name = blockchain.getNetworkName(),
|
||||
address = network.contractAddress,
|
||||
iconUrl = getIconUrl(network.networkId, value.imageHost),
|
||||
decimalCount = network.decimalCount?.toInt(),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ internal fun getNetwork(
|
|||
return Network(
|
||||
id = Network.ID(blockchain.id),
|
||||
backendId = blockchain.toNetworkId(),
|
||||
name = blockchain.fullName,
|
||||
name = blockchain.getNetworkName(),
|
||||
isTestnet = blockchain.isTestnet(),
|
||||
derivationPath = getNetworkDerivationPath(blockchain, extraDerivationPath, derivationStyleProvider),
|
||||
currencySymbol = blockchain.currency,
|
||||
|
|
|
|||
|
|
@ -1889,7 +1889,7 @@ internal class SwapInteractorImpl @Inject constructor(
|
|||
} else {
|
||||
SwapFeeState.NotEnough(
|
||||
feeCurrency = fromTokenStatus.currency,
|
||||
currencyName = fromTokenStatus.currency.network.name,
|
||||
currencyName = fromTokenStatus.currency.name,
|
||||
currencySymbol = fromTokenStatus.currency.symbol,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ markdown = "0.7.2"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "release-app_5.13-731"
|
||||
tangemBlockchainSdk = "release-app_5.13-732"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "release-app_5.13-376"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue