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:
m.ray 2022-08-23 18:24:33 +01:00 committed by GitHub
parent bb40a18e2b
commit b6cda139df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 300 additions and 250 deletions

View File

@ -372,7 +372,7 @@ describe('Proposals list item details', () => {
); );
expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected'); expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected');
expect(screen.getByTestId('vote-status')).toHaveTextContent( expect(screen.getByTestId('vote-status')).toHaveTextContent(
'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT' 'Invalid future product'
); );
}); });
}); });

View File

@ -12,7 +12,10 @@ import { useTranslation } from 'react-i18next';
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
import { ProposalState } from '@vegaprotocol/types'; import {
ProposalRejectionReasonMapping,
ProposalState,
} from '@vegaprotocol/types';
const MajorityNotReached = () => { const MajorityNotReached = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -161,7 +164,7 @@ export const ProposalsListItemDetails = ({
</> </>
); );
voteStatus = proposal.rejectionReason && ( voteStatus = proposal.rejectionReason && (
<>{t(proposal.rejectionReason)}</> <>{t(ProposalRejectionReasonMapping[proposal.rejectionReason])}</>
); );
break; break;
} }

View File

@ -8,13 +8,14 @@ import { SelectMarketPopover } from '@vegaprotocol/market-list';
import { OrderListContainer } from '@vegaprotocol/orders'; import { OrderListContainer } from '@vegaprotocol/orders';
import { FillsContainer } from '@vegaprotocol/fills'; import { FillsContainer } from '@vegaprotocol/fills';
import { PositionsContainer } from '@vegaprotocol/positions'; import { PositionsContainer } from '@vegaprotocol/positions';
import { import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
addDecimalsFormatNumber,
formatLabel,
t,
} from '@vegaprotocol/react-helpers';
import { TradesContainer } from '@vegaprotocol/trades'; 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 { Allotment, LayoutPriority } from 'allotment';
import classNames from 'classnames'; import classNames from 'classnames';
import { useState } from 'react'; import { useState } from 'react';
@ -124,10 +125,9 @@ export const TradeMarketHeader = ({
market.data?.trigger && market.data?.trigger &&
market.data.trigger !== market.data.trigger !==
AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
? `${formatLabel( ? `${MarketTradingModeMapping[market.tradingMode]}
market.tradingMode - ${AuctionTriggerMapping[market.data.trigger]}`
)} - ${market.data?.trigger.toLowerCase()}` : MarketTradingModeMapping[market.tradingMode]}
: formatLabel(market.tradingMode)}
</span> </span>
</div> </div>
</Tooltip> </Tooltip>

View File

@ -17,6 +17,8 @@ import type { AgGridReact } from 'ag-grid-react';
import type { Accounts_party_accounts } from './__generated__/Accounts'; import type { Accounts_party_accounts } from './__generated__/Accounts';
import { getId } from './accounts-data-provider'; import { getId } from './accounts-data-provider';
import { useAssetDetailsDialogStore } from '@vegaprotocol/market-list'; import { useAssetDetailsDialogStore } from '@vegaprotocol/market-list';
import type { AccountType } from '@vegaprotocol/types';
import { AccountTypeMapping } from '@vegaprotocol/types';
interface AccountsTableProps { interface AccountsTableProps {
data: Accounts_party_accounts[] | null; data: Accounts_party_accounts[] | null;
@ -143,7 +145,9 @@ export const AccountsTable = forwardRef<AgGridReact, AccountsTableProps>(
<AgGridColumn <AgGridColumn
headerName={t('Type')} headerName={t('Type')}
field="type" field="type"
valueFormatter="value || '—'" valueFormatter={({ value }: ValueFormatterParams) =>
value ? AccountTypeMapping[value as AccountType] : '-'
}
/> />
<AgGridColumn <AgGridColumn
headerName={t('Market')} headerName={t('Market')}

View File

@ -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 * 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) * number denominated in the currency of the market. (uint64)
* *
* Examples: * Examples:
* Currency Balance decimalPlaces Real Balance * Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100 * GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00 * GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01 * GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p ) * GBP 1 4 GBP 0.0001 ( 0.01p )
* *
* GBX (pence) 100 0 GBP 1.00 (100p ) * GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p ) * GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p ) * GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -1,12 +1,16 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
addDecimalsFormatNumber, addDecimalsFormatNumber,
formatLabel,
formatNumberPercentage, formatNumberPercentage,
PriceCell, PriceCell,
t, t,
} from '@vegaprotocol/react-helpers'; } from '@vegaprotocol/react-helpers';
import { AuctionTrigger, MarketTradingMode } from '@vegaprotocol/types'; import {
AuctionTrigger,
AuctionTriggerMapping,
MarketTradingMode,
MarketTradingModeMapping,
} from '@vegaprotocol/types';
import { import {
KeyValueTable, KeyValueTable,
KeyValueTableRow, KeyValueTableRow,
@ -17,11 +21,15 @@ import {
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import Link from 'next/link'; import Link from 'next/link';
import { totalFees } from '../utils'; import { calcCandleHigh, calcCandleLow, totalFees } from '../utils';
import type { CandleClose } from '@vegaprotocol/types'; 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 classNames from 'classnames';
import isNil from 'lodash/isNil';
export const thClassNames = (direction: 'left' | 'right') => 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%]`; `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 // 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 const candlesClose = market.candles
.map((candle: { close: string }) => candle?.close) ?.map((candle) => candle?.close)
.filter((c: string): c is CandleClose => c !== null); .filter((c: string | undefined): c is CandleClose => !isNil(c));
const handleKeyPress = ( const handleKeyPress = (
event: React.KeyboardEvent<HTMLAnchorElement>, event: React.KeyboardEvent<HTMLAnchorElement>,
id: string id: string
@ -196,6 +207,8 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
return onSelect(id); return onSelect(id);
} }
}; };
const candleLow = calcCandleLow(market);
const candleHigh = calcCandleHigh(market);
const selectMarketColumns: Column[] = [ const selectMarketColumns: Column[] = [
{ {
value: ( value: (
@ -217,11 +230,11 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.lastPrice ? ( value: market.data?.markPrice ? (
<PriceCell <PriceCell
value={new BigNumber(market.lastPrice).toNumber()} value={Number(market.data?.markPrice)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.lastPrice.toString(), market.data?.markPrice.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -233,13 +246,14 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.settlementAsset, value:
market.tradableInstrument.instrument.product.settlementAsset.symbol,
dataTestId: 'settlement-asset', dataTestId: 'settlement-asset',
className: thClassNames('left'), className: thClassNames('left'),
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: ( value: candlesClose && (
<PriceCellChange <PriceCellChange
candles={candlesClose} candles={candlesClose}
decimalPlaces={market.decimalPlaces} decimalPlaces={market.decimalPlaces}
@ -254,18 +268,18 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
width={100} width={100}
height={20} height={20}
muted={false} muted={false}
data={candlesClose.map((c: string) => Number(c))} data={candlesClose?.map((c: string) => Number(c)) || []}
/> />
), ),
className: 'px-8', className: 'px-8',
onlyOnDetailed: false, onlyOnDetailed: false && candlesClose,
}, },
{ {
value: market.candleHigh ? ( value: candleHigh ? (
<PriceCell <PriceCell
value={new BigNumber(market.candleHigh).toNumber()} value={Number(candleHigh)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.candleHigh.toString(), candleHigh.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -277,11 +291,11 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
onlyOnDetailed: true, onlyOnDetailed: true,
}, },
{ {
value: market.candleLow ? ( value: candleLow ? (
<PriceCell <PriceCell
value={new BigNumber(market.candleLow).toNumber()} value={Number(candleLow)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.candleLow.toString(), candleLow.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -298,10 +312,9 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
market.data?.trigger && market.data?.trigger &&
market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
? `${formatLabel( ? `${MarketTradingModeMapping[market.tradingMode]}
market.tradingMode - ${AuctionTriggerMapping[market.data.trigger]}`
)} - ${market.data?.trigger.toLowerCase()}` : MarketTradingModeMapping[market.tradingMode],
: formatLabel(market.tradingMode),
className: thClassNames('left'), className: thClassNames('left'),
onlyOnDetailed: true, onlyOnDetailed: true,
dataTestId: 'trading-mode', dataTestId: 'trading-mode',
@ -312,7 +325,7 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
description={<FeesBreakdown feeFactors={market.fees?.factors} />} description={<FeesBreakdown feeFactors={market.fees?.factors} />}
> >
<span className="border-b-2 border-dotted"> <span className="border-b-2 border-dotted">
{market.totalFees ?? '-'} {totalFees(market.fees.factors) ?? '-'}
</span> </span>
</Tooltip> </Tooltip>
), ),
@ -322,7 +335,7 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
}, },
{ {
value: value:
market.data.indicativeVolume && market.data.indicativeVolume !== '0' market.data?.indicativeVolume && market.data.indicativeVolume !== '0'
? addDecimalsFormatNumber( ? addDecimalsFormatNumber(
market.data.indicativeVolume, market.data.indicativeVolume,
market.positionDecimalPlaces market.positionDecimalPlaces
@ -343,12 +356,14 @@ export const columns = (market: any, onSelect: (id: string) => void) => {
}; };
export const columnsPositionMarkets = ( export const columnsPositionMarkets = (
market: any, market: MarketList_markets & { openVolume: string },
onSelect: (id: string) => void onSelect: (id: string) => void
) => { ) => {
const candlesClose = market.candles const candlesClose = market.candles
.map((candle: { close: string }) => candle?.close) ?.map((candle) => candle?.close)
.filter((c: string): c is CandleClose => c !== null); .filter((c: string | undefined): c is CandleClose => !isNil(c));
const candleLow = calcCandleLow(market);
const candleHigh = calcCandleHigh(market);
const handleKeyPress = ( const handleKeyPress = (
event: React.KeyboardEvent<HTMLAnchorElement>, event: React.KeyboardEvent<HTMLAnchorElement>,
id: string id: string
@ -378,11 +393,11 @@ export const columnsPositionMarkets = (
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.lastPrice ? ( value: market.data?.markPrice ? (
<PriceCell <PriceCell
value={new BigNumber(market.lastPrice).toNumber()} value={Number(market.data.markPrice)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.lastPrice.toString(), market.data.markPrice.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -394,12 +409,13 @@ export const columnsPositionMarkets = (
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.settlementAsset, value:
market.tradableInstrument.instrument.product.settlementAsset.symbol,
className: thClassNames('left'), className: thClassNames('left'),
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: ( value: candlesClose && (
<PriceCellChange <PriceCellChange
candles={candlesClose} candles={candlesClose}
decimalPlaces={market.decimalPlaces} decimalPlaces={market.decimalPlaces}
@ -409,7 +425,7 @@ export const columnsPositionMarkets = (
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.candles && ( value: candlesClose && (
<Sparkline <Sparkline
width={100} width={100}
height={20} height={20}
@ -421,11 +437,11 @@ export const columnsPositionMarkets = (
onlyOnDetailed: false, onlyOnDetailed: false,
}, },
{ {
value: market.candleHigh ? ( value: candleHigh ? (
<PriceCell <PriceCell
value={new BigNumber(market.candleHigh).toNumber()} value={Number(candleHigh)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.candleHigh.toString(), candleHigh.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -437,11 +453,11 @@ export const columnsPositionMarkets = (
onlyOnDetailed: true, onlyOnDetailed: true,
}, },
{ {
value: market.candleLow ? ( value: candleLow ? (
<PriceCell <PriceCell
value={new BigNumber(market.candleLow).toNumber()} value={Number(candleLow)}
valueFormatted={addDecimalsFormatNumber( valueFormatted={addDecimalsFormatNumber(
market.candleLow.toString(), candleLow.toString(),
market.decimalPlaces, market.decimalPlaces,
2 2
)} )}
@ -458,12 +474,12 @@ export const columnsPositionMarkets = (
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
market.data?.trigger && market.data?.trigger &&
market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
? `${formatLabel( ? `${MarketTradingModeMapping[market.tradingMode]}
market.tradingMode - ${AuctionTriggerMapping[market.data.trigger]}`
)} - ${market.data?.trigger.toLowerCase()}` : MarketTradingModeMapping[market.tradingMode],
: formatLabel(market.tradingMode),
className: thClassNames('left'), className: thClassNames('left'),
onlyOnDetailed: true, onlyOnDetailed: true,
dataTestId: 'trading-mode',
}, },
{ {
value: ( value: (
@ -471,7 +487,7 @@ export const columnsPositionMarkets = (
description={<FeesBreakdown feeFactors={market.fees?.factors} />} description={<FeesBreakdown feeFactors={market.fees?.factors} />}
> >
<span className="border-b-2 border-dotted"> <span className="border-b-2 border-dotted">
{market.totalFees ?? '-'} {totalFees(market.fees.factors) ?? '-'}
</span> </span>
</Tooltip> </Tooltip>
), ),

View File

@ -1,4 +1,5 @@
import { fireEvent, render, screen } from '@testing-library/react'; import { fireEvent, render, screen } from '@testing-library/react';
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { MarketList_markets } from '../__generated__/MarketList'; import type { MarketList_markets } from '../__generated__/MarketList';
@ -49,15 +50,24 @@ const mockData = {
decimalPlaces: 2, decimalPlaces: 2,
name: '', name: '',
positionDecimalPlaces: 4, positionDecimalPlaces: 4,
state: 'Active', state: MarketState.STATE_ACTIVE,
tradingMode: 'Continuous', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
data: {}, data: {
markPrice: '14175',
},
tradableInstrument: { tradableInstrument: {
__typename: 'TradableInstrument', __typename: 'TradableInstrument',
instrument: { instrument: {
__typename: 'Instrument', __typename: 'Instrument',
name: 'APEUSD (May 2022)', name: 'APEUSD (May 2022)',
code: 'APEUSD', code: 'APEUSD',
product: {
__typename: 'Future',
settlementAsset: {
__typename: 'Asset',
symbol: 'USD',
},
},
}, },
}, },
marketTimestamps: { marketTimestamps: {
@ -117,6 +127,13 @@ const mockData = {
__typename: 'Instrument', __typename: 'Instrument',
name: 'Apple Monthly (30 Jun 2022)', name: 'Apple Monthly (30 Jun 2022)',
code: 'AAPL.MF21', code: 'AAPL.MF21',
product: {
__typename: 'Future',
settlementAsset: {
__typename: 'Asset',
symbol: 'USD',
},
},
}, },
}, },
fees: { fees: {
@ -167,9 +184,11 @@ const mockData = {
], ],
name: '', name: '',
positionDecimalPlaces: 4, positionDecimalPlaces: 4,
state: 'Active', state: MarketState.STATE_ACTIVE,
tradingMode: 'Continuous', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
data: {}, data: {
markPrice: '14175',
},
} as MarketList_markets, } as MarketList_markets,
], ],
}, },

View File

@ -53,14 +53,8 @@ const mockList = [
open: '2022-05-18T13:00:39.328347732Z', open: '2022-05-18T13:00:39.328347732Z',
close: null, close: null,
}, },
marketName: 'AAPL.MF21',
settlementAsset: 'AAPL.MF21',
lastPrice: '16322118',
candleHigh: '16365861',
candleLow: '16023805',
open: 1652878839328, open: 1652878839328,
close: null, close: null,
totalFees: '0.14%',
}, },
{ {
__typename: 'Market', __typename: 'Market',
@ -106,14 +100,8 @@ const mockList = [
__typename: 'Candle', __typename: 'Candle',
}, },
], ],
marketName: 'APEUSD',
settlementAsset: 'APEUSD',
lastPrice: '16322118',
candleHigh: '16365861',
candleLow: '16023805',
open: 1652879307693, open: 1652879307693,
close: null, close: null,
totalFees: '0.14%',
}, },
]; ];

View File

@ -8,11 +8,6 @@ import type {
MarketList_markets_fees_factors, MarketList_markets_fees_factors,
} from '../__generated__/MarketList'; } 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) => { export const totalFees = (fees: MarketList_markets_fees_factors) => {
if (!fees) { if (!fees) {
return undefined; return undefined;
@ -36,20 +31,12 @@ export const mapDataToMarketList = ({ markets }: MarketList) =>
.map((m) => { .map((m) => {
return { return {
...m, ...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 open: m.marketTimestamps.open
? new Date(m.marketTimestamps.open).getTime() ? new Date(m.marketTimestamps.open).getTime()
: null, : null,
close: m.marketTimestamps.close close: m.marketTimestamps.close
? new Date(m.marketTimestamps.close).getTime() ? new Date(m.marketTimestamps.close).getTime()
: null, : null,
totalFees: totalFees(m.fees?.factors),
}; };
}) || [], }) || [],
['open', 'id'], ['open', 'id'],

View File

@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
import { import {
OrderRejectionReason, OrderRejectionReason,
OrderStatus, OrderStatus,
OrderStatusMapping,
OrderType, OrderType,
Side, Side,
} from '@vegaprotocol/types'; } from '@vegaprotocol/types';
@ -76,7 +77,7 @@ describe('OrderFeedback', () => {
order.market!.name order.market!.name
); );
expect(screen.getByText('Status').nextElementSibling).toHaveTextContent( expect(screen.getByText('Status').nextElementSibling).toHaveTextContent(
order.status OrderStatusMapping[order.status]
); );
expect(screen.getByText('Price').nextElementSibling).toHaveTextContent( expect(screen.getByText('Price').nextElementSibling).toHaveTextContent(
'1.00' '1.00'

View File

@ -1,7 +1,12 @@
import { useEnvironment } from '@vegaprotocol/environment'; import { useEnvironment } from '@vegaprotocol/environment';
import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__'; import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__';
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; 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 type { VegaTxState } from '@vegaprotocol/wallet';
import startCase from 'lodash/startCase'; import startCase from 'lodash/startCase';
@ -28,7 +33,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => {
)} )}
<div> <div>
<p className={labelClass}>{t(`Status`)}</p> <p className={labelClass}>{t(`Status`)}</p>
<p>{t(`${order.status}`)}</p> <p>{t(`${OrderStatusMapping[order.status]}`)}</p>
</div> </div>
{order.type === OrderType.TYPE_LIMIT && order.market && ( {order.type === OrderType.TYPE_LIMIT && order.market && (
<div> <div>

View File

@ -1,6 +1,16 @@
import { act, render, screen } from '@testing-library/react'; import { act, render, screen } from '@testing-library/react';
import { addDecimal, getDateTimeFormat } from '@vegaprotocol/react-helpers'; 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 { PartialDeep } from 'type-fest';
import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
import { VegaWalletContext } from '@vegaprotocol/wallet'; import { VegaWalletContext } from '@vegaprotocol/wallet';
@ -9,7 +19,6 @@ import { MockedProvider } from '@apollo/client/testing';
import { OrderListTable } from '../'; import { OrderListTable } from '../';
import type { Orders_party_ordersConnection_edges_node } from '../'; import type { Orders_party_ordersConnection_edges_node } from '../';
import { limitOrder, marketOrder } from '../mocks/generate-orders'; import { limitOrder, marketOrder } from '../mocks/generate-orders';
import startCase from 'lodash/startCase';
const generateJsx = ( const generateJsx = (
orders: Orders_party_ordersConnection_edges_node[] | null, orders: Orders_party_ordersConnection_edges_node[] | null,
@ -67,11 +76,11 @@ describe('OrderListTable', () => {
const expectedValues: string[] = [ const expectedValues: string[] = [
marketOrder.market?.tradableInstrument.instrument.code || '', marketOrder.market?.tradableInstrument.instrument.code || '',
'+0.10', '+0.10',
marketOrder.type || '', OrderTypeMapping[marketOrder.type as OrderType] || '',
marketOrder.status, OrderStatusMapping[marketOrder.status],
'5', '5',
'-', '-',
marketOrder.timeInForce, OrderTimeInForceMapping[marketOrder.timeInForce],
getDateTimeFormat().format(new Date(marketOrder.createdAt)), getDateTimeFormat().format(new Date(marketOrder.createdAt)),
'-', '-',
'Edit', 'Edit',
@ -91,13 +100,13 @@ describe('OrderListTable', () => {
const expectedValues: string[] = [ const expectedValues: string[] = [
limitOrder.market?.tradableInstrument.instrument.code || '', limitOrder.market?.tradableInstrument.instrument.code || '',
'+0.10', '+0.10',
limitOrder.type || '', OrderTypeMapping[limitOrder.type || OrderType.TYPE_LIMIT],
limitOrder.status, OrderStatusMapping[limitOrder.status],
'5', '5',
addDecimal(limitOrder.price, limitOrder.market?.decimalPlaces ?? 0), 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)), getDateTimeFormat().format(new Date(limitOrder.createdAt)),
'-', '-',
'Edit', 'Edit',
@ -120,7 +129,9 @@ describe('OrderListTable', () => {
}); });
const cells = screen.getAllByRole('gridcell'); const cells = screen.getAllByRole('gridcell');
expect(cells[3]).toHaveTextContent( expect(cells[3]).toHaveTextContent(
`${rejectedOrder.status}: ${startCase(rejectedOrder.rejectionReason)}` `${OrderStatusMapping[rejectedOrder.status]}: ${
OrderRejectionReasonMapping[rejectedOrder.rejectionReason]
}`
); );
}); });
}); });

View File

@ -3,6 +3,10 @@ import {
OrderStatus, OrderStatus,
Side, Side,
OrderType, OrderType,
OrderTypeMapping,
OrderStatusMapping,
OrderTimeInForceMapping,
OrderRejectionReasonMapping,
} from '@vegaprotocol/types'; } from '@vegaprotocol/types';
import { addDecimal, getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; import { addDecimal, getDateTimeFormat, t } from '@vegaprotocol/react-helpers';
import { import {
@ -29,7 +33,6 @@ import { useOrderEdit } from '../../order-hooks/use-order-edit';
import { OrderEditDialog } from './order-edit-dialog'; import { OrderEditDialog } from './order-edit-dialog';
import type { OrderFields } from '../order-data-provider/__generated__'; import type { OrderFields } from '../order-data-provider/__generated__';
import { OrderFeedback } from '../order-feedback'; import { OrderFeedback } from '../order-feedback';
import startCase from 'lodash/startCase';
type OrderListProps = AgGridReactProps | AgReactUiProps; 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 <AgGridColumn
field="status" field="status"
valueFormatter={({ valueFormatter={({
@ -164,11 +174,12 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
return undefined; return undefined;
} }
if (value === OrderStatus.STATUS_REJECTED) { if (value === OrderStatus.STATUS_REJECTED) {
return `${value}: ${ return `${OrderStatusMapping[value]}: ${
data.rejectionReason && startCase(data.rejectionReason) data.rejectionReason &&
OrderRejectionReasonMapping[data.rejectionReason]
}`; }`;
} }
return value; return OrderStatusMapping[value];
}} }}
/> />
<AgGridColumn <AgGridColumn
@ -232,10 +243,10 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
const expiry = getDateTimeFormat().format( const expiry = getDateTimeFormat().format(
new Date(data.expiresAt) new Date(data.expiresAt)
); );
return `${value}: ${expiry}`; return `${OrderTimeInForceMapping[value]}: ${expiry}`;
} }
return value; return OrderTimeInForceMapping[value];
}} }}
/> />
<AgGridColumn <AgGridColumn

View File

@ -7,6 +7,7 @@ import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet';
import { import {
MarketState, MarketState,
MarketTradingMode, MarketTradingMode,
OrderStatus,
OrderTimeInForce, OrderTimeInForce,
OrderType, OrderType,
Side, Side,
@ -76,15 +77,15 @@ function setup(
{ {
type: 'Order', type: 'Order',
event: { event: {
type: 'Limit', type: OrderType.TYPE_LIMIT,
id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62', id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62',
status: 'Active', status: OrderStatus.STATUS_ACTIVE,
rejectionReason: null, rejectionReason: null,
createdAt: '2022-07-05T14:25:47.815283706Z', createdAt: '2022-07-05T14:25:47.815283706Z',
size: '10', size: '10',
price: '300000', price: '300000',
timeInForce: 'GTC', timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
side: 'Buy', side: Side.SIDE_BUY,
market: { market: {
name: 'UNIDAI Monthly (30 Jun 2022)', name: 'UNIDAI Monthly (30 Jun 2022)',
decimalPlaces: 5, decimalPlaces: 5,
@ -111,15 +112,15 @@ function setup(
{ {
type: 'Order', type: 'Order',
event: { event: {
type: 'Limit', type: OrderType.TYPE_LIMIT,
id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62', id: '9c70716f6c3698ac7bbcddc97176025b985a6bb9a0c4507ec09c9960b3216b62',
status: 'Active', status: OrderStatus.STATUS_ACTIVE,
rejectionReason: null, rejectionReason: null,
createdAt: '2022-07-05T14:25:47.815283706Z', createdAt: '2022-07-05T14:25:47.815283706Z',
size: '10', size: '10',
price: '300000', price: '300000',
timeInForce: 'GTC', timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
side: 'Buy', side: Side.SIDE_BUY,
market: { market: {
name: 'UNIDAI Monthly (30 Jun 2022)', name: 'UNIDAI Monthly (30 Jun 2022)',
decimalPlaces: 5, decimalPlaces: 5,

View File

@ -70,7 +70,7 @@ export const useOrderSubmit = (market: Market) => {
side: order.side, side: order.side,
timeInForce: order.timeInForce, timeInForce: order.timeInForce,
expiresAt: order.expiration expiresAt: order.expiration
? toNanoSeconds(order.expiration) // Wallet expects timestampe in nanoseconds ? toNanoSeconds(order.expiration) // Wallet expects timestamp in nanoseconds
: undefined, : undefined,
}, },
}); });

View File

@ -6,6 +6,7 @@ import type {
} from '@vegaprotocol/wallet'; } from '@vegaprotocol/wallet';
import { import {
MarketState, MarketState,
MarketStateMapping,
MarketTradingMode, MarketTradingMode,
OrderTimeInForce, OrderTimeInForce,
OrderType, OrderType,
@ -145,7 +146,9 @@ describe('useOrderValidation', () => {
}); });
expect(result.current).toStrictEqual({ expect(result.current).toStrictEqual({
isDisabled: false, 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`,
}); });
} }
); );

View File

@ -4,6 +4,7 @@ import { t, toDecimal } from '@vegaprotocol/react-helpers';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { import {
MarketState, MarketState,
MarketStateMapping,
MarketTradingMode, MarketTradingMode,
OrderTimeInForce, OrderTimeInForce,
OrderType, OrderType,
@ -28,7 +29,7 @@ export const marketTranslations = (marketState: MarketState) => {
case MarketState.STATE_TRADING_TERMINATED: case MarketState.STATE_TRADING_TERMINATED:
return t('terminated'); return t('terminated');
default: default:
return t(marketState).toLowerCase(); return t(MarketStateMapping[marketState]).toLowerCase();
} }
}; };

View File

@ -276,12 +276,12 @@ export const PositionsTable = forwardRef<AgGridReact, Props>((props, ref) => {
value, value,
}: { }: {
value: string; value: string;
}) => BigInt(value) > 0, }) => value && BigInt(value) > 0,
'text-vega-red-dark dark:text-vega-red': ({ 'text-vega-red-dark dark:text-vega-red': ({
value, value,
}: { }: {
value: string; value: string;
}) => BigInt(value) < 0, }) => value && BigInt(value) < 0,
}} }}
valueFormatter={({ valueFormatter={({
value, value,
@ -305,12 +305,12 @@ export const PositionsTable = forwardRef<AgGridReact, Props>((props, ref) => {
value, value,
}: { }: {
value: string; value: string;
}) => BigInt(value) > 0, }) => value && BigInt(value) > 0,
'text-vega-red-dark dark:text-vega-red': ({ 'text-vega-red-dark dark:text-vega-red': ({
value, value,
}: { }: {
value: string; value: string;
}) => BigInt(value) < 0, }) => value && BigInt(value) < 0,
}} }}
valueFormatter={({ valueFormatter={({
value, value,

View File

@ -1,28 +1,28 @@
export enum AccountTypeMapping { export enum AccountTypeMapping {
ACCOUNT_TYPE_BOND = 'BOND', ACCOUNT_TYPE_BOND = 'Bond',
ACCOUNT_TYPE_EXTERNAL = 'EXTERNAL', ACCOUNT_TYPE_EXTERNAL = 'External',
ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'FEES_INFRASTRUCTURE', ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'Fees Infrastructure',
ACCOUNT_TYPE_FEES_LIQUIDITY = 'FEES_LIQUIDITY', ACCOUNT_TYPE_FEES_LIQUIDITY = 'Fees Liquidity',
ACCOUNT_TYPE_FEES_MAKER = 'FEES_MAKER', ACCOUNT_TYPE_FEES_MAKER = 'Fees Maker',
ACCOUNT_TYPE_GENERAL = 'GENERAL', ACCOUNT_TYPE_GENERAL = 'General',
ACCOUNT_TYPE_GLOBAL_INSURANCE = 'GLOBAL_INSURANCE', ACCOUNT_TYPE_GLOBAL_INSURANCE = 'Global Insurance',
ACCOUNT_TYPE_GLOBAL_REWARD = 'GLOBAL_REWARD', ACCOUNT_TYPE_GLOBAL_REWARD = 'Global Reward',
ACCOUNT_TYPE_INSURANCE = 'INSURANCE', ACCOUNT_TYPE_INSURANCE = 'Insurance',
ACCOUNT_TYPE_MARGIN = 'MARGIN', ACCOUNT_TYPE_MARGIN = 'Margin',
ACCOUNT_TYPE_PENDING_TRANSFERS = 'PENDING_TRANSFERS', ACCOUNT_TYPE_PENDING_TRANSFERS = 'Pending transfers',
ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'REWARD_LP_RECEIVED_FEES', ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'Reward LP received fees',
ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'REWARD_MAKER_RECEIVED_FEES', ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'Reward Maker received fees',
ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'REWARD_MARKET_PROPOSERS', ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'Reward Market Proposers',
ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'REWARD_TAKER_PAID_FEES', ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'Reward Taker paid fees',
ACCOUNT_TYPE_SETTLEMENT = 'SETTLEMENT', ACCOUNT_TYPE_SETTLEMENT = 'Settlement',
} }
export enum AuctionTriggerMapping { export enum AuctionTriggerMapping {
AUCTION_TRIGGER_BATCH = 'BATCH', AUCTION_TRIGGER_BATCH = 'batch',
AUCTION_TRIGGER_LIQUIDITY = 'LIQUIDITY', AUCTION_TRIGGER_LIQUIDITY = 'liquidity',
AUCTION_TRIGGER_OPENING = 'OPENING', AUCTION_TRIGGER_OPENING = 'opening',
AUCTION_TRIGGER_PRICE = 'PRICE', AUCTION_TRIGGER_PRICE = 'price',
AUCTION_TRIGGER_UNSPECIFIED = 'UNSPECIFIED', AUCTION_TRIGGER_UNSPECIFIED = 'unspecified',
} }
/** /**
@ -40,9 +40,9 @@ export enum ConditionOperatorMapping {
* The status of a deposit * The status of a deposit
*/ */
export enum DepositStatusMapping { export enum DepositStatusMapping {
STATUS_CANCELLED = 'CANCELLED', STATUS_CANCELLED = 'Cancelled',
STATUS_FINALIZED = 'FINALIZED', STATUS_FINALIZED = 'Finalized',
STATUS_OPEN = 'OPEN', STATUS_OPEN = 'Open',
} }
/** /**
@ -61,15 +61,15 @@ export enum IntervalMapping {
* The current state of a market * The current state of a market
*/ */
export enum MarketStateMapping { export enum MarketStateMapping {
STATE_ACTIVE = 'ACTIVE', STATE_ACTIVE = 'Active',
STATE_CANCELLED = 'CANCELLED', STATE_CANCELLED = 'Cancelled',
STATE_CLOSED = 'CLOSED', STATE_CLOSED = 'Closed',
STATE_PENDING = 'PENDING', STATE_PENDING = 'Pending',
STATE_PROPOSED = 'PROPOSED', STATE_PROPOSED = 'Proposed',
STATE_REJECTED = 'REJECTED', STATE_REJECTED = 'Rejected',
STATE_SETTLED = 'SETTLED', STATE_SETTLED = 'Settled',
STATE_SUSPENDED = 'SUSPENDED', STATE_SUSPENDED = 'Suspended',
STATE_TRADING_TERMINATED = 'TRADING_TERMINATED', STATE_TRADING_TERMINATED = 'Trading Terminated',
} }
/** /**
@ -77,7 +77,7 @@ export enum MarketStateMapping {
*/ */
export enum MarketTradingModeMapping { export enum MarketTradingModeMapping {
TRADING_MODE_BATCH_AUCTION = 'Batch auction', TRADING_MODE_BATCH_AUCTION = 'Batch auction',
TRADING_MODE_CONTINUOUS = 'Continuous trading', TRADING_MODE_CONTINUOUS = 'Continuous',
TRADING_MODE_MONITORING_AUCTION = 'Monitoring auction', TRADING_MODE_MONITORING_AUCTION = 'Monitoring auction',
TRADING_MODE_NO_TRADING = 'No trading', TRADING_MODE_NO_TRADING = 'No trading',
TRADING_MODE_OPENING_AUCTION = 'Opening auction', TRADING_MODE_OPENING_AUCTION = 'Opening auction',
@ -100,50 +100,50 @@ export enum OracleSpecStatusMapping {
* Reason for the order being rejected by the core node * Reason for the order being rejected by the core node
*/ */
export enum OrderRejectionReasonMapping { export enum OrderRejectionReasonMapping {
ORDER_ERROR_AMEND_FAILURE = 'AMEND_FAILURE', ORDER_ERROR_AMEND_FAILURE = 'Amend failure',
ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'BUY_CANNOT_REFERENCE_BEST_ASK_PRICE', 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_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_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_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_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_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'Cannot amend to GTT without expiry time specified',
ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'CANNOT_HAVE_GTC_AND_EXPIRYAT', 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_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_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'Cannot send IOC order during auction',
ORDER_ERROR_EDIT_NOT_ALLOWED = 'EDIT_NOT_ALLOWED', ORDER_ERROR_EDIT_NOT_ALLOWED = 'Edit not allowed',
ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'EXPIRYAT_BEFORE_CREATEDAT', ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'Expiry time before creation time',
ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'GFA_ORDER_DURING_CONTINUOUS_TRADING', 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_GFN_ORDER_DURING_AN_AUCTION = 'GFN order during an auction',
ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'INSUFFICIENT_ASSET_BALANCE', ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'Insufficient asset balance',
ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'INSUFFICIENT_FUNDS_TO_PAY_FEES', ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'Insufficient funds to pay fees',
ORDER_ERROR_INTERNAL_ERROR = 'INTERNAL_ERROR', ORDER_ERROR_INTERNAL_ERROR = 'Internal error',
ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'INVALID_EXPIRATION_DATETIME', ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'Invalid expiration date time',
ORDER_ERROR_INVALID_MARKET_ID = 'INVALID_MARKET_ID', ORDER_ERROR_INVALID_MARKET_ID = 'Invalid market ID',
ORDER_ERROR_INVALID_ORDER_ID = 'INVALID_ORDER_ID', ORDER_ERROR_INVALID_ORDER_ID = 'Invalid order ID',
ORDER_ERROR_INVALID_ORDER_REFERENCE = 'INVALID_ORDER_REFERENCE', ORDER_ERROR_INVALID_ORDER_REFERENCE = 'Invalid order reference',
ORDER_ERROR_INVALID_PARTY_ID = 'INVALID_PARTY_ID', ORDER_ERROR_INVALID_PARTY_ID = 'Invalid party ID',
ORDER_ERROR_INVALID_PERSISTENCE = 'INVALID_PERSISTENCE', ORDER_ERROR_INVALID_PERSISTENCE = 'Invalid persistence',
ORDER_ERROR_INVALID_REMAINING_SIZE = 'INVALID_REMAINING_SIZE', ORDER_ERROR_INVALID_REMAINING_SIZE = 'Invalid remaining size',
ORDER_ERROR_INVALID_SIZE = 'INVALID_SIZE', ORDER_ERROR_INVALID_SIZE = 'Invalid size',
ORDER_ERROR_INVALID_TIME_IN_FORCE = 'INVALID_TIME_IN_FORCE', ORDER_ERROR_INVALID_TIME_IN_FORCE = 'Invalid time in force',
ORDER_ERROR_INVALID_TYPE = 'INVALID_TYPE', ORDER_ERROR_INVALID_TYPE = 'Invalid type',
ORDER_ERROR_MARGIN_CHECK_FAILED = 'MARGIN_CHECK_FAILED', ORDER_ERROR_MARGIN_CHECK_FAILED = 'Margin check failed',
ORDER_ERROR_MARKET_CLOSED = 'MARKET_CLOSED', ORDER_ERROR_MARKET_CLOSED = 'Market closed',
ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'MISSING_GENERAL_ACCOUNT', ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'Missing general account',
ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'MUST_BE_GTT_OR_GTC', ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'Must be GTT or GTC',
ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'MUST_BE_LIMIT_ORDER', 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_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'Non persistent order out of price bounds',
ORDER_ERROR_NOT_FOUND = 'NOT_FOUND', 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_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_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'Offset must be greater than zero',
ORDER_ERROR_OUT_OF_SEQUENCE = 'OUT_OF_SEQUENCE', ORDER_ERROR_OUT_OF_SEQUENCE = 'Out of sequence',
ORDER_ERROR_REMOVAL_FAILURE = 'REMOVAL_FAILURE', ORDER_ERROR_REMOVAL_FAILURE = 'Removal failure',
ORDER_ERROR_SELF_TRADING = 'SELF_TRADING', ORDER_ERROR_SELF_TRADING = ' Self trading',
ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'SELL_CANNOT_REFERENCE_BEST_BID_PRICE', ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'Sell cannot reference best bid price',
ORDER_ERROR_TIME_FAILURE = 'TIME_FAILURE', 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_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_UNABLE_TO_REPRICE_PEGGED_ORDER = 'Unable to reprice pegged order',
ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'WITHOUT_REFERENCE_PRICE', 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_FOK = 'Fill or Kill (FOK)',
TIME_IN_FORCE_GFA = 'Good for Auction (GFA)', TIME_IN_FORCE_GFA = 'Good for Auction (GFA)',
TIME_IN_FORCE_GFN = 'Good for Normal (GFN)', TIME_IN_FORCE_GFN = 'Good for Normal (GFN)',
TIME_IN_FORCE_GTC = `Good 'till Cancel (GTC)`, TIME_IN_FORCE_GTC = `Good 'til Cancelled (GTC)`,
TIME_IN_FORCE_GTT = `Good 'till Time (GTT)`, TIME_IN_FORCE_GTT = `Good 'til Time (GTT)`,
TIME_IN_FORCE_IOC = 'Immediate or Cancel (IOC)', 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 * Reason for the proposal being rejected by the core node
*/ */
export enum ProposalRejectionReasonMapping { export enum ProposalRejectionReasonMapping {
PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'CLOSE_TIME_TOO_LATE', PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'Close time too late',
PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'CLOSE_TIME_TOO_SOON', PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'Close time too soon',
PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'COULD_NOT_INSTANTIATE_MARKET', 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_LATE = 'Enact time too late',
PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'ENACT_TIME_TOO_SOON', PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'Enact time too soon',
PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'INCOMPATIBLE_TIMESTAMPS', PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'Incompatible timestamps',
PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'INSUFFICIENT_EQUITY_LIKE_SHARE', PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'Insufficient equity like share',
PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'INSUFFICIENT_TOKENS', PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'Insufficient tokens',
PROPOSAL_ERROR_INVALID_ASSET = 'INVALID_ASSET', PROPOSAL_ERROR_INVALID_ASSET = 'Invalid asset',
PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'INVALID_ASSET_DETAILS', PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'Invalid asset details',
PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'INVALID_FEE_AMOUNT', PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'Invalid fee amount',
PROPOSAL_ERROR_INVALID_FREEFORM = 'INVALID_FREEFORM', PROPOSAL_ERROR_INVALID_FREEFORM = 'Invalid freeform',
PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'INVALID_FUTURE_PRODUCT', PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'Invalid future product',
PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'INVALID_INSTRUMENT_SECURITY', PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'Invalid instrument security',
PROPOSAL_ERROR_INVALID_MARKET = 'INVALID_MARKET', PROPOSAL_ERROR_INVALID_MARKET = 'Invalid market',
PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'INVALID_RISK_PARAMETER', PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'Invalid risk parameter',
PROPOSAL_ERROR_INVALID_SHAPE = 'INVALID_SHAPE', PROPOSAL_ERROR_INVALID_SHAPE = 'Invalid shape',
PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'MAJORITY_THRESHOLD_NOT_REACHED', PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'Majority threshold not reached',
PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'MARKET_MISSING_LIQUIDITY_COMMITMENT', PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'Market missing liquidity commitment',
PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'MISSING_BUILTIN_ASSET_FIELD', PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'Missing builtin asset field',
PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'MISSING_COMMITMENT_AMOUNT', PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'Missing commitment amount',
PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'MISSING_ERC20_CONTRACT_ADDRESS', 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_KEY = 'Network parameter invalid key',
PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'NETWORK_PARAMETER_INVALID_VALUE', PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'Network parameter invalid value',
PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'NETWORK_PARAMETER_VALIDATION_FAILED', PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'Network parameter validation failed',
PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'NODE_VALIDATION_FAILED', PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'Node validation failed',
PROPOSAL_ERROR_NO_PRODUCT = 'NO_PRODUCT', PROPOSAL_ERROR_NO_PRODUCT = 'No product',
PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'NO_RISK_PARAMETERS', PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'No risk parameters',
PROPOSAL_ERROR_NO_TRADING_MODE = 'NO_TRADING_MODE', 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_LARGE = 'Opening auction duration too large',
PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'OPENING_AUCTION_DURATION_TOO_SMALL', PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'Opening auction duration too small',
PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'PARTICIPATION_THRESHOLD_NOT_REACHED', 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_MARKET_DECIMAL_PLACES = 'Too many market decimal places',
PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'TOO_MANY_PRICE_MONITORING_TRIGGERS', 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_RISK_PARAMETER_TYPE = 'Unknown risk parameter type',
PROPOSAL_ERROR_UNKNOWN_TYPE = 'UNKNOWN_TYPE', PROPOSAL_ERROR_UNKNOWN_TYPE = 'Unknown type',
PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'UNSUPPORTED_PRODUCT', PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'Unsupported product',
PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'UNSUPPORTED_TRADING_MODE', PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'Unsupported trading mode',
} }
/** /**
@ -257,9 +257,9 @@ export enum StakeLinkingStatusMapping {
} }
export enum ValidatorStatusMapping { export enum ValidatorStatusMapping {
VALIDATOR_NODE_STATUS_ERSATZ = 'ERSATZ', VALIDATOR_NODE_STATUS_ERSATZ = 'Ersatz',
VALIDATOR_NODE_STATUS_PENDING = 'PENDING', VALIDATOR_NODE_STATUS_PENDING = 'Pending',
VALIDATOR_NODE_STATUS_TENDERMINT = 'TENDERMINT', VALIDATOR_NODE_STATUS_TENDERMINT = 'Tendermint',
} }
export enum VoteValueMapping { export enum VoteValueMapping {