From 94a3b1f09a2e1a4ef36d7975c8c83f742cea882f Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 13 Mar 2020 21:05:40 +0100 Subject: [PATCH] eraPoints args (#2047) --- packages/api-derive/src/staking/overview.ts | 8 ++++---- packages/api/src/base/Decorate.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/api-derive/src/staking/overview.ts b/packages/api-derive/src/staking/overview.ts index 953aeb92e0..48a2df3830 100644 --- a/packages/api-derive/src/staking/overview.ts +++ b/packages/api-derive/src/staking/overview.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { AccountId, EraIndex, EraPoints, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces'; +import { AccountId, EraPoints, EraRewardPoints, RewardPoint } from '@polkadot/types/interfaces'; import { ApiInterfaceRx } from '@polkadot/api/types'; import { DerivedStakingOverview } from '../types'; @@ -11,8 +11,8 @@ import { map, switchMap } from 'rxjs/operators'; import { memo } from '../util'; -function retrievePointsPrev (api: ApiInterfaceRx, activeEra: EraIndex, currentElected: AccountId[]): Observable { - return api.query.staking.currentEraPointsEarned(activeEra).pipe( +function retrievePointsPrev (api: ApiInterfaceRx, currentElected: AccountId[]): Observable { + return api.query.staking.currentEraPointsEarned().pipe( map(({ individual, total }): EraRewardPoints => api.registry.createType('EraRewardPoints', { total, @@ -41,7 +41,7 @@ export function overview (api: ApiInterfaceRx): () => Observable(indexes.activeEra) : api.query.staking.currentEraPointsEarned - ? retrievePointsPrev(api, indexes.activeEra, nextElected) + ? retrievePointsPrev(api, nextElected) : of(api.registry.createType('EraRewardPoints')) ]) ), diff --git a/packages/api/src/base/Decorate.ts b/packages/api/src/base/Decorate.ts index 12b422fd59..8e7364d1fc 100644 --- a/packages/api/src/base/Decorate.ts +++ b/packages/api/src/base/Decorate.ts @@ -443,8 +443,8 @@ export default abstract class Decorate extends Events this.createType(meta.type.asDoubleMap.key1.toString() as 'Raw', arg).toU8a() ) : new Uint8Array([]) - )); - const startSubject = new BehaviorSubject(headKey); + )).toHex(); + const startSubject = new BehaviorSubject(headKey); return this._rpcCore.state.getKeysPaged ? startSubject.pipe(