chore: fix status mappings after API updates (#1119)
* chore(#1116 ): status mapping fixes after API changes * fix: modify proposal status * fix: update to use numbers in price cell rather than converting
This commit is contained in:
parent
bb40a18e2b
commit
b6cda139df
@ -372,7 +372,7 @@ describe('Proposals list item details', () => {
|
||||
);
|
||||
expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected');
|
||||
expect(screen.getByTestId('vote-status')).toHaveTextContent(
|
||||
'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT'
|
||||
'Invalid future product'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -12,7 +12,10 @@ import { useTranslation } from 'react-i18next';
|
||||
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
|
||||
import { ProposalState } from '@vegaprotocol/types';
|
||||
import {
|
||||
ProposalRejectionReasonMapping,
|
||||
ProposalState,
|
||||
} from '@vegaprotocol/types';
|
||||
|
||||
const MajorityNotReached = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -161,7 +164,7 @@ export const ProposalsListItemDetails = ({
|
||||
</>
|
||||
);
|
||||
voteStatus = proposal.rejectionReason && (
|
||||
<>{t(proposal.rejectionReason)}</>
|
||||
<>{t(ProposalRejectionReasonMapping[proposal.rejectionReason])}</>
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
@ -8,13 +8,14 @@ import { SelectMarketPopover } from '@vegaprotocol/market-list';
|
||||
import { OrderListContainer } from '@vegaprotocol/orders';
|
||||
import { FillsContainer } from '@vegaprotocol/fills';
|
||||
import { PositionsContainer } from '@vegaprotocol/positions';
|
||||
import {
|
||||
addDecimalsFormatNumber,
|
||||
formatLabel,
|
||||
t,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
|
||||
import { TradesContainer } from '@vegaprotocol/trades';
|
||||
import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types';
|
||||
import {
|
||||
AuctionTrigger,
|
||||
AuctionTriggerMapping,
|
||||
MarketTradingMode,
|
||||
MarketTradingModeMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
import { Allotment, LayoutPriority } from 'allotment';
|
||||
import classNames from 'classnames';
|
||||
import { useState } from 'react';
|
||||
@ -124,10 +125,9 @@ export const TradeMarketHeader = ({
|
||||
market.data?.trigger &&
|
||||
market.data.trigger !==
|
||||
AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||
? `${formatLabel(
|
||||
market.tradingMode
|
||||
)} - ${market.data?.trigger.toLowerCase()}`
|
||||
: formatLabel(market.tradingMode)}
|
||||
? `${MarketTradingModeMapping[market.tradingMode]}
|
||||
- ${AuctionTriggerMapping[market.data.trigger]}`
|
||||
: MarketTradingModeMapping[market.tradingMode]}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
@ -17,6 +17,8 @@ import type { AgGridReact } from 'ag-grid-react';
|
||||
import type { Accounts_party_accounts } from './__generated__/Accounts';
|
||||
import { getId } from './accounts-data-provider';
|
||||
import { useAssetDetailsDialogStore } from '@vegaprotocol/market-list';
|
||||
import type { AccountType } from '@vegaprotocol/types';
|
||||
import { AccountTypeMapping } from '@vegaprotocol/types';
|
||||
|
||||
interface AccountsTableProps {
|
||||
data: Accounts_party_accounts[] | null;
|
||||
@ -143,7 +145,9 @@ export const AccountsTable = forwardRef<AgGridReact, AccountsTableProps>(
|
||||
<AgGridColumn
|
||||
headerName={t('Type')}
|
||||
field="type"
|
||||
valueFormatter="value || '—'"
|
||||
valueFormatter={({ value }: ValueFormatterParams) =>
|
||||
value ? AccountTypeMapping[value as AccountType] : '-'
|
||||
}
|
||||
/>
|
||||
<AgGridColumn
|
||||
headerName={t('Market')}
|
||||
|
@ -178,14 +178,14 @@ export interface MarketList_markets {
|
||||
/**
|
||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||
* number denominated in the currency of the market. (uint64)
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
|
@ -1,12 +1,16 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import {
|
||||
addDecimalsFormatNumber,
|
||||
formatLabel,
|
||||
formatNumberPercentage,
|
||||
PriceCell,
|
||||
t,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types';
|
||||
import {
|
||||
AuctionTrigger,
|
||||
AuctionTriggerMapping,
|
||||
MarketTradingMode,
|
||||
MarketTradingModeMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
import {
|
||||
KeyValueTable,
|
||||
KeyValueTableRow,
|
||||
@ -17,11 +21,15 @@ import {
|
||||
import BigNumber from 'bignumber.js';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { totalFees } from '../utils';
|
||||
import { calcCandleHigh, calcCandleLow, totalFees } from '../utils';
|
||||
|
||||
import type { CandleClose } from '@vegaprotocol/types';
|
||||
import type { MarketList_markets_fees_factors } from '../__generated__/MarketList';
|
||||
import type {
|
||||
MarketList_markets,
|
||||
MarketList_markets_fees_factors,
|
||||
} from '../__generated__/MarketList';
|
||||
import classNames from 'classnames';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
export const thClassNames = (direction: 'left' | 'right') =>
|
||||
`px-8 text-${direction} font-sans text-ui-small leading-9 mb-0 text-dark dark:text-white first:w-[10%]`;
|
||||
@ -184,10 +192,13 @@ export const columnHeaders: Column[] = [
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
export const columns = (
|
||||
market: MarketList_markets,
|
||||
onSelect: (id: string) => void
|
||||
) => {
|
||||
const candlesClose = market.candles
|
||||
.map((candle: { close: string }) => candle?.close)
|
||||
.filter((c: string): c is CandleClose => c !== null);
|
||||
?.map((candle) => candle?.close)
|
||||
.filter((c: string | undefined): c is CandleClose => !isNil(c));
|
||||
const handleKeyPress = (
|
||||
event: React.KeyboardEvent<HTMLAnchorElement>,
|
||||
id: string
|
||||
@ -196,6 +207,8 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
return onSelect(id);
|
||||
}
|
||||
};
|
||||
const candleLow = calcCandleLow(market);
|
||||
const candleHigh = calcCandleHigh(market);
|
||||
const selectMarketColumns: Column[] = [
|
||||
{
|
||||
value: (
|
||||
@ -217,11 +230,11 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.lastPrice ? (
|
||||
value: market.data?.markPrice ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.lastPrice).toNumber()}
|
||||
value={Number(market.data?.markPrice)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.lastPrice.toString(),
|
||||
market.data?.markPrice.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -233,13 +246,14 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.settlementAsset,
|
||||
value:
|
||||
market.tradableInstrument.instrument.product.settlementAsset.symbol,
|
||||
dataTestId: 'settlement-asset',
|
||||
className: thClassNames('left'),
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: (
|
||||
value: candlesClose && (
|
||||
<PriceCellChange
|
||||
candles={candlesClose}
|
||||
decimalPlaces={market.decimalPlaces}
|
||||
@ -254,18 +268,18 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
width={100}
|
||||
height={20}
|
||||
muted={false}
|
||||
data={candlesClose.map((c: string) => Number(c))}
|
||||
data={candlesClose?.map((c: string) => Number(c)) || []}
|
||||
/>
|
||||
),
|
||||
className: 'px-8',
|
||||
onlyOnDetailed: false,
|
||||
onlyOnDetailed: false && candlesClose,
|
||||
},
|
||||
{
|
||||
value: market.candleHigh ? (
|
||||
value: candleHigh ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.candleHigh).toNumber()}
|
||||
value={Number(candleHigh)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.candleHigh.toString(),
|
||||
candleHigh.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -277,11 +291,11 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
onlyOnDetailed: true,
|
||||
},
|
||||
{
|
||||
value: market.candleLow ? (
|
||||
value: candleLow ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.candleLow).toNumber()}
|
||||
value={Number(candleLow)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.candleLow.toString(),
|
||||
candleLow.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -298,10 +312,9 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
market.data?.trigger &&
|
||||
market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||
? `${formatLabel(
|
||||
market.tradingMode
|
||||
)} - ${market.data?.trigger.toLowerCase()}`
|
||||
: formatLabel(market.tradingMode),
|
||||
? `${MarketTradingModeMapping[market.tradingMode]}
|
||||
- ${AuctionTriggerMapping[market.data.trigger]}`
|
||||
: MarketTradingModeMapping[market.tradingMode],
|
||||
className: thClassNames('left'),
|
||||
onlyOnDetailed: true,
|
||||
dataTestId: 'trading-mode',
|
||||
@ -312,7 +325,7 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
description={<FeesBreakdown feeFactors={market.fees?.factors} />}
|
||||
>
|
||||
<span className="border-b-2 border-dotted">
|
||||
{market.totalFees ?? '-'}
|
||||
{totalFees(market.fees.factors) ?? '-'}
|
||||
</span>
|
||||
</Tooltip>
|
||||
),
|
||||
@ -322,7 +335,7 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
},
|
||||
{
|
||||
value:
|
||||
market.data.indicativeVolume && market.data.indicativeVolume !== '0'
|
||||
market.data?.indicativeVolume && market.data.indicativeVolume !== '0'
|
||||
? addDecimalsFormatNumber(
|
||||
market.data.indicativeVolume,
|
||||
market.positionDecimalPlaces
|
||||
@ -343,12 +356,14 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
|
||||
};
|
||||
|
||||
export const columnsPositionMarkets = (
|
||||
market: any,
|
||||
market: MarketList_markets & { openVolume: string },
|
||||
onSelect: (id: string) => void
|
||||
) => {
|
||||
const candlesClose = market.candles
|
||||
.map((candle: { close: string }) => candle?.close)
|
||||
.filter((c: string): c is CandleClose => c !== null);
|
||||
?.map((candle) => candle?.close)
|
||||
.filter((c: string | undefined): c is CandleClose => !isNil(c));
|
||||
const candleLow = calcCandleLow(market);
|
||||
const candleHigh = calcCandleHigh(market);
|
||||
const handleKeyPress = (
|
||||
event: React.KeyboardEvent<HTMLAnchorElement>,
|
||||
id: string
|
||||
@ -378,11 +393,11 @@ export const columnsPositionMarkets = (
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.lastPrice ? (
|
||||
value: market.data?.markPrice ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.lastPrice).toNumber()}
|
||||
value={Number(market.data.markPrice)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.lastPrice.toString(),
|
||||
market.data.markPrice.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -394,12 +409,13 @@ export const columnsPositionMarkets = (
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.settlementAsset,
|
||||
value:
|
||||
market.tradableInstrument.instrument.product.settlementAsset.symbol,
|
||||
className: thClassNames('left'),
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: (
|
||||
value: candlesClose && (
|
||||
<PriceCellChange
|
||||
candles={candlesClose}
|
||||
decimalPlaces={market.decimalPlaces}
|
||||
@ -409,7 +425,7 @@ export const columnsPositionMarkets = (
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.candles && (
|
||||
value: candlesClose && (
|
||||
<Sparkline
|
||||
width={100}
|
||||
height={20}
|
||||
@ -421,11 +437,11 @@ export const columnsPositionMarkets = (
|
||||
onlyOnDetailed: false,
|
||||
},
|
||||
{
|
||||
value: market.candleHigh ? (
|
||||
value: candleHigh ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.candleHigh).toNumber()}
|
||||
value={Number(candleHigh)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.candleHigh.toString(),
|
||||
candleHigh.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -437,11 +453,11 @@ export const columnsPositionMarkets = (
|
||||
onlyOnDetailed: true,
|
||||
},
|
||||
{
|
||||
value: market.candleLow ? (
|
||||
value: candleLow ? (
|
||||
<PriceCell
|
||||
value={new BigNumber(market.candleLow).toNumber()}
|
||||
value={Number(candleLow)}
|
||||
valueFormatted={addDecimalsFormatNumber(
|
||||
market.candleLow.toString(),
|
||||
candleLow.toString(),
|
||||
market.decimalPlaces,
|
||||
2
|
||||
)}
|
||||
@ -458,12 +474,12 @@ export const columnsPositionMarkets = (
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
market.data?.trigger &&
|
||||
market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||
? `${formatLabel(
|
||||
market.tradingMode
|
||||
)} - ${market.data?.trigger.toLowerCase()}`
|
||||
: formatLabel(market.tradingMode),
|
||||
? `${MarketTradingModeMapping[market.tradingMode]}
|
||||
- ${AuctionTriggerMapping[market.data.trigger]}`
|
||||
: MarketTradingModeMapping[market.tradingMode],
|
||||
className: thClassNames('left'),
|
||||
onlyOnDetailed: true,
|
||||
dataTestId: 'trading-mode',
|
||||
},
|
||||
{
|
||||
value: (
|
||||
@ -471,7 +487,7 @@ export const columnsPositionMarkets = (
|
||||
description={<FeesBreakdown feeFactors={market.fees?.factors} />}
|
||||
>
|
||||
<span className="border-b-2 border-dotted">
|
||||
{market.totalFees ?? '-'}
|
||||
{totalFees(market.fees.factors) ?? '-'}
|
||||
</span>
|
||||
</Tooltip>
|
||||
),
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
|
||||
|
||||
import type { ReactNode } from 'react';
|
||||
import type { MarketList_markets } from '../__generated__/MarketList';
|
||||
@ -49,15 +50,24 @@ const mockData = {
|
||||
decimalPlaces: 2,
|
||||
name: '',
|
||||
positionDecimalPlaces: 4,
|
||||
state: 'Active',
|
||||
tradingMode: 'Continuous',
|
||||
data: {},
|
||||
state: MarketState.STATE_ACTIVE,
|
||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
data: {
|
||||
markPrice: '14175',
|
||||
},
|
||||
tradableInstrument: {
|
||||
__typename: 'TradableInstrument',
|
||||
instrument: {
|
||||
__typename: 'Instrument',
|
||||
name: 'APEUSD (May 2022)',
|
||||
code: 'APEUSD',
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: {
|
||||
__typename: 'Asset',
|
||||
symbol: 'USD',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
marketTimestamps: {
|
||||
@ -117,6 +127,13 @@ const mockData = {
|
||||
__typename: 'Instrument',
|
||||
name: 'Apple Monthly (30 Jun 2022)',
|
||||
code: 'AAPL.MF21',
|
||||
product: {
|
||||
__typename: 'Future',
|
||||
settlementAsset: {
|
||||
__typename: 'Asset',
|
||||
symbol: 'USD',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fees: {
|
||||
@ -167,9 +184,11 @@ const mockData = {
|
||||
],
|
||||
name: '',
|
||||
positionDecimalPlaces: 4,
|
||||
state: 'Active',
|
||||
tradingMode: 'Continuous',
|
||||
data: {},
|
||||
state: MarketState.STATE_ACTIVE,
|
||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
data: {
|
||||
markPrice: '14175',
|
||||
},
|
||||
} as MarketList_markets,
|
||||
],
|
||||
},
|
||||
|
@ -53,14 +53,8 @@ const mockList = [
|
||||
open: '2022-05-18T13:00:39.328347732Z',
|
||||
close: null,
|
||||
},
|
||||
marketName: 'AAPL.MF21',
|
||||
settlementAsset: 'AAPL.MF21',
|
||||
lastPrice: '16322118',
|
||||
candleHigh: '16365861',
|
||||
candleLow: '16023805',
|
||||
open: 1652878839328,
|
||||
close: null,
|
||||
totalFees: '0.14%',
|
||||
},
|
||||
{
|
||||
__typename: 'Market',
|
||||
@ -106,14 +100,8 @@ const mockList = [
|
||||
__typename: 'Candle',
|
||||
},
|
||||
],
|
||||
marketName: 'APEUSD',
|
||||
settlementAsset: 'APEUSD',
|
||||
lastPrice: '16322118',
|
||||
candleHigh: '16365861',
|
||||
candleLow: '16023805',
|
||||
open: 1652879307693,
|
||||
close: null,
|
||||
totalFees: '0.14%',
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -8,11 +8,6 @@ import type {
|
||||
MarketList_markets_fees_factors,
|
||||
} from '../__generated__/MarketList';
|
||||
|
||||
export const lastPrice = ({ candles }: MarketList_markets) =>
|
||||
candles && candles.length > 0
|
||||
? candles && candles[candles?.length - 1]?.close
|
||||
: undefined;
|
||||
|
||||
export const totalFees = (fees: MarketList_markets_fees_factors) => {
|
||||
if (!fees) {
|
||||
return undefined;
|
||||
@ -36,20 +31,12 @@ export const mapDataToMarketList = ({ markets }: MarketList) =>
|
||||
.map((m) => {
|
||||
return {
|
||||
...m,
|
||||
marketName: m.tradableInstrument.instrument?.code,
|
||||
settlementAsset:
|
||||
m.tradableInstrument.instrument.product?.settlementAsset?.symbol,
|
||||
lastPrice: lastPrice(m) ?? m.data?.markPrice,
|
||||
candles: (m.candles || []).filter((c) => c),
|
||||
candleHigh: calcCandleHigh(m),
|
||||
candleLow: calcCandleLow(m),
|
||||
open: m.marketTimestamps.open
|
||||
? new Date(m.marketTimestamps.open).getTime()
|
||||
: null,
|
||||
close: m.marketTimestamps.close
|
||||
? new Date(m.marketTimestamps.close).getTime()
|
||||
: null,
|
||||
totalFees: totalFees(m.fees?.factors),
|
||||
};
|
||||
}) || [],
|
||||
['open', 'id'],
|
||||
|
@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
|
||||
import {
|
||||
OrderRejectionReason,
|
||||
OrderStatus,
|
||||
OrderStatusMapping,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
@ -76,7 +77,7 @@ describe('OrderFeedback', () => {
|
||||
order.market!.name
|
||||
);
|
||||
expect(screen.getByText('Status').nextElementSibling).toHaveTextContent(
|
||||
order.status
|
||||
OrderStatusMapping[order.status]
|
||||
);
|
||||
expect(screen.getByText('Price').nextElementSibling).toHaveTextContent(
|
||||
'1.00'
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__';
|
||||
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
|
||||
import { OrderStatus, OrderType, Side } from '@vegaprotocol/types';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderStatusMapping,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { VegaTxState } from '@vegaprotocol/wallet';
|
||||
import startCase from 'lodash/startCase';
|
||||
|
||||
@ -28,7 +33,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => {
|
||||
)}
|
||||
<div>
|
||||
<p className={labelClass}>{t(`Status`)}</p>
|
||||
<p>{t(`${order.status}`)}</p>
|
||||
<p>{t(`${OrderStatusMapping[order.status]}`)}</p>
|
||||
</div>
|
||||
{order.type === OrderType.TYPE_LIMIT && order.market && (
|
||||
<div>
|
||||
|
@ -1,6 +1,16 @@
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import { addDecimal, getDateTimeFormat } from '@vegaprotocol/react-helpers';
|
||||
import { OrderStatus, OrderRejectionReason } from '@vegaprotocol/types';
|
||||
import { OrderType } from '@vegaprotocol/types';
|
||||
import {
|
||||
OrderRejectionReasonMapping,
|
||||
OrderTimeInForceMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderRejectionReason,
|
||||
OrderTypeMapping,
|
||||
OrderStatusMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||
@ -9,7 +19,6 @@ import { MockedProvider } from '@apollo/client/testing';
|
||||
import { OrderListTable } from '../';
|
||||
import type { Orders_party_ordersConnection_edges_node } from '../';
|
||||
import { limitOrder, marketOrder } from '../mocks/generate-orders';
|
||||
import startCase from 'lodash/startCase';
|
||||
|
||||
const generateJsx = (
|
||||
orders: Orders_party_ordersConnection_edges_node[] | null,
|
||||
@ -67,11 +76,11 @@ describe('OrderListTable', () => {
|
||||
const expectedValues: string[] = [
|
||||
marketOrder.market?.tradableInstrument.instrument.code || '',
|
||||
'+0.10',
|
||||
marketOrder.type || '',
|
||||
marketOrder.status,
|
||||
OrderTypeMapping[marketOrder.type as OrderType] || '',
|
||||
OrderStatusMapping[marketOrder.status],
|
||||
'5',
|
||||
'-',
|
||||
marketOrder.timeInForce,
|
||||
OrderTimeInForceMapping[marketOrder.timeInForce],
|
||||
getDateTimeFormat().format(new Date(marketOrder.createdAt)),
|
||||
'-',
|
||||
'Edit',
|
||||
@ -91,13 +100,13 @@ describe('OrderListTable', () => {
|
||||
const expectedValues: string[] = [
|
||||
limitOrder.market?.tradableInstrument.instrument.code || '',
|
||||
'+0.10',
|
||||
limitOrder.type || '',
|
||||
limitOrder.status,
|
||||
OrderTypeMapping[limitOrder.type || OrderType.TYPE_LIMIT],
|
||||
OrderStatusMapping[limitOrder.status],
|
||||
'5',
|
||||
addDecimal(limitOrder.price, limitOrder.market?.decimalPlaces ?? 0),
|
||||
`${limitOrder.timeInForce}: ${getDateTimeFormat().format(
|
||||
new Date(limitOrder.expiresAt ?? '')
|
||||
)}`,
|
||||
`${
|
||||
OrderTimeInForceMapping[limitOrder.timeInForce]
|
||||
}: ${getDateTimeFormat().format(new Date(limitOrder.expiresAt ?? ''))}`,
|
||||
getDateTimeFormat().format(new Date(limitOrder.createdAt)),
|
||||
'-',
|
||||
'Edit',
|
||||
@ -120,7 +129,9 @@ describe('OrderListTable', () => {
|
||||
});
|
||||
const cells = screen.getAllByRole('gridcell');
|
||||
expect(cells[3]).toHaveTextContent(
|
||||
`${rejectedOrder.status}: ${startCase(rejectedOrder.rejectionReason)}`
|
||||
`${OrderStatusMapping[rejectedOrder.status]}: ${
|
||||
OrderRejectionReasonMapping[rejectedOrder.rejectionReason]
|
||||
}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -3,6 +3,10 @@ import {
|
||||
OrderStatus,
|
||||
Side,
|
||||
OrderType,
|
||||
OrderTypeMapping,
|
||||
OrderStatusMapping,
|
||||
OrderTimeInForceMapping,
|
||||
OrderRejectionReasonMapping,
|
||||
} from '@vegaprotocol/types';
|
||||
import { addDecimal, getDateTimeFormat, t } from '@vegaprotocol/react-helpers';
|
||||
import {
|
||||
@ -29,7 +33,6 @@ import { useOrderEdit } from '../../order-hooks/use-order-edit';
|
||||
import { OrderEditDialog } from './order-edit-dialog';
|
||||
import type { OrderFields } from '../order-data-provider/__generated__';
|
||||
import { OrderFeedback } from '../order-feedback';
|
||||
import startCase from 'lodash/startCase';
|
||||
|
||||
type OrderListProps = AgGridReactProps | AgReactUiProps;
|
||||
|
||||
@ -151,7 +154,14 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<AgGridColumn field="type" />
|
||||
<AgGridColumn
|
||||
field="type"
|
||||
valueFormatter={({
|
||||
value,
|
||||
}: ValueFormatterParams & {
|
||||
value?: Orders_party_ordersConnection_edges_node['type'];
|
||||
}) => OrderTypeMapping[value as OrderType]}
|
||||
/>
|
||||
<AgGridColumn
|
||||
field="status"
|
||||
valueFormatter={({
|
||||
@ -164,11 +174,12 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
return undefined;
|
||||
}
|
||||
if (value === OrderStatus.STATUS_REJECTED) {
|
||||
return `${value}: ${
|
||||
data.rejectionReason && startCase(data.rejectionReason)
|
||||
return `${OrderStatusMapping[value]}: ${
|
||||
data.rejectionReason &&
|
||||
OrderRejectionReasonMapping[data.rejectionReason]
|
||||
}`;
|
||||
}
|
||||
return value;
|
||||
return OrderStatusMapping[value];
|
||||
}}
|
||||
/>
|
||||
<AgGridColumn
|
||||
@ -232,10 +243,10 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
|
||||
const expiry = getDateTimeFormat().format(
|
||||
new Date(data.expiresAt)
|
||||
);
|
||||
return `${value}: ${expiry}`;
|
||||
return `${OrderTimeInForceMapping[value]}: ${expiry}`;
|
||||
}
|
||||
|
||||
return value;
|
||||
return OrderTimeInForceMapping[value];
|
||||
}}
|
||||
/>
|
||||
<AgGridColumn
|
||||
|
@ -7,6 +7,7 @@ import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet';
|
||||
import {
|
||||
MarketState,
|
||||
MarketTradingMode,
|
||||
OrderStatus,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
@ -76,15 +77,15 @@ function setup(
|
||||
{
|
||||
type: 'Order',
|
||||
event: {
|
||||
type: 'Limit',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62',
|
||||
status: 'Active',
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
rejectionReason: null,
|
||||
createdAt: '2022-07-05T14:25:47.815283706Z',
|
||||
size: '10',
|
||||
price: '300000',
|
||||
timeInForce: 'GTC',
|
||||
side: 'Buy',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
side: Side.SIDE_BUY,
|
||||
market: {
|
||||
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||
decimalPlaces: 5,
|
||||
@ -111,15 +112,15 @@ function setup(
|
||||
{
|
||||
type: 'Order',
|
||||
event: {
|
||||
type: 'Limit',
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62',
|
||||
status: 'Active',
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
rejectionReason: null,
|
||||
createdAt: '2022-07-05T14:25:47.815283706Z',
|
||||
size: '10',
|
||||
price: '300000',
|
||||
timeInForce: 'GTC',
|
||||
side: 'Buy',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
side: Side.SIDE_BUY,
|
||||
market: {
|
||||
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||
decimalPlaces: 5,
|
||||
|
@ -70,7 +70,7 @@ export const useOrderSubmit = (market: Market) => {
|
||||
side: order.side,
|
||||
timeInForce: order.timeInForce,
|
||||
expiresAt: order.expiration
|
||||
? toNanoSeconds(order.expiration) // Wallet expects timestampe in nanoseconds
|
||||
? toNanoSeconds(order.expiration) // Wallet expects timestamp in nanoseconds
|
||||
: undefined,
|
||||
},
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import type {
|
||||
} from '@vegaprotocol/wallet';
|
||||
import {
|
||||
MarketState,
|
||||
MarketStateMapping,
|
||||
MarketTradingMode,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
@ -145,7 +146,9 @@ describe('useOrderValidation', () => {
|
||||
});
|
||||
expect(result.current).toStrictEqual({
|
||||
isDisabled: false,
|
||||
message: `This market is ${state.toLowerCase()} and only accepting liquidity commitment orders`,
|
||||
message: `This market is ${MarketStateMapping[
|
||||
state as MarketState
|
||||
].toLowerCase()} and only accepting liquidity commitment orders`,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -4,6 +4,7 @@ import { t, toDecimal } from '@vegaprotocol/react-helpers';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import {
|
||||
MarketState,
|
||||
MarketStateMapping,
|
||||
MarketTradingMode,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
@ -28,7 +29,7 @@ export const marketTranslations = (marketState: MarketState) => {
|
||||
case MarketState.STATE_TRADING_TERMINATED:
|
||||
return t('terminated');
|
||||
default:
|
||||
return t(marketState).toLowerCase();
|
||||
return t(MarketStateMapping[marketState]).toLowerCase();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -276,12 +276,12 @@ export const PositionsTable = forwardRef<AgGridReact, Props>((props, ref) => {
|
||||
value,
|
||||
}: {
|
||||
value: string;
|
||||
}) => BigInt(value) > 0,
|
||||
}) => value && BigInt(value) > 0,
|
||||
'text-vega-red-dark dark:text-vega-red': ({
|
||||
value,
|
||||
}: {
|
||||
value: string;
|
||||
}) => BigInt(value) < 0,
|
||||
}) => value && BigInt(value) < 0,
|
||||
}}
|
||||
valueFormatter={({
|
||||
value,
|
||||
@ -305,12 +305,12 @@ export const PositionsTable = forwardRef<AgGridReact, Props>((props, ref) => {
|
||||
value,
|
||||
}: {
|
||||
value: string;
|
||||
}) => BigInt(value) > 0,
|
||||
}) => value && BigInt(value) > 0,
|
||||
'text-vega-red-dark dark:text-vega-red': ({
|
||||
value,
|
||||
}: {
|
||||
value: string;
|
||||
}) => BigInt(value) < 0,
|
||||
}) => value && BigInt(value) < 0,
|
||||
}}
|
||||
valueFormatter={({
|
||||
value,
|
||||
|
@ -1,28 +1,28 @@
|
||||
export enum AccountTypeMapping {
|
||||
ACCOUNT_TYPE_BOND = 'BOND',
|
||||
ACCOUNT_TYPE_EXTERNAL = 'EXTERNAL',
|
||||
ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'FEES_INFRASTRUCTURE',
|
||||
ACCOUNT_TYPE_FEES_LIQUIDITY = 'FEES_LIQUIDITY',
|
||||
ACCOUNT_TYPE_FEES_MAKER = 'FEES_MAKER',
|
||||
ACCOUNT_TYPE_GENERAL = 'GENERAL',
|
||||
ACCOUNT_TYPE_GLOBAL_INSURANCE = 'GLOBAL_INSURANCE',
|
||||
ACCOUNT_TYPE_GLOBAL_REWARD = 'GLOBAL_REWARD',
|
||||
ACCOUNT_TYPE_INSURANCE = 'INSURANCE',
|
||||
ACCOUNT_TYPE_MARGIN = 'MARGIN',
|
||||
ACCOUNT_TYPE_PENDING_TRANSFERS = 'PENDING_TRANSFERS',
|
||||
ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'REWARD_LP_RECEIVED_FEES',
|
||||
ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'REWARD_MAKER_RECEIVED_FEES',
|
||||
ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'REWARD_MARKET_PROPOSERS',
|
||||
ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'REWARD_TAKER_PAID_FEES',
|
||||
ACCOUNT_TYPE_SETTLEMENT = 'SETTLEMENT',
|
||||
ACCOUNT_TYPE_BOND = 'Bond',
|
||||
ACCOUNT_TYPE_EXTERNAL = 'External',
|
||||
ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'Fees Infrastructure',
|
||||
ACCOUNT_TYPE_FEES_LIQUIDITY = 'Fees Liquidity',
|
||||
ACCOUNT_TYPE_FEES_MAKER = 'Fees Maker',
|
||||
ACCOUNT_TYPE_GENERAL = 'General',
|
||||
ACCOUNT_TYPE_GLOBAL_INSURANCE = 'Global Insurance',
|
||||
ACCOUNT_TYPE_GLOBAL_REWARD = 'Global Reward',
|
||||
ACCOUNT_TYPE_INSURANCE = 'Insurance',
|
||||
ACCOUNT_TYPE_MARGIN = 'Margin',
|
||||
ACCOUNT_TYPE_PENDING_TRANSFERS = 'Pending transfers',
|
||||
ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'Reward LP received fees',
|
||||
ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'Reward Maker received fees',
|
||||
ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'Reward Market Proposers',
|
||||
ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'Reward Taker paid fees',
|
||||
ACCOUNT_TYPE_SETTLEMENT = 'Settlement',
|
||||
}
|
||||
|
||||
export enum AuctionTriggerMapping {
|
||||
AUCTION_TRIGGER_BATCH = 'BATCH',
|
||||
AUCTION_TRIGGER_LIQUIDITY = 'LIQUIDITY',
|
||||
AUCTION_TRIGGER_OPENING = 'OPENING',
|
||||
AUCTION_TRIGGER_PRICE = 'PRICE',
|
||||
AUCTION_TRIGGER_UNSPECIFIED = 'UNSPECIFIED',
|
||||
AUCTION_TRIGGER_BATCH = 'batch',
|
||||
AUCTION_TRIGGER_LIQUIDITY = 'liquidity',
|
||||
AUCTION_TRIGGER_OPENING = 'opening',
|
||||
AUCTION_TRIGGER_PRICE = 'price',
|
||||
AUCTION_TRIGGER_UNSPECIFIED = 'unspecified',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,9 +40,9 @@ export enum ConditionOperatorMapping {
|
||||
* The status of a deposit
|
||||
*/
|
||||
export enum DepositStatusMapping {
|
||||
STATUS_CANCELLED = 'CANCELLED',
|
||||
STATUS_FINALIZED = 'FINALIZED',
|
||||
STATUS_OPEN = 'OPEN',
|
||||
STATUS_CANCELLED = 'Cancelled',
|
||||
STATUS_FINALIZED = 'Finalized',
|
||||
STATUS_OPEN = 'Open',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,15 +61,15 @@ export enum IntervalMapping {
|
||||
* The current state of a market
|
||||
*/
|
||||
export enum MarketStateMapping {
|
||||
STATE_ACTIVE = 'ACTIVE',
|
||||
STATE_CANCELLED = 'CANCELLED',
|
||||
STATE_CLOSED = 'CLOSED',
|
||||
STATE_PENDING = 'PENDING',
|
||||
STATE_PROPOSED = 'PROPOSED',
|
||||
STATE_REJECTED = 'REJECTED',
|
||||
STATE_SETTLED = 'SETTLED',
|
||||
STATE_SUSPENDED = 'SUSPENDED',
|
||||
STATE_TRADING_TERMINATED = 'TRADING_TERMINATED',
|
||||
STATE_ACTIVE = 'Active',
|
||||
STATE_CANCELLED = 'Cancelled',
|
||||
STATE_CLOSED = 'Closed',
|
||||
STATE_PENDING = 'Pending',
|
||||
STATE_PROPOSED = 'Proposed',
|
||||
STATE_REJECTED = 'Rejected',
|
||||
STATE_SETTLED = 'Settled',
|
||||
STATE_SUSPENDED = 'Suspended',
|
||||
STATE_TRADING_TERMINATED = 'Trading Terminated',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ export enum MarketStateMapping {
|
||||
*/
|
||||
export enum MarketTradingModeMapping {
|
||||
TRADING_MODE_BATCH_AUCTION = 'Batch auction',
|
||||
TRADING_MODE_CONTINUOUS = 'Continuous trading',
|
||||
TRADING_MODE_CONTINUOUS = 'Continuous',
|
||||
TRADING_MODE_MONITORING_AUCTION = 'Monitoring auction',
|
||||
TRADING_MODE_NO_TRADING = 'No trading',
|
||||
TRADING_MODE_OPENING_AUCTION = 'Opening auction',
|
||||
@ -100,50 +100,50 @@ export enum OracleSpecStatusMapping {
|
||||
* Reason for the order being rejected by the core node
|
||||
*/
|
||||
export enum OrderRejectionReasonMapping {
|
||||
ORDER_ERROR_AMEND_FAILURE = 'AMEND_FAILURE',
|
||||
ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'BUY_CANNOT_REFERENCE_BEST_ASK_PRICE',
|
||||
ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 'CANNOT_AMEND_FROM_GFA_OR_GFN',
|
||||
ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 'CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 'CANNOT_AMEND_TO_FOK_OR_IOC',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 'CANNOT_AMEND_TO_GFA_OR_GFN',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT',
|
||||
ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'CANNOT_HAVE_GTC_AND_EXPIRYAT',
|
||||
ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 'CANNOT_SEND_FOK_ORDER_DURING_AUCTION',
|
||||
ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'CANNOT_SEND_IOC_ORDER_DURING_AUCTION',
|
||||
ORDER_ERROR_EDIT_NOT_ALLOWED = 'EDIT_NOT_ALLOWED',
|
||||
ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'EXPIRYAT_BEFORE_CREATEDAT',
|
||||
ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'GFA_ORDER_DURING_CONTINUOUS_TRADING',
|
||||
ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = 'GFN_ORDER_DURING_AN_AUCTION',
|
||||
ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'INSUFFICIENT_ASSET_BALANCE',
|
||||
ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'INSUFFICIENT_FUNDS_TO_PAY_FEES',
|
||||
ORDER_ERROR_INTERNAL_ERROR = 'INTERNAL_ERROR',
|
||||
ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'INVALID_EXPIRATION_DATETIME',
|
||||
ORDER_ERROR_INVALID_MARKET_ID = 'INVALID_MARKET_ID',
|
||||
ORDER_ERROR_INVALID_ORDER_ID = 'INVALID_ORDER_ID',
|
||||
ORDER_ERROR_INVALID_ORDER_REFERENCE = 'INVALID_ORDER_REFERENCE',
|
||||
ORDER_ERROR_INVALID_PARTY_ID = 'INVALID_PARTY_ID',
|
||||
ORDER_ERROR_INVALID_PERSISTENCE = 'INVALID_PERSISTENCE',
|
||||
ORDER_ERROR_INVALID_REMAINING_SIZE = 'INVALID_REMAINING_SIZE',
|
||||
ORDER_ERROR_INVALID_SIZE = 'INVALID_SIZE',
|
||||
ORDER_ERROR_INVALID_TIME_IN_FORCE = 'INVALID_TIME_IN_FORCE',
|
||||
ORDER_ERROR_INVALID_TYPE = 'INVALID_TYPE',
|
||||
ORDER_ERROR_MARGIN_CHECK_FAILED = 'MARGIN_CHECK_FAILED',
|
||||
ORDER_ERROR_MARKET_CLOSED = 'MARKET_CLOSED',
|
||||
ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'MISSING_GENERAL_ACCOUNT',
|
||||
ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'MUST_BE_GTT_OR_GTC',
|
||||
ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'MUST_BE_LIMIT_ORDER',
|
||||
ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS',
|
||||
ORDER_ERROR_NOT_FOUND = 'NOT_FOUND',
|
||||
ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 'OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO',
|
||||
ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'OFFSET_MUST_BE_GREATER_THAN_ZERO',
|
||||
ORDER_ERROR_OUT_OF_SEQUENCE = 'OUT_OF_SEQUENCE',
|
||||
ORDER_ERROR_REMOVAL_FAILURE = 'REMOVAL_FAILURE',
|
||||
ORDER_ERROR_SELF_TRADING = 'SELF_TRADING',
|
||||
ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'SELL_CANNOT_REFERENCE_BEST_BID_PRICE',
|
||||
ORDER_ERROR_TIME_FAILURE = 'TIME_FAILURE',
|
||||
ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 'UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER',
|
||||
ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 'UNABLE_TO_REPRICE_PEGGED_ORDER',
|
||||
ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'WITHOUT_REFERENCE_PRICE',
|
||||
ORDER_ERROR_AMEND_FAILURE = 'Amend failure',
|
||||
ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'Buy cannot reference best ask price',
|
||||
ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 'Cannot amend from GFA or GFN',
|
||||
ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 'Cannot amend pegged order details on non pegged order',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 'Cannot amend to FOK or IOC',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 'Cannot amend to GFA or GFN',
|
||||
ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'Cannot amend to GTT without expiry time specified',
|
||||
ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'Cannot have GTC and expiry time specified',
|
||||
ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 'Cannot send FOK order during auction',
|
||||
ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'Cannot send IOC order during auction',
|
||||
ORDER_ERROR_EDIT_NOT_ALLOWED = 'Edit not allowed',
|
||||
ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'Expiry time before creation time',
|
||||
ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'GFA order during continuous trading',
|
||||
ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = 'GFN order during an auction',
|
||||
ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'Insufficient asset balance',
|
||||
ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'Insufficient funds to pay fees',
|
||||
ORDER_ERROR_INTERNAL_ERROR = 'Internal error',
|
||||
ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'Invalid expiration date time',
|
||||
ORDER_ERROR_INVALID_MARKET_ID = 'Invalid market ID',
|
||||
ORDER_ERROR_INVALID_ORDER_ID = 'Invalid order ID',
|
||||
ORDER_ERROR_INVALID_ORDER_REFERENCE = 'Invalid order reference',
|
||||
ORDER_ERROR_INVALID_PARTY_ID = 'Invalid party ID',
|
||||
ORDER_ERROR_INVALID_PERSISTENCE = 'Invalid persistence',
|
||||
ORDER_ERROR_INVALID_REMAINING_SIZE = 'Invalid remaining size',
|
||||
ORDER_ERROR_INVALID_SIZE = 'Invalid size',
|
||||
ORDER_ERROR_INVALID_TIME_IN_FORCE = 'Invalid time in force',
|
||||
ORDER_ERROR_INVALID_TYPE = 'Invalid type',
|
||||
ORDER_ERROR_MARGIN_CHECK_FAILED = 'Margin check failed',
|
||||
ORDER_ERROR_MARKET_CLOSED = 'Market closed',
|
||||
ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'Missing general account',
|
||||
ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'Must be GTT or GTC',
|
||||
ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'Must be limit order',
|
||||
ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'Non persistent order out of price bounds',
|
||||
ORDER_ERROR_NOT_FOUND = 'Not found',
|
||||
ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 'Offset must be greater or equal to zero',
|
||||
ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'Offset must be greater than zero',
|
||||
ORDER_ERROR_OUT_OF_SEQUENCE = 'Out of sequence',
|
||||
ORDER_ERROR_REMOVAL_FAILURE = 'Removal failure',
|
||||
ORDER_ERROR_SELF_TRADING = ' Self trading',
|
||||
ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'Sell cannot reference best bid price',
|
||||
ORDER_ERROR_TIME_FAILURE = 'Time failure',
|
||||
ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 'Unable to amend price on pegged order',
|
||||
ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 'Unable to reprice pegged order',
|
||||
ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'Without reference price',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,8 +167,8 @@ export enum OrderTimeInForceMapping {
|
||||
TIME_IN_FORCE_FOK = 'Fill or Kill (FOK)',
|
||||
TIME_IN_FORCE_GFA = 'Good for Auction (GFA)',
|
||||
TIME_IN_FORCE_GFN = 'Good for Normal (GFN)',
|
||||
TIME_IN_FORCE_GTC = `Good 'till Cancel (GTC)`,
|
||||
TIME_IN_FORCE_GTT = `Good 'till Time (GTT)`,
|
||||
TIME_IN_FORCE_GTC = `Good 'til Cancelled (GTC)`,
|
||||
TIME_IN_FORCE_GTT = `Good 'til Time (GTT)`,
|
||||
TIME_IN_FORCE_IOC = 'Immediate or Cancel (IOC)',
|
||||
}
|
||||
|
||||
@ -182,44 +182,44 @@ export enum OrderTypeMapping {
|
||||
* Reason for the proposal being rejected by the core node
|
||||
*/
|
||||
export enum ProposalRejectionReasonMapping {
|
||||
PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'CLOSE_TIME_TOO_LATE',
|
||||
PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'CLOSE_TIME_TOO_SOON',
|
||||
PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'COULD_NOT_INSTANTIATE_MARKET',
|
||||
PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 'ENACT_TIME_TOO_LATE',
|
||||
PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'ENACT_TIME_TOO_SOON',
|
||||
PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'INCOMPATIBLE_TIMESTAMPS',
|
||||
PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'INSUFFICIENT_EQUITY_LIKE_SHARE',
|
||||
PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'INSUFFICIENT_TOKENS',
|
||||
PROPOSAL_ERROR_INVALID_ASSET = 'INVALID_ASSET',
|
||||
PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'INVALID_ASSET_DETAILS',
|
||||
PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'INVALID_FEE_AMOUNT',
|
||||
PROPOSAL_ERROR_INVALID_FREEFORM = 'INVALID_FREEFORM',
|
||||
PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'INVALID_FUTURE_PRODUCT',
|
||||
PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'INVALID_INSTRUMENT_SECURITY',
|
||||
PROPOSAL_ERROR_INVALID_MARKET = 'INVALID_MARKET',
|
||||
PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'INVALID_RISK_PARAMETER',
|
||||
PROPOSAL_ERROR_INVALID_SHAPE = 'INVALID_SHAPE',
|
||||
PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'MAJORITY_THRESHOLD_NOT_REACHED',
|
||||
PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'MARKET_MISSING_LIQUIDITY_COMMITMENT',
|
||||
PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'MISSING_BUILTIN_ASSET_FIELD',
|
||||
PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'MISSING_COMMITMENT_AMOUNT',
|
||||
PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'MISSING_ERC20_CONTRACT_ADDRESS',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'NETWORK_PARAMETER_INVALID_KEY',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'NETWORK_PARAMETER_INVALID_VALUE',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'NETWORK_PARAMETER_VALIDATION_FAILED',
|
||||
PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'NODE_VALIDATION_FAILED',
|
||||
PROPOSAL_ERROR_NO_PRODUCT = 'NO_PRODUCT',
|
||||
PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'NO_RISK_PARAMETERS',
|
||||
PROPOSAL_ERROR_NO_TRADING_MODE = 'NO_TRADING_MODE',
|
||||
PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 'OPENING_AUCTION_DURATION_TOO_LARGE',
|
||||
PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'OPENING_AUCTION_DURATION_TOO_SMALL',
|
||||
PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'PARTICIPATION_THRESHOLD_NOT_REACHED',
|
||||
PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 'TOO_MANY_MARKET_DECIMAL_PLACES',
|
||||
PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'TOO_MANY_PRICE_MONITORING_TRIGGERS',
|
||||
PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 'UNKNOWN_RISK_PARAMETER_TYPE',
|
||||
PROPOSAL_ERROR_UNKNOWN_TYPE = 'UNKNOWN_TYPE',
|
||||
PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'UNSUPPORTED_PRODUCT',
|
||||
PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'UNSUPPORTED_TRADING_MODE',
|
||||
PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'Close time too late',
|
||||
PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'Close time too soon',
|
||||
PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'Could not instantiate market',
|
||||
PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 'Enact time too late',
|
||||
PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'Enact time too soon',
|
||||
PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'Incompatible timestamps',
|
||||
PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'Insufficient equity like share',
|
||||
PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'Insufficient tokens',
|
||||
PROPOSAL_ERROR_INVALID_ASSET = 'Invalid asset',
|
||||
PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'Invalid asset details',
|
||||
PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'Invalid fee amount',
|
||||
PROPOSAL_ERROR_INVALID_FREEFORM = 'Invalid freeform',
|
||||
PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'Invalid future product',
|
||||
PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'Invalid instrument security',
|
||||
PROPOSAL_ERROR_INVALID_MARKET = 'Invalid market',
|
||||
PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'Invalid risk parameter',
|
||||
PROPOSAL_ERROR_INVALID_SHAPE = 'Invalid shape',
|
||||
PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'Majority threshold not reached',
|
||||
PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'Market missing liquidity commitment',
|
||||
PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'Missing builtin asset field',
|
||||
PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'Missing commitment amount',
|
||||
PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'Missing ERC20 contract address',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'Network parameter invalid key',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'Network parameter invalid value',
|
||||
PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'Network parameter validation failed',
|
||||
PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'Node validation failed',
|
||||
PROPOSAL_ERROR_NO_PRODUCT = 'No product',
|
||||
PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'No risk parameters',
|
||||
PROPOSAL_ERROR_NO_TRADING_MODE = 'No trading mode',
|
||||
PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 'Opening auction duration too large',
|
||||
PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'Opening auction duration too small',
|
||||
PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'Participation threshold not reached',
|
||||
PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 'Too many market decimal places',
|
||||
PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'Too many price monitoring triggers',
|
||||
PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 'Unknown risk parameter type',
|
||||
PROPOSAL_ERROR_UNKNOWN_TYPE = 'Unknown type',
|
||||
PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'Unsupported product',
|
||||
PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'Unsupported trading mode',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,9 +257,9 @@ export enum StakeLinkingStatusMapping {
|
||||
}
|
||||
|
||||
export enum ValidatorStatusMapping {
|
||||
VALIDATOR_NODE_STATUS_ERSATZ = 'ERSATZ',
|
||||
VALIDATOR_NODE_STATUS_PENDING = 'PENDING',
|
||||
VALIDATOR_NODE_STATUS_TENDERMINT = 'TENDERMINT',
|
||||
VALIDATOR_NODE_STATUS_ERSATZ = 'Ersatz',
|
||||
VALIDATOR_NODE_STATUS_PENDING = 'Pending',
|
||||
VALIDATOR_NODE_STATUS_TENDERMINT = 'Tendermint',
|
||||
}
|
||||
|
||||
export enum VoteValueMapping {
|
||||
|
Loading…
Reference in New Issue
Block a user