diff --git a/apps/explorer/src/app/components/markets/markets-table.tsx b/apps/explorer/src/app/components/markets/markets-table.tsx index babfa7c2c..f4eb2f305 100644 --- a/apps/explorer/src/app/components/markets/markets-table.tsx +++ b/apps/explorer/src/app/components/markets/markets-table.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { getAsset, type MarketFieldsFragment } from '@vegaprotocol/markets'; +import { getAsset, type MarketMaybeWithData } from '@vegaprotocol/markets'; import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import { type AgGridReact } from 'ag-grid-react'; @@ -17,7 +17,7 @@ import { type RowClickedEvent } from 'ag-grid-community'; import { Link, useNavigate } from 'react-router-dom'; type MarketsTableProps = { - data: MarketFieldsFragment[] | null; + data: MarketMaybeWithData[] | null; }; export const MarketsTable = ({ data }: MarketsTableProps) => { const openAssetDetailsDialog = useAssetDetailsDialogStore( @@ -56,10 +56,10 @@ export const MarketsTable = ({ data }: MarketsTableProps) => { headerName: t('Status'), field: 'state', hide: window.innerWidth <= BREAKPOINT_MD, - valueGetter: ({ - data, - }: VegaValueGetterParams) => { - return data?.state ? MarketStateMapping[data?.state] : '-'; + valueGetter: ({ data }: VegaValueGetterParams) => { + return data?.data?.marketState + ? MarketStateMapping[data?.data.marketState] + : '-'; }, }, { @@ -70,7 +70,7 @@ export const MarketsTable = ({ data }: MarketsTableProps) => { cellRenderer: ({ data, }: VegaICellRendererParams< - MarketFieldsFragment, + MarketMaybeWithData, 'tradableInstrument.instrument.product.settlementAsset.symbol' >) => { const value = data && getAsset(data); @@ -99,7 +99,7 @@ export const MarketsTable = ({ data }: MarketsTableProps) => { field: 'id', cellRenderer: ({ value, - }: VegaICellRendererParams) => + }: VegaICellRendererParams) => value ? ( {t('View details')} @@ -116,7 +116,7 @@ export const MarketsTable = ({ data }: MarketsTableProps) => { data.id} + getRowId={({ data }: { data: MarketMaybeWithData }) => data.id} overlayNoRowsTemplate={t('This chain has no markets')} domLayout="autoHeight" defaultColDef={{ diff --git a/apps/explorer/src/app/routes/markets/markets-page.tsx b/apps/explorer/src/app/routes/markets/markets-page.tsx index f1cb1fe9b..f7639a7df 100644 --- a/apps/explorer/src/app/routes/markets/markets-page.tsx +++ b/apps/explorer/src/app/routes/markets/markets-page.tsx @@ -1,6 +1,6 @@ import { useScrollToLocation } from '../../hooks/scroll-to-location'; import { useDocumentTitle } from '../../hooks/use-document-title'; -import { marketsProvider } from '@vegaprotocol/markets'; +import { marketsWithDataProvider } from '@vegaprotocol/markets'; import { RouteTitle } from '../../components/route-title'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { t } from '@vegaprotocol/i18n'; @@ -12,7 +12,7 @@ export const MarketsPage = () => { useScrollToLocation(); const { data, loading, error } = useDataProvider({ - dataProvider: marketsProvider, + dataProvider: marketsWithDataProvider, variables: undefined, skipUpdates: true, }); diff --git a/apps/trading/client-pages/market/market-header-stats.tsx b/apps/trading/client-pages/market/market-header-stats.tsx index b71137c66..41bc6845f 100644 --- a/apps/trading/client-pages/market/market-header-stats.tsx +++ b/apps/trading/client-pages/market/market-header-stats.tsx @@ -5,8 +5,8 @@ import type { Market } from '@vegaprotocol/markets'; import { addDecimalsFormatNumber, fromNanoSeconds, - getExpiryDate, getMarketExpiryDate, + useExpiryDate, } from '@vegaprotocol/utils'; import { Last24hPriceChange, @@ -20,6 +20,7 @@ import { useMarketTradingMode, useExternalTwap, getQuoteName, + useMarketState, } from '@vegaprotocol/markets'; import { MarketState as State } from '@vegaprotocol/types'; import { HeaderStat } from '../../components/header'; @@ -66,11 +67,8 @@ export const MarketHeaderStats = ({ market }: MarketHeaderStatsProps) => { quoteUnit={quoteUnit} /> - - + + {asset ? ( { }; const ExpiryLabel = ({ market }: ExpiryLabelProps) => { - const content = market.tradableInstrument.instrument.metadata.tags - ? getExpiryDate( - market.tradableInstrument.instrument.metadata.tags, - market.marketTimestamps.close, - market.state - ) - : '-'; + const { data: marketState } = useMarketState(market.id); + const content = + useExpiryDate( + market.tradableInstrument.instrument.metadata.tags, + market.marketTimestamps.close, + marketState + ) || '-'; return
{content}
; }; @@ -283,6 +281,7 @@ const ExpiryTooltipContent = ({ market, explorerUrl, }: ExpiryTooltipContentProps) => { + const { data: state } = useMarketState(market.id); const t = useT(); if (market.marketTimestamps.close === null) { const oracleId = @@ -298,8 +297,8 @@ const ExpiryTooltipContent = ({ const isExpired = metadataExpiryDate && Date.now() - metadataExpiryDate.valueOf() > 0 && - (market.state === State.STATE_TRADING_TERMINATED || - market.state === State.STATE_SETTLED); + (state === State.STATE_TRADING_TERMINATED || + state === State.STATE_SETTLED); return (
diff --git a/apps/trading/client-pages/markets/closed.spec.tsx b/apps/trading/client-pages/markets/closed.spec.tsx index beb8bd6ad..7545136cf 100644 --- a/apps/trading/client-pages/markets/closed.spec.tsx +++ b/apps/trading/client-pages/markets/closed.spec.tsx @@ -40,7 +40,6 @@ describe('Closed', () => { const market = createMarketFragment({ id: marketId, - state: MarketState.STATE_SETTLED, tradableInstrument: { instrument: { metadata: { @@ -96,6 +95,7 @@ describe('Closed', () => { const marketsData = createMarketsDataFragment({ __typename: 'MarketData', + marketState: MarketState.STATE_SETTLED, market: { __typename: 'Market', id: marketId, @@ -208,7 +208,7 @@ describe('Closed', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ market.tradableInstrument.instrument.code, - MarketStateMapping[market.state], + MarketStateMapping[marketsData.marketState], '3 days ago', /* eslint-disable @typescript-eslint/no-non-null-assertion */ addDecimalsFormatNumber(marketsData.bestBidPrice, market.decimalPlaces), @@ -227,87 +227,6 @@ describe('Closed', () => { }); }); - it('only renders settled and terminated markets', async () => { - const mixedMarkets = [ - { - // include as settled - __typename: 'MarketEdge' as const, - node: createMarketFragment({ - id: 'include-0', - state: MarketState.STATE_SETTLED, - }), - }, - { - // omit this market - __typename: 'MarketEdge' as const, - node: createMarketFragment({ - id: 'discard-0', - state: MarketState.STATE_SUSPENDED, - }), - }, - { - // include as terminated - __typename: 'MarketEdge' as const, - node: createMarketFragment({ - id: 'include-1', - state: MarketState.STATE_TRADING_TERMINATED, - }), - }, - { - // omit this market - __typename: 'MarketEdge' as const, - node: createMarketFragment({ - id: 'discard-1', - state: MarketState.STATE_ACTIVE, - }), - }, - ]; - const mixedMarketsMock: MockedResponse = { - request: { - query: MarketsDocument, - }, - result: { - data: { - marketsConnection: { - __typename: 'MarketConnection', - edges: mixedMarkets, - }, - }, - }, - }; - - await renderComponent([mixedMarketsMock, marketsDataMock, oracleDataMock]); - - // check that the number of rows in datagrid is 2 - const container = within( - document.querySelector('.ag-center-cols-container') as HTMLElement - ); - const expectedRows = mixedMarkets.filter((m) => { - return [ - MarketState.STATE_SETTLED, - MarketState.STATE_TRADING_TERMINATED, - ].includes(m.node.state); - }); - - await waitFor(() => { - // check rows length is correct - const rows = container.getAllByRole('row'); - expect(rows).toHaveLength(expectedRows.length); - }); - - // check that only included ids are shown - const cells = screen - .getAllByRole('gridcell') - .filter((cell) => cell.getAttribute('col-id') === 'code') - .map((cell) => { - const marketCode = within(cell).getByTestId('stack-cell-primary'); - return marketCode.textContent; - }); - expect(cells).toEqual( - expectedRows.map((m) => m.node.tradableInstrument.instrument.code) - ); - }); - it('display market actions', async () => { // Use market with a successor Id as the actions dropdown will optionally // show a link to the successor market @@ -315,8 +234,7 @@ describe('Closed', () => { { __typename: 'MarketEdge' as const, node: createMarketFragment({ - id: 'include-0', - state: MarketState.STATE_SETTLED, + id: marketId, successorMarketID: 'successor', parentMarketID: 'parent', }), @@ -375,8 +293,7 @@ describe('Closed', () => { { __typename: 'MarketEdge' as const, node: createMarketFragment({ - id: 'include-0', - state: MarketState.STATE_SETTLED, + id: marketId, successorMarketID: 'successor', }), }, diff --git a/apps/trading/client-pages/markets/closed.tsx b/apps/trading/client-pages/markets/closed.tsx index e55dec97b..3fc5faa8e 100644 --- a/apps/trading/client-pages/markets/closed.tsx +++ b/apps/trading/client-pages/markets/closed.tsx @@ -15,7 +15,7 @@ import { addDecimalsFormatNumber, getMarketExpiryDate, } from '@vegaprotocol/utils'; -import { closedMarketsWithDataProvider, getAsset } from '@vegaprotocol/markets'; +import { closedMarketsProvider, getAsset } from '@vegaprotocol/markets'; import type { DataSourceFilterFragment } from '@vegaprotocol/markets'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { useMarketClickHandler } from '../../lib/hooks/use-market-click-handler'; @@ -35,7 +35,7 @@ interface Row { code: string; name: string; decimalPlaces: number; - state: MarketState; + state?: MarketState; metadata: string[]; closeTimestamp: string | null; bestBidPrice: string | undefined; @@ -53,7 +53,7 @@ interface Row { export const Closed = () => { const { data: marketData, error } = useDataProvider({ - dataProvider: closedMarketsWithDataProvider, + dataProvider: closedMarketsProvider, variables: undefined, }); @@ -87,7 +87,7 @@ export const Closed = () => { code: instrument.code, name: instrument.name, decimalPlaces: market.decimalPlaces, - state: market.state, + state: market.data?.marketState, metadata: instrument.metadata.tags ?? [], closeTimestamp: market.marketTimestamps.close, bestBidPrice: market.data?.bestBidPrice, diff --git a/apps/trading/client-pages/markets/proposals-list/proposal-list.spec.tsx b/apps/trading/client-pages/markets/proposals-list/proposal-list.spec.tsx index 224d2ba94..0a560235f 100644 --- a/apps/trading/client-pages/markets/proposals-list/proposal-list.spec.tsx +++ b/apps/trading/client-pages/markets/proposals-list/proposal-list.spec.tsx @@ -3,11 +3,17 @@ import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import { ProposalsList } from './proposals-list'; import { MarketState } from '@vegaprotocol/types'; -import { createMarketFragment } from '@vegaprotocol/mock'; +import { + createMarketFragment, + createMarketsDataFragment, +} from '@vegaprotocol/mock'; import { type MarketsQuery, MarketsDocument, type MarketsQueryVariables, + type MarketsDataQuery, + type MarketsDataQueryVariables, + MarketsDataDocument, } from '@vegaprotocol/markets'; const parentMarketName = 'Parent Market Name'; @@ -15,12 +21,13 @@ const ParentMarketCell = () => {parentMarketName}; describe('ProposalsList', () => { const rowContainerSelector = '.ag-center-cols-container'; - const market = createMarketFragment({ - state: MarketState.STATE_PROPOSED, + const market = createMarketFragment(); + const marketData = createMarketsDataFragment({ + marketState: MarketState.STATE_PROPOSED, }); it('should be properly rendered', async () => { - const mock: MockedResponse = { + const marketMock: MockedResponse = { request: { query: MarketsDocument, }, @@ -37,8 +44,28 @@ describe('ProposalsList', () => { }, }; + const marketDataMock: MockedResponse< + MarketsDataQuery, + MarketsDataQueryVariables + > = { + request: { + query: MarketsDataDocument, + }, + result: { + data: { + marketsConnection: { + edges: [ + { + node: { data: marketData }, + }, + ], + }, + }, + }, + }; + render( - + ); @@ -69,7 +96,7 @@ describe('ProposalsList', () => { expect(await container.findAllByRole('row')).toHaveLength( // @ts-ignore data is mocked - mock?.result?.data.marketsConnection.edges.length + marketMock?.result?.data.marketsConnection.edges.length ); expect( @@ -81,7 +108,7 @@ describe('ProposalsList', () => { }); it('empty response should causes no data message display', async () => { - const mock: MockedResponse = { + const marketMock: MockedResponse = { request: { query: MarketsDocument, }, @@ -93,8 +120,23 @@ describe('ProposalsList', () => { }, }, }; + const marketDataMock: MockedResponse< + MarketsDataQuery, + MarketsDataQueryVariables + > = { + request: { + query: MarketsDataDocument, + }, + result: { + data: { + marketsConnection: { + edges: [], + }, + }, + }, + }; render( - + ); diff --git a/apps/trading/client-pages/markets/proposals-list/use-column-defs.tsx b/apps/trading/client-pages/markets/proposals-list/use-column-defs.tsx index d7b978b81..9be1dd6f9 100644 --- a/apps/trading/client-pages/markets/proposals-list/use-column-defs.tsx +++ b/apps/trading/client-pages/markets/proposals-list/use-column-defs.tsx @@ -19,7 +19,7 @@ import { } from '@vegaprotocol/types'; import { ProposalActionsDropdown } from './proposal-actions-dropdown'; import { - type MarketFieldsFragment, + type MarketMaybeWithData, getProductType, } from '@vegaprotocol/markets'; import { useT } from '../../../lib/use-t'; @@ -40,7 +40,7 @@ export const useColumnDefs = () => { data, }: { value: string; - data: MarketFieldsFragment; + data: MarketMaybeWithData; }) => { if (!value || !data) return '-'; @@ -70,10 +70,13 @@ export const useColumnDefs = () => { { colId: 'state', headerName: t('State'), - field: 'state', + field: 'data.marketState', valueFormatter: ({ value, - }: VegaValueFormatterParams) => { + }: VegaValueFormatterParams< + MarketMaybeWithData, + 'data.marketState' + >) => { return value ? MarketStateMapping[value] : '-'; }, filter: SetFilter, @@ -93,7 +96,7 @@ export const useColumnDefs = () => { valueFormatter: ({ value, }: VegaValueFormatterParams< - MarketFieldsFragment, + MarketMaybeWithData, 'marketTimestamps.pending' >) => { return value ? getDateTimeFormat().format(new Date(value)) : '-'; @@ -107,7 +110,7 @@ export const useColumnDefs = () => { valueFormatter: ({ value, }: VegaValueFormatterParams< - MarketFieldsFragment, + MarketMaybeWithData, 'marketTimestamps.open' >) => (value ? getDateTimeFormat().format(new Date(value)) : '-'), filter: DateRangeFilter, @@ -117,7 +120,7 @@ export const useColumnDefs = () => { ...COL_DEFS.actions, cellRenderer: ({ data, - }: VegaICellRendererParams) => { + }: VegaICellRendererParams) => { if (!data?.marketProposal?.id) return null; return ; diff --git a/apps/trading/client-pages/markets/settlement-date-cell.tsx b/apps/trading/client-pages/markets/settlement-date-cell.tsx index 7d9efa264..537f47d28 100644 --- a/apps/trading/client-pages/markets/settlement-date-cell.tsx +++ b/apps/trading/client-pages/markets/settlement-date-cell.tsx @@ -9,7 +9,7 @@ export interface SettlementDataCellProps { oracleSpecId: string; metaDate: Date | null; closeTimestamp: string | null; - marketState: MarketState; + marketState?: MarketState; } export const SettlementDateCell = ({ diff --git a/apps/trading/client-pages/markets/use-column-defs.tsx b/apps/trading/client-pages/markets/use-column-defs.tsx index 1449cfb0c..8884f8646 100644 --- a/apps/trading/client-pages/markets/use-column-defs.tsx +++ b/apps/trading/client-pages/markets/use-column-defs.tsx @@ -125,7 +125,9 @@ export const useMarketsColumnDefs = () => { valueFormatter: ({ data, }: VegaValueFormatterParams) => { - return data?.state ? Schema.MarketStateMapping[data.state] : '-'; + return data?.data?.marketState + ? Schema.MarketStateMapping[data?.data?.marketState] + : '-'; }, filter: SetFilter, filterParams: { diff --git a/apps/trading/components/market-selector/market-selector-item.tsx b/apps/trading/components/market-selector/market-selector-item.tsx index e02a7684e..c9107db9f 100644 --- a/apps/trading/components/market-selector/market-selector-item.tsx +++ b/apps/trading/components/market-selector/market-selector-item.tsx @@ -72,17 +72,17 @@ const MarketData = ({ const marketTradingMode = marketData ? marketData.marketTradingMode - : market.data - ? market.data.marketTradingMode - : market.tradingMode; + : market.data?.marketTradingMode; - const mode = [ - MarketTradingMode.TRADING_MODE_BATCH_AUCTION, - MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, - MarketTradingMode.TRADING_MODE_OPENING_AUCTION, - ].includes(marketTradingMode) - ? MarketTradingModeMapping[marketTradingMode] - : ''; + const mode = + marketTradingMode && + [ + MarketTradingMode.TRADING_MODE_BATCH_AUCTION, + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + MarketTradingMode.TRADING_MODE_OPENING_AUCTION, + ].includes(marketTradingMode) + ? MarketTradingModeMapping[marketTradingMode] + : ''; const { oneDayCandles } = useCandles({ marketId: market.id }); diff --git a/apps/trading/components/market-selector/market-selector.tsx b/apps/trading/components/market-selector/market-selector.tsx index 896f8904f..1611306f2 100644 --- a/apps/trading/components/market-selector/market-selector.tsx +++ b/apps/trading/components/market-selector/market-selector.tsx @@ -120,7 +120,7 @@ export const MarketSelector = ({
{ }), createMarketFragment({ id: 'market-1', - state: MarketState.STATE_ACTIVE, // @ts-ignore data not on fragment data: createMarketsDataFragment({ marketState: MarketState.STATE_ACTIVE, @@ -424,7 +423,6 @@ describe('useMarketSelectorList', () => { }), createMarketFragment({ id: 'market-2', - state: MarketState.STATE_ACTIVE, // @ts-ignore data not on fragment data: createMarketsDataFragment({ marketState: MarketState.STATE_ACTIVE, @@ -439,7 +437,6 @@ describe('useMarketSelectorList', () => { }), createMarketFragment({ id: 'market-3', - state: MarketState.STATE_ACTIVE, // @ts-ignore data not on fragment data: createMarketsDataFragment({ marketState: MarketState.STATE_ACTIVE, diff --git a/apps/trading/components/market-state/market-state.tsx b/apps/trading/components/market-state/market-state.tsx index 515c041be..69249429d 100644 --- a/apps/trading/components/market-state/market-state.tsx +++ b/apps/trading/components/market-state/market-state.tsx @@ -1,48 +1,18 @@ -import throttle from 'lodash/throttle'; -import type { MarketData, Market } from '@vegaprotocol/markets'; -import { marketDataProvider } from '@vegaprotocol/markets'; -import { useDataProvider } from '@vegaprotocol/data-provider'; +import { useMarketState } from '@vegaprotocol/markets'; import * as Schema from '@vegaprotocol/types'; import { HeaderStat } from '../header'; -import { useCallback, useRef, useState } from 'react'; -import * as constants from '../constants'; import { DocsLinks } from '@vegaprotocol/environment'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { useT } from '../../lib/use-t'; -export const MarketState = ({ market }: { market: Market | null }) => { +export const MarketState = ({ marketId }: { marketId?: string }) => { const t = useT(); - const [marketState, setMarketState] = useState( - null - ); - - const throttledSetMarketState = useRef( - throttle((state: Schema.MarketState) => { - setMarketState(state); - }, constants.THROTTLE_UPDATE_TIME) - ).current; - - const update = useCallback( - ({ data: marketData }: { data: MarketData | null }) => { - if (marketData) { - throttledSetMarketState(marketData.marketState); - } - return true; - }, - [throttledSetMarketState] - ); - - useDataProvider({ - dataProvider: marketDataProvider, - update, - variables: { marketId: market?.id || '' }, - skip: !market?.id, - }); + const { data: marketState } = useMarketState(marketId); return ( {marketState ? Schema.MarketStateMapping[marketState] : '-'} @@ -50,7 +20,7 @@ export const MarketState = ({ market }: { market: Market | null }) => { ); }; -const useGetMarketStateTooltip = (state: Schema.MarketState | null) => { +const useGetMarketStateTooltip = (state?: Schema.MarketState) => { const t = useT(); if (state === Schema.MarketState.STATE_ACTIVE) { return t('Enactment date reached and usual auction exit checks pass'); diff --git a/apps/trading/components/market-trading-mode/market-trading-mode.tsx b/apps/trading/components/market-trading-mode/market-trading-mode.tsx index 2bc2f73da..595121019 100644 --- a/apps/trading/components/market-trading-mode/market-trading-mode.tsx +++ b/apps/trading/components/market-trading-mode/market-trading-mode.tsx @@ -26,20 +26,15 @@ const getTradingModeLabel = ( interface HeaderStatMarketTradingModeProps { marketId?: string; onSelect?: (marketId: string, metaKey?: boolean) => void; - initialTradingMode?: Schema.MarketTradingMode; - initialTrigger?: Schema.AuctionTrigger; } export const HeaderStatMarketTradingMode = ({ marketId, onSelect, - initialTradingMode, - initialTrigger, }: HeaderStatMarketTradingModeProps) => { const t = useT(); const { data } = useStaticMarketData(marketId); - const marketTradingMode = data?.marketTradingMode ?? initialTradingMode; - const trigger = data?.trigger ?? initialTrigger; + const { marketTradingMode, trigger } = data || {}; return ( & { inViewRoot?: RefObject; @@ -72,10 +65,7 @@ export const MarketTradingMode = ({ } > - {getTradingModeLabel( - data?.marketTradingMode ?? initialTradingMode, - data?.trigger ?? initialTrigger - )} + {getTradingModeLabel(data?.marketTradingMode, data?.trigger)} ); diff --git a/apps/trading/components/rewards-container/reward-card.tsx b/apps/trading/components/rewards-container/reward-card.tsx index 117ec1328..7f5c2dd74 100644 --- a/apps/trading/components/rewards-container/reward-card.tsx +++ b/apps/trading/components/rewards-container/reward-card.tsx @@ -948,13 +948,13 @@ const EntityIcon = ({ export const areAllMarketsSettled = (transferNode: EnrichedRewardTransfer) => { const settledMarkets = transferNode.markets?.filter( (m) => - m?.state && + m?.data?.marketState && [ MarketState.STATE_TRADING_TERMINATED, MarketState.STATE_SETTLED, MarketState.STATE_CANCELLED, MarketState.STATE_CLOSED, - ].includes(m.state) + ].includes(m?.data?.marketState) ); return ( @@ -969,8 +969,8 @@ export const areAllMarketsSuspended = ( return ( transferNode.markets?.filter( (m) => - m?.state === MarketState.STATE_SUSPENDED || - m?.state === MarketState.STATE_SUSPENDED_VIA_GOVERNANCE + m?.data?.marketState === MarketState.STATE_SUSPENDED || + m?.data?.marketState === MarketState.STATE_SUSPENDED_VIA_GOVERNANCE ).length === transferNode.markets?.length && Boolean(transferNode.markets && transferNode.markets.length > 0) ); diff --git a/apps/trading/e2e/tests/market/test_continuous_market_to_price_monitoring_auction.py b/apps/trading/e2e/tests/market/test_continuous_market_to_price_monitoring_auction.py index 00e8ae755..ad2cfc8ad 100644 --- a/apps/trading/e2e/tests/market/test_continuous_market_to_price_monitoring_auction.py +++ b/apps/trading/e2e/tests/market/test_continuous_market_to_price_monitoring_auction.py @@ -7,6 +7,7 @@ from fixtures.market import setup_continuous_market from conftest import init_vega, cleanup_container, init_page, auth_setup, risk_accepted_setup from wallet_config import MM_WALLET, MM_WALLET2 + @pytest.fixture(scope="module") def setup_environment(request, browser) -> Generator[Tuple[Page, str, str], None, None]: with init_vega(request) as vega: @@ -22,7 +23,8 @@ def setup_environment(request, browser) -> Generator[Tuple[Page, str, str], None side="SIDE_BUY", volume=10, price=60, - pegged_order=PeggedOrder(reference="PEGGED_REFERENCE_MID", offset=1), + pegged_order=PeggedOrder( + reference="PEGGED_REFERENCE_MID", offset=1), ) vega.wait_fn(1) vega.wait_for_total_catchup() @@ -66,7 +68,8 @@ def setup_environment(request, browser) -> Generator[Tuple[Page, str, str], None 1, 1 + 0.1 / 2, ) - submit_order(vega, MM_WALLET.name, market_id, "SIDE_SELL", 1, 1 + 0.1 / 2) + submit_order(vega, MM_WALLET.name, market_id, + "SIDE_SELL", 1, 1 + 0.1 / 2) submit_order(vega, MM_WALLET2.name, market_id, "SIDE_SELL", 1, 1) vega.wait_fn(1) @@ -89,31 +92,37 @@ def setup_environment(request, browser) -> Generator[Tuple[Page, str, str], None yield page, market_id - def test_parked_order( setup_environment: Tuple[Page, str, str], ) -> None: page, market_id, = setup_environment + page.goto(f"/#/markets/{market_id}") page.get_by_test_id("All").click() - expect(page.get_by_role("row").nth(5)).to_contain_text("0+10Mid - 1.00 Peg limitParked0.00GTC") + expect(page.get_by_role("row").nth(5)).to_contain_text( + "0+10Mid - 1.00 Peg limitParked0.00GTC") + def test_trading_mode( -setup_environment: Tuple[Page, str, str], + setup_environment: Tuple[Page, str, str], ) -> None: page, market_id, = setup_environment - expect(page.get_by_test_id("market-trading-mode")).to_have_text("Trading modeMonitoring auction - price") + page.goto(f"/#/markets/{market_id}") + expect(page.get_by_test_id("market-trading-mode") + ).to_have_text("Trading modeMonitoring auction - price") expect(page.get_by_test_id("market-state")).to_have_text("StatusSuspended") + def test_market_info_price_monitoring_asd( -setup_environment: Tuple[Page, str, str], + setup_environment: Tuple[Page, str, str], ) -> None: page, market_id, = setup_environment + page.goto(f"/#/markets/{market_id}") page.get_by_test_id("Info").click() page.get_by_test_id("accordion-title").get_by_text( "Key details").click() expect( - page.get_by_test_id( - "key-value-table-row").nth(2)).to_contain_text("Suspended") + page.get_by_test_id( + "key-value-table-row").nth(2)).to_contain_text("Suspended") expect( - page.get_by_test_id( - "key-value-table-row").nth(3)).to_contain_text("Monitoring auction") \ No newline at end of file + page.get_by_test_id( + "key-value-table-row").nth(3)).to_contain_text("Monitoring auction") diff --git a/apps/trading/lib/hooks/use-rewards.ts b/apps/trading/lib/hooks/use-rewards.ts index 4c2d4560e..922284240 100644 --- a/apps/trading/lib/hooks/use-rewards.ts +++ b/apps/trading/lib/hooks/use-rewards.ts @@ -4,9 +4,9 @@ import { } from '@vegaprotocol/assets'; import { useActiveRewardsQuery } from './__generated__/Rewards'; import { - type MarketFieldsFragment, - useMarketsMapProvider, + type MarketMaybeWithData, getAsset, + marketsWithDataProvider, } from '@vegaprotocol/markets'; import { type RecurringTransfer, @@ -20,6 +20,7 @@ import { import { type ApolloError } from '@apollo/client'; import compact from 'lodash/compact'; import { useEpochInfoQuery } from './__generated__/Epoch'; +import { useDataProvider } from '@vegaprotocol/data-provider'; export type RewardTransfer = TransferNode & { transfer: { @@ -35,7 +36,7 @@ export type EnrichedRewardTransfer = RewardTransfer & { /** A flag determining whether a reward asset is being traded on any of the active markets */ isAssetTraded?: boolean; /** A list of markets in scope */ - markets?: MarketFieldsFragment[]; + markets?: MarketMaybeWithData[]; }; /** @@ -115,11 +116,15 @@ export const useRewards = ({ loading: assetsLoading, error: assetsError, } = useAssetsMapProvider(); + const { data: markets, loading: marketsLoading, error: marketsError, - } = useMarketsMapProvider(); + } = useDataProvider({ + dataProvider: marketsWithDataProvider, + variables: undefined, + }); const enriched = compact( data?.transfersConnection?.edges?.map((n) => n?.node) @@ -140,7 +145,7 @@ export const useRewards = ({ undefined; const marketsInScope = compact( node.transfer.kind.dispatchStrategy.marketIdsInScope?.map( - (id) => markets && markets[id] + (id) => markets && markets.find((m) => m.id === id) ) ); const isAssetTraded = @@ -151,7 +156,7 @@ export const useRewards = ({ return ( mAsset.id === node.transfer.kind.dispatchStrategy.dispatchMetricAssetId && - m.state === MarketState.STATE_ACTIVE + m.data?.marketState === MarketState.STATE_ACTIVE ); } catch { // NOOP diff --git a/apps/trading/lib/hooks/use-top-traded-markets.tsx b/apps/trading/lib/hooks/use-top-traded-markets.tsx index 38cd3276b..4146b9bbc 100644 --- a/apps/trading/lib/hooks/use-top-traded-markets.tsx +++ b/apps/trading/lib/hooks/use-top-traded-markets.tsx @@ -5,7 +5,9 @@ import { isMarketActive } from '../utils'; export const useTopTradedMarkets = () => { const { data, loading, error } = useMarketList(); - const activeMarkets = data?.filter((m) => isMarketActive(m.state)); + const activeMarkets = data?.filter( + (m) => m.data?.marketState && isMarketActive(m.data?.marketState) + ); const marketsByTopTraded = data ? orderBy(activeMarkets, (m) => calcTradedFactor(m), 'desc') : undefined; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx index 9983615b1..a7dd84072 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx @@ -850,9 +850,8 @@ describe('DealTicket', () => { ]; it.each(states)('handles state %s correctly', async (marketState) => { - const marketOverrides = { state: marketState }; const marketDataOverrides = { marketState: marketState }; - render(generateJsx([], marketOverrides, marketDataOverrides)); + render(generateJsx([], {}, marketDataOverrides)); const text = `This market is ${marketState .split('_') diff --git a/libs/deal-ticket/src/test-helpers.ts b/libs/deal-ticket/src/test-helpers.ts index 624347b2d..b56c9d871 100644 --- a/libs/deal-ticket/src/test-helpers.ts +++ b/libs/deal-ticket/src/test-helpers.ts @@ -9,8 +9,6 @@ export function generateMarket(override?: PartialDeep): Market { id: 'market-id', decimalPlaces: 2, positionDecimalPlaces: 1, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - state: Schema.MarketState.STATE_ACTIVE, tickSize: '1', marketTimestamps: { __typename: 'MarketTimestamps', diff --git a/libs/deal-ticket/src/utils/map-form-values-to-submisstion.spec.ts b/libs/deal-ticket/src/utils/map-form-values-to-submisstion.spec.ts index ddaeb2981..3c9bf2b0f 100644 --- a/libs/deal-ticket/src/utils/map-form-values-to-submisstion.spec.ts +++ b/libs/deal-ticket/src/utils/map-form-values-to-submisstion.spec.ts @@ -199,8 +199,6 @@ const mockMarket: MarketFieldsFragment = { id: 'marketId', decimalPlaces: 1, positionDecimalPlaces: 4, - state: Schema.MarketState.STATE_ACTIVE, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, } as MarketFieldsFragment; const orderFormValues: OrderFormValues = { diff --git a/libs/fills/src/lib/test-helpers.ts b/libs/fills/src/lib/test-helpers.ts index 005e01bde..b3cc62a18 100644 --- a/libs/fills/src/lib/test-helpers.ts +++ b/libs/fills/src/lib/test-helpers.ts @@ -3,8 +3,6 @@ import type { PartialDeep } from 'type-fest'; import * as Schema from '@vegaprotocol/types'; import type { Trade } from './fills-data-provider'; -const { MarketState, MarketTradingMode } = Schema; - export const generateFill = (override?: PartialDeep) => { const defaultFill: Trade = { __typename: 'Trade', @@ -52,8 +50,6 @@ export const generateFill = (override?: PartialDeep) => { id: 'market-id', positionDecimalPlaces: 0, decimalPlaces: 5, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, tickSize: '1', fees: { __typename: 'Fees', diff --git a/libs/funding-payments/src/lib/test-helpers.ts b/libs/funding-payments/src/lib/test-helpers.ts index 42f585ef8..97d1e28de 100644 --- a/libs/funding-payments/src/lib/test-helpers.ts +++ b/libs/funding-payments/src/lib/test-helpers.ts @@ -1,10 +1,7 @@ import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; -import * as Schema from '@vegaprotocol/types'; import type { FundingPayment } from './funding-payments-data-provider'; -const { MarketState, MarketTradingMode } = Schema; - export const generateFundingPayment = ( override?: PartialDeep ) => { @@ -20,8 +17,6 @@ export const generateFundingPayment = ( id: 'market-id', positionDecimalPlaces: 0, decimalPlaces: 5, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, tickSize: '1', fees: { __typename: 'Fees', diff --git a/libs/markets/src/lib/__generated__/markets.ts b/libs/markets/src/lib/__generated__/markets.ts index f0d8a6819..eda07a8b4 100644 --- a/libs/markets/src/lib/__generated__/markets.ts +++ b/libs/markets/src/lib/__generated__/markets.ts @@ -6,12 +6,12 @@ import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; export type MarketFieldsMainnetFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tickSize: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode, parentMarketID?: string | null, successorMarketID?: string | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string }, liquidityFeeSettings?: { __typename?: 'LiquidityFeeSettings', feeConstant?: string | null, method: Types.LiquidityFeeMethod } | null }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'Perpetual', quoteName: string, fundingRateScalingFactor?: string | null, fundingRateLowerBound?: string | null, fundingRateUpperBound?: string | null, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForSettlementSchedule: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string }, internalCompositePriceConfig?: { __typename?: 'CompositePriceConfiguration', decayWeight: string, decayPower: number, cashAmount: string, SourceWeights?: Array | null, SourceStalenessTolerance: Array, CompositePriceType: Types.CompositePriceType, dataSourcesSpec?: Array<{ __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } | null> | null, dataSourcesSpecBinding?: Array<{ __typename?: 'SpecBindingForCompositePrice', priceSourceProperty: string } | null> | null } | null } | { __typename?: 'Spot', name: string, baseAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }, quoteAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', proposed?: any | null, pending: any, open: any, close: any }, marketProposal?: { __typename?: 'BatchProposal', id?: string | null } | { __typename?: 'Proposal', id?: string | null } | null }; -export type MarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tickSize: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode, parentMarketID?: string | null, successorMarketID?: string | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string }, liquidityFeeSettings?: { __typename?: 'LiquidityFeeSettings', feeConstant?: string | null, method: Types.LiquidityFeeMethod } | null }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'Perpetual', quoteName: string, fundingRateScalingFactor?: string | null, fundingRateLowerBound?: string | null, fundingRateUpperBound?: string | null, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForSettlementSchedule: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string }, internalCompositePriceConfig?: { __typename?: 'CompositePriceConfiguration', decayWeight: string, decayPower: number, cashAmount: string, SourceWeights?: Array | null, SourceStalenessTolerance: Array, CompositePriceType: Types.CompositePriceType, dataSourcesSpec?: Array<{ __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } | null> | null, dataSourcesSpecBinding?: Array<{ __typename?: 'SpecBindingForCompositePrice', priceSourceProperty: string } | null> | null } | null } | { __typename?: 'Spot', name: string, baseAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }, quoteAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', proposed?: any | null, pending: any, open: any, close: any }, marketProposal?: { __typename?: 'BatchProposal', id?: string | null } | { __typename?: 'Proposal', id?: string | null } | null }; +export type MarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tickSize: string, parentMarketID?: string | null, successorMarketID?: string | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string }, liquidityFeeSettings?: { __typename?: 'LiquidityFeeSettings', feeConstant?: string | null, method: Types.LiquidityFeeMethod } | null }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'Perpetual', quoteName: string, fundingRateScalingFactor?: string | null, fundingRateLowerBound?: string | null, fundingRateUpperBound?: string | null, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForSettlementSchedule: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string }, internalCompositePriceConfig?: { __typename?: 'CompositePriceConfiguration', decayWeight: string, decayPower: number, cashAmount: string, SourceWeights?: Array | null, SourceStalenessTolerance: Array, CompositePriceType: Types.CompositePriceType, dataSourcesSpec?: Array<{ __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } | null> | null, dataSourcesSpecBinding?: Array<{ __typename?: 'SpecBindingForCompositePrice', priceSourceProperty: string } | null> | null } | null } | { __typename?: 'Spot', name: string, baseAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }, quoteAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', proposed?: any | null, pending: any, open: any, close: any }, marketProposal?: { __typename?: 'BatchProposal', id?: string | null } | { __typename?: 'Proposal', id?: string | null } | null }; export type MarketsQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type MarketsQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tickSize: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode, parentMarketID?: string | null, successorMarketID?: string | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string }, liquidityFeeSettings?: { __typename?: 'LiquidityFeeSettings', feeConstant?: string | null, method: Types.LiquidityFeeMethod } | null }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'Perpetual', quoteName: string, fundingRateScalingFactor?: string | null, fundingRateLowerBound?: string | null, fundingRateUpperBound?: string | null, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForSettlementSchedule: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string }, internalCompositePriceConfig?: { __typename?: 'CompositePriceConfiguration', decayWeight: string, decayPower: number, cashAmount: string, SourceWeights?: Array | null, SourceStalenessTolerance: Array, CompositePriceType: Types.CompositePriceType, dataSourcesSpec?: Array<{ __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } | null> | null, dataSourcesSpecBinding?: Array<{ __typename?: 'SpecBindingForCompositePrice', priceSourceProperty: string } | null> | null } | null } | { __typename?: 'Spot', name: string, baseAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }, quoteAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', proposed?: any | null, pending: any, open: any, close: any }, marketProposal?: { __typename?: 'BatchProposal', id?: string | null } | { __typename?: 'Proposal', id?: string | null } | null } }> } | null }; +export type MarketsQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tickSize: string, parentMarketID?: string | null, successorMarketID?: string | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string }, liquidityFeeSettings?: { __typename?: 'LiquidityFeeSettings', feeConstant?: string | null, method: Types.LiquidityFeeMethod } | null }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | { __typename?: 'Perpetual', quoteName: string, fundingRateScalingFactor?: string | null, fundingRateLowerBound?: string | null, fundingRateUpperBound?: string | null, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForSettlementSchedule: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecPerpetualBinding', settlementDataProperty: string, settlementScheduleProperty: string }, internalCompositePriceConfig?: { __typename?: 'CompositePriceConfiguration', decayWeight: string, decayPower: number, cashAmount: string, SourceWeights?: Array | null, SourceStalenessTolerance: Array, CompositePriceType: Types.CompositePriceType, dataSourcesSpec?: Array<{ __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } | { __typename?: 'EthCallSpec', abi?: Array | null, address: string, args?: Array | null, method: string, requiredConfirmations: number, normalisers?: Array<{ __typename?: 'Normaliser', name: string, expression: string }> | null, trigger: { __typename?: 'EthCallTrigger', trigger: { __typename?: 'EthTimeTrigger', initial?: any | null, every?: number | null, until?: any | null } }, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType, numberDecimalPlaces?: number | null }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } | { __typename: 'DataSourceSpecConfigurationTimeTrigger', triggers: Array<{ __typename?: 'InternalTimeTrigger', initial?: number | null, every?: number | null } | null>, conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } | null> | null, dataSourcesSpecBinding?: Array<{ __typename?: 'SpecBindingForCompositePrice', priceSourceProperty: string } | null> | null } | null } | { __typename?: 'Spot', name: string, baseAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }, quoteAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', proposed?: any | null, pending: any, open: any, close: any }, marketProposal?: { __typename?: 'BatchProposal', id?: string | null } | { __typename?: 'Proposal', id?: string | null } | null } }> } | null }; export type MarketsMainnetQueryVariables = Types.Exact<{ [key: string]: never; }>; @@ -84,8 +84,6 @@ export const MarketFieldsFragmentDoc = gql` decimalPlaces positionDecimalPlaces tickSize - state - tradingMode parentMarketID successorMarketID fees { diff --git a/libs/markets/src/lib/market-utils.spec.tsx b/libs/markets/src/lib/market-utils.spec.tsx index 63b80d901..5a6dee7fa 100644 --- a/libs/markets/src/lib/market-utils.spec.tsx +++ b/libs/markets/src/lib/market-utils.spec.tsx @@ -1,5 +1,9 @@ import * as Schema from '@vegaprotocol/types'; -import type { Market, MarketMaybeWithDataAndCandles } from './markets-provider'; +import type { + Market, + MarketMaybeWithData, + MarketMaybeWithDataAndCandles, +} from './markets-provider'; import { calcCandleVolumePrice, calcTradedFactor, @@ -7,9 +11,10 @@ import { sumFeesFactors, totalFeesFactorsPercentage, } from './market-utils'; +import type { MarketData } from './market-data-provider'; const { MarketState, MarketTradingMode } = Schema; -const MARKET_A: Partial = { +const MARKET_A: Partial = { id: '1', marketTimestamps: { __typename: 'MarketTimestamps', @@ -18,11 +23,13 @@ const MARKET_A: Partial = { open: '2022-05-18T13:08:27.693537312Z', close: null, }, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + data: { + marketState: MarketState.STATE_ACTIVE, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + } as MarketData, }; -const MARKET_B: Partial = { +const MARKET_B: Partial = { id: '2', marketTimestamps: { __typename: 'MarketTimestamps', @@ -31,11 +38,13 @@ const MARKET_B: Partial = { open: '2022-05-18T13:00:39.328347732Z', close: null, }, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + data: { + marketState: MarketState.STATE_ACTIVE, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + } as MarketData, }; -const MARKET_C: Partial = { +const MARKET_C: Partial = { id: '3', marketTimestamps: { __typename: 'MarketTimestamps', @@ -44,11 +53,13 @@ const MARKET_C: Partial = { open: '2022-05-17T13:00:39.328347732Z', close: null, }, - state: MarketState.STATE_REJECTED, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + data: { + marketState: MarketState.STATE_REJECTED, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + } as MarketData, }; -const MARKET_D: Partial = { +const MARKET_D: Partial = { id: '4', marketTimestamps: { __typename: 'MarketTimestamps', @@ -57,8 +68,10 @@ const MARKET_D: Partial = { open: '2022-05-16T13:00:39.328347732Z', close: null, }, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_NO_TRADING, + data: { + marketState: MarketState.STATE_ACTIVE, + marketTradingMode: MarketTradingMode.TRADING_MODE_NO_TRADING, + } as MarketData, }; describe('mapDataToMarketList', () => { @@ -68,7 +81,7 @@ describe('mapDataToMarketList', () => { MARKET_B, MARKET_C, MARKET_D, - ] as unknown as Market[]); + ] as unknown as MarketMaybeWithData[]); expect(result).toEqual([MARKET_B, MARKET_A]); }); }); diff --git a/libs/markets/src/lib/market-utils.ts b/libs/markets/src/lib/market-utils.ts index 4e0ffc122..2369f956c 100644 --- a/libs/markets/src/lib/market-utils.ts +++ b/libs/markets/src/lib/market-utils.ts @@ -89,8 +89,8 @@ export const filterAndSortMarkets = (markets: MarketMaybeWithData[]) => { ]; const orderedMarkets = orderBy( markets?.filter((m) => { - const state = m.data?.marketState || m.state; - const tradingMode = m.data?.marketTradingMode || m.tradingMode; + const state = m.data?.marketState; + const tradingMode = m.data?.marketTradingMode; return ( state !== MarketState.STATE_REJECTED && tradingMode !== MarketTradingMode.TRADING_MODE_NO_TRADING @@ -101,19 +101,26 @@ export const filterAndSortMarkets = (markets: MarketMaybeWithData[]) => { ); return orderedMarkets.sort( (a, b) => - tradingModesOrdering.indexOf(a.data?.marketTradingMode || a.tradingMode) - - tradingModesOrdering.indexOf(b.data?.marketTradingMode || b.tradingMode) + (a.data?.marketTradingMode + ? tradingModesOrdering.indexOf(a.data?.marketTradingMode) + : -1) - + (b.data?.marketTradingMode + ? tradingModesOrdering.indexOf(b.data?.marketTradingMode) + : -1) ); }; export const filterAndSortClosedMarkets = (markets: MarketMaybeWithData[]) => { return markets.filter((m) => { - return [ - MarketState.STATE_SETTLED, - MarketState.STATE_TRADING_TERMINATED, - MarketState.STATE_CLOSED, - MarketState.STATE_CANCELLED, - ].includes(m.data?.marketState || m.state); + return ( + m.data?.marketState && + [ + MarketState.STATE_SETTLED, + MarketState.STATE_TRADING_TERMINATED, + MarketState.STATE_CLOSED, + MarketState.STATE_CANCELLED, + ].includes(m.data.marketState) + ); }); }; @@ -121,8 +128,9 @@ export const filterAndSortProposedMarkets = ( markets: MarketMaybeWithData[] ) => { return markets.filter((m) => { - return [MarketState.STATE_PROPOSED].includes( - m.data?.marketState || m.state + return ( + m.data?.marketState && + [MarketState.STATE_PROPOSED].includes(m.data?.marketState) ); }); }; diff --git a/libs/markets/src/lib/markets-provider.ts b/libs/markets/src/lib/markets-provider.ts index c674a93bf..ad86df741 100644 --- a/libs/markets/src/lib/markets-provider.ts +++ b/libs/markets/src/lib/markets-provider.ts @@ -110,19 +110,30 @@ export const marketWithDataProvider = makeDerivedDataProvider< }; }); -export const activeMarketsProvider = makeDerivedDataProvider( - [marketsProvider], - ([markets]) => filterAndSortMarkets(markets) +export const marketsWithDataProvider = makeDerivedDataProvider< + MarketMaybeWithData[], + never +>([marketsProvider, marketsDataProvider], (parts) => + addData(parts[0] as Market[], parts[1] as MarketData[]) ); -export const closedMarketsProvider = makeDerivedDataProvider( - [marketsProvider], - ([markets]) => filterAndSortClosedMarkets(markets) +export const activeMarketsProvider = makeDerivedDataProvider< + MarketMaybeWithData[], + never +>([marketsWithDataProvider], ([markets]) => filterAndSortMarkets(markets)); + +export const closedMarketsProvider = makeDerivedDataProvider< + MarketMaybeWithData[], + never +>([marketsWithDataProvider], ([markets]) => + filterAndSortClosedMarkets(markets) ); -export const proposedMarketsProvider = makeDerivedDataProvider( - [marketsProvider], - ([markets]) => filterAndSortProposedMarkets(markets) +export const proposedMarketsProvider = makeDerivedDataProvider< + MarketMaybeWithData[], + never +>([marketsWithDataProvider], ([markets]) => + filterAndSortProposedMarkets(markets) ); export type MarketMaybeWithCandles = Market & { candles?: Candle[] }; @@ -157,28 +168,7 @@ const addData = (markets: T[], marketsData: MarketData[]) => data: marketsData.find((data) => data.market.id === market.id), })); -export const marketsWithDataProvider = makeDerivedDataProvider< - MarketMaybeWithData[], - never ->([activeMarketsProvider, marketsDataProvider], (parts) => - addData(parts[0] as Market[], parts[1] as MarketData[]) -); - -export const closedMarketsWithDataProvider = makeDerivedDataProvider< - MarketMaybeWithData[], - never ->([closedMarketsProvider, marketsDataProvider], (parts) => - addData(parts[0] as Market[], parts[1] as MarketData[]) -); - -export const allMarketsWithDataProvider = makeDerivedDataProvider< - MarketMaybeWithData[], - never ->([marketsProvider, marketsDataProvider], (parts) => - addData(parts[0] as Market[], parts[1] as MarketData[]) -); - -export const allMarketsWithLiveDataProvider = makeDerivedDataProvider< +export const marketsWithLiveDataProvider = makeDerivedDataProvider< MarketMaybeWithData[], MarketMaybeWithData, { marketIds: string[] } diff --git a/libs/markets/src/lib/markets.graphql b/libs/markets/src/lib/markets.graphql index 1f1750767..bf4110105 100644 --- a/libs/markets/src/lib/markets.graphql +++ b/libs/markets/src/lib/markets.graphql @@ -61,8 +61,6 @@ fragment MarketFields on Market { decimalPlaces positionDecimalPlaces tickSize - state - tradingMode parentMarketID successorMarketID fees { diff --git a/libs/markets/src/lib/markets.mock.ts b/libs/markets/src/lib/markets.mock.ts index df0b6cd40..2cfc70a4b 100644 --- a/libs/markets/src/lib/markets.mock.ts +++ b/libs/markets/src/lib/markets.mock.ts @@ -36,8 +36,6 @@ export const createMarketFragment = ( id: 'market-0', decimalPlaces: 5, positionDecimalPlaces: 0, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - state: Schema.MarketState.STATE_ACTIVE, tickSize: '1', marketTimestamps: { __typename: 'MarketTimestamps', @@ -190,8 +188,6 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ }), createMarketFragment({ id: 'market-2', - tradingMode: Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, - state: Schema.MarketState.STATE_SUSPENDED, marketTimestamps: { proposed: '2022-08-23T11:36:32.252490405Z', pending: '2022-08-24T11:36:32.252490405Z', diff --git a/libs/orders/src/lib/components/mocks/generate-orders.ts b/libs/orders/src/lib/components/mocks/generate-orders.ts index 2b43999f5..c37389957 100644 --- a/libs/orders/src/lib/components/mocks/generate-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-orders.ts @@ -29,7 +29,6 @@ export const generateOrder = (partialOrder?: PartialDeep) => { close: null, }, positionDecimalPlaces: 2, - state: Schema.MarketState.STATE_ACTIVE, tradableInstrument: { __typename: 'TradableInstrument', instrument: { @@ -86,7 +85,6 @@ export const generateOrder = (partialOrder?: PartialDeep) => { }, }, }, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, }, size: '10', type: Schema.OrderType.TYPE_MARKET, diff --git a/libs/orders/src/lib/components/mocks/generate-stop-orders.ts b/libs/orders/src/lib/components/mocks/generate-stop-orders.ts index d0cdde878..0794e065d 100644 --- a/libs/orders/src/lib/components/mocks/generate-stop-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-stop-orders.ts @@ -39,7 +39,6 @@ export const generateStopOrder = ( open: '', }, positionDecimalPlaces: 2, - state: Schema.MarketState.STATE_ACTIVE, tradableInstrument: { __typename: 'TradableInstrument', instrument: { @@ -96,7 +95,6 @@ export const generateStopOrder = ( }, }, }, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, }, submission: { marketId: 'market-id', diff --git a/libs/orders/src/lib/components/order-list/order-view-dialog.spec.tsx b/libs/orders/src/lib/components/order-list/order-view-dialog.spec.tsx index f364a8cea..6570885fc 100644 --- a/libs/orders/src/lib/components/order-list/order-view-dialog.spec.tsx +++ b/libs/orders/src/lib/components/order-list/order-view-dialog.spec.tsx @@ -3,8 +3,6 @@ import { OrderViewDialog } from './order-view-dialog'; import type { Order } from '../order-data-provider'; import { BrowserRouter } from 'react-router-dom'; import { - MarketState, - MarketTradingMode, OrderStatus, OrderTimeInForce, OrderType, @@ -20,8 +18,6 @@ describe('OrderViewDialog', () => { id: 'b66cd4be223dfd900a4750bb5175e17d8f678996877d262be4c749a99e22a970', decimalPlaces: 5, positionDecimalPlaces: 3, - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, tickSize: '1', fees: { __typename: 'Fees', diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index d1ba1aa0c..6b4d53b0d 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -111,7 +111,6 @@ const marketsData = [ __typename: 'Market', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', decimalPlaces: 5, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, positionDecimalPlaces: 0, tradableInstrument: { __typename: 'TradableInstrument', @@ -131,6 +130,8 @@ const marketsData = [ }, data: { __typename: 'MarketData', + marketTradingMode: + Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, markPrice: '9431775', market: { __typename: 'Market', @@ -142,7 +143,6 @@ const marketsData = [ __typename: 'Market', id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', decimalPlaces: 5, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, positionDecimalPlaces: 0, tradableInstrument: { __typename: 'TradableInstrument', @@ -162,6 +162,7 @@ const marketsData = [ }, data: { __typename: 'MarketData', + marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, markPrice: '869762', market: { __typename: 'Market', diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index f9e57907d..315caf2b4 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -17,7 +17,7 @@ import { import { type MarketMaybeWithData, type MarketDataQueryVariables, - allMarketsWithLiveDataProvider, + marketsWithLiveDataProvider, getAsset, marketInfoProvider, type MarketInfo, @@ -57,8 +57,8 @@ export interface Position { marketDecimalPlaces: number; marketId: string; marketCode: string; - marketTradingMode: MarketTradingMode; - marketState: MarketState; + marketTradingMode?: MarketTradingMode; + marketState?: MarketState; markPrice: string | undefined; notional: string | undefined; openVolume: string; @@ -171,8 +171,8 @@ export const getMetrics = ( marketDecimalPlaces, marketId: market.id, marketCode: market.tradableInstrument.instrument.code, - marketTradingMode: market.tradingMode, - marketState: market.state, + marketTradingMode: market.data?.marketTradingMode, + marketState: market.data?.marketState, markPrice: marketData ? marketData.markPrice : undefined, notional: notional ? notional.multipliedBy(10 ** marketDecimalPlaces).toFixed(0) @@ -325,6 +325,7 @@ export const preparePositions = (metrics: Position[], showClosed: boolean) => { } if ( + p.marketState && [ MarketState.STATE_ACTIVE, MarketState.STATE_PENDING, @@ -369,7 +370,7 @@ export const positionsMetricsProvider = makeDerivedDataProvider< partyId: firstOrSelf(variables.partyIds), }), (callback, client, variables) => - allMarketsWithLiveDataProvider(callback, client, { + marketsWithLiveDataProvider(callback, client, { marketIds: variables.marketIds, }), (callback, client, variables) => diff --git a/libs/utils/src/lib/markets.ts b/libs/utils/src/lib/markets.ts index 3b3c45dfb..ecb782346 100644 --- a/libs/utils/src/lib/markets.ts +++ b/libs/utils/src/lib/markets.ts @@ -35,10 +35,10 @@ export const getMarketExpiryDateFormatted = ( return null; }; -export const getExpiryDate = ( - tags: ReadonlyArray | null, - close: string | null, - state: MarketState +export const useExpiryDate = ( + tags?: ReadonlyArray | null, + close?: string | null, + state?: MarketState | null ): string => { const t = useT(); const metadataExpiryDate = getMarketExpiryDate(tags); diff --git a/libs/withdraws/src/lib/withdraw-form-container.spec.tsx b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx index 1293ffa81..be94ff2b2 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.spec.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx @@ -138,8 +138,6 @@ describe('WithdrawFormContainer', () => { id: 'marketId-1', decimalPlaces: 5, positionDecimalPlaces: 0, - state: Types.MarketState.STATE_SUSPENDED, - tradingMode: Types.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, tickSize: '1', fees: { __typename: 'Fees',