Merge pull request #5453 from vegaprotocol/chore/sync-main

chore(trading): sync main
This commit is contained in:
Matthew Russell 2023-12-05 12:35:31 -08:00 committed by GitHub
commit a52e60d6a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 6 deletions

View File

@ -310,16 +310,25 @@ export const CurrentVolume = ({
const t = useT(); const t = useT();
const nextTier = tiers[tierIndex + 1]; const nextTier = tiers[tierIndex + 1];
const requiredForNextTier = nextTier const requiredForNextTier = nextTier
? Number(nextTier.minimumRunningNotionalTakerVolume) - windowLengthVolume ? new BigNumber(nextTier.minimumRunningNotionalTakerVolume).minus(
: 0; windowLengthVolume
)
: new BigNumber(0);
const currentVolume = new BigNumber(windowLengthVolume);
return ( return (
<div className="flex flex-col gap-3 pt-4"> <div className="flex flex-col gap-3 pt-4">
<CardStat <CardStat
value={formatNumberRounded(new BigNumber(windowLengthVolume))} value={
text={t('pastEpochs', 'Past {{count}} epochs', { count: windowLength })} currentVolume.isZero()
? `<${formatNumberRounded(requiredForNextTier)}`
: formatNumberRounded(currentVolume)
}
text={t('pastEpochs', 'Past {{count}} epochs', {
count: windowLength,
})}
/> />
{requiredForNextTier > 0 && ( {requiredForNextTier.isGreaterThan(0) && (
<CardStat <CardStat
value={formatNumber(requiredForNextTier)} value={formatNumber(requiredForNextTier)}
text={t('Required for next tier')} text={t('Required for next tier')}

View File

@ -119,6 +119,8 @@ describe('getLiquidityProvision', () => {
createdAt: '2022-12-16T09:28:29.071781Z', createdAt: '2022-12-16T09:28:29.071781Z',
id: 'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59', id: 'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
fee: '0.001', fee: '0.001',
partyId:
'dde288688af2aeb5feb349dd72d3679a7a9be34c7375f6a4a48ef2f6140e7e59',
party: { party: {
__typename: 'Party', __typename: 'Party',
accountsConnection: { accountsConnection: {

View File

@ -159,7 +159,14 @@ export const getLiquidityProvision = (
const liquidityProvider = liquidityProviders.find( const liquidityProvider = liquidityProviders.find(
(f) => liquidityProvision.party.id === f.partyId (f) => liquidityProvision.party.id === f.partyId
); );
if (!liquidityProvider) return liquidityProvision;
if (!liquidityProvider) {
return {
...liquidityProvision,
partyId: liquidityProvision.party.id,
};
}
const accounts = compact( const accounts = compact(
liquidityProvision.party.accountsConnection?.edges liquidityProvision.party.accountsConnection?.edges
).map((e) => e.node); ).map((e) => e.node);