Fix staking.info (#1091)

* Frankenstein

* Remove console.log

* Fix lint

* Remove console

* Fix tests

* Put back old version

* Add comment

* Store changeset data (filling in the blanks) (#1094)

* Store changeset data (filling in the blanks)

* Option(StorageData, null) when not available

* Make test pass
This commit is contained in:
Amaury Martiny
2019-07-10 13:08:32 +02:00
committed by Jaco Greeff
parent 7dfdab7bcc
commit a3ce8672af
7 changed files with 83 additions and 40 deletions
+12 -12
View File
@@ -83,18 +83,18 @@ function withStashController (api: ApiInterface$Rx, accountId: AccountId, contro
const stashId = accountId;
return (
combineLatest([
eraLength(api)(),
bestNumber(api)(),
api.queryMulti([
[api.query.session.nextKeyFor, controllerId],
[api.query.staking.ledger, controllerId],
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
[api.query.staking.stakers, stashId],
[api.query.staking.validators, stashId]
])
]) as any as Observable<[BN, BlockNumber, [Option<Keys | SessionKey>, Option<StakingLedger>, [Array<AccountId>], RewardDestination, Exposure, [ValidatorPrefs]]]>
combineLatest([
eraLength(api)(),
bestNumber(api)(),
api.queryMulti([
[api.query.session.nextKeyFor, controllerId],
[api.query.staking.ledger, controllerId],
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
[api.query.staking.stakers, stashId],
[api.query.staking.validators, stashId]
])
]) as any as Observable<[BN, BlockNumber, [Option<Keys | SessionKey>, Option<StakingLedger>, [Array<AccountId>], RewardDestination, Exposure, [ValidatorPrefs]]]>
).pipe(
map(([eraLength, bestNumber, [nextKeyFor, _stakingLedger, [nominators], rewardDestination, stakers, [validatorPrefs]]]) => {
const stakingLedger = _stakingLedger.unwrapOr(null) || undefined;