Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-29 13:56:15 +04:00
parent df186a5f5d
commit 86b040e421
4 changed files with 20 additions and 0 deletions

View file

@ -18,6 +18,8 @@ import kotlinx.serialization.Serializable
* @property userWalletId the user wallet id associated with the account list
* @property accounts a list of accounts belonging to the user wallet
* @property totalAccounts the total number of accounts
* @property sortType the sorting type applied to the accounts
* @property groupType the grouping type applied to the accounts
*
[REDACTED_AUTHOR]
*/

View file

@ -1,5 +1,7 @@
package com.tangem.domain.account.models
import com.tangem.domain.models.TokensGroupType
import com.tangem.domain.models.TokensSortType
import com.tangem.domain.models.TotalFiatBalance
import com.tangem.domain.models.account.AccountStatus
import com.tangem.domain.models.currency.CryptoCurrencyStatus
@ -13,6 +15,8 @@ import kotlinx.serialization.Serializable
* @property accountStatuses a set of account statuses associated with the user wallet
* @property totalAccounts the total number of accounts (including archived ones)
* @property totalFiatBalance the total fiat balance across all accounts
* @property sortType the sorting type applied to the accounts
* @property groupType the grouping type applied to the accounts
*
[REDACTED_AUTHOR]
*/
@ -22,6 +26,8 @@ data class AccountStatusList(
val accountStatuses: List<AccountStatus>,
val totalAccounts: Int,
val totalFiatBalance: TotalFiatBalance,
val sortType: TokensSortType,
val groupType: TokensGroupType,
) {
val mainAccount: AccountStatus

View file

@ -86,6 +86,8 @@ internal class DefaultSingleAccountStatusListProducer @AssistedInject constructo
accountStatuses = accountStatuses.toList(),
totalAccounts = accountList.totalAccounts,
totalFiatBalance = TotalFiatBalanceCalculator.calculate(balances),
sortType = accountList.sortType,
groupType = accountList.groupType,
)
}
}

View file

@ -84,6 +84,8 @@ class DefaultSingleAccountStatusListProducerTest {
),
totalAccounts = 1,
totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL),
sortType = accountList.sortType,
groupType = accountList.groupType,
)
Truth.assertThat(actual).containsExactly(expected)
@ -119,6 +121,8 @@ class DefaultSingleAccountStatusListProducerTest {
),
totalAccounts = 1,
totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL),
sortType = accountList.sortType,
groupType = accountList.groupType,
)
Truth.assertThat(actual1).containsExactly(expected)
@ -138,6 +142,8 @@ class DefaultSingleAccountStatusListProducerTest {
),
totalAccounts = 1,
totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL),
sortType = updatedAccountList.sortType,
groupType = updatedAccountList.groupType,
)
Truth.assertThat(actual2).containsExactly(expected2)
@ -168,6 +174,8 @@ class DefaultSingleAccountStatusListProducerTest {
),
totalAccounts = 1,
totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL),
sortType = accountList.sortType,
groupType = accountList.groupType,
)
// Act (first emission)
@ -239,6 +247,8 @@ class DefaultSingleAccountStatusListProducerTest {
),
totalAccounts = 1,
totalFiatBalance = TotalFiatBalance.Loading,
sortType = accountList.sortType,
groupType = accountList.groupType,
)
Truth.assertThat(actual).containsExactly(expected)