chore(trading): fees page use window length in label (#5186)
This commit is contained in:
parent
89aeed6305
commit
d76fa13c5d
@ -86,14 +86,14 @@ describe('CurerntVolume', () => {
|
|||||||
],
|
],
|
||||||
tierIndex: 0,
|
tierIndex: 0,
|
||||||
windowLengthVolume,
|
windowLengthVolume,
|
||||||
epochs: 5,
|
windowLength: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
render(<CurrentVolume {...props} />);
|
render(<CurrentVolume {...props} />);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(formatNumber(windowLengthVolume)).nextElementSibling
|
screen.getByText(formatNumber(windowLengthVolume)).nextElementSibling
|
||||||
).toHaveTextContent(`Past ${props.epochs} epochs`);
|
).toHaveTextContent(`Past ${props.windowLength} epochs`);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(formatNumber(nextTierVolume - windowLengthVolume))
|
screen.getByText(formatNumber(nextTierVolume - windowLengthVolume))
|
||||||
|
@ -30,16 +30,16 @@ export const FeesContainer = () => {
|
|||||||
const { data: programData, loading: programLoading } =
|
const { data: programData, loading: programLoading } =
|
||||||
useDiscountProgramsQuery();
|
useDiscountProgramsQuery();
|
||||||
|
|
||||||
const volumeDiscountEpochs =
|
const volumeDiscountWindowLength =
|
||||||
programData?.currentVolumeDiscountProgram?.windowLength || 1;
|
programData?.currentVolumeDiscountProgram?.windowLength || 1;
|
||||||
const referralDiscountEpochs =
|
const referralDiscountWindowLength =
|
||||||
programData?.currentReferralProgram?.windowLength || 1;
|
programData?.currentReferralProgram?.windowLength || 1;
|
||||||
|
|
||||||
const { data: feesData, loading: feesLoading } = useFeesQuery({
|
const { data: feesData, loading: feesLoading } = useFeesQuery({
|
||||||
variables: {
|
variables: {
|
||||||
partyId: pubKey || '',
|
partyId: pubKey || '',
|
||||||
volumeDiscountEpochs,
|
volumeDiscountEpochs: volumeDiscountWindowLength,
|
||||||
referralDiscountEpochs,
|
referralDiscountEpochs: referralDiscountWindowLength,
|
||||||
},
|
},
|
||||||
skip: !pubKey || !programData,
|
skip: !pubKey || !programData,
|
||||||
});
|
});
|
||||||
@ -101,7 +101,7 @@ export const FeesContainer = () => {
|
|||||||
tiers={volumeTiers}
|
tiers={volumeTiers}
|
||||||
tierIndex={volumeTierIndex}
|
tierIndex={volumeTierIndex}
|
||||||
windowLengthVolume={volumeInWindow}
|
windowLengthVolume={volumeInWindow}
|
||||||
epochs={volumeDiscountEpochs}
|
windowLength={volumeDiscountWindowLength}
|
||||||
/>
|
/>
|
||||||
</FeeCard>
|
</FeeCard>
|
||||||
<FeeCard
|
<FeeCard
|
||||||
@ -112,7 +112,7 @@ export const FeesContainer = () => {
|
|||||||
<ReferralBenefits
|
<ReferralBenefits
|
||||||
setRunningNotionalTakerVolume={referralVolumeInWindow}
|
setRunningNotionalTakerVolume={referralVolumeInWindow}
|
||||||
epochsInSet={epochsInSet}
|
epochsInSet={epochsInSet}
|
||||||
epochs={referralDiscountEpochs}
|
epochs={referralDiscountWindowLength}
|
||||||
/>
|
/>
|
||||||
</FeeCard>
|
</FeeCard>
|
||||||
</>
|
</>
|
||||||
@ -126,6 +126,7 @@ export const FeesContainer = () => {
|
|||||||
tiers={volumeTiers}
|
tiers={volumeTiers}
|
||||||
tierIndex={volumeTierIndex}
|
tierIndex={volumeTierIndex}
|
||||||
lastEpochVolume={volumeInWindow}
|
lastEpochVolume={volumeInWindow}
|
||||||
|
windowLength={volumeDiscountWindowLength}
|
||||||
/>
|
/>
|
||||||
</FeeCard>
|
</FeeCard>
|
||||||
<FeeCard
|
<FeeCard
|
||||||
@ -269,12 +270,12 @@ export const CurrentVolume = ({
|
|||||||
tiers,
|
tiers,
|
||||||
tierIndex,
|
tierIndex,
|
||||||
windowLengthVolume,
|
windowLengthVolume,
|
||||||
epochs,
|
windowLength,
|
||||||
}: {
|
}: {
|
||||||
tiers: Array<{ minimumRunningNotionalTakerVolume: string }>;
|
tiers: Array<{ minimumRunningNotionalTakerVolume: string }>;
|
||||||
tierIndex: number;
|
tierIndex: number;
|
||||||
windowLengthVolume: number;
|
windowLengthVolume: number;
|
||||||
epochs: number;
|
windowLength: number;
|
||||||
}) => {
|
}) => {
|
||||||
const nextTier = tiers[tierIndex + 1];
|
const nextTier = tiers[tierIndex + 1];
|
||||||
const requiredForNextTier = nextTier
|
const requiredForNextTier = nextTier
|
||||||
@ -285,7 +286,7 @@ export const CurrentVolume = ({
|
|||||||
<div>
|
<div>
|
||||||
<Stat
|
<Stat
|
||||||
value={formatNumberRounded(new BigNumber(windowLengthVolume))}
|
value={formatNumberRounded(new BigNumber(windowLengthVolume))}
|
||||||
text={t('Past %s epochs', epochs.toString())}
|
text={t('Past %s epochs', windowLength.toString())}
|
||||||
/>
|
/>
|
||||||
{requiredForNextTier > 0 && (
|
{requiredForNextTier > 0 && (
|
||||||
<Stat
|
<Stat
|
||||||
@ -356,6 +357,7 @@ const VolumeTiers = ({
|
|||||||
tiers,
|
tiers,
|
||||||
tierIndex,
|
tierIndex,
|
||||||
lastEpochVolume,
|
lastEpochVolume,
|
||||||
|
windowLength,
|
||||||
}: {
|
}: {
|
||||||
tiers: Array<{
|
tiers: Array<{
|
||||||
volumeDiscountFactor: string;
|
volumeDiscountFactor: string;
|
||||||
@ -363,6 +365,7 @@ const VolumeTiers = ({
|
|||||||
}>;
|
}>;
|
||||||
tierIndex: number;
|
tierIndex: number;
|
||||||
lastEpochVolume: number;
|
lastEpochVolume: number;
|
||||||
|
windowLength: number;
|
||||||
}) => {
|
}) => {
|
||||||
if (!tiers.length) {
|
if (!tiers.length) {
|
||||||
return (
|
return (
|
||||||
@ -380,7 +383,7 @@ const VolumeTiers = ({
|
|||||||
<Th>{t('Tier')}</Th>
|
<Th>{t('Tier')}</Th>
|
||||||
<Th>{t('Discount')}</Th>
|
<Th>{t('Discount')}</Th>
|
||||||
<Th>{t('Min. trading volume')}</Th>
|
<Th>{t('Min. trading volume')}</Th>
|
||||||
<Th>{t('My volume (last epoch)')}</Th>
|
<Th>{t('My volume (last %s epochs)', windowLength.toString())}</Th>
|
||||||
<Th />
|
<Th />
|
||||||
</tr>
|
</tr>
|
||||||
</THead>
|
</THead>
|
||||||
|
Loading…
Reference in New Issue
Block a user