mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-06-19 17:01:08 +00:00
fix: nomination pool exposure queries route to relay chain, graceful pending_rewards fallback
- StakeSummary and Alerts interactors now query elected exposures from relay chain (parentId) instead of parachain for correct staking status - Pending rewards flow catches missing NominationPoolsApi and emits zero - Update Telegram link to @pezkuwichainBot
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ android {
|
|||||||
buildConfigField "String", "PRIVACY_URL", "\"https://pezkuwichain.io/privacy.html\""
|
buildConfigField "String", "PRIVACY_URL", "\"https://pezkuwichain.io/privacy.html\""
|
||||||
buildConfigField "String", "TERMS_URL", "\"https://pezkuwichain.io/terms.html\""
|
buildConfigField "String", "TERMS_URL", "\"https://pezkuwichain.io/terms.html\""
|
||||||
buildConfigField "String", "GITHUB_URL", "\"https://github.com/pezkuwichain\""
|
buildConfigField "String", "GITHUB_URL", "\"https://github.com/pezkuwichain\""
|
||||||
buildConfigField "String", "TELEGRAM_URL", "\"https://t.me/pezkuwichain\""
|
buildConfigField "String", "TELEGRAM_URL", "\"https://t.me/pezkuwichainBot\""
|
||||||
buildConfigField "String", "TWITTER_URL", "\"https://twitter.com/pezkuwichain\""
|
buildConfigField "String", "TWITTER_URL", "\"https://twitter.com/pezkuwichain\""
|
||||||
buildConfigField "String", "RATE_URL", "\"market://details?id=${rootProject.applicationId}.${releaseApplicationSuffix}\""
|
buildConfigField "String", "RATE_URL", "\"market://details?id=${rootProject.applicationId}.${releaseApplicationSuffix}\""
|
||||||
buildConfigField "String", "EMAIL", "\"support@pezkuwichain.io\""
|
buildConfigField "String", "EMAIL", "\"support@pezkuwichain.io\""
|
||||||
|
|||||||
+3
-1
@@ -49,11 +49,13 @@ class RealNominationPoolsAlertsInteractor(
|
|||||||
return flowOfAll {
|
return flowOfAll {
|
||||||
val poolId = poolMember.poolId
|
val poolId = poolMember.poolId
|
||||||
val poolStash = poolAccountDerivation.bondedAccountOf(poolId, chain.id)
|
val poolStash = poolAccountDerivation.bondedAccountOf(poolId, chain.id)
|
||||||
|
// Staking exposures live on the relay chain, not on parachains like Asset Hub
|
||||||
|
val exposureChainId = chain.parentId ?: chain.id
|
||||||
|
|
||||||
combine(
|
combine(
|
||||||
nominationPoolsSharedComputation.participatingPoolNominationsFlow(poolStash, poolId, chain.id, shareComputationScope),
|
nominationPoolsSharedComputation.participatingPoolNominationsFlow(poolStash, poolId, chain.id, shareComputationScope),
|
||||||
nominationPoolsSharedComputation.unbondingPoolsFlow(poolId, chain.id, shareComputationScope),
|
nominationPoolsSharedComputation.unbondingPoolsFlow(poolId, chain.id, shareComputationScope),
|
||||||
stakingSharedComputation.electedExposuresWithActiveEraFlow(chain.id, shareComputationScope),
|
stakingSharedComputation.electedExposuresWithActiveEraFlow(exposureChainId, shareComputationScope),
|
||||||
) { poolNominations, unbondingPools, (eraStakers, activeEra) ->
|
) { poolNominations, unbondingPools, (eraStakers, activeEra) ->
|
||||||
val alertsContext = AlertsResolutionContext(
|
val alertsContext = AlertsResolutionContext(
|
||||||
eraStakers = eraStakers,
|
eraStakers = eraStakers,
|
||||||
|
|||||||
+5
-2
@@ -47,13 +47,16 @@ class RealNominationPoolStakeSummaryInteractor(
|
|||||||
stakingOption: StakingOption,
|
stakingOption: StakingOption,
|
||||||
sharedComputationScope: CoroutineScope,
|
sharedComputationScope: CoroutineScope,
|
||||||
): Flow<StakeSummary<PoolMemberStatus>> = flowOfAll {
|
): Flow<StakeSummary<PoolMemberStatus>> = flowOfAll {
|
||||||
val chainId = stakingOption.assetWithChain.chain.id
|
val chain = stakingOption.assetWithChain.chain
|
||||||
|
val chainId = chain.id
|
||||||
|
// Staking exposures live on the relay chain, not on parachains like Asset Hub
|
||||||
|
val exposureChainId = chain.parentId ?: chainId
|
||||||
val poolStash = poolAccountDerivation.bondedAccountOf(poolMember.poolId, chainId)
|
val poolStash = poolAccountDerivation.bondedAccountOf(poolMember.poolId, chainId)
|
||||||
|
|
||||||
combineTransform(
|
combineTransform(
|
||||||
nominationPoolSharedComputation.participatingBondedPoolStateFlow(poolStash, poolMember.poolId, chainId, sharedComputationScope),
|
nominationPoolSharedComputation.participatingBondedPoolStateFlow(poolStash, poolMember.poolId, chainId, sharedComputationScope),
|
||||||
nominationPoolSharedComputation.participatingPoolNominationsFlow(poolStash, poolMember.poolId, chainId, sharedComputationScope),
|
nominationPoolSharedComputation.participatingPoolNominationsFlow(poolStash, poolMember.poolId, chainId, sharedComputationScope),
|
||||||
stakingSharedComputation.electedExposuresWithActiveEraFlow(chainId, sharedComputationScope)
|
stakingSharedComputation.electedExposuresWithActiveEraFlow(exposureChainId, sharedComputationScope)
|
||||||
) { bondedPoolState, poolNominations, (eraStakers, activeEra) ->
|
) { bondedPoolState, poolNominations, (eraStakers, activeEra) ->
|
||||||
val activeStaked = bondedPoolState.amountOf(poolMember.points)
|
val activeStaked = bondedPoolState.amountOf(poolMember.points)
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -52,6 +52,9 @@ class RealNominationPoolsUserRewardsInteractor(
|
|||||||
|
|
||||||
private fun pendingRewardsFlow(accountId: AccountId, chainId: ChainId): Flow<Balance> {
|
private fun pendingRewardsFlow(accountId: AccountId, chainId: ChainId): Flow<Balance> {
|
||||||
return flowOf { repository.getPendingRewards(accountId, chainId) }
|
return flowOf { repository.getPendingRewards(accountId, chainId) }
|
||||||
.catch { Log.e("NominationPoolsUserRewardsInteractor", "Failed to fetch pending rewards", it) }
|
.catch {
|
||||||
|
Log.e("NominationPoolsUserRewardsInteractor", "Failed to fetch pending rewards", it)
|
||||||
|
emit(Balance.ZERO)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user