Updated on 2026-08-14

This commit is contained in:
Tangem 2023-09-15 15:59:45 +08:00
parent ae2edc7fbf
commit 7cdf385873
16 changed files with 143 additions and 102 deletions

View file

@ -1,34 +1,37 @@
package com.tangem.domain.wallets.models
import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse
/**
* Represents user's wallet which stored in app persistence
* @param name User wallet name
* @param walletId User wallet [UserWalletId]
* @param artworkUrl User wallet card artwork URL
* @param cardsInWallet List of cards IDs assigned with this user's wallet
* @param isMultiCurrency Indicates whether this user wallet can work with more than one currency
* @param scanResponse [ScanResponse] of primary user's wallet card.
* TODO: Replace with [com.tangem.domain.common.CardDTO]
* @property cardId ID of user's wallet primary card
* @property hasAccessCode Indicates if the user's wallet primary card has access code
* @property isLocked Indicates if this primary card has no currency wallets
* */
*
* @property name User wallet name
* @property walletId User wallet [UserWalletId]
* @property artworkUrl User wallet card artwork URL
* @property cardsInWallet List of cards IDs assigned with this user's wallet. The list will be empty if the wallet
* has been backed up on another device.
* @property isMultiCurrency Indicates whether this user wallet can work with more than one currency
* @property scanResponse [ScanResponse] of primary user's wallet card.
*/
data class UserWallet(
val name: String,
val walletId: UserWalletId,
val artworkUrl: String,
val cardsInWallet: Set<String>,
val isMultiCurrency: Boolean,
val scanResponse: ScanResponse,
val scanResponse: ScanResponse, // TODO: Replace with [com.tangem.domain.models.scan.CardDTO]
) {
val cardId: String
get() = scanResponse.card.cardId
val hasAccessCode: Boolean
get() = scanResponse.card.isAccessCodeSet
/** ID of user's wallet primary card */
val cardId: String get() = scanResponse.card.cardId
val isLocked: Boolean
get() = scanResponse.card.wallets.isEmpty()
/** Indicates if the user's wallet primary card has access code */
val hasAccessCode: Boolean get() = scanResponse.card.isAccessCodeSet
/** Indicates if this primary card has no currency wallets */
val isLocked: Boolean get() = scanResponse.card.wallets.isEmpty()
/** Indicated if this primary card is imported */
val isImported: Boolean get() = scanResponse.card.wallets.any(CardDTO.Wallet::isImported)
}