Updated on 2026-08-14
This commit is contained in:
parent
f807fe288f
commit
c9fca04205
4 changed files with 68 additions and 29 deletions
|
|
@ -1,8 +1,10 @@
|
|||
package com.tangem.domain.staking.model
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.blockchainsdk.utils.toMigratedCoinId
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.network.Network
|
||||
|
||||
/**
|
||||
* Represents a staking integration identifier.
|
||||
|
|
@ -143,6 +145,9 @@ sealed interface StakingIntegrationID {
|
|||
}
|
||||
}
|
||||
|
||||
val Network.isStakingSupported: Boolean
|
||||
get() = this.toBlockchain().isStakingSupported
|
||||
|
||||
/**
|
||||
* Extension property to check if staking is supported for a blockchain.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package com.tangem.domain.staking.usecase
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.toNetworkId
|
||||
import com.tangem.domain.staking.model.StakingIntegrationID
|
||||
import com.tangem.domain.staking.model.stakekit.Yield
|
||||
import com.tangem.domain.staking.repositories.StakingRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
|
@ -21,22 +18,10 @@ class StakingApyFlowUseCase(private val stakingRepository: StakingRepository) {
|
|||
return stakingRepository.getEnabledYields()
|
||||
.map { yields ->
|
||||
yields.associate { yield ->
|
||||
val key = composeKey(yield)
|
||||
val key = "${yield.token.coinGeckoId}_${yield.token.symbol}"
|
||||
val apy = yield.validators
|
||||
key to apy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// so that cause for api.stakek.it coinGeckoId on BNB Smart chain different how we receive our backendId
|
||||
// coinGeckoId - binance
|
||||
// our backendId BNB Smart Chain - binance-smart-chain
|
||||
// our backendId BNB Beacon Chain - binance
|
||||
private fun composeKey(yield: Yield): String {
|
||||
return if (yield.token.symbol == StakingIntegrationID.Coin.BSC.blockchain.currency) {
|
||||
"${Blockchain.BSC.toNetworkId()}_${yield.token.symbol}"
|
||||
} else {
|
||||
"${yield.token.coinGeckoId}_${yield.token.symbol}"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue