fix: make sure asset is not added to list if it doesn't container correct reward types
This commit is contained in:
parent
b2860121e5
commit
fc2773d748
@ -241,6 +241,16 @@ describe('generateEpochAssetRewardsList', () => {
|
||||
amount: '5',
|
||||
},
|
||||
},
|
||||
{
|
||||
// This should not be included in the result
|
||||
node: {
|
||||
epoch: 2,
|
||||
assetId: '3',
|
||||
decimals: 18,
|
||||
rewardType: AccountType.ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY,
|
||||
amount: '5',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
epoch: {
|
||||
|
@ -83,13 +83,17 @@ export const generateEpochTotalRewardsList = ({
|
||||
(Number(rewardItem?.amount) || 0) + Number(reward.amount)
|
||||
).toString();
|
||||
|
||||
if (Object.keys(RowAccountTypes).includes(reward.rewardType)) {
|
||||
rewards?.set(reward.rewardType, {
|
||||
rewardType: reward.rewardType,
|
||||
amount,
|
||||
});
|
||||
// only RowAccountTypes are relevant for this table, others should
|
||||
// be discarded
|
||||
if (!Object.keys(RowAccountTypes).includes(reward.rewardType)) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
rewards?.set(reward.rewardType, {
|
||||
rewardType: reward.rewardType,
|
||||
amount,
|
||||
});
|
||||
|
||||
epoch.assetRewards.set(reward.assetId, {
|
||||
assetId: reward.assetId,
|
||||
name: matchingAsset?.name || '',
|
||||
|
Loading…
Reference in New Issue
Block a user