Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8066a5c252 | ||
|
|
82df401611 |
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
useLinks,
|
||||
DApp,
|
||||
CONSOLE_REWARDS_PAGE,
|
||||
} from '@vegaprotocol/environment';
|
||||
import {
|
||||
ExternalLink,
|
||||
Intent,
|
||||
NotificationBanner,
|
||||
VegaIcon,
|
||||
VegaIconNames,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { Trans } from 'react-i18next';
|
||||
import { useMatch } from 'react-router-dom';
|
||||
import Routes from '../../routes/routes';
|
||||
import { type ReactNode } from 'react';
|
||||
|
||||
const ConsoleRewardsLink = ({ children }: { children: ReactNode }) => {
|
||||
const consoleLink = useLinks(DApp.Console);
|
||||
return (
|
||||
<ExternalLink
|
||||
href={consoleLink(CONSOLE_REWARDS_PAGE)}
|
||||
className="underline inline-flex gap-1 items-center"
|
||||
title="Rewards in Console"
|
||||
>
|
||||
<span>{children}</span>
|
||||
<VegaIcon size={12} name={VegaIconNames.OPEN_EXTERNAL} />
|
||||
</ExternalLink>
|
||||
);
|
||||
};
|
||||
|
||||
export const RewardsMovedNotification = () => {
|
||||
const onRewardsPage = useMatch(Routes.REWARDS);
|
||||
if (!onRewardsPage) return null;
|
||||
|
||||
return (
|
||||
<NotificationBanner intent={Intent.Warning}>
|
||||
<Trans
|
||||
i18nKey="rewardsMovedNotification"
|
||||
components={[<ConsoleRewardsLink>Console</ConsoleRewardsLink>]}
|
||||
/>
|
||||
</NotificationBanner>
|
||||
);
|
||||
};
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
ProtocolUpgradeProposalNotification,
|
||||
} from '@vegaprotocol/proposals';
|
||||
import { ViewingAsBanner } from '@vegaprotocol/ui-toolkit';
|
||||
import { RewardsMovedNotification } from '../notifications/rewards-moved-notification';
|
||||
|
||||
interface AppLayoutProps {
|
||||
children: ReactNode;
|
||||
@@ -45,8 +46,10 @@ export const AppLayout = ({ children }: AppLayoutProps) => {
|
||||
|
||||
const NotificationsContainer = () => {
|
||||
const { isReadOnly, pubKey, disconnect } = useVegaWallet();
|
||||
|
||||
return (
|
||||
<div data-testid="banners">
|
||||
<RewardsMovedNotification />
|
||||
<ProtocolUpgradeProposalNotification
|
||||
mode={ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING}
|
||||
/>
|
||||
|
||||
+1
-1
@@ -288,7 +288,7 @@ describe('Consensus validators table', () => {
|
||||
|
||||
expect(
|
||||
grid.querySelector('[role="gridcell"][col-id="totalPenalties"]')
|
||||
).toHaveTextContent('13.16%');
|
||||
).toHaveTextContent('10.07%');
|
||||
|
||||
expect(
|
||||
grid.querySelector('[role="gridcell"][col-id="normalisedVotingPower"]')
|
||||
|
||||
+13
-3
@@ -185,15 +185,19 @@ export const ConsensusValidatorsTable = ({
|
||||
const { rawValidatorScore: previousEpochValidatorScore } =
|
||||
getLastEpochScoreAndPerformance(previousEpochData, id);
|
||||
|
||||
const overstakingPenalty = calculateOverallPenalty(
|
||||
const overstakingPenalty = calculateOverstakedPenalty(
|
||||
id,
|
||||
allNodesInPreviousEpoch
|
||||
);
|
||||
const totalPenalty = calculateOverstakedPenalty(
|
||||
const totalPenalty = calculateOverallPenalty(
|
||||
id,
|
||||
allNodesInPreviousEpoch
|
||||
);
|
||||
|
||||
const lastEpochDataForNode = allNodesInPreviousEpoch.find(
|
||||
(node) => node.id === id
|
||||
);
|
||||
|
||||
return {
|
||||
id,
|
||||
[ValidatorFields.RANKING_INDEX]: stakedTotalRanking,
|
||||
@@ -239,6 +243,12 @@ export const ConsensusValidatorsTable = ({
|
||||
: undefined,
|
||||
[ValidatorFields.MULTISIG_ERROR]:
|
||||
multisigStatus?.showMultisigStatusError,
|
||||
[ValidatorFields.MULTISIG_PENALTY]: formatNumberPercentage(
|
||||
new BigNumber(1)
|
||||
.minus(lastEpochDataForNode?.rewardScore?.multisigScore ?? 1)
|
||||
.times(100),
|
||||
2
|
||||
),
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -378,7 +388,6 @@ export const ConsensusValidatorsTable = ({
|
||||
headerTooltip: t('StakeDescription').toString(),
|
||||
cellRenderer: TotalStakeRenderer,
|
||||
width: 120,
|
||||
sort: 'desc',
|
||||
},
|
||||
{
|
||||
field: ValidatorFields.PENDING_STAKE,
|
||||
@@ -400,6 +409,7 @@ export const ConsensusValidatorsTable = ({
|
||||
headerTooltip: t('NormalisedVotingPowerDescription').toString(),
|
||||
cellRenderer: VotingPowerRenderer,
|
||||
width: 120,
|
||||
sort: 'desc',
|
||||
},
|
||||
{
|
||||
field: ValidatorFields.TOTAL_PENALTIES,
|
||||
|
||||
@@ -40,6 +40,7 @@ export enum ValidatorFields {
|
||||
PENDING_USER_STAKE = 'pendingUserStake',
|
||||
USER_STAKE_SHARE = 'userStakeShare',
|
||||
MULTISIG_ERROR = 'multisigError',
|
||||
MULTISIG_PENALTY = 'multisigPenalty',
|
||||
}
|
||||
|
||||
export const addUserDataToValidator = (
|
||||
@@ -327,7 +328,7 @@ interface TotalPenaltiesRendererProps {
|
||||
overstakedAmount: string;
|
||||
overstakingPenalty: string;
|
||||
totalPenalties: string;
|
||||
multisigError?: boolean;
|
||||
multisigPenalty: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -346,11 +347,9 @@ export const TotalPenaltiesRenderer = ({
|
||||
<div data-testid="overstaked-penalty-tooltip">
|
||||
{t('overstakedPenalty')}: {data.overstakingPenalty}
|
||||
</div>
|
||||
{data.multisigError && (
|
||||
<div data-testid="multisig-error-tooltip">
|
||||
{t('multisigPenalty')}: 100%
|
||||
</div>
|
||||
)}
|
||||
<div data-testid="multisig-error-tooltip">
|
||||
{t('multisigPenalty')}: {data.multisigPenalty}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
>
|
||||
|
||||
@@ -37,7 +37,6 @@ import {
|
||||
import type { ReactNode } from 'react';
|
||||
import type { StakingNodeFieldsFragment } from '../__generated__/Staking';
|
||||
import type { PreviousEpochQuery } from '../__generated__/PreviousEpoch';
|
||||
import { getMultisigStatusInfo } from '../../../lib/get-multisig-status-info';
|
||||
|
||||
const statuses = {
|
||||
[Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_ERSATZ]: 'status-ersatz',
|
||||
@@ -105,9 +104,10 @@ export const ValidatorTable = ({
|
||||
};
|
||||
}, [node, previousEpochData?.epoch.validatorsConnection?.edges]);
|
||||
|
||||
const multisigStatus = previousEpochData
|
||||
? getMultisigStatusInfo(previousEpochData)
|
||||
: undefined;
|
||||
const previousNodeData =
|
||||
previousEpochData?.epoch.validatorsConnection?.edges?.find(
|
||||
(e) => e?.node.id === node.id
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -293,21 +293,15 @@ export const ValidatorTable = ({
|
||||
data-testid="multisig-penalty"
|
||||
className="flex gap-2 items-baseline"
|
||||
>
|
||||
{multisigStatus?.zeroScoreNodes.find(
|
||||
(n) => n.id === node.id
|
||||
) ? (
|
||||
<Tooltip
|
||||
description={t('multisigPenaltyThisNodeIndicator')}
|
||||
>
|
||||
<span className="inline-block w-2 h-2 rounded-full bg-vega-red-500"></span>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
<Tooltip description={t('multisigPenaltyDescription')}>
|
||||
<span>
|
||||
{formatNumberPercentage(
|
||||
BigNumber(
|
||||
multisigStatus?.showMultisigStatusError ? 100 : 0
|
||||
),
|
||||
new BigNumber(1)
|
||||
.minus(
|
||||
previousNodeData?.node.rewardScore?.multisigScore ??
|
||||
1
|
||||
)
|
||||
.times(100),
|
||||
2
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -22,7 +22,7 @@ NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
||||
# Cosmic elevator flags
|
||||
NX_SUCCESSOR_MARKETS=true
|
||||
NX_STOP_ORDERS=true
|
||||
NX_ISOLATED_MARGIN=true
|
||||
NX_ISOLATED_MARGIN=false
|
||||
NX_ICEBERG_ORDERS=true
|
||||
NX_METAMASK_SNAPS=true
|
||||
NX_REFERRALS=true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useT } from '../../lib/use-t';
|
||||
import { addDecimalsFormatNumber, formatNumber } from '@vegaprotocol/utils';
|
||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
type VegaIconSize,
|
||||
@@ -24,9 +24,6 @@ import {
|
||||
type DispatchStrategy,
|
||||
IndividualScopeMapping,
|
||||
IndividualScopeDescriptionMapping,
|
||||
AccountType,
|
||||
DistributionStrategy,
|
||||
IndividualScope,
|
||||
type Asset,
|
||||
} from '@vegaprotocol/types';
|
||||
import { Card } from '../card/card';
|
||||
@@ -65,27 +62,22 @@ export const applyFilter = (
|
||||
filter: Filter
|
||||
) => {
|
||||
const { transfer } = node;
|
||||
|
||||
// if the transfer is a staking reward then it should be displayed
|
||||
if (transfer.toAccountType === AccountType.ACCOUNT_TYPE_GLOBAL_REWARD) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (transfer.kind.__typename !== 'RecurringTransfer') {
|
||||
if (
|
||||
transfer.kind.__typename !== 'RecurringTransfer' ||
|
||||
!transfer.kind.dispatchStrategy?.dispatchMetric
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
(transfer.kind.dispatchStrategy?.dispatchMetric &&
|
||||
DispatchMetricLabels[transfer.kind.dispatchStrategy.dispatchMetric]
|
||||
.toLowerCase()
|
||||
.includes(filter.searchTerm.toLowerCase())) ||
|
||||
DispatchMetricLabels[transfer.kind.dispatchStrategy.dispatchMetric]
|
||||
.toLowerCase()
|
||||
.includes(filter.searchTerm.toLowerCase()) ||
|
||||
transfer.asset?.symbol
|
||||
.toLowerCase()
|
||||
.includes(filter.searchTerm.toLowerCase()) ||
|
||||
(
|
||||
(transfer.kind.dispatchStrategy &&
|
||||
EntityScopeLabelMapping[transfer.kind.dispatchStrategy.entityScope]) ||
|
||||
EntityScopeLabelMapping[transfer.kind.dispatchStrategy.entityScope] ||
|
||||
'Unspecified'
|
||||
)
|
||||
.toLowerCase()
|
||||
@@ -101,7 +93,6 @@ export const applyFilter = (
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -183,29 +174,6 @@ export const ActiveRewardCard = ({
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
!transferNode.transfer.kind.dispatchStrategy &&
|
||||
transferNode.transfer.toAccountType ===
|
||||
AccountType.ACCOUNT_TYPE_GLOBAL_REWARD
|
||||
) {
|
||||
return (
|
||||
<StakingRewardCard
|
||||
colour={CardColour.WHITE}
|
||||
rewardAmount={addDecimalsFormatNumber(
|
||||
transferNode.transfer.amount,
|
||||
transferNode.transfer.asset?.decimals || 0,
|
||||
6
|
||||
)}
|
||||
rewardAsset={transferNode.transfer.asset || undefined}
|
||||
endsIn={
|
||||
transferNode.transfer.kind.endEpoch != null
|
||||
? transferNode.transfer.kind.endEpoch - currentEpoch
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
let colour =
|
||||
DispatchMetricColourMap[
|
||||
transferNode.transfer.kind.dispatchStrategy.dispatchMetric
|
||||
@@ -350,7 +318,7 @@ const RewardCard = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
|
||||
<span className="border-[0.5px] border-gray-700" />
|
||||
{/** DISPATCH METRIC */}
|
||||
{dispatchMetricInfo ? (
|
||||
dispatchMetricInfo
|
||||
@@ -387,11 +355,11 @@ const RewardCard = ({
|
||||
</div>
|
||||
{/** DISPATCH METRIC DESCRIPTION */}
|
||||
{dispatchStrategy?.dispatchMetric && (
|
||||
<p className="text-muted text-sm h-[3rem]">
|
||||
<span className="text-muted text-sm h-[3rem]">
|
||||
{t(DispatchMetricDescription[dispatchStrategy?.dispatchMetric])}
|
||||
</p>
|
||||
</span>
|
||||
)}
|
||||
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
|
||||
<span className="border-[0.5px] border-gray-700" />
|
||||
{/** REQUIREMENTS */}
|
||||
{dispatchStrategy && (
|
||||
<RewardRequirements
|
||||
@@ -406,190 +374,6 @@ const RewardCard = ({
|
||||
);
|
||||
};
|
||||
|
||||
const StakingRewardCard = ({
|
||||
colour,
|
||||
rewardAmount,
|
||||
rewardAsset,
|
||||
endsIn,
|
||||
}: {
|
||||
colour: CardColour;
|
||||
rewardAmount: string;
|
||||
/** The asset linked to the dispatch strategy via `dispatchMetricAssetId` property. */
|
||||
rewardAsset?: Asset;
|
||||
/** The number of epochs until the transfer stops. */
|
||||
endsIn?: number;
|
||||
/** The VEGA asset details, required to format the min staking amount. */
|
||||
vegaAsset?: BasicAssetDetails;
|
||||
}) => {
|
||||
const t = useT();
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
className={classNames(
|
||||
'bg-gradient-to-r col-span-full p-0.5 lg:col-auto h-full',
|
||||
'rounded-lg',
|
||||
CardColourStyles[colour].gradientClassName
|
||||
)}
|
||||
data-testid="active-rewards-card"
|
||||
>
|
||||
<div
|
||||
className={classNames(
|
||||
CardColourStyles[colour].mainClassName,
|
||||
'bg-gradient-to-b bg-vega-clight-800 dark:bg-vega-cdark-800 h-full w-full rounded-md p-4 flex flex-col gap-4'
|
||||
)}
|
||||
>
|
||||
<div className="flex justify-between gap-4">
|
||||
{/** ENTITY SCOPE */}
|
||||
<div className="flex flex-col gap-2 items-center text-center">
|
||||
<EntityIcon entityScope={EntityScope.ENTITY_SCOPE_INDIVIDUALS} />
|
||||
{
|
||||
<span className="text-muted text-xs" data-testid="entity-scope">
|
||||
{EntityScopeLabelMapping[
|
||||
EntityScope.ENTITY_SCOPE_INDIVIDUALS
|
||||
] || t('Unspecified')}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
{/** AMOUNT AND DISTRIBUTION STRATEGY */}
|
||||
<div className="flex flex-col gap-2 items-center text-center">
|
||||
{/** AMOUNT */}
|
||||
<h3 className="flex flex-col gap-1 text-2xl shrink-1 text-center">
|
||||
<span className="font-glitch" data-testid="reward-value">
|
||||
{rewardAmount}
|
||||
</span>
|
||||
|
||||
<span className="font-alpha">{rewardAsset?.symbol || ''}</span>
|
||||
</h3>
|
||||
|
||||
{/** DISTRIBUTION STRATEGY */}
|
||||
<Tooltip
|
||||
description={t(
|
||||
DistributionStrategyDescriptionMapping[
|
||||
DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA
|
||||
]
|
||||
)}
|
||||
underline={true}
|
||||
>
|
||||
<span className="text-xs" data-testid="distribution-strategy">
|
||||
{
|
||||
DistributionStrategyMapping[
|
||||
DistributionStrategy.DISTRIBUTION_STRATEGY_PRO_RATA
|
||||
]
|
||||
}
|
||||
</span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
{/** DISTRIBUTION DELAY */}
|
||||
<div className="flex flex-col gap-2 items-center text-center">
|
||||
<CardIcon
|
||||
iconName={VegaIconNames.LOCK}
|
||||
tooltip={t(
|
||||
'Number of epochs after distribution to delay vesting of rewards by'
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
className="text-muted text-xs whitespace-nowrap"
|
||||
data-testid="locked-for"
|
||||
>
|
||||
{t('numberEpochs', '{{count}} epochs', {
|
||||
count: 0,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
|
||||
{/** DISPATCH METRIC */}
|
||||
{
|
||||
<span data-testid="dispatch-metric-info">
|
||||
{t('Staking rewards')}
|
||||
</span>
|
||||
}
|
||||
<div className="flex items-center gap-8 flex-wrap">
|
||||
{/** ENDS IN */}
|
||||
{endsIn != null && (
|
||||
<span className="flex flex-col">
|
||||
<span className="text-muted text-xs">{t('Ends in')} </span>
|
||||
<span data-testid="ends-in" data-endsin={endsIn}>
|
||||
{endsIn >= 0
|
||||
? t('numberEpochs', '{{count}} epochs', {
|
||||
count: endsIn,
|
||||
})
|
||||
: t('Ended')}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/** WINDOW LENGTH */}
|
||||
<span className="flex flex-col">
|
||||
<span className="text-muted text-xs">{t('Assessed over')}</span>
|
||||
<span data-testid="assessed-over">
|
||||
{t('numberEpochs', '{{count}} epochs', {
|
||||
count: 1,
|
||||
})}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
{/** DISPATCH METRIC DESCRIPTION */}
|
||||
{
|
||||
<p className="text-muted text-sm h-[3rem]">
|
||||
{t(
|
||||
'Global staking reward for staking $VEGA on the network via the Governance app'
|
||||
)}
|
||||
</p>
|
||||
}
|
||||
<span className="border-[0.5px] dark:border-vega-cdark-500 border-vega-clight-500" />
|
||||
{/** REQUIREMENTS */}
|
||||
<dl className="flex justify-between flex-wrap items-center gap-3 text-xs">
|
||||
<div className="flex flex-col gap-1">
|
||||
<dt className="flex items-center gap-1 text-muted">
|
||||
{t('Team scope')}
|
||||
</dt>
|
||||
<dd className="flex items-center gap-1" data-testid="scope">
|
||||
<Tooltip
|
||||
description={
|
||||
IndividualScopeDescriptionMapping[
|
||||
IndividualScope.INDIVIDUAL_SCOPE_ALL
|
||||
]
|
||||
}
|
||||
>
|
||||
<span>{t('Individual')}</span>
|
||||
</Tooltip>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1">
|
||||
<dt className="flex items-center gap-1 text-muted">
|
||||
{t('Staked VEGA')}
|
||||
</dt>
|
||||
<dd
|
||||
className="flex items-center gap-1"
|
||||
data-testid="staking-requirement"
|
||||
>
|
||||
{formatNumber(1, 2)}
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1">
|
||||
<dt className="flex items-center gap-1 text-muted">
|
||||
{t('Average position')}
|
||||
</dt>
|
||||
<dd
|
||||
className="flex items-center gap-1"
|
||||
data-testid="average-position"
|
||||
>
|
||||
{formatNumber(0, 2)}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const DispatchMetricInfo = ({
|
||||
reward,
|
||||
}: {
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
EntityScope,
|
||||
IndividualScope,
|
||||
MarketState,
|
||||
AccountType,
|
||||
} from '@vegaprotocol/types';
|
||||
import { type ApolloError } from '@apollo/client';
|
||||
import compact from 'lodash/compact';
|
||||
@@ -47,9 +46,8 @@ export type EnrichedRewardTransfer = RewardTransfer & {
|
||||
*/
|
||||
export const isReward = (node: TransferNode): node is RewardTransfer => {
|
||||
if (
|
||||
(node.transfer.kind.__typename === 'RecurringTransfer' &&
|
||||
node.transfer.kind.dispatchStrategy != null) ||
|
||||
node.transfer.toAccountType === AccountType.ACCOUNT_TYPE_GLOBAL_REWARD
|
||||
node.transfer.kind.__typename === 'RecurringTransfer' &&
|
||||
node.transfer.kind.dispatchStrategy != null
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
@@ -81,13 +79,13 @@ export const isActiveReward = (node: RewardTransfer, currentEpoch: number) => {
|
||||
*/
|
||||
export const isScopedToTeams = (node: EnrichedRewardTransfer) =>
|
||||
// scoped to teams
|
||||
node.transfer.kind.dispatchStrategy?.entityScope ===
|
||||
node.transfer.kind.dispatchStrategy.entityScope ===
|
||||
EntityScope.ENTITY_SCOPE_TEAMS ||
|
||||
// or to individuals
|
||||
(node.transfer.kind.dispatchStrategy?.entityScope ===
|
||||
(node.transfer.kind.dispatchStrategy.entityScope ===
|
||||
EntityScope.ENTITY_SCOPE_INDIVIDUALS &&
|
||||
// but they have to be in a team
|
||||
node.transfer.kind.dispatchStrategy?.individualScope ===
|
||||
node.transfer.kind.dispatchStrategy.individualScope ===
|
||||
IndividualScope.INDIVIDUAL_SCOPE_IN_TEAM);
|
||||
|
||||
/** Retrieves rewards (transfers) */
|
||||
@@ -144,7 +142,6 @@ export const useRewards = ({
|
||||
.filter((node) => (scopeToTeams ? isScopedToTeams(node) : true))
|
||||
// enrich with dispatch asset and markets in scope details
|
||||
.map((node) => {
|
||||
if (!node.transfer.kind.dispatchStrategy) return node;
|
||||
const dispatchAsset =
|
||||
(assets &&
|
||||
assets[node.transfer.kind.dispatchStrategy.dispatchMetricAssetId]) ||
|
||||
@@ -173,7 +170,7 @@ export const useRewards = ({
|
||||
...node,
|
||||
dispatchAsset,
|
||||
isAssetTraded: isAssetTraded != null ? isAssetTraded : undefined,
|
||||
markets: marketsInScope?.length > 0 ? marketsInScope : undefined,
|
||||
markets: marketsInScope.length > 0 ? marketsInScope : undefined,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { useMemo } from 'react';
|
||||
import { parseISO, isValid, isAfter } from 'date-fns';
|
||||
import classNames from 'classnames';
|
||||
import { useProposalOfMarketQuery } from '@vegaprotocol/proposals';
|
||||
import {
|
||||
useProposalOfMarketQuery,
|
||||
type ProposalOfMarketQuery,
|
||||
type SingleProposal,
|
||||
} from '@vegaprotocol/proposals';
|
||||
import { DocsLinks } from '@vegaprotocol/environment';
|
||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
@@ -36,21 +40,15 @@ export const TradingModeTooltip = ({
|
||||
marketTradingMode,
|
||||
});
|
||||
|
||||
// We only fetch Proposals (and not BatchProposals)
|
||||
const proposal = proposalData?.proposal as SingleProposal<
|
||||
ProposalOfMarketQuery['proposal']
|
||||
>;
|
||||
|
||||
if (!market || !marketData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let enactmentDate;
|
||||
const proposal = proposalData?.proposal;
|
||||
|
||||
if (proposal?.__typename === 'Proposal') {
|
||||
enactmentDate = parseISO(proposal.terms.enactmentDatetime);
|
||||
} else if (proposal?.__typename === 'BatchProposal') {
|
||||
const change = proposal.batchTerms?.changes.find(
|
||||
(c) => c?.change.__typename === 'NewMarket'
|
||||
);
|
||||
enactmentDate = change ? parseISO(change.enactmentDatetime) : undefined;
|
||||
}
|
||||
const enactmentDate = parseISO(proposal?.terms.enactmentDatetime);
|
||||
|
||||
const compiledGrid =
|
||||
!skipGrid && compileGridData(t, market, marketData, onSelect);
|
||||
@@ -69,16 +67,14 @@ export const TradingModeTooltip = ({
|
||||
return (
|
||||
<section data-testid="trading-mode-tooltip">
|
||||
<p
|
||||
className={classNames('flex flex-col items-start gap-2', {
|
||||
className={classNames('flex flex-col', {
|
||||
'mb-4': Boolean(compiledGrid),
|
||||
})}
|
||||
>
|
||||
{enactmentDate &&
|
||||
isValid(enactmentDate) &&
|
||||
isAfter(new Date(), enactmentDate) ? (
|
||||
{isValid(enactmentDate) && isAfter(new Date(), enactmentDate) ? (
|
||||
<>
|
||||
<span
|
||||
className="justify-center font-bold"
|
||||
className="justify-center font-bold my-2"
|
||||
data-testid="opening-auction-sub-status"
|
||||
>
|
||||
{`${Schema.MarketTradingModeMapping[marketTradingMode]}: ${t(
|
||||
@@ -95,7 +91,7 @@ export const TradingModeTooltip = ({
|
||||
<>
|
||||
{isValid(enactmentDate) && (
|
||||
<span
|
||||
className="justify-center font-bold"
|
||||
className="justify-center font-bold my-2"
|
||||
data-testid="opening-auction-sub-status"
|
||||
>
|
||||
{`${
|
||||
@@ -113,7 +109,10 @@ export const TradingModeTooltip = ({
|
||||
</>
|
||||
)}
|
||||
{DocsLinks && (
|
||||
<ExternalLink href={DocsLinks.AUCTION_TYPE_OPENING}>
|
||||
<ExternalLink
|
||||
href={DocsLinks.AUCTION_TYPE_OPENING}
|
||||
className="ml-1"
|
||||
>
|
||||
{t('Find out more')}
|
||||
</ExternalLink>
|
||||
)}
|
||||
|
||||
@@ -134,6 +134,7 @@ export const CONSOLE_TRANSFER = '#/portfolio/assets/transfer';
|
||||
export const CONSOLE_TRANSFER_ASSET =
|
||||
'#/portfolio/assets/transfer?assetId=:assetId';
|
||||
export const CONSOLE_MARKET_PAGE = '#/markets/:marketId';
|
||||
export const CONSOLE_REWARDS_PAGE = '#/rewards';
|
||||
|
||||
// Governance pages
|
||||
export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market';
|
||||
|
||||
@@ -969,5 +969,6 @@
|
||||
"YourIdentityAnonymous": "Your identity is always anonymous on Vega",
|
||||
"yourStake": "Your stake",
|
||||
"yourVote": "Your vote",
|
||||
"youVoted": "You voted"
|
||||
"youVoted": "You voted",
|
||||
"rewardsMovedNotification": "Trading and liquidity rewards have moved. Visit <0>Console</0> to view your rewards."
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@
|
||||
"Governance vote for this market is valid and has been accepted": "Governance vote for this market is valid and has been accepted",
|
||||
"Governance vote has passed and market is awaiting opening auction exit": "Governance vote has passed and market is awaiting opening auction exit",
|
||||
"Governance vote passed to close the market": "Governance vote passed to close the market",
|
||||
"Global staking reward for staking $VEGA on the network via the Governance app": "Global staking reward for staking $VEGA on the network via the Governance app",
|
||||
"Help identify bugs and improve the service by sharing anonymous usage data.": "Help identify bugs and improve the service by sharing anonymous usage data.",
|
||||
"Help us identify bugs and improve Vega Governance by sharing anonymous usage data.": "Help us identify bugs and improve Vega Governance by sharing anonymous usage data.",
|
||||
"Hide closed markets": "Hide closed markets",
|
||||
@@ -369,12 +368,12 @@
|
||||
"TradingView": "TradingView",
|
||||
"Transfer": "Transfer",
|
||||
"Type": "Type",
|
||||
"Staking rewards": "Staking rewards",
|
||||
"Unknown": "Unknown",
|
||||
"Unknown settlement date": "Unknown settlement date",
|
||||
"Update team": "Update team",
|
||||
"URL": "URL",
|
||||
"Use a comma separated list to allow only specific public keys to join the team": "Use a comma separated list to allow only specific public keys to join the team",
|
||||
"Vega chart": "Vega chart",
|
||||
"Vega Reward pot": "Vega Reward pot",
|
||||
"Vega Wallet <0>full featured</0>": "Vega Wallet <0>full featured</0>",
|
||||
"Vega chart": "Vega chart",
|
||||
|
||||
@@ -45,19 +45,6 @@ query ProposalOfMarket($marketId: ID!) {
|
||||
enactmentDatetime
|
||||
}
|
||||
}
|
||||
... on BatchProposal {
|
||||
id
|
||||
batchTerms {
|
||||
changes {
|
||||
enactmentDatetime
|
||||
change {
|
||||
... on NewMarket {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export type ProposalOfMarketQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'BatchProposal', id?: string | null, batchTerms?: { __typename?: 'BatchProposalTerms', changes: Array<{ __typename?: 'BatchProposalTermsChange', enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename: 'NewMarket' } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } | null> } | null } | { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
|
||||
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'BatchProposal' } | { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
|
||||
|
||||
export type SuccessorMarketProposalDetailsQueryVariables = Types.Exact<{
|
||||
proposalId: Types.Scalars['ID'];
|
||||
@@ -152,19 +152,6 @@ export const ProposalOfMarketDocument = gql`
|
||||
enactmentDatetime
|
||||
}
|
||||
}
|
||||
... on BatchProposal {
|
||||
id
|
||||
batchTerms {
|
||||
changes {
|
||||
enactmentDatetime
|
||||
change {
|
||||
... on NewMarket {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Generated
-2
@@ -256,8 +256,6 @@ export type AggregatedLedgerEntry = {
|
||||
toAccountPartyId?: Maybe<Scalars['ID']>;
|
||||
/** Account type, if query was grouped by receiver account type - else null */
|
||||
toAccountType?: Maybe<AccountType>;
|
||||
/** Transfer ID associated with this aggregated ledger entry */
|
||||
transferId: Scalars['ID'];
|
||||
/** Type of the transfer for this ledger entry */
|
||||
transferType?: Maybe<TransferType>;
|
||||
/** RFC3339Nano time from at which this ledger entries records were relevant */
|
||||
|
||||
Reference in New Issue
Block a user