Retrieve ledger for payouts (#2901)

This commit is contained in:
Jaco Greeff
2020-12-02 20:30:40 +01:00
committed by GitHub
parent f7da1d0fb2
commit 6559b1ad11
3 changed files with 7 additions and 7 deletions
@@ -18,7 +18,7 @@ export function electedInfo (instanceId: string, api: ApiInterfaceRx): () => Obs
return memo(instanceId, (): Observable<DeriveStakingElected> =>
api.derive.staking.validators().pipe(
switchMap(({ nextElected, validators }): Observable<DeriveStakingElected> =>
api.derive.staking.queryMulti(combineAccounts(nextElected, validators), { withExposure: true, withPrefs: true }).pipe(
api.derive.staking.queryMulti(combineAccounts(nextElected, validators), { withExposure: true, withLedger: true, withPrefs: true }).pipe(
map((info): DeriveStakingElected => ({
info,
nextElected,
+5 -5
View File
@@ -22,11 +22,11 @@ interface QueryFlags {
withPrefs?: boolean;
}
type MultiResultPrev = [Option<AccountId>, Option<ITuple<[Nominations]>>, RewardDestination, ITuple<[ValidatorPrefs]> | ValidatorPrefs, Exposure];
type MultiResult = [Option<AccountId>, Option<ITuple<[Nominations]> | Nominations>, RewardDestination, ITuple<[ValidatorPrefs]> | ValidatorPrefs, Exposure];
type MultiResultCombo = [Option<AccountId>, Option<ITuple<[Nominations]> | Nominations>, RewardDestination, ITuple<[ValidatorPrefs]> | ValidatorPrefs, Exposure];
type MultiResultCombo = [Option<AccountId>, Option<Nominations>, RewardDestination, ValidatorPrefs, Exposure];
function parseDetails (stashId: AccountId, [controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure]: MultiResultCombo, stakingLedgerOpt: Option<StakingLedger>): DeriveStakingQuery {
function parseDetails (stashId: AccountId, [controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure]: MultiResult, stakingLedgerOpt: Option<StakingLedger>): DeriveStakingQuery {
const nominators = nominatorsOpt && nominatorsOpt.unwrapOr(null);
return {
@@ -47,8 +47,8 @@ function parseDetails (stashId: AccountId, [controllerIdOpt, nominatorsOpt, rewa
};
}
function retrievePrev (api: ApiInterfaceRx, stashId: AccountId): Observable<MultiResultPrev> {
return api.queryMulti<MultiResultPrev>([
function retrievePrev (api: ApiInterfaceRx, stashId: AccountId): Observable<MultiResult> {
return api.queryMulti<MultiResult>([
[api.query.staking.bonded, stashId],
[api.query.staking.nominators, stashId],
[api.query.staking.payee, stashId],
@@ -20,7 +20,7 @@ export function waitingInfo (instanceId: string, api: ApiInterfaceRx): () => Obs
const elected = nextElected.map((a) => a.toString());
const waiting = stashes.filter((v) => !elected.includes(v.toString()));
return api.derive.staking.queryMulti(waiting, { withPrefs: true }).pipe(
return api.derive.staking.queryMulti(waiting, { withLedger: true, withPrefs: true }).pipe(
map((info): DeriveStakingWaiting => ({
info,
waiting