diff --git a/packages/api-derive/src/staking/validators.ts b/packages/api-derive/src/staking/validators.ts index e8561e904c0..aad1f2d687d 100644 --- a/packages/api-derive/src/staking/validators.ts +++ b/packages/api-derive/src/staking/validators.ts @@ -12,11 +12,11 @@ import { memo } from '../util/index.js'; export function nextElected (instanceId: string, api: DeriveApi): () => Observable { return memo(instanceId, (): Observable => // 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))) )