Updated on 2026-08-14
This commit is contained in:
parent
75be53dd29
commit
df9e5cd2b8
1 changed files with 16 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
|||
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
|
||||
|
|
@ -18,10 +21,22 @@ class StakingApyFlowUseCase(private val stakingRepository: StakingRepository) {
|
|||
return stakingRepository.getEnabledYields()
|
||||
.map { yields ->
|
||||
yields.associate { yield ->
|
||||
val key = "${yield.token.coinGeckoId}_${yield.token.symbol}"
|
||||
val key = composeKey(yield)
|
||||
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