Fix returned accountId for derived staking.info (#1501)

This commit is contained in:
Jaco Greeff
2019-10-21 17:26:34 +02:00
committed by GitHub
parent d4ab4f8293
commit 62eab2d661
+4 -4
View File
@@ -133,7 +133,7 @@ function retrieveMulti (api: ApiInterfaceRx, stashId: AccountId, controllerId: A
]) as Observable<MultiResult>;
}
function retrieveInfo (api: ApiInterfaceRx, stashId: AccountId, controllerId: AccountId): Observable<DerivedStaking> {
function retrieveInfo (api: ApiInterfaceRx, accountId: AccountId, stashId: AccountId, controllerId: AccountId): Observable<DerivedStaking> {
return combineLatest([
eraLength(api)(),
bestNumber(api)(),
@@ -144,7 +144,7 @@ function retrieveInfo (api: ApiInterfaceRx, stashId: AccountId, controllerId: Ac
const stakingLedger = _stakingLedger.unwrapOr(undefined);
return {
accountId: stashId,
accountId,
controllerId,
nominators,
offline: recentlyOffline[stashId.toString()],
@@ -179,9 +179,9 @@ export function info (api: ApiInterfaceRx): (_accountId: Uint8Array | string) =>
).pipe(
switchMap(([controllerId, stakingLedger]): Observable<DerivedStaking> =>
controllerId.isSome
? retrieveInfo(api, accountId, controllerId.unwrap())
? retrieveInfo(api, accountId, accountId, controllerId.unwrap())
: stakingLedger.isSome
? retrieveInfo(api, stakingLedger.unwrap().stash, accountId)
? retrieveInfo(api, accountId, stakingLedger.unwrap().stash, accountId)
: of({ accountId, nextSessionIds: [], sessionIds: [] })
),
drr()