Drop support for linked lists (#2643)
* Drop support for linked lists * CHANGELOG * Remove all .linked. checks
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { AccountId, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Vec } from '@polkadot/types';
|
||||
|
||||
import { memo } from '../util';
|
||||
|
||||
@@ -16,12 +14,8 @@ import { memo } from '../util';
|
||||
*/
|
||||
export function stashes (instanceId: string, api: ApiInterfaceRx): () => Observable<AccountId[]> {
|
||||
return memo(instanceId, (): Observable<AccountId[]> =>
|
||||
api.query.staking.validators.creator.meta.type.asMap.linked.isTrue
|
||||
? api.query.staking.validators<ITuple<[Vec<AccountId>, Vec<ValidatorPrefs>]>>().pipe(
|
||||
map(([stashIds]) => stashIds)
|
||||
)
|
||||
: api.query.staking.validators.keys().pipe(
|
||||
map((keys) => keys.map((key) => key.args[0] as AccountId).filter((a) => a))
|
||||
)
|
||||
api.query.staking.validators.keys().pipe(
|
||||
map((keys) => keys.map((key) => key.args[0] as AccountId).filter((a) => a))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user