Cleanup staking info (#1532)
* Cleanup staking info * Cache calls * V1, V2 (Aura & Babe) tested & working * Hopefully pacify docs build * Second time lucky? * Third time lucky? * Fouth time
This commit is contained in:
@@ -58,7 +58,8 @@ function derivePhragmen (candidates: Vec<AccountId>, members: Vec<[AccountId, Ba
|
||||
}
|
||||
|
||||
function queryPhragmen (api: ApiInterfaceRx): Observable<DerivedElectionsInfo> {
|
||||
// NOTE We have an issue where candidates can return `null` for an empty array
|
||||
// NOTE We have an issue where candidates can return `null` for an empty array, hence
|
||||
// we are not using multi queries here, so empty array is empty (instead of space-filled)
|
||||
return combineLatest([
|
||||
api.query.electionsPhragmen.candidates<Vec<AccountId>>(),
|
||||
api.query.electionsPhragmen.members<Vec<[AccountId, Balance] & Codec>>()
|
||||
|
||||
@@ -26,8 +26,10 @@ import { voterPositions } from './voterPositions';
|
||||
* ```
|
||||
*/
|
||||
export function voters (api: ApiInterfaceRx): () => Observable<Vec<AccountId>> {
|
||||
const voterPositionsCall = voterPositions(api);
|
||||
|
||||
return (): Observable<Vec<AccountId>> =>
|
||||
voterPositions(api)().pipe(
|
||||
voterPositionsCall().pipe(
|
||||
map(
|
||||
(voterPositions: DerivedVoterPositions): Vec<AccountId> =>
|
||||
createType(
|
||||
|
||||
Reference in New Issue
Block a user