Skip to content

Commit

Permalink
fix some naming
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Apr 23, 2024
1 parent ac0f0ab commit 28ec8eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/api-derive/src/staking/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function rewardDestinationCompat (rewardDestination: PalletStakingRewardDestinat
}

function filterClaimedRewards(cl: number[]): number[] {

Check failure on line 23 in packages/api-derive/src/staking/query.ts

View workflow job for this annotation

GitHub Actions / pr (lint)

Missing space before function parentheses
console.log('CL: ', cl);
return cl.filter((c) => c !== -1)

Check failure on line 25 in packages/api-derive/src/staking/query.ts

View workflow job for this annotation

GitHub Actions / pr (lint)

Expected blank line before this statement

Check failure on line 25 in packages/api-derive/src/staking/query.ts

View workflow job for this annotation

GitHub Actions / pr (lint)

Missing semicolon
}

Expand Down Expand Up @@ -107,6 +108,7 @@ function getStashInfo (api: DeriveApi, stashIds: AccountId[], activeEra: EraInde
return r.map((stashClaimedEras) => {
// stashClaimedEras length will match the length of eras
return stashClaimedEras.map((claimedReward, idx) => {
console.log('HIT THIS')
if (claimedReward.length) return eras[idx]
return -1
})
Expand All @@ -119,11 +121,11 @@ function getStashInfo (api: DeriveApi, stashIds: AccountId[], activeEra: EraInde

function getBatch (api: DeriveApi, activeEra: EraIndex, stashIds: AccountId[], flags: StakingQueryFlags, page: u32 | AnyNumber): Observable<DeriveStakingQuery[]> {
return getStashInfo(api, stashIds, activeEra, flags, page).pipe(
switchMap(([controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure, exposureMeta, claimedRewards]): Observable<DeriveStakingQuery[]> =>
switchMap(([controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure, exposureMeta, claimedRewardsEras]): Observable<DeriveStakingQuery[]> =>
getLedgers(api, controllerIdOpt, flags).pipe(
map((stakingLedgerOpts) =>
stashIds.map((stashId, index) =>
parseDetails(stashId, controllerIdOpt[index], nominatorsOpt[index], rewardDestination[index], validatorPrefs[index], exposure[index], stakingLedgerOpts[index], exposureMeta[index], claimedRewards[index])
parseDetails(stashId, controllerIdOpt[index], nominatorsOpt[index], rewardDestination[index], validatorPrefs[index], exposure[index], stakingLedgerOpts[index], exposureMeta[index], claimedRewardsEras[index])
)
)
)
Expand Down

0 comments on commit 28ec8eb

Please sign in to comment.