fix(trading): reward pot total value (#5531)
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
This commit is contained in:
parent
4cffee29f8
commit
95775679ca
@ -69,11 +69,13 @@ describe('RewardPot', () => {
|
|||||||
balance: '100',
|
balance: '100',
|
||||||
asset: rewardAsset,
|
asset: rewardAsset,
|
||||||
},
|
},
|
||||||
|
// should include this in total:
|
||||||
{
|
{
|
||||||
type: AccountType.ACCOUNT_TYPE_VESTED_REWARDS,
|
type: AccountType.ACCOUNT_TYPE_VESTED_REWARDS,
|
||||||
balance: '100',
|
balance: '100',
|
||||||
asset: rewardAsset,
|
asset: rewardAsset,
|
||||||
},
|
},
|
||||||
|
// should include this in total:
|
||||||
{
|
{
|
||||||
type: AccountType.ACCOUNT_TYPE_VESTED_REWARDS,
|
type: AccountType.ACCOUNT_TYPE_VESTED_REWARDS,
|
||||||
balance: '50',
|
balance: '50',
|
||||||
@ -138,20 +140,20 @@ describe('RewardPot', () => {
|
|||||||
|
|
||||||
renderComponent(props);
|
renderComponent(props);
|
||||||
|
|
||||||
expect(screen.getByTestId('total-rewards')).toHaveTextContent(
|
|
||||||
`7.00 ${rewardAsset.symbol}`
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.getByText(/Locked/).nextElementSibling).toHaveTextContent(
|
expect(screen.getByText(/Locked/).nextElementSibling).toHaveTextContent(
|
||||||
'2.50'
|
'2.50'
|
||||||
);
|
);
|
||||||
expect(screen.getByText(/Vesting/).nextElementSibling).toHaveTextContent(
|
expect(screen.getByText(/Vesting/).nextElementSibling).toHaveTextContent(
|
||||||
'4.50'
|
'4.50'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(/Available to withdraw/).nextElementSibling
|
screen.getByText(/Available to withdraw/).nextElementSibling
|
||||||
).toHaveTextContent('1.50');
|
).toHaveTextContent('1.50');
|
||||||
|
|
||||||
|
// should be sum of the above
|
||||||
|
expect(screen.getByTestId('total-rewards')).toHaveTextContent(
|
||||||
|
`8.50 ${rewardAsset.symbol}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,6 +62,10 @@ export const RewardsContainer = () => {
|
|||||||
},
|
},
|
||||||
// Inclusion of activity streak in query currently fails
|
// Inclusion of activity streak in query currently fails
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
|
// polling here so that as rewards are are moved to ACCOUNT_TYPE_VESTED_REWARDS the vesting stats information stays
|
||||||
|
// almost up to sync with accounts updating from subscriptions. There is a chance the data could be out
|
||||||
|
// of sync for 10s if you happen to be on the page at the end of an epoch
|
||||||
|
pollInterval: 10000,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!epochData?.epoch || !assetMap) return null;
|
if (!epochData?.epoch || !assetMap) return null;
|
||||||
@ -295,7 +299,9 @@ export const RewardPot = ({
|
|||||||
: [0];
|
: [0];
|
||||||
const totalVesting = BigNumber.sum.apply(null, vestingBalances);
|
const totalVesting = BigNumber.sum.apply(null, vestingBalances);
|
||||||
|
|
||||||
const totalRewards = totalLocked.plus(totalVesting);
|
const totalRewards = totalLocked
|
||||||
|
.plus(totalVesting)
|
||||||
|
.plus(totalVestedRewardsByRewardAsset);
|
||||||
|
|
||||||
let rewardAsset = undefined;
|
let rewardAsset = undefined;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user