Updated on 2026-08-14
This commit is contained in:
parent
99f62f79ee
commit
cb50b7cf07
15 changed files with 162 additions and 124 deletions
|
|
@ -0,0 +1,121 @@
|
|||
package com.tangem.blockchainsdk.models
|
||||
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import java.math.BigDecimal
|
||||
|
||||
/** Result of updating wallet manager */
|
||||
sealed class UpdateWalletManagerResult {
|
||||
|
||||
/** Missed derivation */
|
||||
data object MissedDerivation : UpdateWalletManagerResult()
|
||||
|
||||
/**
|
||||
* Unreachable result.
|
||||
* [selectedAddress] and [addresses] can be null if error is happened while getting available addresses.
|
||||
*
|
||||
* @property selectedAddress selected address
|
||||
* @property addresses available addresses
|
||||
*/
|
||||
data class Unreachable(
|
||||
val selectedAddress: String? = null,
|
||||
val addresses: Set<Address>? = null,
|
||||
) : UpdateWalletManagerResult()
|
||||
|
||||
/**
|
||||
* Verified
|
||||
*
|
||||
* @property selectedAddress selected address
|
||||
* @property addresses available addresses
|
||||
* @property currenciesAmounts amounts of added crypto currencies
|
||||
* @property currentTransactions current transactions
|
||||
*/
|
||||
data class Verified(
|
||||
val selectedAddress: String,
|
||||
val addresses: Set<Address>,
|
||||
val currenciesAmounts: Set<CryptoCurrencyAmount>,
|
||||
val currentTransactions: Set<CryptoCurrencyTransaction>,
|
||||
) : UpdateWalletManagerResult()
|
||||
|
||||
/**
|
||||
* No account
|
||||
*
|
||||
* @property selectedAddress selected address
|
||||
* @property addresses available addresses
|
||||
* @property amountToCreateAccount required amount to create account
|
||||
* @property errorMessage error message
|
||||
*/
|
||||
data class NoAccount(
|
||||
val selectedAddress: String,
|
||||
val addresses: Set<Address>,
|
||||
val amountToCreateAccount: BigDecimal,
|
||||
val errorMessage: String,
|
||||
) : UpdateWalletManagerResult()
|
||||
|
||||
/** Crypto currency amount */
|
||||
sealed interface CryptoCurrencyAmount {
|
||||
|
||||
/** Represents amount as [BigDecimal] */
|
||||
val value: BigDecimal
|
||||
|
||||
/**
|
||||
* Coin
|
||||
*
|
||||
* @property value amount value
|
||||
*/
|
||||
data class Coin(override val value: BigDecimal) : CryptoCurrencyAmount
|
||||
|
||||
/**
|
||||
* Token
|
||||
*
|
||||
* @property currencyRawId crypto currency id
|
||||
* @property contractAddress token contract address
|
||||
* @property value amount value
|
||||
*/
|
||||
data class Token(
|
||||
override val value: BigDecimal,
|
||||
val currencyRawId: CryptoCurrency.RawID?,
|
||||
val contractAddress: String,
|
||||
) : CryptoCurrencyAmount
|
||||
}
|
||||
|
||||
/** Crypto currency transaction */
|
||||
sealed interface CryptoCurrencyTransaction {
|
||||
|
||||
/** Transaction info */
|
||||
val txInfo: TxInfo
|
||||
|
||||
/**
|
||||
* Coin
|
||||
*
|
||||
* @property txInfo transaction info
|
||||
*/
|
||||
data class Coin(override val txInfo: TxInfo) : CryptoCurrencyTransaction
|
||||
|
||||
/**
|
||||
* Token
|
||||
*
|
||||
* @property txInfo transaction info
|
||||
* @property tokenId token unique identifier
|
||||
* @property contractAddress token contract address
|
||||
*/
|
||||
data class Token(
|
||||
override val txInfo: TxInfo,
|
||||
val tokenId: String?,
|
||||
val contractAddress: String,
|
||||
) : CryptoCurrencyTransaction
|
||||
}
|
||||
|
||||
/**
|
||||
* Address
|
||||
*
|
||||
* @property value string representation of the address
|
||||
* @property type address type
|
||||
*/
|
||||
data class Address(val value: String, val type: Type) {
|
||||
|
||||
enum class Type {
|
||||
Primary, Secondary,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue