Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-26 19:04:40 +04:00
parent 6aab25427d
commit e04ac1fb2c
19 changed files with 273 additions and 8 deletions

View file

@ -1,5 +1,6 @@
package com.tangem.data.common.currency
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchainsdk.utils.toCoinId
import com.tangem.blockchainsdk.utils.toNetworkId
import com.tangem.data.common.network.NetworkFactory
@ -54,9 +55,14 @@ class UserTokensResponseFactory @Inject constructor() {
userWallet: UserWallet?,
networkFactory: NetworkFactory,
accountId: AccountId?,
extraBlockchains: List<Blockchain> = emptyList(),
): UserTokensResponse {
val tokens = if (userWallet != null) {
getDefaultWalletBlockchains(userWallet = userWallet, demoConfig = DemoConfig)
getDefaultWalletBlockchains(
userWallet = userWallet,
demoConfig = DemoConfig,
extraBlockchains = extraBlockchains,
)
.map { blockchain ->
val derivationPath = networkFactory.createDerivationPath(
blockchain = blockchain,

View file

@ -375,6 +375,7 @@ class NetworkFactory @Inject constructor(
Blockchain.Linea, Blockchain.LineaTestnet,
Blockchain.ArbitrumNova,
Blockchain.Plasma, Blockchain.PlasmaTestnet,
Blockchain.Adi, Blockchain.AdiTestnet,
Blockchain.Monad, Blockchain.MonadTestnet,
-> Network.TransactionExtrasType.NONE
// endregion

View file

@ -8,10 +8,16 @@ import com.tangem.domain.models.wallet.UserWallet
/**
* Returns the default blockchains for the multi-currency wallet.
*
* @param userWallet The user's wallet, which can be either a cold or hot wallet.
* @param demoConfig Configuration for demo cards, which may specify different default blockchains.
* @param userWallet The user's wallet, which can be either a cold or hot wallet.
* @param demoConfig Configuration for demo cards, which may specify different default blockchains.
* @param extraBlockchains Additional blockchains appended on top of the standard defaults for non-demo cold wallets
* (e.g. batch- or promo-specific entries resolved by the caller).
*/
fun getDefaultWalletBlockchains(userWallet: UserWallet, demoConfig: DemoConfig): Collection<Blockchain> {
fun getDefaultWalletBlockchains(
userWallet: UserWallet,
demoConfig: DemoConfig,
extraBlockchains: List<Blockchain> = emptyList(),
): Collection<Blockchain> {
return when (userWallet) {
is UserWallet.Cold -> {
val card = userWallet.scanResponse.card
@ -19,7 +25,7 @@ fun getDefaultWalletBlockchains(userWallet: UserWallet, demoConfig: DemoConfig):
var blockchainsInternal = if (demoConfig.isDemoCardId(card.cardId)) {
demoConfig.getDemoBlockchains(card.cardId)
} else {
listOf(Blockchain.Bitcoin, Blockchain.Ethereum)
listOf(Blockchain.Bitcoin, Blockchain.Ethereum) + extraBlockchains
}
if (card.isTestCard) {