Updated on 2026-08-14
This commit is contained in:
parent
89cb0e3cdb
commit
2e09b2e3ca
9 changed files with 25 additions and 10 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit b791bd4cf6c5eca9778f89e87cd62b72d24f5ce9
|
||||
Subproject commit 8c1c53b73950698d4acfa4d925b8c14bf6f0da63
|
||||
|
|
@ -6,6 +6,7 @@ import com.tangem.blockchain.common.Amount
|
|||
import com.tangem.blockchain.common.AmountType
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.blockchain.extensions.Result
|
||||
import com.tangem.domain.models.scan.CardDTO
|
||||
import com.tangem.tap.common.extensions.safeUpdate
|
||||
|
|
@ -96,7 +97,10 @@ suspend fun buyErc20TestnetTokens(card: CardDTO, walletManager: EthereumWalletMa
|
|||
amountToSend,
|
||||
destinationAddress,
|
||||
) as? Result.Success ?: return
|
||||
val fee = feeResult.data.minimum
|
||||
val fee = when (val feeForTx = feeResult.data) {
|
||||
is TransactionFee.Choosable -> feeForTx.minimum
|
||||
is TransactionFee.Single -> feeForTx.normal
|
||||
}
|
||||
|
||||
val coinValue = walletManager.wallet.amounts[AmountType.Coin]?.value ?: BigDecimal.ZERO
|
||||
if (coinValue < fee.amount.value) return
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.tangem.common.card.WalletData
|
|||
import com.tangem.domain.common.TapWorkarounds.getTangemNoteBlockchain
|
||||
import com.tangem.domain.common.TapWorkarounds.isStart2Coin
|
||||
import com.tangem.domain.common.TapWorkarounds.isTestCard
|
||||
import com.tangem.domain.common.TapWorkarounds.isWallet2
|
||||
import com.tangem.domain.models.scan.CardDTO
|
||||
import com.tangem.domain.models.scan.ProductType
|
||||
import com.tangem.operations.attestation.Attestation
|
||||
|
|
@ -30,7 +31,7 @@ internal class TangemCardTypesResolver(
|
|||
}
|
||||
|
||||
override fun isWallet2(): Boolean {
|
||||
return card.firmwareVersion >= FirmwareVersion.Ed25519Slip0010Available && card.settings.isKeysImportAllowed
|
||||
return card.isWallet2
|
||||
}
|
||||
|
||||
override fun isTangemTwins(): Boolean = productType == ProductType.Twins
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ object TapWorkarounds {
|
|||
val CardDTO.canSkipBackup: Boolean
|
||||
get() = this.firmwareVersion < backupRequiredFirmwareVersion
|
||||
|
||||
val CardDTO.isWallet2: Boolean
|
||||
get() = this.firmwareVersion >= FirmwareVersion.Ed25519Slip0010Available && this.settings.isKeysImportAllowed
|
||||
|
||||
val CardDTO.useOldStyleDerivation: Boolean
|
||||
get() = batchId == "AC01" || batchId == "AC02" || batchId == "CB95"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ sealed interface CardConfig {
|
|||
if (cardDTO.settings.isBackupAllowed && cardDTO.settings.isHDWalletAllowed &&
|
||||
cardDTO.firmwareVersion >= FirmwareVersion.MultiWalletAvailable
|
||||
) {
|
||||
return TangemWalletCardConfig
|
||||
return GenericCardConfig
|
||||
}
|
||||
error("This card is not supported by this configs")
|
||||
return GenericCardConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.common.card.EllipticCurve
|
||||
import timber.log.Timber
|
||||
|
||||
object TangemWalletCardConfig : CardConfig {
|
||||
object GenericCardConfig : CardConfig {
|
||||
override val mandatoryCurves: List<EllipticCurve>
|
||||
get() = listOf(
|
||||
EllipticCurve.Secp256k1,
|
||||
|
|
@ -4,6 +4,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.common.card.EllipticCurve
|
||||
import com.tangem.common.card.FirmwareVersion
|
||||
import com.tangem.domain.common.TapWorkarounds.isTestCard
|
||||
import com.tangem.domain.common.TapWorkarounds.isWallet2
|
||||
import com.tangem.domain.models.scan.CardDTO
|
||||
|
||||
/**
|
||||
|
|
@ -17,8 +18,14 @@ fun CardDTO.supportedBlockchains(): List<Blockchain> {
|
|||
Blockchain.fromCurve(EllipticCurve.Secp256k1)
|
||||
} else {
|
||||
wallets.flatMap { Blockchain.fromCurve(it.curve) }.distinct()
|
||||
}.toMutableList()
|
||||
// disabled Cardano for wallet 2 for now, should be enabled after key processed
|
||||
// ([REDACTED_JIRA])
|
||||
if (this.isWallet2) {
|
||||
supportedBlockchains.apply {
|
||||
remove(Blockchain.Cardano)
|
||||
}
|
||||
}
|
||||
|
||||
return supportedBlockchains
|
||||
.filter { isTestCard == it.isTestnet() }
|
||||
.filter { it.isSupportedInApp() }
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ private fun ScanResponse.hasDerivation(blockchain: Blockchain, derivationPath: D
|
|||
Blockchain.secp256k1Blockchains(isTestnet).contains(blockchain) -> {
|
||||
hasDerivation(EllipticCurve.Secp256k1, derivationPath)
|
||||
}
|
||||
Blockchain.ed25519OnlyBlockchains(isTestnet).contains(blockchain) -> {
|
||||
Blockchain.ed25519Blockchains(isTestnet).contains(blockchain) -> {
|
||||
hasDerivation(EllipticCurve.Ed25519, derivationPath)
|
||||
}
|
||||
else -> false
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ okHttp-prettyLogging = "3.1.0"
|
|||
# endregion Other libraries
|
||||
|
||||
# region Tangem
|
||||
tangemBlockchainSdk = "develop-314"
|
||||
tangemBlockchainSdk = "develop-316"
|
||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||
tangemCardSdk = "develop-288"
|
||||
tangemCardSdk = "develop-289"
|
||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds
|
||||
# endregion Tangem
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue