diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 068d233a86..2203d4681a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.application) alias(deps.plugins.kotlin.android) @@ -232,6 +234,10 @@ dependencies { implementation(deps.walletConnectWeb3) implementation(deps.prettyLogger) + implementation(deps.moshi.kotlin) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) + /** Testing libraries */ testImplementation(deps.test.coroutine) testImplementation(deps.test.junit) @@ -249,6 +255,7 @@ dependencies { /** Chucker */ debugImplementation(deps.chucker) + debugPGImplementation(deps.chucker) mockedImplementation(deps.chuckerStub) externalImplementation(deps.chuckerStub) internalImplementation(deps.chuckerStub) @@ -270,5 +277,4 @@ dependencies { // excludes version 9999.0-empty-to-avoid-conflict-with-guava exclude(group = "com.google.guava", module = "listenablefuture") } - } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2f9dc5a47e..b6b4f80005 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,21 +1,182 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle.kts. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile +-flattenpackagehierarchy +-adaptclassstrings + +# firebase +-keep public class com.google.firebase.** { *; } +-keep class com.google.android.gms.internal.** { *; } +-keepclasseswithmembers class com.google.firebase.FirebaseException + +# hedera sdk +-keep class com.hedera.hashgraph.sdk.** { *; } +-keep interface com.hedera.hashgraph.sdk.** { *; } +-dontwarn com.esaulpaugh.headlong.** +-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings +-dontwarn io.grpc.stub.** + +# trustwallet sdk +-keep class wallet.core.jni.** { *; } + +# solana +-keep class org.p2p.solanaj.** { *; } + +# kethereum +-keep class org.kethereum.bip32.model.ExtendedKey** +-keepclassmembers class org.kethereum.bip32.model.ExtendedKey** { *; } + +# some crypto +-dontwarn net.i2p.crypto.** +-dontwarn java.net.http.** +-dontwarn lombok.** + +-keep class org.spongycastle.** { *; } + +-dontwarn org.apache.hc.core5.** +-dontwarn org.apache.hc.client5.** +-dontwarn org.apache.log4j.config.** + +-dontwarn javax.naming.** +-dontwarn javax.xml.stream.** +-dontwarn javax.script.** + +-dontwarn org.java_websocket.client.WebSocketClient +-dontwarn org.java_websocket.handshake.ServerHandshake + +-dontwarn aQute.bnd.annotation.spi.ServiceProvider + +-dontwarn org.threeten.bp.** +-keep class org.threeten.bp.* +-keepclassmembers class org.threeten.bp.** { *; } + +# joda time +# These aren't necessary if including joda-convert +-dontwarn org.joda.convert.FromString +-dontwarn org.joda.convert.ToString + +-keepnames class org.joda.** implements java.io.Serializable +-keepclassmembers class org.joda.** implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + !static !transient ; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} +# joda time + +# The name of @JsonClass types is used to look up the generated adapter. +-keepnames @com.squareup.moshi.JsonClass class * + +-keepclassmembers class * { + @com.squareup.moshi.FromJson ; + @com.squareup.moshi.ToJson ; +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class kotlin.Metadata { *; } +-keepclassmembers class kotlin.Metadata { + public ; +} + +# Proguard configuration for Jackson 2.x +-keep class com.fasterxml.** { *; } +-keep class com.fasterxml.jackson.databind.ObjectMapper { + public ; + protected ; +} +-keep class com.fasterxml.jackson.databind.ObjectWriter { + public ** writeValueAsString(**); +} +-keepnames class com.fasterxml.jackson.** { *; } +-dontwarn com.fasterxml.jackson.databind.** +-keep class * implements com.fasterxml.jackson.core.type.TypeReference + +-keep class kotlin.reflect.** +-keep public class kotlin.reflect.jvm.internal.impl.** { public *; } + +# Kotlin serialization looks up the generated serializer classes through a function on companion +# objects. The companions are looked up reflectively so we need to explicitly keep these functions. +-keepclasseswithmembers class **.*$Companion { + kotlinx.serialization.KSerializer serializer(...); +} +# If a companion has the serializer function, keep the companion field on the original type so that +# the reflective lookup succeeds. +-if class **.*$Companion { + kotlinx.serialization.KSerializer serializer(...); +} +-keepclassmembers class <1>.<2> { + <1>.<2>$Companion Companion; +} + +-keepnames class * implements android.os.Parcelable { + public static final ** CREATOR; +} +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-dontwarn okhttp3.** +-dontwarn okio.** + +# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and +# EnclosingMethod is required to use InnerClasses. +-keepattributes Signature, InnerClasses, EnclosingMethod, *Annotation*, Exceptions + +# Retrofit does reflection on method and parameter annotations. +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations + +# Keep annotation default values (e.g., retrofit2.http.Field.encoded). +-keepattributes AnnotationDefault + +# Retain service method parameters when optimizing. +-keepclassmembers,allowshrinking,allowobfuscation interface * { + @retrofit2.http.* ; +} + +-keepclasseswithmembers class * { + @retrofit2.http.* ; +} +-keepclassmembernames interface * { + @retrofit.http.* ; +} + +# Ignore annotation used for build tooling. +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement + +# Ignore JSR 305 annotations for embedding nullability information. +-dontwarn javax.annotation.** + +# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. +-dontwarn kotlin.Unit + +# Top-level functions that can only be used by Kotlin. +-dontwarn retrofit2.KotlinExtensions +-dontwarn retrofit2.KotlinExtensions.* + +# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy +# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> + +# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). +-keep,allowobfuscation,allowshrinking interface retrofit2.Call +-keep,allowobfuscation,allowshrinking class retrofit2.Response + +# With R8 full mode generic signatures are stripped for classes that are not +# kept. Suspend functions are wrapped in continuations where the type argument +# is used. +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation + +-keep class com.patrykandpatrick.vico.core.** { *; } + +# public tangem android sdk +-keep class com.tangem.operations.attestation.** { *; } +-keep class com.tangem.operations.personalization.** { *; } +-keep class com.tangem.common.card.** { *; } + +# non-sensitive enums +-keep enum com.tangem.domain.apptheme.model.AppThemeMode { *; } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt index 850a558941..a50f29dae0 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/model/UserWalletInformation.kt @@ -1,5 +1,6 @@ package com.tangem.tap.domain.userWalletList.model +import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse @@ -7,16 +8,24 @@ import com.tangem.domain.wallets.models.UserWalletId @JsonClass(generateAdapter = true) internal data class UserWalletSensitiveInformation( + @Json(name = "wallets") val wallets: List, ) @JsonClass(generateAdapter = true) internal data class UserWalletPublicInformation( + @Json(name = "name") val name: String, + @Json(name = "walletId") val walletId: UserWalletId, + @Json(name = "artworkUrl") val artworkUrl: String, + @Json(name = "cardsInWallet") val cardsInWallet: Set, + @Json(name = "scanResponse") val scanResponse: ScanResponse, + @Json(name = "isMultiCurrency") val isMultiCurrency: Boolean, + @Json(name = "hasBackupError") val hasBackupError: Boolean = false, ) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WcJrpcMethods.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WcJrpcMethods.kt index 58edaee5b1..bc53c634ce 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WcJrpcMethods.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/WcJrpcMethods.kt @@ -52,6 +52,8 @@ data class WcSignMessage( @Json(name = "type") val type: WCSignType, ) : WcRequestData { + + @JsonClass(generateAdapter = false) enum class WCSignType { MESSAGE, PERSONAL_MESSAGE, TYPED_MESSAGE, SOLANA_MESSAGE, } diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Account.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Account.kt index d7222aa91d..80523daf26 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Account.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Account.kt @@ -1,3 +1,16 @@ package com.tangem.tap.domain.walletconnect2.domain.models -data class Account(val chainId: String, val walletAddress: String, val derivationPath: String?) +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) +data class Account( + @Json(name = "chainId") + val chainId: String, + + @Json(name = "walletAddress") + val walletAddress: String, + + @Json(name = "derivationPath") + val derivationPath: String?, +) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Session.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Session.kt index 6cfeac030b..e69775cc68 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Session.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/Session.kt @@ -1,6 +1,13 @@ package com.tangem.tap.domain.walletconnect2.domain.models +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class Session( + @Json(name = "topic") val topic: String, + + @Json(name = "accounts") val accounts: List, ) diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceCancelOrder.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceCancelOrder.kt index 1dc5cd5333..fd393301e9 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceCancelOrder.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceCancelOrder.kt @@ -2,29 +2,34 @@ package com.tangem.tap.domain.walletconnect2.domain.models.binance import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import com.tangem.tap.domain.walletconnect2.domain.WcRequestData @Suppress("LongParameterList") @JsonClass(generateAdapter = true) -class WcBinanceCancelOrder( +data class WcBinanceCancelOrder( @Json(name = "account_number") - accountNumber: String, + val accountNumber: String, @Json(name = "chain_id") - chainId: String, + val chainId: String, @Json(name = "data") - data: String?, + val data: String?, @Json(name = "memo") - memo: String?, + val memo: String?, @Json(name = "sequence") - sequence: String, + val sequence: String, @Json(name = "source") - source: String, + val source: String, @Json(name = "msgs") - msgs: List, -) : WcBinanceOrder(accountNumber, chainId, data, memo, sequence, source, msgs) { + val msgs: List, +) : WcRequestData { + @JsonClass(generateAdapter = true) data class Message( + @Json(name = "refid") val refid: String, + @Json(name = "sender") val sender: String, + @Json(name = "symbol") val symbol: String, ) } diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceOrder.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceOrder.kt deleted file mode 100644 index b6cb87d90a..0000000000 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceOrder.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.tangem.tap.domain.walletconnect2.domain.models.binance - -import com.tangem.tap.domain.walletconnect2.domain.WcRequestData - -@Suppress("LongParameterList") -open class WcBinanceOrder( - val accountNumber: String, - val chainId: String, - val data: String?, - val memo: String?, - val sequence: String, - val source: String, - val msgs: List, -) : WcRequestData - -data class WcBinanceTxConfirmParam( - val ok: Boolean, - val errorMsg: String?, -) : WcRequestData diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTradeOrder.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTradeOrder.kt index 84befe7ca3..659e3e94fe 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTradeOrder.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTradeOrder.kt @@ -4,21 +4,28 @@ import com.github.salomonbrys.kotson.jsonSerializer import com.google.gson.JsonObject import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import com.tangem.tap.domain.walletconnect2.domain.WcRequestData @Suppress("LongParameterList") @JsonClass(generateAdapter = true) -class WcBinanceTradeOrder( +data class WcBinanceTradeOrder( @Json(name = "account_number") - accountNumber: String, + val accountNumber: String, @Json(name = "chain_id") - chainId: String, - data: String?, - memo: String?, - sequence: String, - source: String, - msgs: List, -) : WcBinanceOrder(accountNumber, chainId, data, memo, sequence, source, msgs) { + val chainId: String, + @Json(name = "data") + val data: String?, + @Json(name = "memo") + val memo: String?, + @Json(name = "sequence") + val sequence: String, + @Json(name = "source") + val source: String, + @Json(name = "msgs") + val msgs: List, +) : WcRequestData { + @JsonClass(generateAdapter = false) enum class MessageKey(val key: String) { ID("id"), ORDER_TYPE("ordertype"), @@ -30,14 +37,23 @@ class WcBinanceTradeOrder( TIME_INFORCE("timeinforce"), } + @JsonClass(generateAdapter = true) data class Message( + @Json(name = "id") val id: String, + @Json(name = "orderType") val orderType: Int, + @Json(name = "price") val price: Long, + @Json(name = "quantity") val quantity: Long, + @Json(name = "sender") val sender: String, + @Json(name = "side") val side: Int, + @Json(name = "symbol") val symbol: String, + @Json(name = "timeInforce") val timeInforce: Int, ) } diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTransferOrder.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTransferOrder.kt index 303ad4527d..f01181cbf6 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTransferOrder.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTransferOrder.kt @@ -2,33 +2,48 @@ package com.tangem.tap.domain.walletconnect2.domain.models.binance import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +import com.tangem.tap.domain.walletconnect2.domain.WcRequestData @Suppress("LongParameterList") @JsonClass(generateAdapter = true) -class WcBinanceTransferOrder( +data class WcBinanceTransferOrder( @Json(name = "account_number") - accountNumber: String, + val accountNumber: String, @Json(name = "chain_id") - chainId: String, - data: String?, - memo: String?, - sequence: String, - source: String, - msgs: List, -) : WcBinanceOrder(accountNumber, chainId, data, memo, sequence, source, msgs) { + val chainId: String, + @Json(name = "data") + val data: String?, + @Json(name = "memo") + val memo: String?, + @Json(name = "sequence") + val sequence: String, + @Json(name = "source") + val source: String, + @Json(name = "msgs") + val msgs: List, +) : WcRequestData { + @JsonClass(generateAdapter = true) data class Message( + @Json(name = "inputs") val inputs: List, + @Json(name = "outputs") val outputs: List, ) { + @JsonClass(generateAdapter = true) data class Item( + @Json(name = "address") val address: String, + @Json(name = "coins") val coins: List, ) { + @JsonClass(generateAdapter = true) data class Coin( + @Json(name = "amount") val amount: Long, + @Json(name = "denom") val denom: String, ) } diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTxConfirmParam.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTxConfirmParam.kt new file mode 100644 index 0000000000..8b53911071 --- /dev/null +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/domain/models/binance/WcBinanceTxConfirmParam.kt @@ -0,0 +1,13 @@ +package com.tangem.tap.domain.walletconnect2.domain.models.binance + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import com.tangem.tap.domain.walletconnect2.domain.WcRequestData + +@JsonClass(generateAdapter = true) +data class WcBinanceTxConfirmParam( + @Json(name = "ok") + val ok: Boolean, + @Json(name = "errorMsg") + val errorMsg: String?, +) : WcRequestData diff --git a/app/src/main/java/com/tangem/tap/network/exchangeServices/mercuryo/MercuryoApi.kt b/app/src/main/java/com/tangem/tap/network/exchangeServices/mercuryo/MercuryoApi.kt index 9687331cb5..dbfa5f3e5f 100644 --- a/app/src/main/java/com/tangem/tap/network/exchangeServices/mercuryo/MercuryoApi.kt +++ b/app/src/main/java/com/tangem/tap/network/exchangeServices/mercuryo/MercuryoApi.kt @@ -1,6 +1,7 @@ package com.tangem.tap.network.exchangeServices.mercuryo import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import retrofit2.http.GET import retrofit2.http.Path @@ -20,21 +21,25 @@ interface MercuryoApi { suspend fun currencies(@Path("apiVersion") apiVersion: String): MercuryoCurrenciesResponse } +@JsonClass(generateAdapter = true) data class MercuryoCurrenciesResponse( val status: Int, val data: Data, ) { + @JsonClass(generateAdapter = true) data class Data( val fiat: List, val crypto: List, val config: Config, ) + @JsonClass(generateAdapter = true) data class Config( @Json(name = "crypto_currencies") val cryptoCurrencies: List, ) + @JsonClass(generateAdapter = true) data class MercuryoCryptoCurrency( @Json(name = "currency") val currencySymbol: String, diff --git a/core/datasource/build.gradle.kts b/core/datasource/build.gradle.kts index c2941ddbb1..58271abc6d 100644 --- a/core/datasource/build.gradle.kts +++ b/core/datasource/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -51,6 +53,8 @@ dependencies { implementation(deps.okHttp.prettyLogging) implementation(deps.retrofit) implementation(deps.retrofit.moshi) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) /** Time */ implementation(deps.jodatime) @@ -60,6 +64,7 @@ dependencies { /** Chucker */ debugImplementation(deps.chucker) + debugPGImplementation(deps.chucker) mockedImplementation(deps.chuckerStub) externalImplementation(deps.chuckerStub) internalImplementation(deps.chuckerStub) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiConfig.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiConfig.kt index 5c1047bf82..dcdbc0a2a9 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiConfig.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiConfig.kt @@ -36,6 +36,7 @@ sealed class ApiConfig { companion object { internal const val DEBUG_BUILD_TYPE = "debug" + internal const val DEBUG_PG_BUILD_TYPE = "debugPG" internal const val INTERNAL_BUILD_TYPE = "internal" internal const val MOCKED_BUILD_TYPE = "mocked" internal const val EXTERNAL_BUILD_TYPE = "external" diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiEnvironment.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiEnvironment.kt index ec7042e51b..652fb2167a 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiEnvironment.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/ApiEnvironment.kt @@ -1,10 +1,21 @@ package com.tangem.datasource.api.common.config +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + /** * Api environment * * @author Andrew Khokhlov on 07/08/2024 */ +@JsonClass(generateAdapter = false) enum class ApiEnvironment { - DEV, STAGE, PROD + @Json(name = "DEV") + DEV, + + @Json(name = "STAGE") + STAGE, + + @Json(name = "PROD") + PROD, } diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/Express.kt b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/Express.kt index e1a9dad408..9295b5cbbb 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/common/config/Express.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/common/config/Express.kt @@ -68,7 +68,9 @@ internal class Express( fun getInitialEnvironment(): ApiEnvironment { return when (BuildConfig.BUILD_TYPE) { - DEBUG_BUILD_TYPE -> ApiEnvironment.DEV + DEBUG_BUILD_TYPE, + DEBUG_PG_BUILD_TYPE, + -> ApiEnvironment.DEV INTERNAL_BUILD_TYPE, MOCKED_BUILD_TYPE, -> ApiEnvironment.STAGE diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/AssetsRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/AssetsRequestBody.kt index 1bbab11a61..317ced4d9c 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/AssetsRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/AssetsRequestBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class AssetsRequestBody( @Json(name = "tokensList") val tokensList: List?, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/ExchangeSentRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/ExchangeSentRequestBody.kt index 94259dd07d..2b014926f6 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/ExchangeSentRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/ExchangeSentRequestBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class ExchangeSentRequestBody( @Json(name = "txId") val txId: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/LeastTokenInfo.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/LeastTokenInfo.kt index 23a308fb5b..628ce60e63 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/LeastTokenInfo.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/LeastTokenInfo.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class LeastTokenInfo( @Json(name = "contractAddress") val contractAddress: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/PairsRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/PairsRequestBody.kt index 32c4b5f278..959f26a642 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/PairsRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/request/PairsRequestBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class PairsRequestBody( @Json(name = "from") val from: List, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt index 570af5c471..903dbb6c5a 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/Asset.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class Asset( @Json(name = "contractAddress") val contractAddress: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeDataResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeDataResponse.kt index 5ee227e245..bd277c2f77 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeDataResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeDataResponse.kt @@ -1,11 +1,17 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class ExchangeDataResponseWithTxDetails( + @Json(name = "dataResponse") val dataResponse: ExchangeDataResponse, + @Json(name = "txDetails") val txDetails: TxDetails, ) + +@JsonClass(generateAdapter = true) data class ExchangeDataResponse( @Json(name = "fromAmount") val fromAmount: String, @@ -29,6 +35,7 @@ data class ExchangeDataResponse( val signature: String, ) +@JsonClass(generateAdapter = true) data class TxDetails( @Json(name = "payoutAddress") val payoutAddress: String, @@ -70,6 +77,7 @@ data class TxDetails( val gas: String?, ) +@JsonClass(generateAdapter = false) enum class TxType { @Json(name = "send") SEND, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeProvider.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeProvider.kt index 803090d1c5..42cafd2b2d 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeProvider.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeProvider.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class ExchangeProvider( @Json(name = "id") val id: String, @@ -32,6 +34,7 @@ data class ExchangeProvider( val slippage: BigDecimal?, ) +@JsonClass(generateAdapter = false) enum class ExchangeProviderType { @Json(name = "dex") DEX, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeQuoteResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeQuoteResponse.kt index f4f058ca42..8e78b3f8ae 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeQuoteResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeQuoteResponse.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class ExchangeQuoteResponse( @Json(name = "fromAmount") diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeSentResponseBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeSentResponseBody.kt index b6c439e938..6b30d1ab42 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeSentResponseBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeSentResponseBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class ExchangeSentResponseBody( @Json(name = "txId") val txId: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeStatusResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeStatusResponse.kt index f1d141d7e6..75ad46d5b9 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeStatusResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExchangeStatusResponse.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class ExchangeStatusResponse( @Json(name = "providerId") @@ -26,6 +28,7 @@ data class ExchangeStatusResponse( val refundContractAddress: String? = null, ) +@JsonClass(generateAdapter = false) enum class ExchangeStatus { @Json(name = "new") @@ -71,6 +74,7 @@ enum class ExchangeStatus { Unknown, } +@JsonClass(generateAdapter = true) data class ExchangeStatusError( @Json(name = "code") val code: Int, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExpressErrorResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExpressErrorResponse.kt index 98e419b7f1..476a2fa6b8 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExpressErrorResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/ExpressErrorResponse.kt @@ -1,13 +1,16 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class ExpressErrorResponse( @Json(name = "error") val error: ExpressError, ) +@JsonClass(generateAdapter = true) data class ExpressError( @Json(name = "code") val code: Int, @@ -19,6 +22,7 @@ data class ExpressError( val value: ExpressErrorValue?, ) +@JsonClass(generateAdapter = true) data class ExpressErrorValue( @Json(name = "minAmount") val minAmount: String?, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/SwapPair.kt b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/SwapPair.kt index 50213d64cf..6255abf122 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/SwapPair.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/express/models/response/SwapPair.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.express.models.response import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.datasource.api.express.models.request.LeastTokenInfo +@JsonClass(generateAdapter = true) data class SwapPair( @Json(name = "from") val from: LeastTokenInfo, @@ -15,6 +17,7 @@ data class SwapPair( ) +@JsonClass(generateAdapter = true) data class SwapPairProvider( @Json(name = "providerId") val providerId: String, @@ -23,6 +26,7 @@ data class SwapPairProvider( val rateTypes: List, ) +@JsonClass(generateAdapter = false) enum class RateType { @Json(name = "float") FLOAT, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampDataResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampDataResponse.kt index b968288dbf..b6f171da85 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampDataResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampDataResponse.kt @@ -3,8 +3,11 @@ package com.tangem.datasource.api.onramp.models.response import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class OnrampDataResponseWithTxDetails( + @Json(name = "dataResponse") val dataResponse: OnrampDataResponse, + @Json(name = "txDetails") val txDetails: OnrampTxDetails, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampStatusResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampStatusResponse.kt index 26d0fca80a..d7e3ac8592 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampStatusResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/onramp/models/response/OnrampStatusResponse.kt @@ -60,6 +60,7 @@ data class OnrampStatusResponse( val countryCode: String, ) +@JsonClass(generateAdapter = false) enum class Status { @Json(name = "created") Created, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt index af19425127..82582bbf92 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ActionRequestBody.kt @@ -1,11 +1,13 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.datasource.api.stakekit.models.request.ConstructTransactionRequestBody.GasArgs import com.tangem.datasource.api.stakekit.models.response.model.BalanceDTO import com.tangem.datasource.api.stakekit.models.response.model.TokenDTO import com.tangem.domain.staking.model.stakekit.action.StakingActionType +@JsonClass(generateAdapter = true) data class PendingActionRequestBody( @Json(name = "type") val type: StakingActionType, @@ -19,6 +21,7 @@ data class PendingActionRequestBody( val gasArgs: GasArgs? = null, // used only in estimate_gas request ) +@JsonClass(generateAdapter = true) data class ActionRequestBody( @Json(name = "integrationId") val integrationId: String, @@ -32,6 +35,7 @@ data class ActionRequestBody( val gasArgs: GasArgs? = null, // used only in estimate_gas request ) +@JsonClass(generateAdapter = true) data class ActionRequestBodyArgs( @Json(name = "amount") val amount: String, @@ -55,6 +59,7 @@ data class ActionRequestBodyArgs( val inputToken: TokenDTO? = null, ) +@JsonClass(generateAdapter = true) data class SignatureVerification( @Json(name = "message") val message: String, @@ -62,6 +67,7 @@ data class SignatureVerification( val signed: String, ) +@JsonClass(generateAdapter = false) enum class TronResource { @Json(name = "ENERGY") ENERGY, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/Address.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/Address.kt index 4650cb0a1d..a418468f91 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/Address.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/Address.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class Address( @Json(name = "address") val address: String, @@ -11,6 +13,7 @@ data class Address( val explorerUrl: String? = null, ) { + @JsonClass(generateAdapter = true) data class AdditionalAddresses( // cosmos-specific @Json(name = "cosmosPubKey") diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ConstructTransactionRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ConstructTransactionRequestBody.kt index e3fee0bc5d..0beef79eab 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ConstructTransactionRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/ConstructTransactionRequestBody.kt @@ -1,14 +1,17 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class ConstructTransactionRequestBody( @Json(name = "gasArgs") val gasArgs: GasArgs? = null, @Json(name = "ledgerWalletAPICompatible") val ledgerWalletAPICompatible: Boolean? = null, ) { + @JsonClass(generateAdapter = true) data class GasArgs( // cosmos-specific @Json(name = "gasPrice") diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/MultipleYieldBalancesRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/MultipleYieldBalancesRequestBody.kt index 4bf2eb9f7e..1be97ec060 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/MultipleYieldBalancesRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/MultipleYieldBalancesRequestBody.kt @@ -1,19 +1,23 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class MultipleYieldBalancesRequestBody( @Json(name = "addresses") val addresses: Address, @Json(name = "args") val args: MultipleYieldBalancesRequestArgs, @Json(name = "integrationId") val integrationId: String, ) { + @JsonClass(generateAdapter = true) data class Address( @Json(name = "address") val address: String, @Json(name = "additionalAddresses") val additionalAddresses: AdditionalAddresses? = null, @Json(name = "explorerUrl") val explorerUrl: String, ) { + @JsonClass(generateAdapter = true) data class AdditionalAddresses( @Json(name = "cosmosPubKey") val cosmosPubKey: String? = null, @Json(name = "binanceBeaconAddress") val binanceBeaconAddress: String? = null, @@ -25,6 +29,7 @@ data class MultipleYieldBalancesRequestBody( ) } + @JsonClass(generateAdapter = true) data class MultipleYieldBalancesRequestArgs( @Json(name = "validatorAddresses") val validatorAddresses: List, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/RevenueOption.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/RevenueOption.kt index ae74fc5ab8..d244b812d6 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/RevenueOption.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/RevenueOption.kt @@ -1,8 +1,13 @@ package com.tangem.datasource.api.stakekit.models.request +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = false) enum class RevenueOption(val value: String) { - SUPPORTS_FEE("supportsFee"), - SUPPORTS_REV_SHARE("supportsRevShare"), + @Json(name = "SUPPORTS_FEE") SUPPORTS_FEE("supportsFee"), + + @Json(name = "SUPPORTS_REV_SHARE") SUPPORTS_REV_SHARE("supportsRevShare"), ; override fun toString(): String { diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/SubmitTransactionHashRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/SubmitTransactionHashRequestBody.kt index af2cf3fd02..b08785d9ea 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/SubmitTransactionHashRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/SubmitTransactionHashRequestBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class SubmitTransactionHashRequestBody( @Json(name = "hash") val hash: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/YieldBalanceRequestBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/YieldBalanceRequestBody.kt index 27b8efd405..7f286f5397 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/YieldBalanceRequestBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/request/YieldBalanceRequestBody.kt @@ -1,13 +1,16 @@ package com.tangem.datasource.api.stakekit.models.request import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class YieldBalanceRequestBody( @Json(name = "addresses") val addresses: Address, @Json(name = "args") val args: YieldBalanceRequestArgs, @Json(name = "integrationId") val integrationId: String, ) { + @JsonClass(generateAdapter = true) data class YieldBalanceRequestArgs( @Json(name = "validatorAddresses") val validatorAddresses: List, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/NetworkTypeDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/NetworkTypeDTO.kt index 0479b148b1..43cdb07559 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/NetworkTypeDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/NetworkTypeDTO.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = false) enum class NetworkTypeDTO { @Json(name = "avalanche-c") AVALANCHE_C, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt index 2b62ee75bc..a734123394 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldBalanceWrapperDTO.kt @@ -41,6 +41,7 @@ data class BalanceDTO( val providerId: String?, ) { + @JsonClass(generateAdapter = false) enum class BalanceTypeDTO { @Json(name = "available") AVAILABLE, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt index eac6f59846..57c64eecd5 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/YieldDTO.kt @@ -85,7 +85,7 @@ data class YieldDTO( @Json(name = "preferred") val preferred: Boolean?, ) { - @JsonClass(generateAdapter = true) + @JsonClass(generateAdapter = false) enum class ValidatorStatusDTO { @Json(name = "active") ACTIVE, @@ -153,6 +153,7 @@ data class YieldDTO( val enabled: Boolean?, ) + @JsonClass(generateAdapter = false) enum class RewardScheduleDTO { @Json(name = "block") BLOCK, @@ -178,6 +179,7 @@ data class YieldDTO( UNKNOWN, } + @JsonClass(generateAdapter = false) enum class RewardClaimingDTO { @Json(name = "auto") AUTO, @@ -189,6 +191,7 @@ data class YieldDTO( } } + @JsonClass(generateAdapter = false) enum class RewardTypeDTO { @Json(name = "apy") APY, // compound rate diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionStatusDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionStatusDTO.kt index f3b571aa30..f0664d877a 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionStatusDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionStatusDTO.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model.action import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = false) enum class StakingActionStatusDTO { @Json(name = "CANCELED") CANCELED, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionTypeDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionTypeDTO.kt index 04e58d9023..abc6e43104 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionTypeDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/action/StakingActionTypeDTO.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model.action import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = false) enum class StakingActionTypeDTO { @Json(name = "STAKE") STAKE, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/error/StakeKitErrorResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/error/StakeKitErrorResponse.kt index fd62fdf3a5..32e186c5e6 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/error/StakeKitErrorResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/error/StakeKitErrorResponse.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model.error import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) class StakeKitErrorResponse( @Json(name = "message") val message: String? = null, @@ -26,6 +28,7 @@ class StakeKitErrorResponse( val tags: List? = null, ) +@JsonClass(generateAdapter = true) data class StakeKitErrorDetailsDTO( @Json(name = "arguments") val arguments: String? = null, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionStatusDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionStatusDTO.kt index 62065f880b..e47df83032 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionStatusDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionStatusDTO.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model.transaction import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = false) enum class StakingTransactionStatusDTO { @Json(name = "NOT_FOUND") NOT_FOUND, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionTypeDTO.kt b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionTypeDTO.kt index 2ce7e277c1..2ae49ad627 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionTypeDTO.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/stakekit/models/response/model/transaction/StakingTransactionTypeDTO.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.stakekit.models.response.model.transaction import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = false) enum class StakingTransactionTypeDTO { @Json(name = "SWAP") SWAP, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt index 866316079d..ee7a491d8d 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CoinsResponse.kt @@ -1,14 +1,17 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class CoinsResponse( @Json(name = "imageHost") val imageHost: String?, @Json(name = "coins") val coins: List, @Json(name = "total") val total: Int, ) { + @JsonClass(generateAdapter = true) data class Coin( @Json(name = "id") val id: String, @Json(name = "name") val name: String, @@ -17,6 +20,7 @@ data class CoinsResponse( @Json(name = "networks") val networks: List = listOf(), ) { + @JsonClass(generateAdapter = true) data class Network( @Json(name = "networkId") val networkId: String, @Json(name = "contractAddress") val contractAddress: String? = null, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserTokensAccountBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserTokensAccountBody.kt index 7cbb3aa9ea..908d280c00 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserTokensAccountBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CreateUserTokensAccountBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class CreateUserTokensAccountBody( @Json(name = "accountId") val id: Int, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CurrenciesResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CurrenciesResponse.kt index 7603314bf3..d9ed65f66f 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CurrenciesResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/CurrenciesResponse.kt @@ -17,7 +17,7 @@ data class CurrenciesResponse( @Json(name = "rateBTC") val rateBTC: String, @Json(name = "unit") val unit: String, // $, €, ₽ @Json(name = "type") val type: String, - val iconSmallUrl: String? = null, - val iconMediumUrl: String? = null, + @Json(name = "iconSmallUrl") val iconSmallUrl: String? = null, + @Json(name = "iconMediumUrl") val iconMediumUrl: String? = null, ) } diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/FeaturesResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/FeaturesResponse.kt index 46ebaa16cf..16691fcced 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/FeaturesResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/FeaturesResponse.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class FeaturesResponse( @Json(name = "send") val isNewSendEnabled: Boolean, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/QuotesResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/QuotesResponse.kt index 1c84a812d3..762f19899c 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/QuotesResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/QuotesResponse.kt @@ -1,13 +1,16 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class QuotesResponse( @Json(name = "quotes") val quotes: Map, ) { + @JsonClass(generateAdapter = true) data class Quote( @Json(name = "price") val price: BigDecimal?, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/RatesResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/RatesResponse.kt index 4223a2054e..0fda00772a 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/RatesResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/RatesResponse.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass // rates.keys = networkId's +@JsonClass(generateAdapter = true) data class RatesResponse( @Json(name = "rates") val rates: Map, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ReferralResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ReferralResponse.kt index 584cbc1721..ff520d8d3e 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ReferralResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ReferralResponse.kt @@ -1,30 +1,36 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import org.joda.time.LocalDate +@JsonClass(generateAdapter = true) data class ReferralResponse( @Json(name = "conditions") val conditions: Conditions, @Json(name = "referral") val referral: Referral?, @Json(name = "expectedAwards") val expectedAwards: ExpectedAwards?, ) { + @JsonClass(generateAdapter = true) data class Conditions( @Json(name = "discount") val discount: Discount, @Json(name = "awards") val awards: List, @Json(name = "tosLink") val tosLink: String, ) { + @JsonClass(generateAdapter = true) data class Discount( @Json(name = "amount") val amount: Int, @Json(name = "type") val discountType: String, ) + @JsonClass(generateAdapter = true) data class Award( @Json(name = "amount") val amount: Int, @Json(name = "token") val token: Token, ) { + @JsonClass(generateAdapter = true) data class Token( @Json(name = "id") val id: String, @Json(name = "name") val name: String, @@ -36,6 +42,7 @@ data class ReferralResponse( } } + @JsonClass(generateAdapter = true) data class Referral( @Json(name = "shareLink") val shareLink: String, @Json(name = "address") val address: String, @@ -44,11 +51,13 @@ data class ReferralResponse( @Json(name = "termsAcceptedAt") val termsAcceptedAt: String?, ) + @JsonClass(generateAdapter = true) data class ExpectedAwards( @Json(name = "numberOfWallets") val numberOfWallets: Int, @Json(name = "list") val list: List, ) { + @JsonClass(generateAdapter = true) data class AwardItem( @Json(name = "currency") val currency: String, @Json(name = "paymentDate") val paymentDate: LocalDate, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SalesResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SalesResponse.kt index ce6b28cc27..b51ba53ae1 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SalesResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/SalesResponse.kt @@ -1,10 +1,12 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * Sales response */ +@JsonClass(generateAdapter = true) data class SalesResponse( @Json(name = "sales") val sales: List, ) @@ -17,6 +19,7 @@ data class SalesResponse( * @property product product that is sales * @property notification optional notification for product */ +@JsonClass(generateAdapter = true) data class Sales( @Json(name = "id") val id: String, @Json(name = "state") val state: String, @@ -31,12 +34,14 @@ data class Sales( * @property code code that shows what product it is * @property name product name */ +@JsonClass(generateAdapter = true) data class Product( @Json(name = "id") val id: String, @Json(name = "code") val code: String, @Json(name = "name") val name: String, ) +@JsonClass(generateAdapter = true) data class Notification( @Json(name = "type") val type: String, @Json(name = "title") val title: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ShopResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ShopResponse.kt index 0c41bd21bb..3b7167ca52 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ShopResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/ShopResponse.kt @@ -1,6 +1,7 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** * Shop response @@ -9,6 +10,7 @@ import com.squareup.moshi.Json * * @author Andrew Khokhlov on 15/06/2023 */ +@JsonClass(generateAdapter = true) data class ShopResponse( @Json(name = "canOrder") val isOrderingAvailable: Boolean, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/StartReferralBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/StartReferralBody.kt index 1bd35840e2..ec261f085a 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/StartReferralBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/StartReferralBody.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** Body for make user referral */ +@JsonClass(generateAdapter = true) data class StartReferralBody( @Json(name = "walletId") val walletId: String, @Json(name = "networkId") val networkId: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UpdateUserTokensAccountBody.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UpdateUserTokensAccountBody.kt index e596b3a4fd..85eb4e2ba2 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UpdateUserTokensAccountBody.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UpdateUserTokensAccountBody.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class UpdateUserTokensAccountBody( @Json(name = "accountTitle") val title: String, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensAccountResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensAccountResponse.kt index aa8d29044a..a16e98d485 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensAccountResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensAccountResponse.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class UserTokensAccountResponse( @Json(name = "accountId") val id: Int, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt index 5eb1b261b8..cdd44736ff 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensResponse.kt @@ -1,8 +1,10 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.common.extensions.calculateHashCode +@JsonClass(generateAdapter = true) data class UserTokensResponse( @Json(name = "version") val version: Int = 0, @Json(name = "group") val group: GroupType, @@ -10,6 +12,7 @@ data class UserTokensResponse( @Json(name = "tokens") val tokens: List = emptyList(), ) { + @JsonClass(generateAdapter = true) data class Token( @Json(name = "id") val id: String? = null, @Json(name = "networkId") val networkId: String, @@ -36,6 +39,7 @@ data class UserTokensResponse( ) } + @JsonClass(generateAdapter = false) enum class GroupType { @Json(name = "none") NONE, @@ -47,6 +51,7 @@ data class UserTokensResponse( NETWORK, } + @JsonClass(generateAdapter = false) enum class SortType { @Json(name = "balance") BALANCE, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensSettingsResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensSettingsResponse.kt index 64f89f8b2d..514856e099 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensSettingsResponse.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/UserTokensSettingsResponse.kt @@ -1,7 +1,9 @@ package com.tangem.datasource.api.tangemTech.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) data class UserTokensSettingsResponse( @Json(name = "group") val group: UserTokensResponse.GroupType, diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/v2/UserTokensResponseV2.kt b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/v2/UserTokensResponseV2.kt index ea5318255e..bfec407ec3 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/v2/UserTokensResponseV2.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/tangemTech/models/v2/UserTokensResponseV2.kt @@ -1,13 +1,16 @@ package com.tangem.datasource.api.tangemTech.models.v2 import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.datasource.api.tangemTech.models.UserTokensResponse +@JsonClass(generateAdapter = true) data class UserTokensResponseV2( @Json(name = "accounts") val accounts: List, ) { + @JsonClass(generateAdapter = true) data class TokensAccount( @Json(name = "id") val id: Int, diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/card/UsedCardInfo.kt b/core/datasource/src/main/java/com/tangem/datasource/local/card/UsedCardInfo.kt index 5abb08f357..4e9cdb8b71 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/card/UsedCardInfo.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/card/UsedCardInfo.kt @@ -1,8 +1,16 @@ package com.tangem.datasource.local.card +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class UsedCardInfo( + @Json(name = "cardId") val cardId: String, + @Json(name = "isScanned") val isScanned: Boolean = false, + @Json(name = "isActivationStarted") val isActivationStarted: Boolean = false, + @Json(name = "isActivationFinished") val isActivationFinished: Boolean = false, ) diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/config/providers/models/ProviderModel.kt b/core/datasource/src/main/java/com/tangem/datasource/local/config/providers/models/ProviderModel.kt index ee1185b17a..d1e7223299 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/config/providers/models/ProviderModel.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/config/providers/models/ProviderModel.kt @@ -1,6 +1,7 @@ package com.tangem.datasource.local.config.providers.models import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass /** Config provider model */ sealed class ProviderModel { @@ -12,6 +13,7 @@ sealed class ProviderModel { * "url": "https://example.com" * } */ + @JsonClass(generateAdapter = true) data class Public( @Json(name = "url") val url: String, ) : ProviderModel() @@ -23,6 +25,7 @@ sealed class ProviderModel { * "name": "nownodes" * } */ + @JsonClass(generateAdapter = true) data class Private( @Json(name = "name") val name: String, ) : ProviderModel() diff --git a/core/datasource/src/test/kotlin/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManagerTest.kt b/core/datasource/src/test/kotlin/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManagerTest.kt index 5b35e910c2..5282073b12 100644 --- a/core/datasource/src/test/kotlin/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManagerTest.kt +++ b/core/datasource/src/test/kotlin/com/tangem/datasource/api/common/config/managers/ProdApiConfigsManagerTest.kt @@ -6,6 +6,7 @@ import com.tangem.datasource.BuildConfig import com.tangem.datasource.api.common.AuthProvider import com.tangem.datasource.api.common.config.* import com.tangem.datasource.api.common.config.ApiConfig.Companion.DEBUG_BUILD_TYPE +import com.tangem.datasource.api.common.config.ApiConfig.Companion.DEBUG_PG_BUILD_TYPE import com.tangem.datasource.api.common.config.ApiConfig.Companion.EXTERNAL_BUILD_TYPE import com.tangem.datasource.api.common.config.ApiConfig.Companion.INTERNAL_BUILD_TYPE import com.tangem.datasource.api.common.config.ApiConfig.Companion.MOCKED_BUILD_TYPE @@ -90,7 +91,9 @@ internal class ProdApiConfigsManagerTest(private val model: Model) { private fun createExpressModel(): Model { val environment = when (BuildConfig.BUILD_TYPE) { - DEBUG_BUILD_TYPE -> ApiEnvironment.DEV + DEBUG_BUILD_TYPE, + DEBUG_PG_BUILD_TYPE, + -> ApiEnvironment.DEV INTERNAL_BUILD_TYPE, MOCKED_BUILD_TYPE, -> ApiEnvironment.STAGE @@ -105,7 +108,9 @@ internal class ProdApiConfigsManagerTest(private val model: Model) { expected = ApiEnvironmentConfig( environment = environment, baseUrl = when (BuildConfig.BUILD_TYPE) { - DEBUG_BUILD_TYPE -> "https://express.tangem.org/v1/" + DEBUG_BUILD_TYPE, + DEBUG_PG_BUILD_TYPE, + -> "https://express.tangem.org/v1/" INTERNAL_BUILD_TYPE, MOCKED_BUILD_TYPE, -> "https://express-stage.tangem.com/v1/" diff --git a/core/featuretoggles/build.gradle.kts b/core/featuretoggles/build.gradle.kts index 32ce69fde2..97c51fa7fa 100644 --- a/core/featuretoggles/build.gradle.kts +++ b/core/featuretoggles/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -11,7 +13,6 @@ android { } dependencies { - /** DI */ implementation(deps.hilt.android) kapt(deps.hilt.kapt) @@ -23,6 +24,7 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) /** Core modules */ implementation(projects.core.datasource) diff --git a/data/manage-tokens/build.gradle.kts b/data/manage-tokens/build.gradle.kts index d2ff6fbc92..a8373e38ff 100644 --- a/data/manage-tokens/build.gradle.kts +++ b/data/manage-tokens/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -44,4 +46,6 @@ dependencies { /** Other */ implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) } \ No newline at end of file diff --git a/data/markets/build.gradle.kts b/data/markets/build.gradle.kts index c8fe87aece..7d33a2ce33 100644 --- a/data/markets/build.gradle.kts +++ b/data/markets/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -38,6 +40,8 @@ dependencies { implementation(deps.moshi.kotlin) implementation(deps.timber) implementation(deps.tangem.blockchain) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) // endregion } diff --git a/data/onramp/build.gradle.kts b/data/onramp/build.gradle.kts index eeb856c7d5..3c99f9c8a0 100644 --- a/data/onramp/build.gradle.kts +++ b/data/onramp/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -37,6 +39,8 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) implementation(projects.libs.blockchainSdk) implementation(projects.libs.crypto) diff --git a/data/settings/build.gradle.kts b/data/settings/build.gradle.kts index d5b81fe036..ffb0cdad49 100644 --- a/data/settings/build.gradle.kts +++ b/data/settings/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -32,6 +34,8 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) // endregion } diff --git a/data/staking/build.gradle.kts b/data/staking/build.gradle.kts index 2e08d4171c..af4d4d6122 100644 --- a/data/staking/build.gradle.kts +++ b/data/staking/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -45,6 +47,8 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) implementation(projects.libs.blockchainSdk) implementation(projects.libs.crypto) diff --git a/data/tokens/build.gradle.kts b/data/tokens/build.gradle.kts index 009d901b4e..a3f4b8c9d3 100644 --- a/data/tokens/build.gradle.kts +++ b/data/tokens/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -48,4 +50,6 @@ dependencies { implementation(deps.timber) implementation(deps.retrofit) // For HttpException implementation(deps.androidx.paging.runtime) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) } diff --git a/data/visa/build.gradle.kts b/data/visa/build.gradle.kts index ee7b6fe397..8529cc80d2 100644 --- a/data/visa/build.gradle.kts +++ b/data/visa/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -37,6 +39,8 @@ dependencies { implementation(deps.timber) implementation(deps.androidx.paging.runtime) implementation(deps.moshi.kotlin) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) /** Libs - Tangem */ implementation(deps.tangem.blockchain) diff --git a/data/visa/src/debug/kotlin/com/tangem/data/visa/config/VisaConfig.kt b/data/visa/src/debug/kotlin/com/tangem/data/visa/config/VisaConfig.kt index e02043bc20..68ef75072a 100644 --- a/data/visa/src/debug/kotlin/com/tangem/data/visa/config/VisaConfig.kt +++ b/data/visa/src/debug/kotlin/com/tangem/data/visa/config/VisaConfig.kt @@ -1,7 +1,9 @@ package com.tangem.data.visa.config import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +@JsonClass(generateAdapter = true) internal data class VisaConfig( @Json(name = "testnet") val testnet: Addresses, @@ -11,6 +13,7 @@ internal data class VisaConfig( val header: Header, ) { + @JsonClass(generateAdapter = true) data class Addresses( @Json(name = "paymentAccountRegistry") val paymentAccountRegistry: String, @@ -18,6 +21,7 @@ internal data class VisaConfig( val bridgeProcessor: String, ) + @JsonClass(generateAdapter = true) data class Header( @Json(name = "x-asn") val xAsn: String, diff --git a/domain/analytics/build.gradle.kts b/domain/analytics/build.gradle.kts index 588ac755e6..af9e76f9e4 100644 --- a/domain/analytics/build.gradle.kts +++ b/domain/analytics/build.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(deps.plugins.kotlin.jvm) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -9,4 +10,6 @@ dependencies { implementation(projects.core.utils) implementation(projects.domain.core) implementation(projects.domain.wallets.models) + implementation(deps.moshi.kotlin) + kapt(deps.moshi.kotlin.codegen) } diff --git a/domain/analytics/src/main/kotlin/com/tangem/domain/analytics/model/WalletBalanceState.kt b/domain/analytics/src/main/kotlin/com/tangem/domain/analytics/model/WalletBalanceState.kt index a614fc1581..90ca26c10b 100644 --- a/domain/analytics/src/main/kotlin/com/tangem/domain/analytics/model/WalletBalanceState.kt +++ b/domain/analytics/src/main/kotlin/com/tangem/domain/analytics/model/WalletBalanceState.kt @@ -1,5 +1,13 @@ package com.tangem.domain.analytics.model +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = false) enum class WalletBalanceState { - ToppedUp, Empty, Error, + @Json(name = "ToppedUp") ToppedUp, + + @Json(name = "Empty") Empty, + + @Json(name = "Error") Error, } diff --git a/domain/core/src/main/kotlin/com/tangem/domain/core/serialization/BigDecimalSerializer.kt b/domain/core/src/main/kotlin/com/tangem/domain/core/serialization/BigDecimalSerializer.kt index 2e2d6bb18d..6238eeee6e 100644 --- a/domain/core/src/main/kotlin/com/tangem/domain/core/serialization/BigDecimalSerializer.kt +++ b/domain/core/src/main/kotlin/com/tangem/domain/core/serialization/BigDecimalSerializer.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import java.math.BigDecimal -internal object BigDecimalSerializer : KSerializer { +object BigDecimalSerializer : KSerializer { override val descriptor = PrimitiveSerialDescriptor(serialName = "BigDecimal", PrimitiveKind.STRING) diff --git a/domain/legacy/build.gradle.kts b/domain/legacy/build.gradle.kts index ff9909cea9..4575ada9b0 100644 --- a/domain/legacy/build.gradle.kts +++ b/domain/legacy/build.gradle.kts @@ -1,6 +1,9 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -38,6 +41,7 @@ dependencies { implementation(deps.moshi.kotlin) implementation(deps.reKotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) /** Testing libraries */ testImplementation(deps.test.junit) diff --git a/domain/legacy/proguard-rules.pro b/domain/legacy/proguard-rules.pro deleted file mode 100644 index ff59496d81..0000000000 --- a/domain/legacy/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle.kts. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt b/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt index 61c6e3f4ae..c452807610 100644 --- a/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt +++ b/domain/legacy/src/main/java/com/tangem/domain/common/BlockchainNetwork.kt @@ -1,5 +1,6 @@ package com.tangem.domain.common +import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Token @@ -8,8 +9,11 @@ import com.tangem.common.extensions.calculateHashCode @JsonClass(generateAdapter = true) @Deprecated("Use Network model") data class BlockchainNetwork( + @Json(name = "blockchain") val blockchain: Blockchain, + @Json(name = "derivationPath") val derivationPath: String?, + @Json(name = "tokens") val tokens: List, ) { diff --git a/domain/models/build.gradle.kts b/domain/models/build.gradle.kts index e310d2d210..3a969e2e1f 100644 --- a/domain/models/build.gradle.kts +++ b/domain/models/build.gradle.kts @@ -1,6 +1,9 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.kotlin.jvm) alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -8,4 +11,5 @@ dependencies { implementation(deps.tangem.card.core) implementation(deps.moshi.kotlin) implementation(deps.kotlin.serialization) + kapt(deps.moshi.kotlin.codegen) } diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt index f396961df3..3c5fd005f1 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt @@ -1,5 +1,6 @@ package com.tangem.domain.models.scan +import com.squareup.moshi.Json import com.squareup.moshi.JsonClass import com.tangem.common.card.Card import com.tangem.common.card.CardWallet @@ -17,20 +18,35 @@ import com.tangem.common.card.FirmwareVersion as SdkFirmwareVersion * */ @JsonClass(generateAdapter = true) data class CardDTO( + @Json(name = "cardId") val cardId: String, + @Json(name = "batchId") val batchId: String, + @Json(name = "cardPublicKey") val cardPublicKey: ByteArray, + @Json(name = "firmwareVersion") val firmwareVersion: FirmwareVersion, + @Json(name = "manufacturer") val manufacturer: Manufacturer, + @Json(name = "issuer") val issuer: Issuer, + @Json(name = "settings") val settings: Settings, + @Json(name = "userSettings") val userSettings: UserSettings?, + @Json(name = "linkedTerminalStatus") val linkedTerminalStatus: LinkedTerminalStatus, + @Json(name = "isAccessCodeSet") val isAccessCodeSet: Boolean, + @Json(name = "isPasscodeSet") val isPasscodeSet: Boolean?, + @Json(name = "supportedCurves") val supportedCurves: List, + @Json(name = "wallets") val wallets: List, + @Json(name = "attestation") val attestation: Attestation, + @Json(name = "backupStatus") val backupStatus: BackupStatus?, ) { constructor(card: Card) : this( @@ -92,16 +108,27 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class Settings( + @Json(name = "securityDelay") val securityDelay: Int, + @Json(name = "maxWalletsCount") val maxWalletsCount: Int, + @Json(name = "isSettingAccessCodeAllowed") val isSettingAccessCodeAllowed: Boolean, + @Json(name = "isSettingPasscodeAllowed") val isSettingPasscodeAllowed: Boolean, + @Json(name = "isResettingUserCodesAllowed") val isResettingUserCodesAllowed: Boolean, + @Json(name = "isLinkedTerminalEnabled") val isLinkedTerminalEnabled: Boolean, + @Json(name = "isBackupAllowed") val isBackupAllowed: Boolean, + @Json(name = "supportedEncryptionModes") val supportedEncryptionModes: List, + @Json(name = "isFilesAllowed") val isFilesAllowed: Boolean, + @Json(name = "isHDWalletAllowed") val isHDWalletAllowed: Boolean, + @Json(name = "isKeysImportAllowed") val isKeysImportAllowed: Boolean = false, ) { constructor(settings: Card.Settings) : this( @@ -121,6 +148,7 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class UserSettings( + @Json(name = "isUserCodeRecoveryAllowed") val isUserCodeRecoveryAllowed: Boolean, ) { constructor(userSettings: com.tangem.common.card.UserSettings) : this( @@ -130,9 +158,13 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class FirmwareVersion( + @Json(name = "major") val major: Int, + @Json(name = "minor") val minor: Int, + @Json(name = "patch") val patch: Int, + @Json(name = "type") val type: SdkFirmwareVersion.FirmwareType, ) : Comparable { val stringValue: String @@ -161,8 +193,11 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class Manufacturer( + @Json(name = "name") val name: String, + @Json(name = "manufactureDate") val manufactureDate: Date, + @Json(name = "signature") val signature: ByteArray?, ) { constructor(manufacturer: Card.Manufacturer) : this( @@ -195,7 +230,9 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class Issuer( + @Json(name = "name") val name: String, + @Json(name = "publicKey") val publicKey: ByteArray, ) { constructor(issuer: Card.Issuer) : this( @@ -220,16 +257,27 @@ data class CardDTO( @JsonClass(generateAdapter = true) data class Wallet( + @Json(name = "publicKey") val publicKey: ByteArray, + @Json(name = "chainCode") val chainCode: ByteArray?, + @Json(name = "curve") val curve: EllipticCurve, + @Json(name = "settings") val settings: CardWallet.Settings, + @Json(name = "totalSignedHashes") val totalSignedHashes: Int?, + @Json(name = "remainingSignatures") val remainingSignatures: Int?, + @Json(name = "index") val index: Int, + @Json(name = "hasBackup") val hasBackup: Boolean, + @Json(name = "derivedKeys") val derivedKeys: Map, + @Json(name = "extendedPublicKey") val extendedPublicKey: ExtendedPublicKey?, + @Json(name = "isImported") val isImported: Boolean = false, ) { constructor(wallet: CardWallet) : this( @@ -281,9 +329,15 @@ data class CardDTO( } } + @JsonClass(generateAdapter = false) enum class LinkedTerminalStatus { + @Json(name = "Current") Current, + + @Json(name = "Other") Other, + + @Json(name = "None") None, ; diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/ScanResponse.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/ScanResponse.kt index 85797daf62..dd297898d0 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/ScanResponse.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/ScanResponse.kt @@ -1,5 +1,7 @@ package com.tangem.domain.models.scan +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.common.card.WalletData import com.tangem.common.extensions.ByteArrayKey import com.tangem.operations.backup.PrimaryCard @@ -9,17 +11,44 @@ import com.tangem.operations.derivation.ExtendedPublicKeysMap /** * Created by Anton Zhilenkov on 07/04/2022. */ +@JsonClass(generateAdapter = true) data class ScanResponse( + @Json(name = "card") val card: CardDTO, + @Json(name = "productType") val productType: ProductType, + @Json(name = "walletData") val walletData: WalletData?, + @Json(name = "secondTwinPublicKey") val secondTwinPublicKey: String? = null, + @Json(name = "derivedKeys") val derivedKeys: Map = mapOf(), + @Json(name = "primaryCard") val primaryCard: PrimaryCard? = null, ) typealias KeyWalletPublicKey = ByteArrayKey +@JsonClass(generateAdapter = false) enum class ProductType { - Note, Twins, Wallet, Start2Coin, Wallet2, Ring, Visa, + @Json(name = "Note") + Note, + + @Json(name = "Twins") + Twins, + + @Json(name = "Wallet") + Wallet, + + @Json(name = "Start2Coin") + Start2Coin, + + @Json(name = "Wallet2") + Wallet2, + + @Json(name = "Ring") + Ring, + + @Json(name = "Visa") + Visa, } diff --git a/domain/onramp/models/build.gradle.kts b/domain/onramp/models/build.gradle.kts index b2f0278199..7cdb1324a0 100644 --- a/domain/onramp/models/build.gradle.kts +++ b/domain/onramp/models/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(deps.plugins.kotlin.jvm) alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -9,6 +10,8 @@ dependencies { implementation(projects.domain.tokens.models) implementation(projects.domain.wallets.models) + implementation(deps.moshi.kotlin) + kapt(deps.moshi.kotlin.codegen) implementation(deps.kotlin.serialization) implementation(deps.jodatime) } diff --git a/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/OnrampCurrency.kt b/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/OnrampCurrency.kt index 5c7696df55..227db20b8c 100644 --- a/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/OnrampCurrency.kt +++ b/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/OnrampCurrency.kt @@ -1,11 +1,18 @@ package com.tangem.domain.onramp.model +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import kotlinx.serialization.Serializable @Serializable +@JsonClass(generateAdapter = true) data class OnrampCurrency( + @Json(name = "name") val name: String, + @Json(name = "code") val code: String, + @Json(name = "image") val image: String, + @Json(name = "precision") val precision: Int, ) diff --git a/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/cache/OnrampTransaction.kt b/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/cache/OnrampTransaction.kt index 2bc2efd363..300175b3ff 100644 --- a/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/cache/OnrampTransaction.kt +++ b/domain/onramp/models/src/main/kotlin/com/tangem/domain/onramp/model/cache/OnrampTransaction.kt @@ -1,18 +1,29 @@ package com.tangem.domain.onramp.model.cache +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.domain.core.serialization.SerializedBigDecimal import com.tangem.domain.onramp.model.OnrampCurrency import com.tangem.domain.wallets.models.UserWalletId import kotlinx.serialization.Serializable @Serializable +@JsonClass(generateAdapter = true) data class OnrampTransaction( + @Json(name = "txId") val txId: String, + @Json(name = "userWalletId") val userWalletId: UserWalletId, + @Json(name = "fromAmount") val fromAmount: SerializedBigDecimal, + @Json(name = "fromCurrency") val fromCurrency: OnrampCurrency, + @Json(name = "toAmount") val toAmount: SerializedBigDecimal, + @Json(name = "toCurrencyId") val toCurrencyId: String, + @Json(name = "providerName") val providerName: String, + @Json(name = "providerImageUrl") val providerImageUrl: String, ) diff --git a/domain/wallets/models/build.gradle.kts b/domain/wallets/models/build.gradle.kts index f356c773f9..73e8a62c05 100644 --- a/domain/wallets/models/build.gradle.kts +++ b/domain/wallets/models/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(deps.plugins.kotlin.jvm) alias(deps.plugins.kotlin.serialization) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -15,5 +16,8 @@ dependencies { // region Other libraries implementation(deps.kotlin.serialization) + implementation(deps.moshi.kotlin) + implementation(deps.timber) + kapt(deps.moshi.kotlin.codegen) // endregion } diff --git a/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt index e100b14070..9da861d59c 100644 --- a/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt +++ b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWallet.kt @@ -1,5 +1,7 @@ package com.tangem.domain.wallets.models +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse @@ -14,13 +16,21 @@ import com.tangem.domain.models.scan.ScanResponse * @property isMultiCurrency Indicates whether this user wallet can work with more than one currency * @property scanResponse [ScanResponse] of primary user's wallet card. */ +@JsonClass(generateAdapter = true) data class UserWallet( + @Json(name = "name") val name: String, + @Json(name = "walletId") val walletId: UserWalletId, + @Json(name = "artworkUrl") val artworkUrl: String, + @Json(name = "cardsInWallet") val cardsInWallet: Set, + @Json(name = "isMultiCurrency") val isMultiCurrency: Boolean, + @Json(name = "hasBackupError") val hasBackupError: Boolean, + @Json(name = "scanResponse") val scanResponse: ScanResponse, // TODO: Replace with [com.tangem.domain.models.scan.CardDTO] ) { diff --git a/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt index 3ff1218b27..7df04d8df0 100644 --- a/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt +++ b/domain/wallets/models/src/main/java/com/tangem/domain/wallets/models/UserWalletId.kt @@ -1,11 +1,17 @@ package com.tangem.domain.wallets.models +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toHexString import kotlinx.serialization.Serializable @Serializable -data class UserWalletId(val stringValue: String) { +@JsonClass(generateAdapter = true) +data class UserWalletId( + @Json(name = "stringValue") + val stringValue: String, +) { val value = stringValue.hexToBytes() diff --git a/features/qr-scanning/impl/proguard-rules.pro b/features/qr-scanning/impl/proguard-rules.pro deleted file mode 100644 index 481bb43481..0000000000 --- a/features/qr-scanning/impl/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/features/swap/data/build.gradle.kts b/features/swap/data/build.gradle.kts index f7b2c4a924..021b2a2bb2 100644 --- a/features/swap/data/build.gradle.kts +++ b/features/swap/data/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -27,6 +29,8 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.arrow.core) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) /** Domain */ implementation(projects.domain.tokens.models) diff --git a/features/swap/domain/build.gradle.kts b/features/swap/domain/build.gradle.kts index d86f55eb76..b5109c40d7 100644 --- a/features/swap/domain/build.gradle.kts +++ b/features/swap/domain/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -51,4 +53,5 @@ dependencies { implementation(deps.tangem.blockchain) implementation(deps.tangem.card.core) implementation(deps.moshi) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) } diff --git a/features/swap/domain/models/build.gradle.kts b/features/swap/domain/models/build.gradle.kts index 431789f3d2..dd42b09ca2 100644 --- a/features/swap/domain/models/build.gradle.kts +++ b/features/swap/domain/models/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -21,5 +23,7 @@ dependencies { /** Other Libraries **/ implementation(deps.kotlin.serialization) implementation(deps.arrow.core) + implementation(deps.moshi.kotlin) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) } \ No newline at end of file diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/Currency.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/Currency.kt deleted file mode 100644 index 62aebfd8e3..0000000000 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/Currency.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.tangem.feature.swap.domain.models.domain - -import kotlinx.serialization.Serializable - -@Serializable -sealed class Currency { - abstract val id: String - abstract val name: String - abstract val symbol: String - abstract val networkId: String - abstract val logoUrl: String - - @Serializable - data class NativeToken( - override val id: String, - override val name: String, - override val symbol: String, - override val networkId: String, - override val logoUrl: String, - ) : Currency() - - @Serializable - data class NonNativeToken( - override val id: String, - override val name: String, - override val symbol: String, - override val networkId: String, - override val logoUrl: String, - val contractAddress: String, - val decimalCount: Int, - ) : Currency() -} - -fun Currency.isNonNative(): Boolean { - return this is Currency.NonNativeToken -} diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeQuote.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeQuote.kt deleted file mode 100644 index 66f7b6d287..0000000000 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeQuote.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.tangem.feature.swap.domain.models.domain - -data class ExchangeQuote( - val toAmount: String, - val allowanceContract: String?, -) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt index 66c5a4b861..616ff86309 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/ExchangeStatus.kt @@ -1,28 +1,67 @@ package com.tangem.feature.swap.domain.models.domain +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class ExchangeStatusModel( + @Json(name = "providerId") val providerId: String, + @Json(name = "status") val status: ExchangeStatus? = null, + @Json(name = "txId") val txId: String? = null, + @Json(name = "txExternalUrl") val txExternalUrl: String? = null, + @Json(name = "txExternalId") val txExternalId: String? = null, + @Json(name = "refundNetwork") val refundNetwork: String? = null, + @Json(name = "refundContractAddress") val refundContractAddress: String? = null, ) +@JsonClass(generateAdapter = false) enum class ExchangeStatus { + @Json(name = "New") New, + + @Json(name = "Waiting") Waiting, + + @Json(name = "WaitingTxHash") WaitingTxHash, + + @Json(name = "Confirming") Confirming, + + @Json(name = "Verifying") Verifying, + + @Json(name = "Exchanging") Exchanging, + + @Json(name = "Failed") Failed, + + @Json(name = "Sending") Sending, + + @Json(name = "Finished") Finished, + + @Json(name = "Refunded") Refunded, + + @Json(name = "Cancelled") Cancelled, + + @Json(name = "TxFailed") TxFailed, + + @Json(name = "Unknown") Unknown, + + @Json(name = "Paused") Paused, } diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedLastSwappedCryptoCurrency.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedLastSwappedCryptoCurrency.kt index d6a19904be..e6aadeb7c5 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedLastSwappedCryptoCurrency.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedLastSwappedCryptoCurrency.kt @@ -1,6 +1,12 @@ package com.tangem.feature.swap.domain.models.domain +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +@JsonClass(generateAdapter = true) data class SavedLastSwappedCryptoCurrency( + @Json(name = "userWalletId") val userWalletId: String, + @Json(name = "cryptoCurrencyId") val cryptoCurrencyId: String, ) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt index 4df129a3df..6322bbe23f 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SavedSwapTransactionListModel.kt @@ -1,5 +1,7 @@ package com.tangem.feature.swap.domain.models.domain +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.datasource.api.tangemTech.models.UserTokensResponse import com.tangem.domain.tokens.model.CryptoCurrency import java.math.BigDecimal @@ -17,21 +19,35 @@ data class SavedSwapTransactionListModel( * IMPORTANT !!! * This is internal model for storing swap tx. It should not be used outside. */ +@JsonClass(generateAdapter = true) data class SavedSwapTransactionListModelInner( + @Json(name = "userWalletId") val userWalletId: String, + @Json(name = "fromCryptoCurrencyId") val fromCryptoCurrencyId: String, + @Json(name = "toCryptoCurrencyId") val toCryptoCurrencyId: String, + @Json(name = "fromTokensResponse") val fromTokensResponse: UserTokensResponse.Token? = null, + @Json(name = "toTokensResponse") val toTokensResponse: UserTokensResponse.Token? = null, + @Json(name = "transactions") val transactions: List, ) // TODO refactor to use separate models to store +@JsonClass(generateAdapter = true) data class SavedSwapTransactionModel( + @Json(name = "txId") val txId: String, + @Json(name = "timestamp") val timestamp: Long, + @Json(name = "fromCryptoAmount") val fromCryptoAmount: BigDecimal, + @Json(name = "toCryptoAmount") val toCryptoAmount: BigDecimal, + @Json(name = "provider") val provider: SwapProvider, + @Json(name = "status") val status: ExchangeStatusModel? = null, ) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt index 1e969106b9..83e827dc66 100644 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt +++ b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/SwapPairLeast.kt @@ -1,5 +1,7 @@ package com.tangem.feature.swap.domain.models.domain +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import com.tangem.domain.tokens.model.CryptoCurrencyStatus import java.math.BigDecimal @@ -31,22 +33,35 @@ data class CryptoCurrencySwapInfo( * Uses to store transaction data in datastore, when extends - should always add default value * to support backward compatibility */ +@JsonClass(generateAdapter = true) data class SwapProvider( + @Json(name = "providerId") val providerId: String, + @Json(name = "rateTypes") val rateTypes: List = emptyList(), + @Json(name = "name") val name: String, + @Json(name = "type") val type: ExchangeProviderType, + @Json(name = "imageLarge") val imageLarge: String, + @Json(name = "termsOfUse") val termsOfUse: String?, + @Json(name = "privacyPolicy") val privacyPolicy: String?, + @Json(name = "isRecommended") val isRecommended: Boolean = false, + @Json(name = "slippage") val slippage: BigDecimal?, ) +@JsonClass(generateAdapter = false) enum class ExchangeProviderType(val providerName: String) { - DEX("DEX"), - CEX("CEX"), - DEX_BRIDGE("DEX/Bridge"), + @Json(name = "DEX") DEX("DEX"), + + @Json(name = "CEX") CEX("CEX"), + + @Json(name = "DEX_BRIDGE") DEX_BRIDGE("DEX/Bridge"), } /** @@ -54,7 +69,9 @@ enum class ExchangeProviderType(val providerName: String) { * * Current implementation contains only float type, fixed will be supported later. */ +@JsonClass(generateAdapter = false) enum class RateType { - FLOAT, - FIXED, + @Json(name = "FLOAT") FLOAT, + + @Json(name = "FIXED") FIXED, } diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/TransactionModel.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/TransactionModel.kt deleted file mode 100644 index f7980215ae..0000000000 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/domain/TransactionModel.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.tangem.feature.swap.domain.models.domain - -/** - * Transaction model - * - * @property fromWalletAddress wallet from address (transactions will be sent from this address) - * @property toWalletAddress transactions will be sent to our(1inch) contract address - * @property data The encoded data to call the approve method on the swapped token contract - * @property value Native token value in WEI (for approve is always 0) - * @property gasPrice maximum amount of gas for a swap default: 11500000; max: 11500000 - * @property gas estimated amount of the gas limit, increase this value by 25% - */ -data class TransactionModel( - val fromWalletAddress: String, - val toWalletAddress: String, - val data: String, - val value: String, - val gasPrice: String, - val gas: String, -) diff --git a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataState.kt b/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataState.kt deleted file mode 100644 index 2fcb993b1d..0000000000 --- a/features/swap/domain/models/src/main/java/com/tangem/feature/swap/domain/models/ui/TokensDataState.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.tangem.feature.swap.domain.models.ui - -import com.tangem.feature.swap.domain.models.domain.Currency - -data class TokensDataState( - val preselectTokens: PreselectTokens, - val foundTokensState: FoundTokensState, -) - -data class FoundTokensState( - val tokensInWallet: List, - val loadedTokens: List, -) - -data class PreselectTokens( - val fromToken: Currency, - val toToken: Currency, -) - -data class TokenWithBalance( - val token: Currency, - val tokenBalanceData: TokenBalanceData? = null, -) - -data class TokenBalanceData( - val amount: String?, - val amountEquivalent: String?, -) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/VisaTxDetailsBottomSheet.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/VisaTxDetailsBottomSheet.kt index 44f7f65175..fe9b82b264 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/VisaTxDetailsBottomSheet.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/visa/VisaTxDetailsBottomSheet.kt @@ -107,32 +107,33 @@ private fun TransactionBlock(transaction: VisaTxDetailsBottomSheetConfig.Transac ) } +@Suppress("LongMethod") @Composable private fun BlockchainRequestBlock(request: VisaTxDetailsBottomSheetConfig.Request, modifier: Modifier = Modifier) { BlockContent( modifier = modifier, title = stringReference(value = "Blockchain request"), description = { - if (request.onExploreClick == null) return - - Row( - modifier = Modifier.clickable(onClick = request.onExploreClick), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing4), - ) { - Icon( - painter = painterResource(id = R.drawable.ic_compass_24), - contentDescription = null, - modifier = Modifier.size(size = TangemTheme.dimens.size18), - tint = TangemTheme.colors.icon.informative, - ) - Text( - text = "Explore", - color = TangemTheme.colors.text.tertiary, - style = TangemTheme.typography.caption1, - ) + if (request.onExploreClick != null) { + Row( + modifier = Modifier.clickable(onClick = request.onExploreClick), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing4), + ) { + Icon( + painter = painterResource(id = R.drawable.ic_compass_24), + contentDescription = null, + modifier = Modifier.size(size = TangemTheme.dimens.size18), + tint = TangemTheme.colors.icon.informative, + ) + Text( + text = "Explore", + color = TangemTheme.colors.text.tertiary, + style = TangemTheme.typography.caption1, + ) + } + SpacerW12() } - SpacerW12() }, content = { BlockItem( diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 0f18d4e68c..2c08dcf58c 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -3,7 +3,7 @@ [versions] # region Classpath -androidGradlePlugin = "8.2.2" +androidGradlePlugin = "8.6.1" firebaseCrashlytics = "3.0.1" googleServices = "4.4.1" kotlin = "1.9.22" @@ -56,11 +56,11 @@ jodatime = "2.12.1" kotlin-immutable-collections = "0.3.5" kotsonGsonExt = "2.5.0" lottie = "3.4.0" -moshi = "1.12.0" +moshi = "1.15.1" okhttp = "4.9.3" rekotlin = "1.0.4" -retrofit = "2.8.1" -retrofitMoshiConverter = "2.6.0" +retrofit = "2.11.0" +retrofitMoshiConverter = "2.9.0" spongycastleCryptoCore = "1.58.0.0" timber = "4.7.1" viewBindingDelegate = "1.5.9" @@ -236,11 +236,13 @@ material = { module = "com.google.android.material:material", version.ref = "goo moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "moshi" } +moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } okHttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okHttp-prettyLogging = { module = "com.github.ihsanbal:LoggingInterceptor", version.ref = "okHttp-prettyLogging" } spongecastle-core = { module = "com.madgag.spongycastle:core", version.ref = "spongycastleCryptoCore" } reKotlin = { module = "org.rekotlin:rekotlin", version.ref = "rekotlin" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-response-type-keeper = { module = "com.squareup.retrofit2:response-type-keeper", version.ref = "retrofit" } retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofitMoshiConverter" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } viewBindingDelegate = { module = "com.github.kirich1409:viewbindingpropertydelegate-noreflection", version.ref = "viewBindingDelegate" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f5e4b2a14c..7d6922649d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Feb 13 17:04:37 MSK 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/libs/blockchain-sdk/build.gradle.kts b/libs/blockchain-sdk/build.gradle.kts index 47b65e7313..b46d84e35a 100644 --- a/libs/blockchain-sdk/build.gradle.kts +++ b/libs/blockchain-sdk/build.gradle.kts @@ -1,3 +1,5 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) @@ -31,6 +33,8 @@ dependencies { implementation(deps.moshi) implementation(deps.moshi.kotlin) implementation(deps.timber) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) // endregion // region Firebase libraries diff --git a/libs/visa/build.gradle.kts b/libs/visa/build.gradle.kts index dd4315dcaf..7b0cd05aea 100644 --- a/libs/visa/build.gradle.kts +++ b/libs/visa/build.gradle.kts @@ -1,6 +1,9 @@ +import com.tangem.plugin.configuration.configurations.extension.kaptForObfuscatingVariants + plugins { alias(deps.plugins.android.library) alias(deps.plugins.kotlin.android) + alias(deps.plugins.kotlin.kapt) id("configuration") } @@ -21,6 +24,8 @@ dependencies { implementation(deps.okHttp.prettyLogging) implementation(deps.retrofit) implementation(deps.retrofit.moshi) + kaptForObfuscatingVariants(deps.moshi.kotlin.codegen) + kaptForObfuscatingVariants(deps.retrofit.response.type.keeper) /** Libs - Other */ implementation(deps.web3j.core) diff --git a/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/VisaTxHistoryResponse.kt b/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/VisaTxHistoryResponse.kt index 0ca5a0272a..6667c3bd97 100644 --- a/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/VisaTxHistoryResponse.kt +++ b/libs/visa/src/main/kotlin/com/tangem/lib/visa/model/VisaTxHistoryResponse.kt @@ -1,9 +1,11 @@ package com.tangem.lib.visa.model import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass import org.joda.time.DateTime import java.math.BigDecimal +@JsonClass(generateAdapter = true) data class VisaTxHistoryResponse( @Json(name = "card_wallet_address") val cardWalletAddress: String, @@ -11,6 +13,7 @@ data class VisaTxHistoryResponse( val transactions: List, ) { + @JsonClass(generateAdapter = true) data class Transaction( @Json(name = "auth_code") val authCode: String?, @@ -52,6 +55,7 @@ data class VisaTxHistoryResponse( val transactionType: String, ) { + @JsonClass(generateAdapter = true) data class Request( @Json(name = "billing_amount") val billingAmount: BigDecimal, diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt index 5fc302b255..76e586ea4d 100644 --- a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/AppExtensionConfigurations.kt @@ -71,12 +71,15 @@ private fun AndroidBuildType.configureBuildVariant(appExtension: AppExtension, b when (buildType) { BuildType.Release -> { isDebuggable = false - isMinifyEnabled = false - proguardFiles(appExtension.getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") } BuildType.Debug -> { isDebuggable = true - isMinifyEnabled = false + } + BuildType.DebugPG -> { + // build is not debuggable to let R8 make optimizations + // otherwise, only shrinking will be applied + matchingFallbacks.add(BuildType.Debug.id) + signingConfig = appExtension.signingConfigs.getByName(BuildType.Debug.id) } BuildType.Internal, BuildType.External, @@ -95,6 +98,9 @@ private fun AndroidBuildType.configureBuildVariant(appExtension: AppExtension, b versionNameSuffix = buildType.versionSuffix?.let { "-$it" } applicationIdSuffix = buildType.appIdSuffix?.let { ".$it" } + isMinifyEnabled = buildType.obfuscating + isShrinkResources = buildType.obfuscating + proguardFiles("proguard-rules.pro", appExtension.getDefaultProguardFile("proguard-android.txt")) } private fun AppExtension.configurePackagingOptions() { @@ -104,6 +110,7 @@ private fun AppExtension.configurePackagingOptions() { excludes += "lib/x86_64/freebsd/libscrypt.so" excludes += "lib/x86_64/linux/libscrypt.so" excludes += "META-INF/gradle/incremental.annotation.processors" + pickFirsts += "google/protobuf/*" merges += "paymentrequest.proto" } diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/DependencyHandler.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/DependencyHandler.kt new file mode 100644 index 0000000000..6b0c96219d --- /dev/null +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/DependencyHandler.kt @@ -0,0 +1,25 @@ +package com.tangem.plugin.configuration.configurations.extension + +import com.android.build.gradle.internal.plugins.AppPlugin +import com.android.build.gradle.internal.plugins.LibraryPlugin +import com.tangem.plugin.configuration.model.BuildType +import org.gradle.api.Project + +fun Project.kaptForObfuscatingVariants(dependencyNotation: Any) { + plugins.all { + when (this) { + is AppPlugin -> { + BuildType.values().filter { it.obfuscating }.forEach { + dependencies.add(it.createKaptConfiguration(), dependencyNotation) + } + } + is LibraryPlugin -> { + BuildType.values().filter { it.obfuscating }.forEach { + dependencies.add(it.createKaptConfiguration(), dependencyNotation) + } + } + } + } +} + +private fun BuildType.createKaptConfiguration() = "kapt" + name.replaceFirstChar(Char::titlecase) diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt index e32c747eaa..d179bb9f49 100644 --- a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/configurations/extension/LibraryExtensionConfigurations.kt @@ -45,6 +45,7 @@ private fun LibraryExtension.configurePackagingOptions() { excludes += "lib/x86_64/freebsd/libscrypt.so" excludes += "lib/x86_64/linux/libscrypt.so" excludes += "META-INF/gradle/incremental.annotation.processors" + pickFirsts += "google/protobuf/*" } } } diff --git a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt index 713ce6adb9..726030652d 100644 --- a/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt +++ b/plugins/configuration/src/main/kotlin/com/tangem/plugin/configuration/model/BuildType.kt @@ -4,6 +4,7 @@ internal enum class BuildType( val id: String, val appIdSuffix: String? = null, val versionSuffix: String? = null, + val obfuscating: Boolean = true, val configFields: List, ) { @@ -22,6 +23,20 @@ internal enum class BuildType( Debug( id = "debug", appIdSuffix = "debug", + obfuscating = false, + configFields = listOf( + BuildConfigField.Environment(value = "dev"), + BuildConfigField.TestActionEnabled(isEnabled = true), + BuildConfigField.LogEnabled(isEnabled = true), + BuildConfigField.TesterMenuAvailability(isEnabled = true), + BuildConfigField.MockDataSource(isEnabled = false), + ), + ), + + DebugPG( + id = "debugPG", + appIdSuffix = "debug", + obfuscating = true, configFields = listOf( BuildConfigField.Environment(value = "dev"), BuildConfigField.TestActionEnabled(isEnabled = true),