Updated on 2026-08-14
This commit is contained in:
parent
185fffe11c
commit
8176ce8032
9 changed files with 45 additions and 24 deletions
|
|
@ -93,7 +93,7 @@ dependencies {
|
|||
implementation 'com.google.android.play:core-ktx:1.8.1'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
|
||||
implementation 'com.tangem:blockchain:develop-83'
|
||||
implementation 'com.tangem:blockchain:develop-84'
|
||||
// implementation 'com.tangem:blockchain:0.0.1'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-142'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-142'
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 64ae04d2086e5a605dd4da3cba4af32a60d46c79
|
||||
Subproject commit 7f058ec409b4eaaf8688ecd4bf944ef8d58d3564
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ dependencies {
|
|||
implementation implementation(project(path: ':network'))
|
||||
implementation implementation(project(path: ':common'))
|
||||
|
||||
implementation 'com.tangem:blockchain:develop-83'
|
||||
implementation 'com.tangem:blockchain:develop-84'
|
||||
// implementation 'com.tangem:blockchain:0.0.1'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:core:develop-142'
|
||||
implementation 'com.tangem.tangem-sdk-kotlin:android:develop-142'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.tangem.domain.common.extensions
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
|
||||
suspend fun TangemTechService.getTokens(
|
||||
contractAddress: String,
|
||||
networkId: String? = null,
|
||||
active: Boolean? = null,
|
||||
): Result<CoinsResponse> = coins(
|
||||
contractAddress = contractAddress,
|
||||
networkIds = networkId,
|
||||
active = active
|
||||
)
|
||||
|
||||
suspend fun TangemTechService.getListOfCoins(
|
||||
networkIds: List<String>,
|
||||
searchText: String? = null,
|
||||
offset: Int? = null,
|
||||
limit: Int? = null
|
||||
): Result<CoinsResponse> = coins(
|
||||
networkIds = networkIds.joinToString(","),
|
||||
searchText = searchText,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
)
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.domain.features.addCustomToken
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.getTokens
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
|
||||
|
|
|
|||
|
|
@ -18,29 +18,19 @@ class TangemTechService {
|
|||
|
||||
private var api: TangemTechApi = createApi()
|
||||
|
||||
suspend fun getTokens(
|
||||
contractAddress: String,
|
||||
networkId: String? = null,
|
||||
suspend fun coins(
|
||||
contractAddress: String? = null,
|
||||
networkIds: String? = null,
|
||||
active: Boolean? = null,
|
||||
): Result<CoinsResponse> = withContext(Dispatchers.IO) {
|
||||
performRequest {
|
||||
api.coins(
|
||||
contractAddress = contractAddress,
|
||||
networkIds = networkId,
|
||||
active = active
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getListOfCoins(
|
||||
networkIds: List<String>,
|
||||
searchText: String? = null,
|
||||
offset: Int? = null,
|
||||
limit: Int? = null
|
||||
): Result<CoinsResponse> = withContext(Dispatchers.IO) {
|
||||
performRequest {
|
||||
api.coins(
|
||||
networkIds = networkIds.joinToString(","),
|
||||
contractAddress = contractAddress,
|
||||
networkIds = networkIds,
|
||||
active = active,
|
||||
searchText = searchText,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue