Updated on 2026-08-14
This commit is contained in:
parent
03e48b0929
commit
0bbfef1bc7
3 changed files with 22 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ sealed interface TangemTechResponse : HttpResponse
|
|||
data class CoinsResponse(
|
||||
val imageHost: String?,
|
||||
val coins: List<Coin>,
|
||||
val total: Int
|
||||
val total: Int,
|
||||
) : TangemTechResponse {
|
||||
|
||||
data class Coin(
|
||||
|
|
@ -19,13 +19,14 @@ data class CoinsResponse(
|
|||
val name: String,
|
||||
val symbol: String,
|
||||
val active: Boolean,
|
||||
val networks: List<Network> = listOf()
|
||||
val networks: List<Network> = listOf(),
|
||||
) : TangemTechResponse {
|
||||
|
||||
data class Network(
|
||||
val networkId: String,
|
||||
val contractAddress: String? = null,
|
||||
val decimalCount: BigDecimal? = null,
|
||||
val exchangeable: Boolean? = false,
|
||||
) : TangemTechResponse
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ interface TangemTechApi {
|
|||
@GET("coins")
|
||||
suspend fun coins(
|
||||
@Query("contractAddress") contractAddress: String? = null,
|
||||
@Query("exchangeable") exchangeable: Boolean? = false,
|
||||
@Query("networkIds") networkIds: String? = null,
|
||||
@Query("active") active: Boolean? = null,
|
||||
@Query("searchText") searchText: String? = null,
|
||||
@Query("offset") offset: Int? = null,
|
||||
@Query("limit") limit: Int? = null
|
||||
@Query("limit") limit: Int? = null,
|
||||
): CoinsResponse
|
||||
|
||||
@GET("rates")
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
|||
import com.tangem.datasource.api.AuthHeaderInterceptor
|
||||
import com.tangem.datasource.api.oneinch.OneInchApi
|
||||
import com.tangem.datasource.api.referral.ReferralApi
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.di.qualifiers.OneInchEthereum
|
||||
import com.tangem.lib.auth.AuthProvider
|
||||
import dagger.Module
|
||||
|
|
@ -21,6 +22,19 @@ import javax.inject.Singleton
|
|||
@InstallIn(SingletonComponent::class)
|
||||
class NetworkModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideTangemTechApi(okHttpClient: OkHttpClient): TangemTechApi {
|
||||
return Retrofit.Builder()
|
||||
.addConverterFactory(
|
||||
MoshiConverterFactory.create(),
|
||||
)
|
||||
.baseUrl(DEV_TANGEM_TECH_BASE_URL)
|
||||
.client(okHttpClient)
|
||||
.build()
|
||||
.create(TangemTechApi::class.java)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@OneInchEthereum
|
||||
|
|
@ -46,7 +60,7 @@ class NetworkModule {
|
|||
.build(),
|
||||
),
|
||||
)
|
||||
.baseUrl(PROD_REFERRAL_BASE_URL)
|
||||
.baseUrl(DEV_TANGEM_TECH_BASE_URL)
|
||||
.client(okHttpClient)
|
||||
.build()
|
||||
.create(ReferralApi::class.java)
|
||||
|
|
@ -64,7 +78,8 @@ class NetworkModule {
|
|||
}
|
||||
|
||||
private companion object {
|
||||
const val PROD_REFERRAL_BASE_URL = "https://devapi.tangem-tech.com/v1/"//"https://api.tangem-tech.com/v1/"
|
||||
const val PROD_TANGEM_TECH_BASE_URL = "https://api.tangem-tech.com/v1/"
|
||||
const val DEV_TANGEM_TECH_BASE_URL = "https://devapi.tangem-tech.com/v1/"
|
||||
const val ONE_INCH_ETHER_BASE_URL = ""
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue