diff --git a/packages/api-derive/src/staking/query.ts b/packages/api-derive/src/staking/query.ts index b307947308..9999a6a848 100644 --- a/packages/api-derive/src/staking/query.ts +++ b/packages/api-derive/src/staking/query.ts @@ -13,7 +13,7 @@ import { Option, Vec } from '@polkadot/types'; import { memo } from '../util'; -type MultiResult = [Option, Option | Nominations>, RewardDestination, ITuple<[ValidatorPrefs]>, Option, Exposure]; +type MultiResult = [Option, Option | Nominations>, RewardDestination, ITuple<[ValidatorPrefs]> | ValidatorPrefs, Option, Exposure]; function unwrapSessionIds (stashId: AccountId, queuedKeys: [AccountId, Keys][], nextKeys: Option): { nextSessionIds: AccountId[]; sessionIds: AccountId[] } { const sessionIds = (queuedKeys.find(([currentId]): boolean => @@ -55,7 +55,7 @@ function retrieveCurr (api: ApiInterfaceRx, stashId: AccountId): Observable>, MultiResult]): Observable { +function retrieveController (api: ApiInterfaceRx, stashId: AccountId, [queuedKeys, [controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, nextKeys, exposure]]: [Vec>, MultiResult]): Observable { const controllerId = controllerIdOpt.unwrapOr(null); const nominators = nominatorsOpt.unwrapOr(null); @@ -73,7 +73,9 @@ function retrieveController (api: ApiInterfaceRx, stashId: AccountId, [queuedKey rewardDestination, stakingLedger: stakingLedgerOpt.unwrapOr(undefined), stashId, - validatorPrefs, + validatorPrefs: Array.isArray(validatorPrefs) + ? validatorPrefs[0] + : validatorPrefs, ...unwrapSessionIds(stashId, queuedKeys, nextKeys) })) )