Drop support for linked lists (#2643)

* Drop support for linked lists

* CHANGELOG

* Remove all .linked. checks
This commit is contained in:
Jaco Greeff
2020-09-25 10:19:28 +02:00
committed by GitHub
parent 82afd93bf6
commit 7fd45f63df
7 changed files with 23 additions and 160 deletions
+4 -10
View File
@@ -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))
)
);
}