Updated on 2026-08-14
This commit is contained in:
parent
6aab25427d
commit
e04ac1fb2c
19 changed files with 273 additions and 8 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 12821d37a835b5a225c69912a37df33506b315bf
|
Subproject commit 3d111de2b364a6191d213c138b1d2d11a999f779
|
||||||
|
|
@ -163,5 +163,6 @@ internal val Blockchain.moonPaySupportedCurrency: MoonPaySupportedCurrency?
|
||||||
Linea, LineaTestnet -> null
|
Linea, LineaTestnet -> null
|
||||||
ArbitrumNova -> null
|
ArbitrumNova -> null
|
||||||
Plasma, PlasmaTestnet -> null
|
Plasma, PlasmaTestnet -> null
|
||||||
|
Adi, AdiTestnet -> null
|
||||||
Monad, MonadTestnet -> null
|
Monad, MonadTestnet -> null
|
||||||
}
|
}
|
||||||
|
|
@ -196,6 +196,9 @@ private fun iconSetOf(blockchain: Blockchain): IconSet? = when (blockchain) {
|
||||||
Blockchain.Plasma,
|
Blockchain.Plasma,
|
||||||
Blockchain.PlasmaTestnet,
|
Blockchain.PlasmaTestnet,
|
||||||
-> IconSet(active = R.drawable.img_plasma_22, greyedOut = R.drawable.ic_plasma_22)
|
-> IconSet(active = R.drawable.img_plasma_22, greyedOut = R.drawable.ic_plasma_22)
|
||||||
|
Blockchain.Adi,
|
||||||
|
Blockchain.AdiTestnet,
|
||||||
|
-> IconSet(active = R.drawable.img_adi_22, greyedOut = R.drawable.ic_adi_22)
|
||||||
Blockchain.Playa3ull,
|
Blockchain.Playa3ull,
|
||||||
-> IconSet(active = R.drawable.img_playa3ull_22, greyedOut = R.drawable.ic_playa3ull_22)
|
-> IconSet(active = R.drawable.img_playa3ull_22, greyedOut = R.drawable.ic_playa3ull_22)
|
||||||
Blockchain.Polkadot,
|
Blockchain.Polkadot,
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ internal class BlockchainIconsTest {
|
||||||
Blockchain.Optimism, Blockchain.OptimismTestnet -> R.drawable.img_optimism_22
|
Blockchain.Optimism, Blockchain.OptimismTestnet -> R.drawable.img_optimism_22
|
||||||
Blockchain.Pepecoin, Blockchain.PepecoinTestnet -> R.drawable.img_pepecoin_22
|
Blockchain.Pepecoin, Blockchain.PepecoinTestnet -> R.drawable.img_pepecoin_22
|
||||||
Blockchain.Plasma, Blockchain.PlasmaTestnet -> R.drawable.img_plasma_22
|
Blockchain.Plasma, Blockchain.PlasmaTestnet -> R.drawable.img_plasma_22
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet -> R.drawable.img_adi_22
|
||||||
Blockchain.Playa3ull -> R.drawable.img_playa3ull_22
|
Blockchain.Playa3ull -> R.drawable.img_playa3ull_22
|
||||||
Blockchain.Polkadot, Blockchain.PolkadotTestnet -> R.drawable.img_polkadot_22
|
Blockchain.Polkadot, Blockchain.PolkadotTestnet -> R.drawable.img_polkadot_22
|
||||||
Blockchain.Polygon, Blockchain.PolygonTestnet -> R.drawable.img_polygon_22
|
Blockchain.Polygon, Blockchain.PolygonTestnet -> R.drawable.img_polygon_22
|
||||||
|
|
@ -216,6 +217,7 @@ internal class BlockchainIconsTest {
|
||||||
Blockchain.Optimism, Blockchain.OptimismTestnet -> R.drawable.ic_optimism_22
|
Blockchain.Optimism, Blockchain.OptimismTestnet -> R.drawable.ic_optimism_22
|
||||||
Blockchain.Pepecoin, Blockchain.PepecoinTestnet -> R.drawable.ic_pepecoin_22
|
Blockchain.Pepecoin, Blockchain.PepecoinTestnet -> R.drawable.ic_pepecoin_22
|
||||||
Blockchain.Plasma, Blockchain.PlasmaTestnet -> R.drawable.ic_plasma_22
|
Blockchain.Plasma, Blockchain.PlasmaTestnet -> R.drawable.ic_plasma_22
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet -> R.drawable.ic_adi_22
|
||||||
Blockchain.Playa3ull -> R.drawable.ic_playa3ull_22
|
Blockchain.Playa3ull -> R.drawable.ic_playa3ull_22
|
||||||
Blockchain.Polkadot, Blockchain.PolkadotTestnet -> R.drawable.ic_polkadot_16
|
Blockchain.Polkadot, Blockchain.PolkadotTestnet -> R.drawable.ic_polkadot_16
|
||||||
Blockchain.Polygon, Blockchain.PolygonTestnet -> R.drawable.ic_polygon_22
|
Blockchain.Polygon, Blockchain.PolygonTestnet -> R.drawable.ic_polygon_22
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,10 @@
|
||||||
"name": "AND_15101_TANGEM_PAY_HOT_WALLET_ONBOARDING",
|
"name": "AND_15101_TANGEM_PAY_HOT_WALLET_ONBOARDING",
|
||||||
"version": "undefined"
|
"version": "undefined"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "AND_15402_ADI_MAIN_SCREEN_DEFAULT_ENABLED",
|
||||||
|
"version": "undefined"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "AND_15103_SWAP_RATE_EXPERIENCE_ENABLED",
|
"name": "AND_15103_SWAP_RATE_EXPERIENCE_ENABLED",
|
||||||
"version": "undefined"
|
"version": "undefined"
|
||||||
|
|
|
||||||
13
core/ui/src/main/res/drawable/ic_adi_22.xml
Normal file
13
core/ui/src/main/res/drawable/ic_adi_22.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="22dp"
|
||||||
|
android:height="22dp"
|
||||||
|
android:viewportWidth="22"
|
||||||
|
android:viewportHeight="22">
|
||||||
|
<path
|
||||||
|
android:pathData="M10.8061,17.8827C10.8942,18.0391 11.1058,18.0391 11.1939,17.8827L14.9102,11.2904C15.0308,11.0765 15.0299,10.8084 14.9078,10.5955L11.193,4.11571C11.1046,3.96143 10.8954,3.96143 10.807,4.11571L7.09219,10.5955C6.97015,10.8084 6.96921,11.0765 7.08977,11.2904L10.8061,17.8827ZM12.9077,10.9422C13.1277,10.9422 13.2637,10.6851 13.1507,10.4827L11.2402,7.06214C11.1309,6.86647 10.8669,6.86502 10.7557,7.05946L8.80024,10.4801C8.68463,10.6823 8.82042,10.9422 9.04173,10.9422H12.9077Z"
|
||||||
|
android:fillColor="#919191"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M10.9434,8.66572C10.5523,8.66572 10.2353,9.00545 10.2353,9.42453C10.2353,9.84361 10.5523,10.1833 10.9434,10.1833C11.3344,10.1833 11.6514,9.84361 11.6514,9.42453C11.6514,9.00545 11.3344,8.66572 10.9434,8.66572Z"
|
||||||
|
android:fillColor="#919191"/>
|
||||||
|
</vector>
|
||||||
54
core/ui/src/main/res/drawable/img_adi_22.xml
Normal file
54
core/ui/src/main/res/drawable/img_adi_22.xml
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="22dp"
|
||||||
|
android:height="22dp"
|
||||||
|
android:viewportWidth="22"
|
||||||
|
android:viewportHeight="22">
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M11,0L11,0A11,11 0,0 1,22 11L22,11A11,11 0,0 1,11 22L11,22A11,11 0,0 1,0 11L0,11A11,11 0,0 1,11 0z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M0,0h22v22h-22z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startX="5.5"
|
||||||
|
android:startY="5"
|
||||||
|
android:endX="17"
|
||||||
|
android:endY="18.5"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0" android:color="#052185"/>
|
||||||
|
<item android:offset="1" android:color="#010B2D"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:pathData="M10.8061,17.8827C10.8942,18.0391 11.1058,18.0391 11.1939,17.8827L14.9102,11.2904C15.0308,11.0765 15.0299,10.8084 14.9078,10.5955L11.193,4.11571C11.1046,3.96143 10.8954,3.96143 10.807,4.11571L7.09219,10.5955C6.97015,10.8084 6.96921,11.0765 7.08977,11.2904L10.8061,17.8827ZM12.9077,10.9422C13.1277,10.9422 13.2637,10.6851 13.1507,10.4827L11.2402,7.06214C11.1309,6.86647 10.8669,6.86502 10.7557,7.05946L8.80024,10.4801C8.68463,10.6823 8.82042,10.9422 9.04173,10.9422H12.9077Z"
|
||||||
|
android:fillType="evenOdd">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startX="11"
|
||||||
|
android:startY="4"
|
||||||
|
android:endX="11"
|
||||||
|
android:endY="18"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0.410186" android:color="#FE7109"/>
|
||||||
|
<item android:offset="0.841456" android:color="#003BFF"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:pathData="M10.9434,8.66572C10.5523,8.66572 10.2353,9.00545 10.2353,9.42453C10.2353,9.84361 10.5523,10.1833 10.9434,10.1833C11.3344,10.1833 11.6514,9.84361 11.6514,9.42453C11.6514,9.00545 11.3344,8.66572 10.9434,8.66572Z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startX="11"
|
||||||
|
android:startY="4"
|
||||||
|
android:endX="11"
|
||||||
|
android:endY="18"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0.410186" android:color="#FE7109"/>
|
||||||
|
<item android:offset="0.841456" android:color="#003BFF"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.tangem.data.account.utils
|
package com.tangem.data.account.utils
|
||||||
|
|
||||||
|
import com.tangem.blockchain.common.Blockchain
|
||||||
|
import com.tangem.core.configtoggle.FeatureToggles
|
||||||
|
import com.tangem.core.configtoggle.feature.FeatureTogglesManager
|
||||||
import com.tangem.data.account.converter.CryptoPortfolioConverter
|
import com.tangem.data.account.converter.CryptoPortfolioConverter
|
||||||
import com.tangem.data.common.currency.UserTokensResponseFactory
|
import com.tangem.data.common.currency.UserTokensResponseFactory
|
||||||
import com.tangem.data.common.network.NetworkFactory
|
import com.tangem.data.common.network.NetworkFactory
|
||||||
|
|
@ -31,6 +34,7 @@ internal class DefaultWalletAccountsResponseFactory @Inject constructor(
|
||||||
private val cryptoPortfolioCF: CryptoPortfolioConverter.Factory,
|
private val cryptoPortfolioCF: CryptoPortfolioConverter.Factory,
|
||||||
private val userTokensResponseFactory: UserTokensResponseFactory,
|
private val userTokensResponseFactory: UserTokensResponseFactory,
|
||||||
private val networkFactory: NetworkFactory,
|
private val networkFactory: NetworkFactory,
|
||||||
|
private val featureTogglesManager: FeatureTogglesManager,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun create(userWalletId: UserWalletId, userTokensResponse: UserTokensResponse?): GetWalletAccountsResponse {
|
fun create(userWalletId: UserWalletId, userTokensResponse: UserTokensResponse?): GetWalletAccountsResponse {
|
||||||
|
|
@ -69,6 +73,21 @@ internal class DefaultWalletAccountsResponseFactory @Inject constructor(
|
||||||
accountId = userWallet?.let {
|
accountId = userWallet?.let {
|
||||||
AccountId.forCryptoPortfolio(userWalletId = it.walletId, derivationIndex = DerivationIndex.Main)
|
AccountId.forCryptoPortfolio(userWalletId = it.walletId, derivationIndex = DerivationIndex.Main)
|
||||||
},
|
},
|
||||||
|
extraBlockchains = userWallet?.extraDefaultBlockchains().orEmpty(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun UserWallet.extraDefaultBlockchains(): List<Blockchain> {
|
||||||
|
val batchId = (this as? UserWallet.Cold)?.scanResponse?.card?.batchId ?: return emptyList()
|
||||||
|
return when {
|
||||||
|
batchId == ADI_PROMO_BATCH_ID &&
|
||||||
|
featureTogglesManager.isFeatureEnabled(FeatureToggles.AND_15402_ADI_MAIN_SCREEN_DEFAULT_ENABLED) ->
|
||||||
|
listOf(Blockchain.Adi)
|
||||||
|
else -> emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val ADI_PROMO_BATCH_ID = "BB000053"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.tangem.data.account.utils
|
package com.tangem.data.account.utils
|
||||||
|
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import com.tangem.blockchain.common.Blockchain
|
||||||
|
import com.tangem.core.configtoggle.FeatureToggles
|
||||||
|
import com.tangem.core.configtoggle.feature.FeatureTogglesManager
|
||||||
import com.tangem.data.account.converter.CryptoPortfolioConverter
|
import com.tangem.data.account.converter.CryptoPortfolioConverter
|
||||||
import com.tangem.data.account.converter.createWalletAccountDTO
|
import com.tangem.data.account.converter.createWalletAccountDTO
|
||||||
import com.tangem.data.account.utils.GetWalletAccountsResponseExtTest.Companion.createUserToken
|
import com.tangem.data.account.utils.GetWalletAccountsResponseExtTest.Companion.createUserToken
|
||||||
|
|
@ -32,12 +35,14 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
private val cryptoPortfolioConverter = mockk<CryptoPortfolioConverter>()
|
private val cryptoPortfolioConverter = mockk<CryptoPortfolioConverter>()
|
||||||
private val userTokensResponseFactory = mockk<UserTokensResponseFactory>()
|
private val userTokensResponseFactory = mockk<UserTokensResponseFactory>()
|
||||||
private val networkFactory = mockk<NetworkFactory>()
|
private val networkFactory = mockk<NetworkFactory>()
|
||||||
|
private val featureTogglesManager = mockk<FeatureTogglesManager>()
|
||||||
|
|
||||||
private val factory = DefaultWalletAccountsResponseFactory(
|
private val factory = DefaultWalletAccountsResponseFactory(
|
||||||
userWalletsListRepository = userWalletsListRepository,
|
userWalletsListRepository = userWalletsListRepository,
|
||||||
cryptoPortfolioCF = cryptoPortfolioCF,
|
cryptoPortfolioCF = cryptoPortfolioCF,
|
||||||
userTokensResponseFactory = userTokensResponseFactory,
|
userTokensResponseFactory = userTokensResponseFactory,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
|
featureTogglesManager = featureTogglesManager,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val userWalletId = UserWalletId("011")
|
private val userWalletId = UserWalletId("011")
|
||||||
|
|
@ -75,6 +80,7 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
userWallet = null,
|
userWallet = null,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
accountId = null,
|
accountId = null,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
)
|
)
|
||||||
} returns userTokensResponse
|
} returns userTokensResponse
|
||||||
|
|
||||||
|
|
@ -100,6 +106,7 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
userWallet = null,
|
userWallet = null,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
accountId = null,
|
accountId = null,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -129,6 +136,7 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
userWallet = userWallet,
|
userWallet = userWallet,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
accountId = accounts.first().accountId,
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
)
|
)
|
||||||
} returns defaultResponse
|
} returns defaultResponse
|
||||||
|
|
||||||
|
|
@ -159,6 +167,7 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
userWallet = userWallet,
|
userWallet = userWallet,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
accountId = accounts.first().accountId,
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +197,7 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
userWallet = userWallet,
|
userWallet = userWallet,
|
||||||
networkFactory = networkFactory,
|
networkFactory = networkFactory,
|
||||||
accountId = accounts.first().accountId,
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
)
|
)
|
||||||
} returns defaultResponse
|
} returns defaultResponse
|
||||||
|
|
||||||
|
|
@ -210,6 +220,138 @@ class DefaultWalletAccountsResponseFactoryTest {
|
||||||
Truth.assertThat(actual).isEqualTo(expected)
|
Truth.assertThat(actual).isEqualTo(expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `create passes ADI as extra blockchain when batch is BB000053 and toggle is on`() = runTest {
|
||||||
|
// Arrange
|
||||||
|
val userWallet = mockk<UserWallet.Cold>(relaxed = true) {
|
||||||
|
every { walletId } returns userWalletId
|
||||||
|
every { scanResponse.card.batchId } returns "BB000053"
|
||||||
|
}
|
||||||
|
|
||||||
|
every { userWalletsListRepository.userWallets } returns MutableStateFlow(listOf(userWallet))
|
||||||
|
every {
|
||||||
|
featureTogglesManager.isFeatureEnabled(FeatureToggles.AND_15402_ADI_MAIN_SCREEN_DEFAULT_ENABLED)
|
||||||
|
} returns true
|
||||||
|
|
||||||
|
val accounts = AccountList.empty(userWallet.walletId).accounts
|
||||||
|
.filterIsInstance<Account.CryptoPortfolio>()
|
||||||
|
val defaultResponse = UserTokensResponse(
|
||||||
|
group = UserTokensResponse.GroupType.NETWORK,
|
||||||
|
sort = UserTokensResponse.SortType.BALANCE,
|
||||||
|
tokens = emptyList(),
|
||||||
|
)
|
||||||
|
every {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = listOf(Blockchain.Adi),
|
||||||
|
)
|
||||||
|
} returns defaultResponse
|
||||||
|
every { cryptoPortfolioConverter.convertListBack(accounts) } returns emptyList()
|
||||||
|
|
||||||
|
// Act
|
||||||
|
factory.create(userWalletId, null)
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
coVerifyOrder {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = listOf(Blockchain.Adi),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `create passes no extra blockchains when batch is BB000053 but toggle is off`() = runTest {
|
||||||
|
// Arrange
|
||||||
|
val userWallet = mockk<UserWallet.Cold>(relaxed = true) {
|
||||||
|
every { walletId } returns userWalletId
|
||||||
|
every { scanResponse.card.batchId } returns "BB000053"
|
||||||
|
}
|
||||||
|
|
||||||
|
every { userWalletsListRepository.userWallets } returns MutableStateFlow(listOf(userWallet))
|
||||||
|
every {
|
||||||
|
featureTogglesManager.isFeatureEnabled(FeatureToggles.AND_15402_ADI_MAIN_SCREEN_DEFAULT_ENABLED)
|
||||||
|
} returns false
|
||||||
|
|
||||||
|
val accounts = AccountList.empty(userWallet.walletId).accounts
|
||||||
|
.filterIsInstance<Account.CryptoPortfolio>()
|
||||||
|
val defaultResponse = UserTokensResponse(
|
||||||
|
group = UserTokensResponse.GroupType.NETWORK,
|
||||||
|
sort = UserTokensResponse.SortType.BALANCE,
|
||||||
|
tokens = emptyList(),
|
||||||
|
)
|
||||||
|
every {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
|
)
|
||||||
|
} returns defaultResponse
|
||||||
|
every { cryptoPortfolioConverter.convertListBack(accounts) } returns emptyList()
|
||||||
|
|
||||||
|
// Act
|
||||||
|
factory.create(userWalletId, null)
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
coVerifyOrder {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `create passes no extra blockchains when batch is not BB000053 even if toggle is on`() = runTest {
|
||||||
|
// Arrange
|
||||||
|
val userWallet = mockk<UserWallet.Cold>(relaxed = true) {
|
||||||
|
every { walletId } returns userWalletId
|
||||||
|
every { scanResponse.card.batchId } returns "AC000001"
|
||||||
|
}
|
||||||
|
|
||||||
|
every { userWalletsListRepository.userWallets } returns MutableStateFlow(listOf(userWallet))
|
||||||
|
every {
|
||||||
|
featureTogglesManager.isFeatureEnabled(FeatureToggles.AND_15402_ADI_MAIN_SCREEN_DEFAULT_ENABLED)
|
||||||
|
} returns true
|
||||||
|
|
||||||
|
val accounts = AccountList.empty(userWallet.walletId).accounts
|
||||||
|
.filterIsInstance<Account.CryptoPortfolio>()
|
||||||
|
val defaultResponse = UserTokensResponse(
|
||||||
|
group = UserTokensResponse.GroupType.NETWORK,
|
||||||
|
sort = UserTokensResponse.SortType.BALANCE,
|
||||||
|
tokens = emptyList(),
|
||||||
|
)
|
||||||
|
every {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
|
)
|
||||||
|
} returns defaultResponse
|
||||||
|
every { cryptoPortfolioConverter.convertListBack(accounts) } returns emptyList()
|
||||||
|
|
||||||
|
// Act
|
||||||
|
factory.create(userWalletId, null)
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
coVerifyOrder {
|
||||||
|
userTokensResponseFactory.createDefaultResponse(
|
||||||
|
userWallet = userWallet,
|
||||||
|
networkFactory = networkFactory,
|
||||||
|
accountId = accounts.first().accountId,
|
||||||
|
extraBlockchains = emptyList(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `create returns response with assigned tokens`() = runTest {
|
fun `create returns response with assigned tokens`() = runTest {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.tangem.data.common.currency
|
package com.tangem.data.common.currency
|
||||||
|
|
||||||
|
import com.tangem.blockchain.common.Blockchain
|
||||||
import com.tangem.blockchainsdk.utils.toCoinId
|
import com.tangem.blockchainsdk.utils.toCoinId
|
||||||
import com.tangem.blockchainsdk.utils.toNetworkId
|
import com.tangem.blockchainsdk.utils.toNetworkId
|
||||||
import com.tangem.data.common.network.NetworkFactory
|
import com.tangem.data.common.network.NetworkFactory
|
||||||
|
|
@ -54,9 +55,14 @@ class UserTokensResponseFactory @Inject constructor() {
|
||||||
userWallet: UserWallet?,
|
userWallet: UserWallet?,
|
||||||
networkFactory: NetworkFactory,
|
networkFactory: NetworkFactory,
|
||||||
accountId: AccountId?,
|
accountId: AccountId?,
|
||||||
|
extraBlockchains: List<Blockchain> = emptyList(),
|
||||||
): UserTokensResponse {
|
): UserTokensResponse {
|
||||||
val tokens = if (userWallet != null) {
|
val tokens = if (userWallet != null) {
|
||||||
getDefaultWalletBlockchains(userWallet = userWallet, demoConfig = DemoConfig)
|
getDefaultWalletBlockchains(
|
||||||
|
userWallet = userWallet,
|
||||||
|
demoConfig = DemoConfig,
|
||||||
|
extraBlockchains = extraBlockchains,
|
||||||
|
)
|
||||||
.map { blockchain ->
|
.map { blockchain ->
|
||||||
val derivationPath = networkFactory.createDerivationPath(
|
val derivationPath = networkFactory.createDerivationPath(
|
||||||
blockchain = blockchain,
|
blockchain = blockchain,
|
||||||
|
|
|
||||||
|
|
@ -375,6 +375,7 @@ class NetworkFactory @Inject constructor(
|
||||||
Blockchain.Linea, Blockchain.LineaTestnet,
|
Blockchain.Linea, Blockchain.LineaTestnet,
|
||||||
Blockchain.ArbitrumNova,
|
Blockchain.ArbitrumNova,
|
||||||
Blockchain.Plasma, Blockchain.PlasmaTestnet,
|
Blockchain.Plasma, Blockchain.PlasmaTestnet,
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet,
|
||||||
Blockchain.Monad, Blockchain.MonadTestnet,
|
Blockchain.Monad, Blockchain.MonadTestnet,
|
||||||
-> Network.TransactionExtrasType.NONE
|
-> Network.TransactionExtrasType.NONE
|
||||||
// endregion
|
// endregion
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,16 @@ import com.tangem.domain.models.wallet.UserWallet
|
||||||
/**
|
/**
|
||||||
* Returns the default blockchains for the multi-currency wallet.
|
* 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 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 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) {
|
return when (userWallet) {
|
||||||
is UserWallet.Cold -> {
|
is UserWallet.Cold -> {
|
||||||
val card = userWallet.scanResponse.card
|
val card = userWallet.scanResponse.card
|
||||||
|
|
@ -19,7 +25,7 @@ fun getDefaultWalletBlockchains(userWallet: UserWallet, demoConfig: DemoConfig):
|
||||||
var blockchainsInternal = if (demoConfig.isDemoCardId(card.cardId)) {
|
var blockchainsInternal = if (demoConfig.isDemoCardId(card.cardId)) {
|
||||||
demoConfig.getDemoBlockchains(card.cardId)
|
demoConfig.getDemoBlockchains(card.cardId)
|
||||||
} else {
|
} else {
|
||||||
listOf(Blockchain.Bitcoin, Blockchain.Ethereum)
|
listOf(Blockchain.Bitcoin, Blockchain.Ethereum) + extraBlockchains
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.isTestCard) {
|
if (card.isTestCard) {
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ public val Blockchain.mercuryoNetwork: String?
|
||||||
Blockchain.Linea, Blockchain.LineaTestnet -> null
|
Blockchain.Linea, Blockchain.LineaTestnet -> null
|
||||||
Blockchain.ArbitrumNova -> null
|
Blockchain.ArbitrumNova -> null
|
||||||
Blockchain.Plasma, Blockchain.PlasmaTestnet -> null
|
Blockchain.Plasma, Blockchain.PlasmaTestnet -> null
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet -> null
|
||||||
Blockchain.Monad, Blockchain.MonadTestnet -> null
|
Blockchain.Monad, Blockchain.MonadTestnet -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +65,9 @@ fun CardDTO.supportedBlockchains(
|
||||||
*/
|
*/
|
||||||
private fun CardDTO.isBlockchainUnsupported(blockchain: Blockchain): Boolean {
|
private fun CardDTO.isBlockchainUnsupported(blockchain: Blockchain): Boolean {
|
||||||
return when (blockchain) {
|
return when (blockchain) {
|
||||||
Blockchain.Quai, Blockchain.QuaiTestnet -> {
|
Blockchain.Quai, Blockchain.QuaiTestnet,
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet,
|
||||||
|
-> {
|
||||||
firmwareVersion <= FirmwareVersion.HDWalletAvailable
|
firmwareVersion <= FirmwareVersion.HDWalletAvailable
|
||||||
}
|
}
|
||||||
else -> false
|
else -> false
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,8 @@ data object Wallet2CardConfig : CardConfig {
|
||||||
Blockchain.ArbitrumNova -> EllipticCurve.Secp256k1
|
Blockchain.ArbitrumNova -> EllipticCurve.Secp256k1
|
||||||
Blockchain.Plasma -> EllipticCurve.Secp256k1
|
Blockchain.Plasma -> EllipticCurve.Secp256k1
|
||||||
Blockchain.PlasmaTestnet -> EllipticCurve.Secp256k1
|
Blockchain.PlasmaTestnet -> EllipticCurve.Secp256k1
|
||||||
|
Blockchain.Adi -> EllipticCurve.Secp256k1
|
||||||
|
Blockchain.AdiTestnet -> EllipticCurve.Secp256k1
|
||||||
Blockchain.Monad -> EllipticCurve.Secp256k1
|
Blockchain.Monad -> EllipticCurve.Secp256k1
|
||||||
Blockchain.MonadTestnet -> EllipticCurve.Secp256k1
|
Blockchain.MonadTestnet -> EllipticCurve.Secp256k1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,8 @@ class Wallet2CardConfigTest {
|
||||||
Blockchain.ArbitrumNova to EllipticCurve.Secp256k1,
|
Blockchain.ArbitrumNova to EllipticCurve.Secp256k1,
|
||||||
Blockchain.Plasma to EllipticCurve.Secp256k1,
|
Blockchain.Plasma to EllipticCurve.Secp256k1,
|
||||||
Blockchain.PlasmaTestnet to EllipticCurve.Secp256k1,
|
Blockchain.PlasmaTestnet to EllipticCurve.Secp256k1,
|
||||||
|
Blockchain.Adi to EllipticCurve.Secp256k1,
|
||||||
|
Blockchain.AdiTestnet to EllipticCurve.Secp256k1,
|
||||||
Blockchain.Monad to EllipticCurve.Secp256k1,
|
Blockchain.Monad to EllipticCurve.Secp256k1,
|
||||||
Blockchain.MonadTestnet to EllipticCurve.Secp256k1,
|
Blockchain.MonadTestnet to EllipticCurve.Secp256k1,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
# https://github.com/tangem/tangem-sdk-android/
|
# https://github.com/tangem/tangem-sdk-android/
|
||||||
# https://github.com/tangem/vico
|
# https://github.com/tangem/vico
|
||||||
|
|
||||||
tangemBlockchainSdk = "develop-1520"
|
tangemBlockchainSdk = "develop-1527"
|
||||||
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
|
||||||
tangemCardSdk = "develop-614"
|
tangemCardSdk = "develop-614"
|
||||||
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? {
|
||||||
"arbitrum-nova" -> Blockchain.ArbitrumNova
|
"arbitrum-nova" -> Blockchain.ArbitrumNova
|
||||||
"plasma" -> Blockchain.Plasma
|
"plasma" -> Blockchain.Plasma
|
||||||
"plasma/test" -> Blockchain.PlasmaTestnet
|
"plasma/test" -> Blockchain.PlasmaTestnet
|
||||||
|
"adi-token" -> Blockchain.Adi
|
||||||
|
"adi-token/test" -> Blockchain.AdiTestnet
|
||||||
"monad" -> Blockchain.Monad
|
"monad" -> Blockchain.Monad
|
||||||
"monad/test" -> Blockchain.MonadTestnet
|
"monad/test" -> Blockchain.MonadTestnet
|
||||||
else -> null
|
else -> null
|
||||||
|
|
@ -347,6 +349,8 @@ fun Blockchain.toNetworkId(): String {
|
||||||
Blockchain.ArbitrumNova -> "arbitrum-nova"
|
Blockchain.ArbitrumNova -> "arbitrum-nova"
|
||||||
Blockchain.Plasma -> "plasma"
|
Blockchain.Plasma -> "plasma"
|
||||||
Blockchain.PlasmaTestnet -> "plasma/test"
|
Blockchain.PlasmaTestnet -> "plasma/test"
|
||||||
|
Blockchain.Adi -> "adi-token"
|
||||||
|
Blockchain.AdiTestnet -> "adi-token/test"
|
||||||
Blockchain.Monad -> "monad"
|
Blockchain.Monad -> "monad"
|
||||||
Blockchain.MonadTestnet -> "monad/test"
|
Blockchain.MonadTestnet -> "monad/test"
|
||||||
}
|
}
|
||||||
|
|
@ -457,6 +461,7 @@ fun Blockchain.toCoinId(): String {
|
||||||
Blockchain.Linea, Blockchain.LineaTestnet -> "linea-ethereum"
|
Blockchain.Linea, Blockchain.LineaTestnet -> "linea-ethereum"
|
||||||
Blockchain.ArbitrumNova -> "arbitrum-nova-ethereum"
|
Blockchain.ArbitrumNova -> "arbitrum-nova-ethereum"
|
||||||
Blockchain.Plasma, Blockchain.PlasmaTestnet -> "plasma"
|
Blockchain.Plasma, Blockchain.PlasmaTestnet -> "plasma"
|
||||||
|
Blockchain.Adi, Blockchain.AdiTestnet -> "adi-token"
|
||||||
Blockchain.Monad, Blockchain.MonadTestnet -> "monad"
|
Blockchain.Monad, Blockchain.MonadTestnet -> "monad"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,7 @@ class AccountNodeRecognizer(private val blockchain: Blockchain) {
|
||||||
Blockchain.ArbitrumNova,
|
Blockchain.ArbitrumNova,
|
||||||
Blockchain.Quai,
|
Blockchain.Quai,
|
||||||
Blockchain.Plasma,
|
Blockchain.Plasma,
|
||||||
|
Blockchain.Adi,
|
||||||
Blockchain.Monad,
|
Blockchain.Monad,
|
||||||
-> true
|
-> true
|
||||||
Blockchain.Nexa, // unsupported network
|
Blockchain.Nexa, // unsupported network
|
||||||
|
|
@ -253,6 +254,7 @@ class AccountNodeRecognizer(private val blockchain: Blockchain) {
|
||||||
Blockchain.QuaiTestnet,
|
Blockchain.QuaiTestnet,
|
||||||
Blockchain.LineaTestnet,
|
Blockchain.LineaTestnet,
|
||||||
Blockchain.PlasmaTestnet,
|
Blockchain.PlasmaTestnet,
|
||||||
|
Blockchain.AdiTestnet,
|
||||||
Blockchain.MonadTestnet,
|
Blockchain.MonadTestnet,
|
||||||
-> false
|
-> false
|
||||||
// endregion
|
// endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue