Bump dev (w/ ts-eslint updates) (#5691)
This commit is contained in:
@@ -39,8 +39,10 @@ export function setEraMultiCache <T extends { era: EraIndex }> (CACHE_KEY: strin
|
||||
}
|
||||
|
||||
export function filterCachedEras <T extends { era: EraIndex }> (eras: EraIndex[], cached: T[], query: T[]): T[] {
|
||||
return eras.map((e) =>
|
||||
cached.find(({ era }) => e.eq(era)) ||
|
||||
query.find(({ era }) => e.eq(era)) as T
|
||||
);
|
||||
return eras
|
||||
.map((e) =>
|
||||
cached.find(({ era }) => e.eq(era)) ||
|
||||
query.find(({ era }) => e.eq(era))
|
||||
)
|
||||
.filter((e): e is T => !!e);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { firstMemo, memo } from '../util/index.js';
|
||||
function parseDetails (stashId: AccountId, controllerIdOpt: Option<AccountId> | null, nominatorsOpt: Option<PalletStakingNominations>, rewardDestination: PalletStakingRewardDestination, validatorPrefs: PalletStakingValidatorPrefs, exposure: PalletStakingExposure, stakingLedgerOpt: Option<PalletStakingStakingLedger>): DeriveStakingQuery {
|
||||
return {
|
||||
accountId: stashId,
|
||||
controllerId: controllerIdOpt && controllerIdOpt.unwrapOr(null),
|
||||
controllerId: controllerIdOpt?.unwrapOr(null) || null,
|
||||
exposure,
|
||||
nominators: nominatorsOpt.isSome
|
||||
? nominatorsOpt.unwrap().targets
|
||||
|
||||
@@ -167,10 +167,12 @@ export function _stakerRewards (instanceId: string, api: DeriveApi): (accountIds
|
||||
queries.map(({ stakingLedger }, index): DeriveStakerReward[] =>
|
||||
filterRewards(
|
||||
eras,
|
||||
stashValidators[index].map((validatorId): [string, DeriveStakingQuery] => [
|
||||
validatorId,
|
||||
queriedVals.find((q) => q.accountId.eq(validatorId)) as DeriveStakingQuery
|
||||
]),
|
||||
stashValidators[index]
|
||||
.map((validatorId): [string, DeriveStakingQuery | undefined] => [
|
||||
validatorId,
|
||||
queriedVals.find((q) => q.accountId.eq(validatorId))
|
||||
])
|
||||
.filter((v): v is [string, DeriveStakingQuery] => !!v[1]),
|
||||
{
|
||||
rewards: allRewards[index],
|
||||
stakingLedger
|
||||
|
||||
Reference in New Issue
Block a user