diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/P2PEthPoolApi.kt b/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/P2PEthPoolApi.kt index 99de156115..f76e0a7bfa 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/P2PEthPoolApi.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/P2PEthPoolApi.kt @@ -94,23 +94,4 @@ interface P2PEthPoolApi { @Path("delegatorAddress") delegatorAddress: String, @Path("vaultAddress") vaultAddress: String, ): ApiResponse> - - /** - * Get rewards history - * - * Retrieve historical rewards data for a specific account and vault. - * - * @param network Ethereum pool network: "mainnet" or "hoodi" - * @param delegatorAddress Account address that initiated staking - * @param vaultAddress Ethereum address of the vault - * @param period Optional period filter (30, 60, or 90 days) - */ - // TODO p2p not used, consider removing this method - @GET("api/v1/staking/pool/{network}/account/{delegatorAddress}/vault/{vaultAddress}/rewards") - suspend fun getRewards( - @Path("network") network: String, - @Path("delegatorAddress") delegatorAddress: String, - @Path("vaultAddress") vaultAddress: String, - @Query("period") period: Int? = null, - ): ApiResponse> } \ No newline at end of file diff --git a/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/models/response/P2PEthPoolRewardsResponse.kt b/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/models/response/P2PEthPoolRewardsResponse.kt deleted file mode 100644 index ef4dd03ff0..0000000000 --- a/core/datasource/src/main/java/com/tangem/datasource/api/ethpool/models/response/P2PEthPoolRewardsResponse.kt +++ /dev/null @@ -1,31 +0,0 @@ -package com.tangem.datasource.api.ethpool.models.response - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass -import org.joda.time.DateTime -import java.math.BigDecimal - -/** - * Response for GET /api/v1/staking/pool/{network}/account/{delegatorAddress}/vault/{vaultAddress}/rewards - */ -@JsonClass(generateAdapter = true) -data class P2PEthPoolRewardsResponse( - @Json(name = "delegatorAddress") - val delegatorAddress: String, - @Json(name = "vaultAddress") - val vaultAddress: String, - @Json(name = "rewards") - val rewards: List, -) - -@JsonClass(generateAdapter = true) -data class P2PEthPoolRewardDTO( - @Json(name = "date") - val date: DateTime, - @Json(name = "apy") - val apy: Double, - @Json(name = "balance") - val balance: BigDecimal, - @Json(name = "rewards") - val rewards: BigDecimal, -) \ No newline at end of file diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultP2PEthPoolRepository.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultP2PEthPoolRepository.kt index 4ffe515037..8752d83b0e 100644 --- a/data/staking/src/main/java/com/tangem/data/staking/DefaultP2PEthPoolRepository.kt +++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultP2PEthPoolRepository.kt @@ -7,7 +7,6 @@ import arrow.core.raise.either import arrow.core.raise.ensure import com.tangem.data.staking.converters.ethpool.P2PEthPoolBroadcastResultConverter import com.tangem.data.staking.converters.ethpool.P2PEthPoolErrorConverter -import com.tangem.data.staking.converters.ethpool.P2PEthPoolRewardConverter import com.tangem.data.staking.converters.ethpool.P2PEthPoolStakingAccountConverter import com.tangem.data.staking.converters.ethpool.P2PEthPoolUnsignedTxConverter import com.tangem.data.staking.converters.ethpool.P2PEthPoolVaultConverter @@ -23,7 +22,6 @@ import com.tangem.domain.staking.model.StakingAvailability import com.tangem.domain.staking.model.StakingOption import com.tangem.domain.staking.model.ethpool.P2PEthPoolBroadcastResult import com.tangem.domain.staking.model.ethpool.P2PEthPoolNetwork -import com.tangem.domain.staking.model.ethpool.P2PEthPoolReward import com.tangem.domain.staking.model.ethpool.P2PEthPoolUnsignedTx import com.tangem.domain.staking.model.ethpool.P2PEthPoolVault import com.tangem.domain.staking.model.stakekit.StakingError @@ -48,7 +46,6 @@ internal class DefaultP2PEthPoolRepository( private val vaultConverter = P2PEthPoolVaultConverter private val accountConverter = P2PEthPoolStakingAccountConverter - private val rewardConverter = P2PEthPoolRewardConverter private val broadcastResultConverter = P2PEthPoolBroadcastResultConverter private val errorConverter = P2PEthPoolErrorConverter @@ -181,26 +178,6 @@ internal class DefaultP2PEthPoolRepository( } } - override suspend fun getRewards( - network: P2PEthPoolNetwork, - delegatorAddress: String, - vaultAddress: String, - period: Int?, - ): Either> = either { - withContext(dispatchers.io) { - handleApiResponse( - p2pEthPoolApi.getRewards( - network = network.value, - delegatorAddress = delegatorAddress, - vaultAddress = vaultAddress, - period = period, - ), - ) { result -> - result.rewards.map { rewardConverter.convert(it) } - } - } - } - override fun getVaultsFlow(): Flow> { return p2pEthPoolVaultsStore.get() } diff --git a/data/staking/src/main/java/com/tangem/data/staking/converters/ethpool/P2PEthPoolRewardConverter.kt b/data/staking/src/main/java/com/tangem/data/staking/converters/ethpool/P2PEthPoolRewardConverter.kt deleted file mode 100644 index 0efd436ce7..0000000000 --- a/data/staking/src/main/java/com/tangem/data/staking/converters/ethpool/P2PEthPoolRewardConverter.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.tangem.data.staking.converters.ethpool - -import com.tangem.datasource.api.ethpool.models.response.P2PEthPoolRewardDTO -import com.tangem.domain.staking.model.ethpool.P2PEthPoolReward -import com.tangem.utils.converter.Converter - -/** - * Converter from P2PEthPool Reward Entry DTO to Domain model - */ -internal object P2PEthPoolRewardConverter : Converter { - - override fun convert(value: P2PEthPoolRewardDTO): P2PEthPoolReward { - return P2PEthPoolReward( - date = value.date, - apy = value.apy.toBigDecimal(), - balance = value.balance, - rewards = value.rewards, - ) - } -} \ No newline at end of file diff --git a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/ethpool/P2PEthPoolReward.kt b/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/ethpool/P2PEthPoolReward.kt deleted file mode 100644 index b4672d3f90..0000000000 --- a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/ethpool/P2PEthPoolReward.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.tangem.domain.staking.model.ethpool - -import com.tangem.domain.models.serialization.SerializedBigDecimal -import org.joda.time.DateTime - -/** - * Rewards history entry - * Historical reward information for account - */ -data class P2PEthPoolReward( - val date: DateTime, - val apy: SerializedBigDecimal, - val balance: SerializedBigDecimal, - val rewards: SerializedBigDecimal, -) \ No newline at end of file diff --git a/domain/staking/src/main/java/com/tangem/domain/staking/repositories/P2PEthPoolRepository.kt b/domain/staking/src/main/java/com/tangem/domain/staking/repositories/P2PEthPoolRepository.kt index 7b4e4568e2..f0f34da571 100644 --- a/domain/staking/src/main/java/com/tangem/domain/staking/repositories/P2PEthPoolRepository.kt +++ b/domain/staking/src/main/java/com/tangem/domain/staking/repositories/P2PEthPoolRepository.kt @@ -5,7 +5,6 @@ import com.tangem.domain.models.staking.P2PEthPoolStakingAccount import com.tangem.domain.staking.model.StakingAvailability import com.tangem.domain.staking.model.ethpool.P2PEthPoolBroadcastResult import com.tangem.domain.staking.model.ethpool.P2PEthPoolNetwork -import com.tangem.domain.staking.model.ethpool.P2PEthPoolReward import com.tangem.domain.staking.model.ethpool.P2PEthPoolUnsignedTx import com.tangem.domain.staking.model.ethpool.P2PEthPoolVault import com.tangem.domain.staking.model.ethpool.P2PEthPoolStakingConfig @@ -112,22 +111,6 @@ interface P2PEthPoolRepository { vaultAddress: String, ): Either - /** - * Get rewards history for account and vault - * - * @param network P2PEthPool network (MAINNET or TESTNET) - * @param delegatorAddress User's wallet address - * @param vaultAddress Vault contract address - * @param period Optional period filter in days (30, 60, or 90) - * @return Either error or list of reward entries - */ - suspend fun getRewards( - network: P2PEthPoolNetwork, - delegatorAddress: String, - vaultAddress: String, - period: Int? = null, - ): Either> - /** * Get flow of cached vaults. * diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CryptoCurrencyStatusFactory.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CryptoCurrencyStatusFactory.kt index d58781bda3..a229a4fd7c 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CryptoCurrencyStatusFactory.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CryptoCurrencyStatusFactory.kt @@ -268,7 +268,6 @@ object CryptoCurrencyStatusFactory { } } is StakingBalance.Data.P2PEthPool -> { - // TODO p2p val isCurrentAddressStaking = stakingBalance.stakingId.address == address.defaultAddress.value if (isCurrentAddressStaking) stakingBalance else null }