Updated on 2026-08-14
This commit is contained in:
parent
20e6ff8ef0
commit
03e48b0929
236 changed files with 150 additions and 155 deletions
|
|
@ -108,9 +108,9 @@ repositories {
|
|||
dependencies {
|
||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
|
||||
implementation(project(":domain"))
|
||||
implementation(project(":network"))
|
||||
implementation(project(":common"))
|
||||
implementation(project(":core:ui"))
|
||||
implementation(project(":core:datasource"))
|
||||
implementation(project(":core:utils"))
|
||||
implementation(project(":libs:crypto"))
|
||||
implementation(project(":libs:auth"))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit bfc2bf8157089bce6b44779bdae66df2c920de70
|
||||
Subproject commit a1658496e777b611fc990ef2bc1a1a1fd48bc1e6
|
||||
|
|
@ -11,9 +11,9 @@ import com.tangem.blockchain.common.BlockchainSdkConfig
|
|||
import com.tangem.blockchain.common.WalletManagerFactory
|
||||
import com.tangem.blockchain.network.BlockchainSdkRetrofitBuilder
|
||||
import com.tangem.common.json.MoshiJsonConverter
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.domain.DomainLayer
|
||||
import com.tangem.domain.common.LogConfig
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.tap.common.AndroidAssetReader
|
||||
import com.tangem.tap.common.AssetReader
|
||||
import com.tangem.tap.common.analytics.Analytics
|
||||
|
|
@ -156,6 +156,7 @@ class TapApplication : Application(), ImageLoaderFactory {
|
|||
appStateHolder.userTokensRepository = userTokensRepository
|
||||
}
|
||||
|
||||
//todo refactor: move to datasource and provide via DI
|
||||
private fun initMoshiConverter() {
|
||||
fun appAdapters(): List<Any> = listOf(
|
||||
BigDecimalAdapter(),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.tangem.tap.domain
|
|||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.ThrottlerWithValues
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.tap.features.wallet.models.Currency
|
||||
import com.tangem.tap.store
|
||||
import java.math.BigDecimal
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.tangem.tap.domain
|
|||
|
||||
import androidx.annotation.StringRes
|
||||
import com.tangem.common.core.TangemError
|
||||
import com.tangem.network.api.tangemTech.TangemTechError
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechError
|
||||
import com.tangem.wallet.R
|
||||
|
||||
interface TapErrors
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.tangem.tap.domain.tokens
|
|||
import com.squareup.moshi.JsonClass
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.domain.common.extensions.fromNetworkId
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class CurrencyFromJson(
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.getListOfCoins
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.tap.common.AssetReader
|
||||
|
||||
class LoadAvailableCoinsService(
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import com.tangem.blockchain.common.DerivationStyle
|
|||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.getTokens
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.tap.common.FileReader
|
||||
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
|
||||
import com.tangem.tap.domain.tokens.models.TokenDao
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.tangem.tap.domain.tokens
|
|||
|
||||
import com.tangem.common.core.TangemSdkError
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.network.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.tap.domain.NoDataError
|
||||
|
||||
class UserTokensNetworkService(private val tangemTechService: TangemTechService) {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package com.tangem.tap.domain.tokens
|
|||
import android.content.Context
|
||||
import com.tangem.blockchain.common.DerivationStyle
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.domain.common.CardDTO
|
||||
import com.tangem.domain.common.util.userWalletId
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.network.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.tap.common.AndroidFileReader
|
||||
import com.tangem.tap.domain.NoDataError
|
||||
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.tangem.tap.domain.tokens
|
|||
|
||||
import com.squareup.moshi.JsonAdapter
|
||||
import com.tangem.Log
|
||||
import com.tangem.datasource.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.domain.common.CardDTO
|
||||
import com.tangem.network.api.tangemTech.UserTokensResponse
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.tap.common.FileReader
|
||||
import com.tangem.tap.features.wallet.models.Currency
|
||||
import com.tangem.tap.features.wallet.models.toCurrencies
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import com.tangem.common.extensions.hexToBytes
|
|||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.domain.common.CardDTO
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.operations.wallet.CreateWalletResponse
|
||||
import com.tangem.tap.common.AssetReader
|
||||
import com.tangem.tap.tangemSdkManager
|
||||
|
|
@ -85,7 +85,7 @@ class TwinCardsManager(
|
|||
}
|
||||
|
||||
private fun getAdapter(): JsonAdapter<List<Issuer>> {
|
||||
return MoshiConverter.defaultMoshi().adapter(
|
||||
return com.tangem.datasource.api.common.MoshiConverter.defaultMoshi().adapter(
|
||||
Types.newParameterizedType(List::class.java, Issuer::class.java),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.squareup.moshi.JsonClass
|
|||
import com.squareup.moshi.Types
|
||||
import com.tangem.common.extensions.hexToBytes
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.tap.features.details.redux.walletconnect.WalletConnectSession
|
||||
import com.tangem.tap.features.details.redux.walletconnect.WalletForSession
|
||||
import com.trustwallet.walletconnect.models.WCPeerMeta
|
||||
|
|
@ -18,7 +18,7 @@ import java.nio.charset.Charset
|
|||
class WalletConnectRepository(val context: Application) {
|
||||
private val moshi = MoshiConverter.defaultMoshi()
|
||||
private val walletConnectAdapter: JsonAdapter<List<SessionDao>> = moshi.adapter(
|
||||
Types.newParameterizedType(List::class.java, SessionDao::class.java)
|
||||
Types.newParameterizedType(List::class.java, SessionDao::class.java),
|
||||
)
|
||||
|
||||
fun saveSession(session: WalletConnectSession) {
|
||||
|
|
@ -76,7 +76,6 @@ class WalletConnectRepository(val context: Application) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class SessionDao(
|
||||
val peerId: String,
|
||||
|
|
@ -91,7 +90,7 @@ data class SessionDao(
|
|||
remotePeerId = remotePeerId,
|
||||
wallet = wallet,
|
||||
session = session,
|
||||
peerMeta = peerMeta
|
||||
peerMeta = peerMeta,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +101,7 @@ data class SessionDao(
|
|||
remotePeerId = session.remotePeerId,
|
||||
wallet = session.wallet,
|
||||
session = session.session,
|
||||
peerMeta = session.peerMeta
|
||||
peerMeta = session.peerMeta,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ import com.tangem.common.extensions.isZero
|
|||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.successOr
|
||||
import com.tangem.domain.common.util.UserWalletId
|
||||
import com.tangem.network.api.paymentology.AttestationResponse
|
||||
import com.tangem.network.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.network.api.paymentology.RegisterKYCRequest
|
||||
import com.tangem.network.api.paymentology.RegisterWalletRequest
|
||||
import com.tangem.network.api.paymentology.RegisterWalletResponse
|
||||
import com.tangem.network.api.paymentology.RegistrationResponse
|
||||
import com.tangem.network.api.paymentology.tryExtractError
|
||||
import com.tangem.datasource.api.paymentology.AttestationResponse
|
||||
import com.tangem.datasource.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.datasource.api.paymentology.RegisterKYCRequest
|
||||
import com.tangem.datasource.api.paymentology.RegisterWalletRequest
|
||||
import com.tangem.datasource.api.paymentology.RegisterWalletResponse
|
||||
import com.tangem.datasource.api.paymentology.RegistrationResponse
|
||||
import com.tangem.datasource.api.paymentology.tryExtractError
|
||||
import com.tangem.operations.attestation.AttestWalletKeyResponse
|
||||
import com.tangem.tap.common.extensions.safeUpdate
|
||||
import com.tangem.tap.domain.getFirstToken
|
||||
|
|
@ -79,7 +79,7 @@ class SaltPayActivationManager(
|
|||
}
|
||||
}
|
||||
|
||||
suspend fun requestAttestationChallenge(): Result<AttestationResponse> {
|
||||
suspend fun requestAttestationChallenge(): Result<com.tangem.datasource.api.paymentology.AttestationResponse> {
|
||||
return paymentologyService.requestAttestationChallenge(cardId, cardPublicKey)
|
||||
.successOr { return it }
|
||||
.tryExtractError()
|
||||
|
|
@ -94,8 +94,8 @@ class SaltPayActivationManager(
|
|||
suspend fun registerWallet(
|
||||
attestResponse: AttestWalletKeyResponse,
|
||||
pinCode: String,
|
||||
): Result<RegisterWalletResponse> {
|
||||
val request = RegisterWalletRequest(
|
||||
): Result<com.tangem.datasource.api.paymentology.RegisterWalletResponse> {
|
||||
val request = com.tangem.datasource.api.paymentology.RegisterWalletRequest(
|
||||
cardId = cardId,
|
||||
publicKey = cardPublicKey,
|
||||
walletPublicKey = walletPublicKey,
|
||||
|
|
@ -152,12 +152,13 @@ class SaltPayActivationManager(
|
|||
)
|
||||
}
|
||||
|
||||
private fun makeRegisterKYCRequest(): RegisterKYCRequest = RegisterKYCRequest(
|
||||
cardId = cardId,
|
||||
publicKey = cardPublicKey,
|
||||
kycProvider = "UTORG",
|
||||
kycRefId = kycUrlProvider.kycRefId,
|
||||
)
|
||||
private fun makeRegisterKYCRequest(): com.tangem.datasource.api.paymentology.RegisterKYCRequest =
|
||||
com.tangem.datasource.api.paymentology.RegisterKYCRequest(
|
||||
cardId = cardId,
|
||||
publicKey = cardPublicKey,
|
||||
kycProvider = "UTORG",
|
||||
kycRefId = kycUrlProvider.kycRefId,
|
||||
)
|
||||
|
||||
companion object {
|
||||
fun stub(): SaltPayActivationManager = SaltPayActivationManager(
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import com.tangem.common.extensions.guard
|
|||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.successOr
|
||||
import com.tangem.domain.common.extensions.withMainContext
|
||||
import com.tangem.network.api.paymentology.KYCStatus
|
||||
import com.tangem.network.api.paymentology.RegistrationResponse
|
||||
import com.tangem.datasource.api.paymentology.KYCStatus
|
||||
import com.tangem.datasource.api.paymentology.RegistrationResponse
|
||||
import com.tangem.tap.common.analytics.Analytics
|
||||
import com.tangem.tap.common.analytics.events.Onboarding
|
||||
import com.tangem.tap.common.extensions.dispatchDebugErrorNotification
|
||||
|
|
@ -295,7 +295,7 @@ suspend fun SaltPayActivationManager.update(
|
|||
private fun determineStep(
|
||||
currentStep: SaltPayActivationStep,
|
||||
amountToClaim: Amount?,
|
||||
response: RegistrationResponse.Item,
|
||||
response: com.tangem.datasource.api.paymentology.RegistrationResponse.Item,
|
||||
): SaltPayActivationStep {
|
||||
fun getStepBaseOnAmountToClaim(amount: Amount?): SaltPayActivationStep = when (amount) {
|
||||
null -> SaltPayActivationStep.Success
|
||||
|
|
@ -315,25 +315,25 @@ private fun determineStep(
|
|||
response.kycStatus != null -> {
|
||||
when (currentStep) {
|
||||
SaltPayActivationStep.KycWaiting -> when (response.kycStatus) {
|
||||
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
else -> SaltPayActivationStep.KycIntro
|
||||
}
|
||||
SaltPayActivationStep.KycReject -> when (response.kycStatus) {
|
||||
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycStart
|
||||
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
KYCStatus.CORRECTION_REQUESTED -> SaltPayActivationStep.KycStart
|
||||
KYCStatus.REJECTED -> SaltPayActivationStep.KycStart
|
||||
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycStart
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED -> SaltPayActivationStep.KycStart
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycStart
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
else -> SaltPayActivationStep.KycIntro
|
||||
}
|
||||
else -> when (response.kycStatus) {
|
||||
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
|
||||
else -> SaltPayActivationStep.KycIntro
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ private suspend fun checkGasIfNeeded(
|
|||
}
|
||||
|
||||
@Throws(SaltPayActivationError::class)
|
||||
fun RegistrationResponse.Item.toSaltPayStep(currentStep: SaltPayActivationStep): SaltPayActivationStep {
|
||||
fun com.tangem.datasource.api.paymentology.RegistrationResponse.Item.toSaltPayStep(currentStep: SaltPayActivationStep): SaltPayActivationStep {
|
||||
return when {
|
||||
passed != true -> throw SaltPayActivationError.CardNotPassed(this.error)
|
||||
disabledByAdmin == true -> throw SaltPayActivationError.CardDisabled(this.error)
|
||||
|
|
@ -426,10 +426,10 @@ fun RegistrationResponse.Item.toSaltPayStep(currentStep: SaltPayActivationStep):
|
|||
|
||||
kycStatus != null -> {
|
||||
when (kycStatus) {
|
||||
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
KYCStatus.APPROVED -> SaltPayActivationStep.Claim
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
|
||||
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> SaltPayActivationStep.Claim
|
||||
null -> throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.tangem.blockchain.common.WalletManagerFactory
|
|||
import com.tangem.common.extensions.guard
|
||||
import com.tangem.domain.common.SaltPayWorkaround
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.network.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.datasource.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.tap.common.toggleWidget.WidgetState
|
||||
import com.tangem.tap.domain.extensions.makeSaltPayWalletManager
|
||||
import com.tangem.tap.features.onboarding.products.wallet.saltPay.GnosisRegistrator
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.tangem.domain.common.extensions.fromNetworkId
|
|||
import com.tangem.domain.common.extensions.toCoinId
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.domain.features.addCustomToken.CustomCurrency
|
||||
import com.tangem.network.api.tangemTech.TokenResponse
|
||||
import com.tangem.datasource.api.tangemTech.TokenResponse
|
||||
import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
||||
import com.tangem.tap.domain.tokens.models.BlockchainNetwork
|
||||
import com.tangem.tap.features.tokens.redux.TokenWithBlockchain
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.tap.features.wallet.redux.middlewares
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.network.api.tangemTech.CurrenciesResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.CurrenciesResponse
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
import com.tangem.tap.common.analytics.Analytics
|
||||
import com.tangem.tap.common.analytics.events.AnalyticsParam
|
||||
import com.tangem.tap.common.analytics.events.MainScreen
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.tangem.common.extensions.calculateSha512
|
|||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
||||
import com.tangem.tap.features.wallet.models.Currency
|
||||
import com.tangem.tap.network.exchangeServices.CurrencyExchangeManager
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.domain.common.extensions.withIOContext
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
import com.tangem.tap.common.extensions.urlEncode
|
||||
import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
||||
import com.tangem.tap.features.wallet.models.Currency
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.tangem.tap.network.payid
|
|||
import com.squareup.moshi.JsonClass
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
import retrofit2.Retrofit
|
||||
|
||||
class PayIdService {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.tangem.tap.network.payid
|
|||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.tangem.tap.persistence
|
|||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
import com.tangem.common.json.MoshiJsonConverter
|
||||
import com.tangem.network.api.tangemTech.CurrenciesResponse
|
||||
import com.tangem.datasource.api.tangemTech.CurrenciesResponse
|
||||
import com.tangem.tap.common.entities.FiatCurrency
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import android.app.Application
|
|||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import java.util.*
|
||||
|
||||
class PreferencesStorage(applicationContext: Application) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ dependencies {
|
|||
/** Project */
|
||||
implementation(project(":libs:auth"))
|
||||
|
||||
/** Tangem libraries */
|
||||
implementation(Tangem.cardCore)
|
||||
|
||||
/** DI */
|
||||
implementation(Library.hilt)
|
||||
kapt(Library.hiltKapt)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.common
|
||||
package com.tangem.datasource.api.common
|
||||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.common
|
||||
package com.tangem.datasource.api.common
|
||||
|
||||
import com.squareup.moshi.JsonAdapter
|
||||
import com.squareup.moshi.Moshi
|
||||
|
|
@ -9,8 +9,10 @@ import retrofit2.converter.moshi.MoshiConverterFactory
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
//todo needs to be refactored
|
||||
object MoshiConverter {
|
||||
|
||||
//todo refactor: provide via DI
|
||||
var INSTANCE = MoshiJsonConverter()
|
||||
private set
|
||||
|
||||
|
|
@ -23,7 +25,9 @@ object MoshiConverter {
|
|||
|
||||
fun createFactory(moshi: Moshi = INSTANCE.moshi): Converter.Factory = MoshiConverterFactory.create(moshi)
|
||||
|
||||
//todo provide via DI using quealifiers
|
||||
fun defaultMoshi(): Moshi = INSTANCE.moshi
|
||||
|
||||
//todo provide via DI using quealifiers
|
||||
fun sdkMoshi(): Moshi = MoshiJsonConverter.INSTANCE.moshi
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.tangem.datasource.api.common
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
// sealed interface NetworkModuleMessage : ModuleMessage
|
||||
//
|
||||
// sealed class NetworkError(
|
||||
// subCode: Int,
|
||||
// override val message: String,
|
||||
// override val data: Any?,
|
||||
// ) : NetworkModuleMessage, ModuleError() {
|
||||
// override val code: Int = ModuleErrorCode.NETWORK + subCode
|
||||
//
|
||||
// companion object {
|
||||
// // base code used for all error in the module
|
||||
// // const val CODE_ANY_OTHER = 100..199, 200..299
|
||||
// }
|
||||
// }
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.common
|
||||
package com.tangem.datasource.api.common
|
||||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.api.paymentology
|
||||
package com.tangem.datasource.api.paymentology
|
||||
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.Headers
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.tangem.network.api.paymentology
|
||||
package com.tangem.datasource.api.paymentology
|
||||
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.MoshiConverter
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.api.paymentology
|
||||
package com.tangem.datasource.api.paymentology
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.api.paymentology
|
||||
package com.tangem.datasource.api.paymentology
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.tangem.common.extensions.calculateHashCode
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.api.tangemTech
|
||||
package com.tangem.datasource.api.tangemTech
|
||||
|
||||
import java.math.BigDecimal
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.tangem.network.api.tangemTech
|
||||
package com.tangem.datasource.api.tangemTech
|
||||
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.tangem.network.api.tangemTech
|
||||
package com.tangem.datasource.api.tangemTech
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.AddHeaderInterceptor
|
||||
import com.tangem.network.common.CacheControlHttpInterceptor
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
import com.tangem.datasource.api.common.AddHeaderInterceptor
|
||||
import com.tangem.datasource.api.common.CacheControlHttpInterceptor
|
||||
import com.tangem.datasource.api.common.createRetrofitInstance
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":network"))
|
||||
implementation(project(":core:datasource"))
|
||||
implementation(project(":common"))
|
||||
|
||||
/** Tangem libraries */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.tangem.domain
|
||||
|
||||
import com.tangem.common.extensions.VoidCallback
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.domain.common.extensions
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
|
||||
suspend fun TangemTechService.getTokens(
|
||||
contractAddress: String,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.tangem.domain.features.addCustomToken
|
|||
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.domain.common.extensions.getTokens
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import com.tangem.domain.common.form.Field
|
|||
import com.tangem.domain.common.form.FieldId
|
||||
import com.tangem.domain.features.addCustomToken.CustomCurrency
|
||||
import com.tangem.domain.features.addCustomToken.CustomTokenFieldId
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import org.rekotlin.Action
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import com.tangem.domain.redux.domainStore
|
|||
import com.tangem.domain.redux.extensions.dispatchOnMain
|
||||
import com.tangem.domain.redux.global.DomainGlobalAction
|
||||
import com.tangem.domain.redux.global.DomainGlobalState
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -342,7 +342,7 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
|
|||
|
||||
private suspend fun requestInfoAboutToken(
|
||||
contractAddress: String,
|
||||
): List<CoinsResponse.Coin> {
|
||||
): List<com.tangem.datasource.api.tangemTech.CoinsResponse.Coin> {
|
||||
val tangemTechServiceManager = requireNotNull(hubState.tangemTechServiceManager)
|
||||
dispatchOnMain(Screen.UpdateTokenFields(listOf(ContractAddress to ViewStates.TokenField(isLoading = true))))
|
||||
|
||||
|
|
@ -432,8 +432,8 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
|
|||
)
|
||||
|
||||
private suspend fun fillTokenFields(
|
||||
token: CoinsResponse.Coin,
|
||||
coinNetwork: CoinsResponse.Coin.Network,
|
||||
token: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin,
|
||||
coinNetwork: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin.Network,
|
||||
) {
|
||||
val blockchain = Blockchain.fromNetworkId(coinNetwork.networkId) ?: Blockchain.Unknown
|
||||
Network.setFieldValue(Field.Data(blockchain, false))
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.tangem.domain.features.addCustomToken.TokenDerivationPathField
|
|||
import com.tangem.domain.features.addCustomToken.TokenField
|
||||
import com.tangem.domain.redux.DomainState
|
||||
import com.tangem.domain.redux.state.StringActionStateConverter
|
||||
import com.tangem.network.api.tangemTech.CoinsResponse
|
||||
import com.tangem.datasource.api.tangemTech.CoinsResponse
|
||||
import org.rekotlin.Action
|
||||
import org.rekotlin.StateType
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ data class AddCustomTokenState(
|
|||
val form: Form = Form(listOf()),
|
||||
val formValidators: Map<CustomTokenFieldId, CustomTokenValidator<out Any>> = createFormValidators(),
|
||||
val formErrors: Map<CustomTokenFieldId, AddCustomTokenError> = emptyMap(),
|
||||
val foundToken: CoinsResponse.Coin? = null,
|
||||
val foundToken: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin? = null,
|
||||
val warnings: Set<AddCustomTokenError.Warning> = emptySet(),
|
||||
val screenState: ScreenState = createInitialScreenState(),
|
||||
val tangemTechServiceManager: AddCustomTokenService? = null,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.tangem.common.extensions.toHexString
|
|||
import com.tangem.domain.redux.BaseStoreHub
|
||||
import com.tangem.domain.redux.DomainState
|
||||
import com.tangem.domain.redux.ReStoreReducer
|
||||
import com.tangem.network.common.CardPublicKeyHttpInterceptor
|
||||
import com.tangem.datasource.api.common.CardPublicKeyHttpInterceptor
|
||||
import org.rekotlin.Action
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package com.tangem.domain.redux.global
|
|||
import com.tangem.domain.DomainDialog
|
||||
import com.tangem.domain.common.LogConfig
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.network.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.network.api.tangemTech.TangemTechService
|
||||
import com.tangem.datasource.api.paymentology.PaymentologyApiService
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechService
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -19,6 +19,8 @@ data class DomainGlobalState(
|
|||
)
|
||||
|
||||
data class NetworkServices(
|
||||
val tangemTechService: TangemTechService = TangemTechService(LogConfig.network.tangemTechService),
|
||||
val paymentologyService: PaymentologyApiService = PaymentologyApiService(LogConfig.network.paymentologyApiService),
|
||||
val tangemTechService: TangemTechService = TangemTechService(
|
||||
LogConfig.network.tangemTechService),
|
||||
val paymentologyService: PaymentologyApiService = PaymentologyApiService(
|
||||
LogConfig.network.paymentologyApiService),
|
||||
)
|
||||
|
|
|
|||
1
network/.gitignore
vendored
1
network/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
/build
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
plugins {
|
||||
id("java-library")
|
||||
id("org.jetbrains.kotlin.jvm")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":common"))
|
||||
|
||||
/** Tangem libraries */
|
||||
implementation(Tangem.cardCore)
|
||||
|
||||
/** Other libraries */
|
||||
implementation(Library.retrofit)
|
||||
implementation(Library.retrofitMoshiConverter)
|
||||
implementation(Library.moshi)
|
||||
implementation(Library.moshiKotlin)
|
||||
implementation(Library.okHttp)
|
||||
implementation(Library.okHttpLogging)
|
||||
implementation(Library.timber)
|
||||
implementation(Library.coroutine)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network.jar
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network.jar
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network.jar
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
|
|
@ -0,0 +1 @@
|
|||
o/jetified-network.jar
|
||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
|
|
@ -0,0 +1 @@
|
|||
i/
|
||||
BIN
network/build/classes/kotlin/main/META-INF/network.kotlin_module
Normal file
BIN
network/build/classes/kotlin/main/META-INF/network.kotlin_module
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue