diff --git a/.gitignore b/.gitignore
index b6b970499..3fc3c1b9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@ cypress.env.json
/apps/**/cypress/reports/
/apps/**/cypress/downloads/
/apps/**/fixtures/wallet/node**
+<<<<<<< HEAD
# apps/trading/e2e
__pycache__/
@@ -59,5 +60,4 @@ apps/trading/e2e/logs/
apps/trading/e2e/.pytest_cache/
apps/trading/e2e/traces/
-.nx/cache
-
+.nx/
diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
index 9ef3f86eb..c6adb8531 100644
--- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
+++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx
@@ -1,5 +1,5 @@
import { useCallback, useState } from 'react';
-import { getAsset, getProductType, getQuoteName } from '@vegaprotocol/markets';
+import { getAsset, getQuoteName } from '@vegaprotocol/markets';
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
import { useVegaWallet } from '@vegaprotocol/wallet';
@@ -297,134 +297,120 @@ export const DealTicketMarginDetails = ({
);
const quoteName = getQuoteName(market);
- const productType = getProductType(market);
return (
- {/*
- TODO: remove this conditional check once the following PRs are deployed
- and the estimatePosition query is working for perps
-
- - https://github.com/vegaprotocol/vega/pull/10119
- - https://github.com/vegaprotocol/vega/pull/10122
- */}
- {productType === 'Future' && (
- <>
-
-
-
-
-
-
- {t('Margin required')}
-
-
-
-
-
-
-
- {formatValue(
- marginRequiredWorstCase,
- assetDecimals,
- quantum
- )}{' '}
- {assetSymbol || ''}
-
-
-
-
- }
+
+
-
-
+
+
+ {t('Margin required')}
+
+
+
+
+
+
+ {formatValue(
+ marginRequiredWorstCase,
+ assetDecimals,
+ quantum
+ )}{' '}
+ {assetSymbol || ''}
+
+
+
+
+ }
+ >
+
+
- {deductionFromCollateral}
- setBreakdownDialog(true)
- : undefined
- }
- value={formatValue(marginAccountBalance, assetDecimals)}
- symbol={assetSymbol}
- labelDescription={t(
- 'MARGIN_ACCOUNT_TOOLTIP_TEXT',
- MARGIN_ACCOUNT_TOOLTIP_TEXT
- )}
- formattedValue={formatValue(
+ ),
+ marginAccountBalance: formatValue(
marginAccountBalance,
assetDecimals,
quantum
- )}
- />
-
-
-
- {projectedMargin}
- >
- )}
+ ),
+ marginMaintenance: formatValue(
+ currentMargins?.maintenanceLevel,
+ assetDecimals,
+ quantum
+ ),
+ assetSymbol,
+ }
+ )}
+ />
+ {deductionFromCollateral}
+ setBreakdownDialog(true)
+ : undefined
+ }
+ value={formatValue(marginAccountBalance, assetDecimals)}
+ symbol={assetSymbol}
+ labelDescription={t(
+ 'MARGIN_ACCOUNT_TOOLTIP_TEXT',
+ MARGIN_ACCOUNT_TOOLTIP_TEXT
+ )}
+ formattedValue={formatValue(
+ marginAccountBalance,
+ assetDecimals,
+ quantum
+ )}
+ />
+
+
+
+ {projectedMargin}
({
...jest.requireActual('@vegaprotocol/wallet'),
useVegaWallet: jest.fn(() => ({ pubKey: 'partyId' })),
}));
+
jest.mock('@vegaprotocol/web3', () => ({
...jest.requireActual('@vegaprotocol/web3'),
useVegaTransactionStore: jest.fn(() => mockCreate),
}));
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mockUseDataProvider = (args: any) => {
if (args.dataProvider === positionsMarketsProvider) {
@@ -21,17 +24,20 @@ const mockUseDataProvider = (args: any) => {
}
return { data: [singleRow] };
};
+
jest.mock('@vegaprotocol/data-provider', () => ({
...jest.requireActual('@vegaprotocol/data-provider'),
useDataProvider: jest.fn((args) => mockUseDataProvider(args)),
}));
describe('PositionsManager', () => {
- it('should close position with max uint64', async () => {
+ // TODO: Close position temporarily disabled in https://github.com/vegaprotocol/frontend-monorepo/pull/5350
+ // eslint-disable-next-line jest/no-disabled-tests
+ it.skip('should close position with max uint64', async () => {
render(, {
wrapper: MockedProvider,
});
- expect(await screen.getByTestId('close-position')).toBeInTheDocument();
+ expect(await screen.findByTestId('close-position')).toBeInTheDocument();
fireEvent.click(screen.getByTestId('close-position'));
diff --git a/libs/positions/src/lib/positions-manager.tsx b/libs/positions/src/lib/positions-manager.tsx
index 05dc1685b..033776999 100644
--- a/libs/positions/src/lib/positions-manager.tsx
+++ b/libs/positions/src/lib/positions-manager.tsx
@@ -1,7 +1,4 @@
-import { useCallback } from 'react';
import { PositionsTable } from './positions-table';
-import * as Schema from '@vegaprotocol/types';
-import { useVegaTransactionStore } from '@vegaprotocol/web3';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { useDataProvider } from '@vegaprotocol/data-provider';
import {
@@ -9,9 +6,15 @@ import {
positionsMarketsProvider,
} from './positions-data-providers';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
-import { MAXGOINT64 } from '@vegaprotocol/utils';
import { useT } from '../use-t';
+// TODO: Close position temporarily disabled in https://github.com/vegaprotocol/frontend-monorepo/pull/5350
+//
+// import { useCallback } from 'react';
+// import * as Schema from '@vegaprotocol/types';
+// import { useVegaTransactionStore } from '@vegaprotocol/web3';
+// import { MAXGOINT64 } from '@vegaprotocol/utils';
+
interface PositionsManagerProps {
partyIds: string[];
onMarketClick?: (marketId: string) => void;
@@ -29,33 +32,37 @@ export const PositionsManager = ({
}: PositionsManagerProps) => {
const t = useT();
const { pubKeys, pubKey } = useVegaWallet();
- const create = useVegaTransactionStore((store) => store.create);
- const onClose = useCallback(
- ({ marketId, openVolume }: { marketId: string; openVolume: string }) =>
- create({
- batchMarketInstructions: {
- cancellations: [
- {
- marketId,
- orderId: '', // omit order id to cancel all active orders
- },
- ],
- submissions: [
- {
- marketId: marketId,
- type: Schema.OrderType.TYPE_MARKET as const,
- timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC as const,
- side: openVolume.startsWith('-')
- ? Schema.Side.SIDE_BUY
- : Schema.Side.SIDE_SELL,
- size: MAXGOINT64, // improvement for avoiding leftovers filled in the meantime when close request has been sent
- reduceOnly: true,
- },
- ],
- },
- }),
- [create]
- );
+
+ // TODO: Close position temporarily disabled in https://github.com/vegaprotocol/frontend-monorepo/pull/5350
+ //
+ // const create = useVegaTransactionStore((store) => store.create);
+ //
+ // const onClose = useCallback(
+ // ({ marketId, openVolume }: { marketId: string; openVolume: string }) =>
+ // create({
+ // batchMarketInstructions: {
+ // cancellations: [
+ // {
+ // marketId,
+ // orderId: '', // omit order id to cancel all active orders
+ // },
+ // ],
+ // submissions: [
+ // {
+ // marketId: marketId,
+ // type: Schema.OrderType.TYPE_MARKET as const,
+ // timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC as const,
+ // side: openVolume.startsWith('-')
+ // ? Schema.Side.SIDE_BUY
+ // : Schema.Side.SIDE_SELL,
+ // size: MAXGOINT64, // improvement for avoiding leftovers filled in the meantime when close request has been sent
+ // reduceOnly: true,
+ // },
+ // ],
+ // },
+ // }),
+ // [create]
+ // );
const { data: marketIds } = useDataProvider({
dataProvider: positionsMarketsProvider,
@@ -74,7 +81,8 @@ export const PositionsManager = ({
pubKeys={pubKeys}
rowData={data}
onMarketClick={onMarketClick}
- onClose={onClose}
+ // TODO: temporarily disable close position
+ // onClose={onClose}
isReadOnly={isReadOnly}
multipleKeys={partyIds.length > 1}
overlayNoRowsTemplate={error ? error.message : t('No positions')}