feat(explorer): move metric labels to global lib

This commit is contained in:
Edd
2023-02-21 11:37:17 +00:00
parent 4c87263322
commit 0d6fa91c84
2 changed files with 17 additions and 8 deletions
@@ -3,10 +3,16 @@ import { AssetLink, MarketLink } from '../../../../links';
import { headerClasses, wrapperClasses } from '../transfer-details';
import type { components } from '../../../../../../types/explorer';
import type { Recurring } from '../transfer-details';
import { DispatchMetricLabels } from '@vegaprotocol/types';
export type Metric = components['schemas']['vegaDispatchMetric'];
export type Strategy = components['schemas']['vegaDispatchStrategy'];
const metricLabels = {
DISPATCH_METRIC_UNSPECIFIED: 'Unknown metric',
...DispatchMetricLabels,
};
interface TransferRewardsProps {
recurring: Recurring;
}
@@ -59,14 +65,6 @@ export function TransferRewards({ recurring }: TransferRewardsProps) {
);
}
const metricLabels: Record<Metric, string> = {
DISPATCH_METRIC_LP_FEES_RECEIVED: 'Liquidity Provision fees received',
DISPATCH_METRIC_MAKER_FEES_PAID: 'Price maker fees paid',
DISPATCH_METRIC_MAKER_FEES_RECEIVED: 'Price maker fees earned',
DISPATCH_METRIC_MARKET_VALUE: 'Total market Value',
DISPATCH_METRIC_UNSPECIFIED: 'Unknown metric',
};
interface TransferRecurringStrategyProps {
strategy: Strategy;
}
+11
View File
@@ -20,6 +20,7 @@ import type {
ValidatorStatus,
VoteValue,
WithdrawalStatus,
DispatchMetric,
} from './__generated__/types';
export const AccountTypeMapping: {
@@ -434,3 +435,13 @@ export const DescriptionTransferTypeMapping: TransferTypeMap = {
TRANSFER_TYPE_UNSPECIFIED: 'Default value, always invalid',
TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE: `Balances are being restored to the user's account following a checkpoint restart of the network`,
};
type DispatchMetricLabel = {
[T in DispatchMetric]: string;
};
export const DispatchMetricLabels: DispatchMetricLabel = {
DISPATCH_METRIC_LP_FEES_RECEIVED: 'Liquidity Provision fees received',
DISPATCH_METRIC_MAKER_FEES_PAID: 'Price maker fees paid',
DISPATCH_METRIC_MAKER_FEES_RECEIVED: 'Price maker fees earned',
DISPATCH_METRIC_MARKET_VALUE: 'Total market Value',
};