Updated on 2026-08-14
This commit is contained in:
parent
99f62f79ee
commit
cb50b7cf07
15 changed files with 162 additions and 124 deletions
|
|
@ -1,10 +1,8 @@
|
|||
package com.tangem.common.test.domain.walletmanager
|
||||
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.*
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyAmount
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyTransaction
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
|
|
@ -13,18 +11,18 @@ import java.math.BigDecimal
|
|||
class MockUpdateWalletManagerResultFactory {
|
||||
|
||||
fun createUnreachable(): UpdateWalletManagerResult {
|
||||
return UpdateWalletManagerResult.Unreachable(selectedAddress = null, addresses = null)
|
||||
return Unreachable(selectedAddress = null, addresses = null)
|
||||
}
|
||||
|
||||
fun createUnreachableWithAddress(): UpdateWalletManagerResult {
|
||||
return UpdateWalletManagerResult.Unreachable(
|
||||
return Unreachable(
|
||||
selectedAddress = "0x1",
|
||||
addresses = setOf(Address(value = "0x1", type = Address.Type.Primary)),
|
||||
)
|
||||
}
|
||||
|
||||
fun createNoAccount(): UpdateWalletManagerResult {
|
||||
return UpdateWalletManagerResult.NoAccount(
|
||||
return NoAccount(
|
||||
selectedAddress = "0x1",
|
||||
addresses = setOf(Address(value = "0x1", type = Address.Type.Primary)),
|
||||
amountToCreateAccount = BigDecimal.ONE,
|
||||
|
|
@ -33,15 +31,13 @@ class MockUpdateWalletManagerResultFactory {
|
|||
}
|
||||
|
||||
fun createVerified(): UpdateWalletManagerResult {
|
||||
return UpdateWalletManagerResult.Verified(
|
||||
return Verified(
|
||||
selectedAddress = "0x1",
|
||||
addresses = setOf(Address(value = "0x1", type = Address.Type.Primary)),
|
||||
currenciesAmounts = setOf(
|
||||
CryptoCurrencyAmount.Coin(value = BigDecimal.ONE),
|
||||
),
|
||||
currentTransactions = setOf(
|
||||
CryptoCurrencyTransaction.Coin(txInfo),
|
||||
),
|
||||
currentTransactions = setOf(CryptoCurrencyTransaction.Coin(txInfo)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
package com.tangem.data.networks.utils
|
||||
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.*
|
||||
import com.tangem.domain.models.StatusSource
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.network.NetworkAddress
|
||||
import com.tangem.domain.models.network.NetworkStatus
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyAmount
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyTransaction
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import timber.log.Timber
|
||||
|
||||
/** Factory for creating [NetworkStatus] */
|
||||
|
|
@ -30,17 +28,17 @@ object NetworkStatusFactory {
|
|||
return NetworkStatus(
|
||||
network = network,
|
||||
value = when (updatingResult) {
|
||||
is UpdateWalletManagerResult.MissedDerivation -> NetworkStatus.MissedDerivation
|
||||
is UpdateWalletManagerResult.Unreachable -> createUnreachableStatus(result = updatingResult)
|
||||
is UpdateWalletManagerResult.NoAccount -> createNoAccount(result = updatingResult)
|
||||
is UpdateWalletManagerResult.Verified -> {
|
||||
is MissedDerivation -> NetworkStatus.MissedDerivation
|
||||
is Unreachable -> createUnreachableStatus(result = updatingResult)
|
||||
is NoAccount -> createNoAccount(result = updatingResult)
|
||||
is Verified -> {
|
||||
createVerifiedStatus(result = updatingResult, addedCurrencies = addedCurrencies)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun createUnreachableStatus(result: UpdateWalletManagerResult.Unreachable): NetworkStatus.Unreachable {
|
||||
private fun createUnreachableStatus(result: Unreachable): NetworkStatus.Unreachable {
|
||||
return NetworkStatus.Unreachable(
|
||||
address = getNetworkAddressOrNull(
|
||||
selectedAddress = result.selectedAddress,
|
||||
|
|
@ -49,7 +47,7 @@ object NetworkStatusFactory {
|
|||
)
|
||||
}
|
||||
|
||||
private fun createNoAccount(result: UpdateWalletManagerResult.NoAccount): NetworkStatus.NoAccount {
|
||||
private fun createNoAccount(result: NoAccount): NetworkStatus.NoAccount {
|
||||
return NetworkStatus.NoAccount(
|
||||
address = getNetworkAddress(
|
||||
selectedAddress = result.selectedAddress,
|
||||
|
|
@ -61,10 +59,7 @@ object NetworkStatusFactory {
|
|||
)
|
||||
}
|
||||
|
||||
private fun createVerifiedStatus(
|
||||
result: UpdateWalletManagerResult.Verified,
|
||||
addedCurrencies: Set<CryptoCurrency>,
|
||||
): NetworkStatus.Verified {
|
||||
private fun createVerifiedStatus(result: Verified, addedCurrencies: Set<CryptoCurrency>): NetworkStatus.Verified {
|
||||
return NetworkStatus.Verified(
|
||||
address = getNetworkAddress(
|
||||
selectedAddress = result.selectedAddress,
|
||||
|
|
@ -97,8 +92,8 @@ object NetworkStatusFactory {
|
|||
is CryptoCurrency.Token -> {
|
||||
amounts.firstOrNull { amount ->
|
||||
amount is CryptoCurrencyAmount.Token &&
|
||||
currency.id.rawCurrencyId == amount.tokenId &&
|
||||
currency.contractAddress.equals(amount.tokenContractAddress, ignoreCase = true)
|
||||
currency.id.rawCurrencyId == amount.currencyRawId &&
|
||||
currency.contractAddress.equals(amount.contractAddress, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +122,7 @@ object NetworkStatusFactory {
|
|||
}
|
||||
is CryptoCurrency.Token -> transactions.filterTo(hashSetOf()) { transaction ->
|
||||
transaction is CryptoCurrencyTransaction.Token &&
|
||||
transaction.tokenContractAddress.equals(currency.contractAddress, ignoreCase = true)
|
||||
transaction.contractAddress.equals(currency.contractAddress, ignoreCase = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.data.networks.fetcher
|
|||
import arrow.core.Either
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.common.test.domain.network.MockNetworkStatusFactory
|
||||
import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
|
||||
import com.tangem.common.test.domain.walletmanager.MockUpdateWalletManagerResultFactory
|
||||
|
|
@ -14,7 +15,6 @@ import com.tangem.domain.models.currency.CryptoCurrency
|
|||
import com.tangem.domain.models.network.NetworkAddress
|
||||
import com.tangem.domain.models.network.NetworkStatus
|
||||
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
||||
import io.mockk.*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.data.networks.repository
|
||||
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
|
||||
import com.tangem.common.test.domain.walletmanager.MockUpdateWalletManagerResultFactory
|
||||
import com.tangem.data.common.currency.CardCryptoCurrencyFactory
|
||||
|
|
@ -10,7 +11,6 @@ import com.tangem.data.networks.utils.NetworkStatusFactory
|
|||
import com.tangem.domain.models.network.CryptoCurrencyAddress
|
||||
import com.tangem.domain.models.network.NetworkStatus
|
||||
import com.tangem.domain.walletmanager.WalletManagersFacade
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
||||
import io.mockk.*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.tangem.data.networks.utils
|
|||
|
||||
import com.google.common.truth.Truth
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address
|
||||
import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
|
||||
import com.tangem.common.test.domain.walletmanager.MockUpdateWalletManagerResultFactory
|
||||
import com.tangem.domain.models.StatusSource
|
||||
|
|
@ -11,8 +13,6 @@ import com.tangem.domain.models.network.NetworkAddress
|
|||
import com.tangem.domain.models.network.NetworkStatus
|
||||
import com.tangem.domain.models.network.NetworkStatus.Amount
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.tangem.blockchain.nft.models.NFTAsset
|
|||
import com.tangem.blockchain.nft.models.NFTCollection
|
||||
import com.tangem.blockchain.transactionhistory.models.TransactionHistoryRequest
|
||||
import com.tangem.blockchainsdk.BlockchainSDKFactory
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.crypto.hdWallet.DerivationPath
|
||||
import com.tangem.datasource.asset.loader.AssetLoader
|
||||
|
|
@ -36,7 +37,6 @@ import com.tangem.domain.txhistory.models.TxHistoryState
|
|||
import com.tangem.domain.walletmanager.model.RentData
|
||||
import com.tangem.domain.walletmanager.model.SmartContractMethod
|
||||
import com.tangem.domain.walletmanager.model.TokenInfo
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import com.tangem.domain.walletmanager.utils.*
|
||||
import com.tangem.domain.walletmanager.utils.WalletManagerFactory
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.tangem.blockchain.extensions.Result
|
|||
import com.tangem.blockchain.extensions.SimpleResult
|
||||
import com.tangem.blockchain.nft.models.NFTAsset
|
||||
import com.tangem.blockchain.nft.models.NFTCollection
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
|
|
@ -20,7 +21,6 @@ import com.tangem.domain.txhistory.models.PaginationWrapper
|
|||
import com.tangem.domain.txhistory.models.TxHistoryState
|
||||
import com.tangem.domain.walletmanager.model.RentData
|
||||
import com.tangem.domain.walletmanager.model.TokenInfo
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import java.math.BigDecimal
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
package com.tangem.domain.walletmanager.model
|
||||
|
||||
data class Address(
|
||||
val value: String,
|
||||
val type: Type,
|
||||
) {
|
||||
|
||||
enum class Type {
|
||||
Primary, Secondary,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.tangem.domain.walletmanager.model
|
||||
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import java.math.BigDecimal
|
||||
|
||||
sealed class CryptoCurrencyAmount {
|
||||
|
||||
abstract val value: BigDecimal
|
||||
|
||||
data class Coin(override val value: BigDecimal) : CryptoCurrencyAmount()
|
||||
|
||||
data class Token(
|
||||
val tokenId: CryptoCurrency.RawID?,
|
||||
val tokenContractAddress: String,
|
||||
override val value: BigDecimal,
|
||||
) : CryptoCurrencyAmount()
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.tangem.domain.walletmanager.model
|
||||
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
|
||||
// TODO: [REDACTED_JIRA] move to txhistory module
|
||||
sealed class CryptoCurrencyTransaction {
|
||||
|
||||
abstract val txInfo: TxInfo
|
||||
|
||||
data class Coin(override val txInfo: TxInfo) : CryptoCurrencyTransaction()
|
||||
|
||||
data class Token(
|
||||
val tokenId: String?,
|
||||
val tokenContractAddress: String,
|
||||
override val txInfo: TxInfo,
|
||||
) : CryptoCurrencyTransaction()
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.tangem.domain.walletmanager.model
|
||||
|
||||
import java.math.BigDecimal
|
||||
|
||||
sealed class UpdateWalletManagerResult {
|
||||
|
||||
data object MissedDerivation : UpdateWalletManagerResult()
|
||||
|
||||
data class Unreachable(
|
||||
val selectedAddress: String? = null,
|
||||
val addresses: Set<Address>? = null,
|
||||
) : UpdateWalletManagerResult()
|
||||
|
||||
data class Verified(
|
||||
val selectedAddress: String,
|
||||
val addresses: Set<Address>,
|
||||
val currenciesAmounts: Set<CryptoCurrencyAmount>,
|
||||
val currentTransactions: Set<CryptoCurrencyTransaction>,
|
||||
) : UpdateWalletManagerResult()
|
||||
|
||||
data class NoAccount(
|
||||
val selectedAddress: String,
|
||||
val addresses: Set<Address>,
|
||||
val amountToCreateAccount: BigDecimal,
|
||||
val errorMessage: String,
|
||||
) : UpdateWalletManagerResult()
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.tangem.domain.walletmanager.utils
|
||||
|
||||
import com.tangem.blockchain.common.address.AddressType
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address
|
||||
import com.tangem.utils.converter.Converter
|
||||
import com.tangem.blockchain.common.address.Address as SdkAddress
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.domain.walletmanager.utils
|
||||
|
||||
import com.tangem.blockchain.common.*
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.Address
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.utils.converter.Converter
|
||||
import timber.log.Timber
|
||||
import java.math.BigDecimal
|
||||
|
|
|
|||
|
|
@ -1,25 +1,23 @@
|
|||
package com.tangem.domain.walletmanager.utils
|
||||
|
||||
import com.tangem.blockchain.common.*
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult
|
||||
import com.tangem.blockchainsdk.models.UpdateWalletManagerResult.*
|
||||
import com.tangem.blockchainsdk.utils.amountToCreateAccount
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.walletmanager.model.Address
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyAmount
|
||||
import com.tangem.domain.walletmanager.model.CryptoCurrencyTransaction
|
||||
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
|
||||
import timber.log.Timber
|
||||
import java.math.BigDecimal
|
||||
import com.tangem.blockchain.common.address.Address as SdkAddress
|
||||
|
||||
internal class UpdateWalletManagerResultFactory {
|
||||
|
||||
fun getResult(walletManager: WalletManager): UpdateWalletManagerResult.Verified {
|
||||
fun getResult(walletManager: WalletManager): Verified {
|
||||
val wallet = walletManager.wallet
|
||||
val addresses = getAvailableAddresses(wallet.addresses)
|
||||
val feePaidCurrency = wallet.blockchain.feePaidCurrency()
|
||||
val txHistoryItemConverter = TransactionDataToTxHistoryItemConverter(addresses, feePaidCurrency)
|
||||
|
||||
return UpdateWalletManagerResult.Verified(
|
||||
return Verified(
|
||||
selectedAddress = wallet.address,
|
||||
addresses = addresses,
|
||||
currenciesAmounts = getTokensAmounts(wallet.amounts.values.toSet()),
|
||||
|
|
@ -27,13 +25,13 @@ internal class UpdateWalletManagerResultFactory {
|
|||
)
|
||||
}
|
||||
|
||||
fun getDemoResult(walletManager: WalletManager, demoAmount: Amount): UpdateWalletManagerResult.Verified {
|
||||
fun getDemoResult(walletManager: WalletManager, demoAmount: Amount): Verified {
|
||||
val wallet = walletManager.wallet
|
||||
val addresses = getAvailableAddresses(wallet.addresses)
|
||||
val feePaidCurrency = wallet.blockchain.feePaidCurrency()
|
||||
val txHistoryItemConverter = TransactionDataToTxHistoryItemConverter(addresses, feePaidCurrency)
|
||||
|
||||
return UpdateWalletManagerResult.Verified(
|
||||
return Verified(
|
||||
selectedAddress = wallet.address,
|
||||
addresses = addresses,
|
||||
currenciesAmounts = getDemoTokensAmounts(demoAmount, walletManager.cardTokens),
|
||||
|
|
@ -53,12 +51,12 @@ internal class UpdateWalletManagerResultFactory {
|
|||
|
||||
return if (amount == null) {
|
||||
Timber.w("Unable to get required amount to create account for: $blockchain")
|
||||
UpdateWalletManagerResult.Unreachable(
|
||||
Unreachable(
|
||||
selectedAddress = wallet.address,
|
||||
addresses = getAvailableAddresses(wallet.addresses),
|
||||
)
|
||||
} else {
|
||||
UpdateWalletManagerResult.NoAccount(
|
||||
NoAccount(
|
||||
selectedAddress = wallet.address,
|
||||
addresses = getAvailableAddresses(wallet.addresses),
|
||||
amountToCreateAccount = amount,
|
||||
|
|
@ -70,7 +68,7 @@ internal class UpdateWalletManagerResultFactory {
|
|||
fun getUnreachableResult(walletManager: WalletManager): UpdateWalletManagerResult {
|
||||
val wallet = walletManager.wallet
|
||||
|
||||
return UpdateWalletManagerResult.Unreachable(
|
||||
return Unreachable(
|
||||
selectedAddress = wallet.address,
|
||||
addresses = getAvailableAddresses(wallet.addresses),
|
||||
)
|
||||
|
|
@ -86,8 +84,8 @@ internal class UpdateWalletManagerResultFactory {
|
|||
|
||||
return tokens.mapTo(demoAmounts) { token ->
|
||||
CryptoCurrencyAmount.Token(
|
||||
tokenId = token.id?.let { CryptoCurrency.RawID(it) },
|
||||
tokenContractAddress = token.contractAddress,
|
||||
currencyRawId = token.id?.let(CryptoCurrency::RawID),
|
||||
contractAddress = token.contractAddress,
|
||||
value = amountValue,
|
||||
)
|
||||
}
|
||||
|
|
@ -112,8 +110,8 @@ internal class UpdateWalletManagerResultFactory {
|
|||
private fun createCurrencyAmount(amount: Amount): CryptoCurrencyAmount? {
|
||||
return when (val type = amount.type) {
|
||||
is AmountType.Token -> CryptoCurrencyAmount.Token(
|
||||
tokenId = type.token.id?.let { CryptoCurrency.RawID(it) },
|
||||
tokenContractAddress = type.token.contractAddress,
|
||||
currencyRawId = type.token.id?.let(CryptoCurrency::RawID),
|
||||
contractAddress = type.token.contractAddress,
|
||||
value = getCurrencyAmountValue(amount) ?: return null,
|
||||
)
|
||||
is AmountType.Coin -> CryptoCurrencyAmount.Coin(
|
||||
|
|
@ -138,7 +136,7 @@ internal class UpdateWalletManagerResultFactory {
|
|||
val txHistoryItem = txHistoryItemConverter.convert(data) ?: return null
|
||||
CryptoCurrencyTransaction.Token(
|
||||
tokenId = type.token.id,
|
||||
tokenContractAddress = type.token.contractAddress,
|
||||
contractAddress = type.token.contractAddress,
|
||||
txInfo = txHistoryItem,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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