Updated on 2026-08-14

This commit is contained in:
Tangem 2023-01-10 02:24:44 -08:00
commit 188ed93c08
13 changed files with 53 additions and 41 deletions

@ -1 +1 @@
Subproject commit 897f0f7c402fd53c5ee1fa4ab601ecd4e43ff389
Subproject commit 8453faa078220801858166081947972639f166db

View file

@ -1,6 +1,8 @@
package com.tangem.tap.domain.configurable.config
import com.tangem.blockchain.common.BlockchainSdkConfig
import com.tangem.blockchain.common.BlockchairCredentials
import com.tangem.blockchain.common.QuickNodeCredentials
import com.tangem.tap.common.shop.shopify.ShopifyShop
import com.tangem.tap.common.zendesk.ZendeskConfig
import com.tangem.tap.domain.configurable.Loader
@ -66,12 +68,12 @@ class ConfigManager {
config = config.copy(
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed,
)
defaultConfig = defaultConfig.copy(
isTopUpEnabled = model.isTopUpEnabled,
isSendingToPayIdEnabled = model.isSendingToPayIdEnabled,
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed
isCreatingTwinCardsAllowed = model.isCreatingTwinCardsAllowed,
)
}
@ -84,11 +86,21 @@ class ConfigManager {
mercuryoWidgetId = values.mercuryoWidgetId,
mercuryoSecret = values.mercuryoSecret,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairApiKey = values.blockchairApiKey,
blockchairAuthorizationToken = values.blockchairAuthorizationToken,
blockchairCredentials = BlockchairCredentials(
apiKey = values.blockchairApiKeys,
authToken = values.blockchairAuthorizationToken,
),
blockcypherTokens = values.blockcypherTokens,
quickNodeCredentials = QuickNodeCredentials(
apiKey = values.quiknodeApiKey,
subdomain = values.quiknodeSubdomain,
),
bscQuickNodeCredentials = QuickNodeCredentials(
apiKey = values.bscQuiknodeApiKey,
subdomain = values.bscQuiknodeSubdomain,
),
infuraProjectId = values.infuraProjectId,
tronGridApiKey = values.tronGridApiKey
tronGridApiKey = values.tronGridApiKey,
),
appsFlyerDevKey = values.appsFlyerDevKey,
amplitudeApiKey = values.amplitudeApiKey,
@ -103,9 +115,19 @@ class ConfigManager {
mercuryoWidgetId = values.mercuryoWidgetId,
mercuryoSecret = values.mercuryoSecret,
blockchainSdkConfig = BlockchainSdkConfig(
blockchairApiKey = values.blockchairApiKey,
blockchairAuthorizationToken = values.blockchairAuthorizationToken,
blockchairCredentials = BlockchairCredentials(
apiKey = values.blockchairApiKeys,
authToken = values.blockchairAuthorizationToken,
),
blockcypherTokens = values.blockcypherTokens,
quickNodeCredentials = QuickNodeCredentials(
apiKey = values.quiknodeApiKey,
subdomain = values.quiknodeSubdomain,
),
bscQuickNodeCredentials = QuickNodeCredentials(
apiKey = values.bscQuiknodeApiKey,
subdomain = values.bscQuiknodeSubdomain,
),
infuraProjectId = values.infuraProjectId,
),
appsFlyerDevKey = values.appsFlyerDevKey,

View file

@ -21,8 +21,12 @@ class ConfigValueModel(
val mercuryoSecret: String,
val moonPayApiKey: String,
val moonPayApiSecretKey: String,
val blockchairApiKey: String?,
val blockchairApiKeys: List<String>,
val blockchairAuthorizationToken: String?,
val quiknodeSubdomain: String,
val quiknodeApiKey: String,
val bscQuiknodeSubdomain: String,
val bscQuiknodeApiKey: String,
val blockcypherTokens: Set<String>?,
val infuraProjectId: String?,
val appsFlyerDevKey: String,

View file

@ -143,7 +143,7 @@ fun WalletManagerFactory.makeSaltPayWalletManager(
scanResponse: ScanResponse,
): EthereumWalletManager {
val blockchain = scanResponse.getBlockchain()
if (blockchain != Blockchain.SaltPay && blockchain != Blockchain.SaltPayTestnet)
if (blockchain != Blockchain.SaltPay)
throw IllegalArgumentException()
val token = SaltPayWorkaround.tokenFrom(blockchain)

View file

@ -29,9 +29,9 @@ class UserWalletBuilder(
ProductType.Note -> "Note"
ProductType.Twins -> "Twin"
ProductType.SaltPay -> "SaltPay"
ProductType.Start2Coin -> "Start2Coin"
ProductType.Wallet -> when {
card.isBackupNotAllowed -> "Tangem card"
card.isStart2Coin -> "Start2Coin"
else -> "Wallet"
}
}
@ -41,6 +41,7 @@ class UserWalletBuilder(
ProductType.Note -> false
ProductType.Twins -> false
ProductType.SaltPay -> false
ProductType.Start2Coin -> false
ProductType.Wallet -> when {
card.isStart2Coin -> false
card.firmwareVersion >= FirmwareVersion.MultiWalletAvailable -> true

View file

@ -57,6 +57,7 @@ class UserWalletIdBuilder private constructor(
ProductType.Note,
ProductType.Wallet,
ProductType.SaltPay,
ProductType.Start2Coin,
-> null
},
)

View file

@ -19,6 +19,7 @@ import com.tangem.domain.common.ScanResponse
import com.tangem.domain.common.TapWorkarounds.isExcluded
import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease
import com.tangem.domain.common.TapWorkarounds.isSaltPay
import com.tangem.domain.common.TapWorkarounds.isStart2Coin
import com.tangem.domain.common.TapWorkarounds.isTangemNote
import com.tangem.domain.common.TapWorkarounds.isTangemTwins
import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation
@ -193,8 +194,9 @@ private class ScanWalletProcessor(
session: CardSession,
callback: (result: CompletionResult<ScanResponse>) -> Unit,
) {
val productType = when (card.isSaltPay) {
true -> ProductType.SaltPay
val productType = when {
card.isSaltPay -> ProductType.SaltPay
card.isStart2Coin -> ProductType.Start2Coin
else -> ProductType.Wallet
}
scope.launch {
@ -264,12 +266,7 @@ private class ScanWalletProcessor(
}
if (additionalBlockchainsToDerive != null) {
blockchainsToDerive.addAll(
additionalBlockchainsToDerive.map {
BlockchainNetwork(
blockchain = it,
card = card,
)
},
additionalBlockchainsToDerive.map { BlockchainNetwork(it, card) }
)
}
if (!card.useOldStyleDerivation) {
@ -280,12 +277,7 @@ private class ScanWalletProcessor(
Blockchain.RSK,
Blockchain.Fantom, Blockchain.FantomTestnet,
Blockchain.Avalanche, Blockchain.AvalancheTestnet,
).map {
BlockchainNetwork(
blockchain = it,
card = card,
)
},
).map { BlockchainNetwork(it, card) },
)
}
return blockchainsToDerive.distinct()

View file

@ -46,6 +46,9 @@ class OnboardingHelper {
}
ProductType.Twins -> AppScreen.OnboardingTwins
ProductType.SaltPay -> AppScreen.OnboardingWallet
ProductType.Start2Coin -> throw java.lang.UnsupportedOperationException(
"Onboarding for Start2Coin cards is not supported"
)
}
}

View file

@ -39,7 +39,6 @@ class GnosisRegistrator(
private val otpProcessorContractAddress: String = when (walletManager.wallet.blockchain) {
Blockchain.SaltPay -> "0x3B4397C817A26521Df8bD01a949AFDE2251d91C2"
Blockchain.SaltPayTestnet -> "0x710BF23486b549836509a08c184cE0188830f197"
else -> throw IllegalArgumentException("GnosisRegistrator supports only the SaltPay blockchain")
}

View file

@ -59,7 +59,7 @@ object Versions {
// endregion Other libraries
// region Tangem
const val tangemBlockchainSdk = "develop-141"
const val tangemBlockchainSdk = "develop-151"
const val tangemCardSgk = "develop-179"
// endregion Tangem

View file

@ -15,13 +15,6 @@ object SaltPayWorkaround {
decimals = 18,
id = "wrapped-xdai",
)
Blockchain.SaltPayTestnet -> Token(
name = "WXDAI Test",
symbol = "MyERC20",
contractAddress = "0x69cca8D8295de046C7c14019D9029Ccc77987A48",
decimals = 0,
id = "wrapped-xdai",
)
else -> throw IllegalArgumentException()
}
}

View file

@ -30,7 +30,8 @@ data class ScanResponse(
) : CommandResponse {
fun getBlockchain(): Blockchain {
return when (productType) {
ProductType.SaltPay -> if (card.isTestCard) Blockchain.SaltPayTestnet else Blockchain.SaltPay
ProductType.Start2Coin -> if (card.isTestCard) Blockchain.BitcoinTestnet else Blockchain.Bitcoin
ProductType.SaltPay -> Blockchain.SaltPay
ProductType.Note -> card.getTangemNoteBlockchain() ?: Blockchain.Unknown
else -> {
val blockchainName: String = walletData?.blockchain ?: return Blockchain.Unknown
@ -71,11 +72,9 @@ data class ScanResponse(
Blockchain.secp256k1Blockchains(isTestnet).contains(blockchain) -> {
hasDerivation(EllipticCurve.Secp256k1, derivationPath)
}
Blockchain.ed25519OnlyBlockchains(isTestnet).contains(blockchain) -> {
hasDerivation(EllipticCurve.Ed25519, derivationPath)
}
else -> false
}
}
@ -90,7 +89,7 @@ data class ScanResponse(
}
enum class ProductType {
Note, Twins, Wallet, SaltPay
Note, Twins, Wallet, SaltPay, Start2Coin
}
typealias KeyWalletPublicKey = ByteArrayKey

View file

@ -48,7 +48,6 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? {
"optimistic-ethereum/test" -> Blockchain.OptimismTestnet
"dash" -> Blockchain.Dash
"sxdai" -> Blockchain.SaltPay
"sxdai/test" -> Blockchain.SaltPayTestnet
else -> null
}
}
@ -101,7 +100,6 @@ fun Blockchain.toNetworkId(): String {
Blockchain.OptimismTestnet -> "optimistic-ethereum/test"
Blockchain.Dash -> "dash"
Blockchain.SaltPay -> "sxdai"
Blockchain.SaltPayTestnet -> "sxdai/test"
}
}
@ -133,7 +131,7 @@ fun Blockchain.toCoinId(): String {
Blockchain.Kusama -> "kusama"
Blockchain.Optimism, Blockchain.OptimismTestnet -> "ethereum"
Blockchain.Dash -> "dash"
Blockchain.SaltPay, Blockchain.SaltPayTestnet -> "xdai"
Blockchain.SaltPay -> "xdai"
Blockchain.Unknown -> "unknown"
}
}