Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/api-derive/src/staking/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { memo } from '../util/index.js';
export function nextElected (instanceId: string, api: DeriveApi): () => Observable<AccountId[]> {
return memo(instanceId, (): Observable<AccountId[]> =>
// Compatibility for future generation changes in staking.
api.query.staking.erasStakersPaged
api.query.staking.erasStakersOverview
? api.derive.session.indexes().pipe(
// only populate for next era in the last session, so track both here - entries are not
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
switchMap(({ currentEra }) => api.query.staking.erasStakersPaged.keys(currentEra)),
switchMap(({ currentEra }) => api.query.staking.erasStakersOverview.keys(currentEra)),
// Dedupe any duplicates
map((keys) => [...new Set(keys.map(({ args: [, accountId] }) => accountId.toString()))].map((a) => api.registry.createType('AccountId', a)))
)
Expand Down
Loading