Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-10 13:26:27 +04:00
parent 799a38655e
commit 4570bc334c
54 changed files with 178 additions and 183 deletions

View file

@ -80,7 +80,7 @@ class ArchiveCryptoPortfolioUseCase(
val hasNotReferralToken = statuses.none { status ->
val currency = status.currency
currency.network.backendId == referralToken.networkId &&
currency.network.rawId == referralToken.networkId &&
(currency as? CryptoCurrency.Token)?.contractAddress == referralToken.contractAddress &&
status.value.networkAddress?.availableAddresses?.any { it.value == address } == true
}

View file

@ -168,7 +168,7 @@ class ManageCryptoCurrenciesUseCase(
val foundToken = accountStatus.tokenList.flattenCurrencies()
.mapNotNull { it.currency as? CryptoCurrency.Token }
.firstOrNull { token ->
token.network.backendId == networkId &&
token.network.rawId == networkId &&
!token.isCustom &&
token.contractAddress.equals(contractAddress, true)
}
@ -361,7 +361,7 @@ class ManageCryptoCurrenciesUseCase(
launch {
val assetIds = currencies.mapTo(hashSetOf()) { currency ->
ExpressAsset.ID(
networkId = currency.network.backendId,
networkId = currency.network.rawId,
contractAddress = (currency as? CryptoCurrency.Token)?.contractAddress,
)
}
@ -388,19 +388,19 @@ class ManageCryptoCurrenciesUseCase(
) {
constructor(network: Network) : this(
networkId = network.backendId,
networkId = network.rawId,
derivationPath = network.derivationPath,
contractAddress = null,
)
constructor(currency: CryptoCurrency) : this(
networkId = currency.network.backendId,
networkId = currency.network.rawId,
derivationPath = currency.network.derivationPath,
contractAddress = (currency as? CryptoCurrency.Token)?.contractAddress,
)
constructor(status: CryptoCurrencyStatus) : this(
networkId = status.currency.network.backendId,
networkId = status.currency.network.rawId,
derivationPath = status.currency.network.derivationPath,
contractAddress = (status.currency as? CryptoCurrency.Token)?.contractAddress,
)

View file

@ -143,7 +143,7 @@ class ArchiveCryptoPortfolioUseCaseTest {
val defaultAddress = "0xABC"
val cryptoCurrency = mockk<CryptoCurrency.Token> {
every { this@mockk.network.backendId } returns token.networkId
every { this@mockk.network.rawId } returns token.networkId
every { this@mockk.contractAddress } returns token.contractAddress!!
}