Updated on 2026-08-14
This commit is contained in:
parent
f64b387fe2
commit
ae87969a37
4 changed files with 21 additions and 6 deletions
|
|
@ -28,6 +28,7 @@ private class AddCustomTokenConverter(
|
|||
val rawMessage = when (customTokenError) {
|
||||
AddCustomTokenError.Warning.PotentialScamToken -> R.string.custom_token_validation_error_not_found
|
||||
AddCustomTokenError.Warning.TokenAlreadyAdded -> R.string.custom_token_validation_error_already_added
|
||||
AddCustomTokenError.Warning.UnsupportedSolanaToken -> R.string.alert_manage_tokens_unsupported_message
|
||||
AddCustomTokenError.InvalidContractAddress -> R.string.custom_token_creation_error_invalid_contract_address
|
||||
AddCustomTokenError.NetworkIsNotSelected -> R.string.custom_token_creation_error_network_not_selected
|
||||
AddCustomTokenError.InvalidDerivationPath -> R.string.custom_token_creation_error_invalid_derivation_path
|
||||
|
|
|
|||
|
|
@ -42,5 +42,6 @@ sealed class AddCustomTokenError(
|
|||
sealed class Warning : AddCustomTokenError() {
|
||||
object PotentialScamToken : Warning()
|
||||
object TokenAlreadyAdded : Warning()
|
||||
object UnsupportedSolanaToken: Warning()
|
||||
}
|
||||
}
|
||||
|
|
@ -11,10 +11,6 @@ import com.tangem.domain.features.addCustomToken.redux.AddCustomTokenState
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
enum class CompleteDataType {
|
||||
Blockchain, Token
|
||||
}
|
||||
|
||||
sealed class CustomCurrency(
|
||||
val network: Blockchain,
|
||||
val derivationPath: DerivationPath?,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ import com.tangem.domain.AddCustomTokenException
|
|||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.DomainWrapped
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
import com.tangem.domain.common.extensions.canHandleToken
|
||||
import com.tangem.domain.common.extensions.fromNetworkId
|
||||
import com.tangem.domain.common.extensions.supportedTokens
|
||||
import com.tangem.domain.common.extensions.supportedBlockchains
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.domain.common.form.*
|
||||
import com.tangem.domain.features.addCustomToken.*
|
||||
|
|
@ -226,6 +227,15 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
|
|||
val singleTokenContract = foundToken.networks[0]
|
||||
fillTokenFields(foundToken, singleTokenContract)
|
||||
|
||||
if (canHandleToken(Network.getFieldValue())) {
|
||||
AddCustomTokenError.Warning.UnsupportedSolanaToken.remove()
|
||||
} else {
|
||||
AddCustomTokenError.Warning.UnsupportedSolanaToken.add()
|
||||
updateTokenDetailFields(false)
|
||||
updateAddButton(false)
|
||||
return
|
||||
}
|
||||
|
||||
val isInAppSavedTokens = isTokenPersistIntoAppSavedTokensList()
|
||||
if (isInAppSavedTokens) {
|
||||
updateTokenDetailFields(false)
|
||||
|
|
@ -511,6 +521,11 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
|
|||
dispatchOnMain(Warning.Replace(setOf(this), setOf(to)))
|
||||
}
|
||||
|
||||
private fun canHandleToken(blockchain: Blockchain): Boolean {
|
||||
val card = globalState.scanResponse?.card ?: return false
|
||||
return card.canHandleToken(blockchain)
|
||||
}
|
||||
|
||||
@Throws
|
||||
private fun throwUnAppropriateInitialization(objName: String) {
|
||||
throw AddCustomTokenException.UnAppropriateInitializationException(
|
||||
|
|
@ -533,7 +548,9 @@ private class AddCustomTokenReducer(
|
|||
}
|
||||
is OnCreate -> {
|
||||
val card = requireNotNull(globalState.scanResponse?.card)
|
||||
val supportedTokenNetworkIds = card.supportedTokens().map { it.toNetworkId() }
|
||||
val supportedTokenNetworkIds = card.supportedBlockchains()
|
||||
.filter { it.canHandleTokens() }
|
||||
.map { it.toNetworkId() }
|
||||
val tangemTechServiceManager = AddCustomTokenService(
|
||||
tangemTechService = globalState.networkServices.tangemTechService,
|
||||
supportedTokenNetworkIds = supportedTokenNetworkIds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue