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

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")
}