Update api.derive.staking calls with breaking changes (#5860)
* Fix staking derives * ownexposure * fix query * Add WithExposureMEta * exposureMEta * fix ownExposures * Add page input for staking.query * Update types for query * add page param to ownExposure * change page to exposurePaged * fix small nit
This commit is contained in:
@@ -11,11 +11,11 @@ import { memo } from '../util/index.js';
|
||||
|
||||
export function nextElected (instanceId: string, api: DeriveApi): () => Observable<AccountId[]> {
|
||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||
api.query.staking.erasStakers
|
||||
api.query.staking.erasStakersPaged
|
||||
? 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.erasStakers.keys(currentEra)),
|
||||
switchMap(({ currentEra }) => api.query.staking.erasStakersPaged.keys(currentEra)),
|
||||
map((keys) => keys.map(({ args: [, accountId] }) => accountId))
|
||||
)
|
||||
: api.query.staking['currentElected']<AccountId[]>()
|
||||
|
||||
Reference in New Issue
Block a user