Updated on 2026-08-14
This commit is contained in:
parent
87c43ab20f
commit
8261e72fec
25 changed files with 269 additions and 48 deletions
|
|
@ -0,0 +1,16 @@
|
|||
package com.tangem.datasource.api.common
|
||||
|
||||
import com.squareup.moshi.FromJson
|
||||
import com.squareup.moshi.ToJson
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class BigDecimalAdapter {
|
||||
@FromJson
|
||||
fun fromJson(value: String) = BigDecimal(value)
|
||||
|
||||
@ToJson
|
||||
fun toJson(value: BigDecimal) = value.toString()
|
||||
}
|
||||
|
|
@ -15,7 +15,8 @@ class TangemTechService(
|
|||
private val logIsEnabled: Boolean = false,
|
||||
) {
|
||||
|
||||
private val headerInterceptors = mutableListOf<AddHeaderInterceptor>(
|
||||
private val
|
||||
headerInterceptors = mutableListOf<AddHeaderInterceptor>(
|
||||
CacheControlHttpInterceptor(cacheMaxAge),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.datasource.di
|
|||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
||||
import com.tangem.datasource.api.AuthHeaderInterceptor
|
||||
import com.tangem.datasource.api.common.BigDecimalAdapter
|
||||
import com.tangem.datasource.api.oneinch.OneInchApi
|
||||
import com.tangem.datasource.api.referral.ReferralApi
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
|
|
@ -27,7 +28,12 @@ class NetworkModule {
|
|||
fun provideTangemTechApi(okHttpClient: OkHttpClient): TangemTechApi {
|
||||
return Retrofit.Builder()
|
||||
.addConverterFactory(
|
||||
MoshiConverterFactory.create(),
|
||||
MoshiConverterFactory.create(
|
||||
Moshi.Builder()
|
||||
.add(KotlinJsonAdapterFactory())
|
||||
.add(BigDecimalAdapter())
|
||||
.build(),
|
||||
),
|
||||
)
|
||||
.baseUrl(DEV_TANGEM_TECH_BASE_URL)
|
||||
.client(okHttpClient)
|
||||
|
|
@ -80,6 +86,6 @@ class NetworkModule {
|
|||
private companion object {
|
||||
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 = ""
|
||||
const val ONE_INCH_ETHER_BASE_URL = "https://api.1inch.io/swagger/ethereum-json/"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue