Updated on 2026-08-14
This commit is contained in:
parent
185fffe11c
commit
8176ce8032
9 changed files with 45 additions and 24 deletions
|
|
@ -9,6 +9,7 @@ import com.tangem.blockchain.common.DerivationStyle
|
|||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.common.card.FirmwareVersion
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.getTokens
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.squareup.moshi.Json
|
|||
import com.squareup.moshi.JsonClass
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
|
||||
@Deprecated("The class is used only for migration from older versions of the app")
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class BlockchainDao(
|
||||
@Json(name = "key")
|
||||
|
|
@ -11,6 +12,7 @@ data class BlockchainDao(
|
|||
@Json(name = "testnet")
|
||||
val isTestNet: Boolean
|
||||
) {
|
||||
@Deprecated("The method is used only for migration from older versions of the app")
|
||||
fun toBlockchain(): Blockchain {
|
||||
val blockchain = Blockchain.values().find { it.name.lowercase() == name.lowercase() }
|
||||
?: throw Exception("Invalid BlockchainDao")
|
||||
|
|
@ -19,6 +21,7 @@ data class BlockchainDao(
|
|||
}
|
||||
|
||||
companion object {
|
||||
@Deprecated("The method is used only for migration from older versions of the app")
|
||||
fun fromBlockchain(blockchain: Blockchain): BlockchainDao {
|
||||
val name = blockchain.name.removeSuffix("Testnet").lowercase()
|
||||
return BlockchainDao(name, blockchain.isTestnet())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchain.common.WalletManager
|
||||
import com.tangem.common.card.Card
|
||||
import com.tangem.common.extensions.calculateHashCode
|
||||
import com.tangem.domain.common.TapWorkarounds.derivationStyle
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
@ -39,11 +40,9 @@ data class BlockchainNetwork(
|
|||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = blockchain.hashCode()
|
||||
result = 31 * result + (derivationPath?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
override fun hashCode(): Int = calculateHashCode(
|
||||
blockchain.hashCode(), derivationPath?.hashCode() ?: 0
|
||||
)
|
||||
|
||||
companion object {
|
||||
fun fromWalletManager(walletManager: WalletManager): BlockchainNetwork {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue