Skip to content

Commit

Permalink
Add isClaimed field to api.derive.staking._stakerRewards
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Oct 24, 2024
1 parent 5c0fe9b commit 8b07d7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/api-derive/src/staking/stakerRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function parseRewards (api: DeriveApi, stashId: AccountId, [erasPoints, erasPref
return {
era,
eraReward,
isClaimed: false,
isEmpty,
isValidator,
nominating,
Expand Down Expand Up @@ -152,6 +153,7 @@ function filterRewards (eras: EraIndex[], valInfo: [string, DeriveStakingQuery][
.filter(({ validators }) => Object.keys(validators).length !== 0)
.map((reward) =>
objectSpread({}, reward, {
isClaimed: filter.some((f) => reward.era.eq(f)),
nominators: reward.nominating.filter((n) => reward.validators[n.validatorId])
})
);
Expand Down
1 change: 1 addition & 0 deletions packages/api-derive/src/staking/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface DeriveStakerRewardValidator {
export interface DeriveStakerReward {
era: EraIndex;
eraReward: Balance;
isClaimed: boolean;
isEmpty: boolean;
isValidator: boolean;
nominating: DeriveEraExposureNominating[];
Expand Down

0 comments on commit 8b07d7b

Please sign in to comment.