Updated on 2026-08-14
This commit is contained in:
parent
b7ddb0476c
commit
b64fb767f4
6 changed files with 7 additions and 56 deletions
|
|
@ -51,19 +51,11 @@ interface TangemTechApi {
|
|||
|
||||
/** Returns referral status by [walletId] */
|
||||
@GET("referral/{walletId}")
|
||||
suspend fun getReferralStatus(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("walletId") walletId: String,
|
||||
): ReferralResponse
|
||||
suspend fun getReferralStatus(@Path("walletId") walletId: String): ReferralResponse
|
||||
|
||||
/** Make user referral, requires [StartReferralBody] */
|
||||
@POST("referral")
|
||||
suspend fun startReferral(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body startReferralBody: StartReferralBody,
|
||||
): ReferralResponse
|
||||
suspend fun startReferral(@Body startReferralBody: StartReferralBody): ReferralResponse
|
||||
|
||||
@GET("quotes")
|
||||
suspend fun getQuotes(
|
||||
|
|
@ -79,55 +71,35 @@ interface TangemTechApi {
|
|||
): ApiResponse<PromotionInfoResponse>
|
||||
|
||||
@GET("settings/{wallet_id}")
|
||||
suspend fun getUserTokensSettings(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
): ApiResponse<UserTokensSettingsResponse>
|
||||
suspend fun getUserTokensSettings(@Path("wallet_id") walletId: String): ApiResponse<UserTokensSettingsResponse>
|
||||
|
||||
@PUT("settings/{wallet_id}")
|
||||
suspend fun saveUserTokensSettings(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
@Body userTokensSettings: UserTokensSettingsResponse,
|
||||
): ApiResponse<Unit>
|
||||
|
||||
@POST("user-network-account")
|
||||
suspend fun createUserNetworkAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body body: CreateUserNetworkAccountBody,
|
||||
): ApiResponse<CreateUserNetworkAccountResponse>
|
||||
|
||||
@POST("account")
|
||||
suspend fun createUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body body: CreateUserTokensAccountBody,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}")
|
||||
suspend fun updateUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
@Body body: UpdateUserTokensAccountBody,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}/archive")
|
||||
suspend fun archiveUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
suspend fun archiveUserTokensAccount(@Path("account_id") accountId: Int): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}/unarchive")
|
||||
suspend fun restoreUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
suspend fun restoreUserTokensAccount(@Path("account_id") accountId: Int): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@GET("features")
|
||||
suspend fun getFeatures(): ApiResponse<FeaturesResponse>
|
||||
|
|
|
|||
|
|
@ -7,16 +7,10 @@ import retrofit2.http.*
|
|||
interface TangemTechApiV2 {
|
||||
|
||||
@GET("user-tokens/{wallet_id}")
|
||||
suspend fun getUserTokens(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
): ApiResponse<UserTokensResponseV2>
|
||||
suspend fun getUserTokens(@Path("wallet_id") walletId: String): ApiResponse<UserTokensResponseV2>
|
||||
|
||||
@PUT("user-tokens/{wallet_id}")
|
||||
suspend fun saveUserTokens(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
@Body userTokens: UserTokensResponseV2,
|
||||
): ApiResponse<Unit>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.data.common.currency.CryptoCurrencyFactory
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.api.tangemTech.models.StartReferralBody
|
||||
import com.tangem.datasource.demo.DemoModeDatasource
|
||||
|
|
@ -24,7 +23,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
private val referralConverter: ReferralConverter,
|
||||
private val coroutineDispatcher: CoroutineDispatcherProvider,
|
||||
private val demoModeDatasource: DemoModeDatasource,
|
||||
private val authProvider: AuthProvider,
|
||||
private val userWalletsStore: UserWalletsStore,
|
||||
) : ReferralRepository {
|
||||
|
||||
|
|
@ -35,8 +33,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
return withContext(coroutineDispatcher.io) {
|
||||
referralConverter.convert(
|
||||
referralApi.getReferralStatus(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
walletId = walletId,
|
||||
),
|
||||
)
|
||||
|
|
@ -52,8 +48,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
return withContext(coroutineDispatcher.io) {
|
||||
referralConverter.convert(
|
||||
referralApi.startReferral(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
startReferralBody = StartReferralBody(
|
||||
walletId = walletId,
|
||||
networkId = networkId,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.feature.referral.di
|
||||
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.demo.DemoModeDatasource
|
||||
import com.tangem.datasource.local.userwallet.UserWalletsStore
|
||||
|
|
@ -25,7 +24,6 @@ class ReferralRepositoryModule {
|
|||
referralConverter: ReferralConverter,
|
||||
coroutineDispatcherProvider: CoroutineDispatcherProvider,
|
||||
demoModeDatasource: DemoModeDatasource,
|
||||
authProvider: AuthProvider,
|
||||
userWalletsStore: UserWalletsStore,
|
||||
): ReferralRepository {
|
||||
return ReferralRepositoryImpl(
|
||||
|
|
@ -33,7 +31,6 @@ class ReferralRepositoryModule {
|
|||
referralConverter = referralConverter,
|
||||
coroutineDispatcher = coroutineDispatcherProvider,
|
||||
demoModeDatasource = demoModeDatasource,
|
||||
authProvider = authProvider,
|
||||
userWalletsStore = userWalletsStore,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.BlockchainSdkError
|
||||
import com.tangem.blockchain.extensions.Result
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.common.response.getOrThrow
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.api.tangemTech.models.CreateUserNetworkAccountBody
|
||||
|
||||
internal class DefaultAccountCreator(
|
||||
private val authProvider: AuthProvider,
|
||||
private val tangemTechApi: TangemTechApi,
|
||||
) : AccountCreator {
|
||||
|
||||
|
|
@ -22,8 +20,6 @@ internal class DefaultAccountCreator(
|
|||
)
|
||||
return try {
|
||||
val response = tangemTechApi.createUserNetworkAccount(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
body = request,
|
||||
).getOrThrow()
|
||||
Result.Success(response.data.accountId)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.tangem.blockchainsdk.featuretoggles.DefaultBlockchainSDKFeatureToggle
|
|||
import com.tangem.blockchainsdk.loader.BlockchainProvidersResponseLoader
|
||||
import com.tangem.blockchainsdk.store.DefaultRuntimeStore
|
||||
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.local.config.environment.EnvironmentConfigStorage
|
||||
import com.tangem.datasource.local.preferences.AppPreferencesStore
|
||||
|
|
@ -45,14 +44,13 @@ internal object BlockchainSDKFactoryModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
fun provideWalletManagerFactoryCreator(
|
||||
authProvider: AuthProvider,
|
||||
tangemTechApi: TangemTechApi,
|
||||
appPreferencesStore: AppPreferencesStore,
|
||||
blockchainSDKLogger: BlockchainSDKLogger,
|
||||
featureTogglesManager: FeatureTogglesManager,
|
||||
): WalletManagerFactoryCreator {
|
||||
return WalletManagerFactoryCreator(
|
||||
accountCreator = DefaultAccountCreator(authProvider, tangemTechApi),
|
||||
accountCreator = DefaultAccountCreator(tangemTechApi),
|
||||
blockchainDataStorage = DefaultBlockchainDataStorage(appPreferencesStore),
|
||||
blockchainSDKLogger = blockchainSDKLogger,
|
||||
blockchainSDKFeatureToggles = DefaultBlockchainSDKFeatureToggles(featureTogglesManager),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue