[#128] Capitalize types in position queries
This commit is contained in:
parent
fe29e86c74
commit
444f1b6584
@ -6,8 +6,8 @@ import { AsyncRenderer } from '../../components/async-renderer';
|
|||||||
import { PositionsTable, getRowNodeId } from '@vegaprotocol/positions';
|
import { PositionsTable, getRowNodeId } from '@vegaprotocol/positions';
|
||||||
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
import {
|
import {
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
positionSubscribe_positions,
|
PositionSubscribe_positions,
|
||||||
positionsDataProvider,
|
positionsDataProvider,
|
||||||
} from '@vegaprotocol/graphql';
|
} from '@vegaprotocol/graphql';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
@ -20,17 +20,17 @@ export const Positions = () => {
|
|||||||
const { keypair } = useVegaWallet();
|
const { keypair } = useVegaWallet();
|
||||||
const variables = useMemo(() => ({ partyId: keypair.pub }), [keypair]);
|
const variables = useMemo(() => ({ partyId: keypair.pub }), [keypair]);
|
||||||
const update = useCallback(
|
const update = useCallback(
|
||||||
(delta: positionSubscribe_positions) => {
|
(delta: PositionSubscribe_positions) => {
|
||||||
const update: positions_party_positions[] = [];
|
const update: Positions_party_positions[] = [];
|
||||||
const add: positions_party_positions[] = [];
|
const add: Positions_party_positions[] = [];
|
||||||
if (!gridRef.current) {
|
if (!gridRef.current) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const rowNode = gridRef.current.api.getRowNode(getRowNodeId(delta));
|
const rowNode = gridRef.current.api.getRowNode(getRowNodeId(delta));
|
||||||
if (rowNode) {
|
if (rowNode) {
|
||||||
const updatedData = produce<positions_party_positions>(
|
const updatedData = produce<Positions_party_positions>(
|
||||||
rowNode.data,
|
rowNode.data,
|
||||||
(draft: positions_party_positions) => {
|
(draft: Positions_party_positions) => {
|
||||||
merge(draft, delta);
|
merge(draft, delta);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -52,8 +52,8 @@ export const Positions = () => {
|
|||||||
[gridRef]
|
[gridRef]
|
||||||
);
|
);
|
||||||
const { data, error, loading } = useDataProvider<
|
const { data, error, loading } = useDataProvider<
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
positionSubscribe_positions
|
PositionSubscribe_positions
|
||||||
>(positionsDataProvider, update, variables);
|
>(positionsDataProvider, update, variables);
|
||||||
return (
|
return (
|
||||||
<AsyncRenderer loading={loading} error={error} data={data}>
|
<AsyncRenderer loading={loading} error={error} data={data}>
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
import { MarketTradingMode } from "./globalTypes";
|
import { MarketTradingMode } from "./globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL subscription operation: positionSubscribe
|
// GraphQL subscription operation: PositionSubscribe
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_data_market {
|
export interface PositionSubscribe_positions_market_data_market {
|
||||||
__typename: "Market";
|
__typename: "Market";
|
||||||
/**
|
/**
|
||||||
* Market ID
|
* Market ID
|
||||||
@ -17,7 +17,7 @@ export interface positionSubscribe_positions_market_data_market {
|
|||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_data {
|
export interface PositionSubscribe_positions_market_data {
|
||||||
__typename: "MarketData";
|
__typename: "MarketData";
|
||||||
/**
|
/**
|
||||||
* the mark price (actually an unsigned int)
|
* the mark price (actually an unsigned int)
|
||||||
@ -30,10 +30,10 @@ export interface positionSubscribe_positions_market_data {
|
|||||||
/**
|
/**
|
||||||
* market id of the associated mark price
|
* market id of the associated mark price
|
||||||
*/
|
*/
|
||||||
market: positionSubscribe_positions_market_data_market;
|
market: PositionSubscribe_positions_market_data_market;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_tradableInstrument_instrument_metadata {
|
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_metadata {
|
||||||
__typename: "InstrumentMetadata";
|
__typename: "InstrumentMetadata";
|
||||||
/**
|
/**
|
||||||
* An arbitrary list of tags to associated to associate to the Instrument (string list)
|
* An arbitrary list of tags to associated to associate to the Instrument (string list)
|
||||||
@ -41,7 +41,7 @@ export interface positionSubscribe_positions_market_tradableInstrument_instrumen
|
|||||||
tags: string[] | null;
|
tags: string[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_tradableInstrument_instrument_product_settlementAsset {
|
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_product_settlementAsset {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The id of the asset
|
* The id of the asset
|
||||||
@ -61,19 +61,19 @@ export interface positionSubscribe_positions_market_tradableInstrument_instrumen
|
|||||||
decimals: number;
|
decimals: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_tradableInstrument_instrument_product {
|
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_product {
|
||||||
__typename: "Future";
|
__typename: "Future";
|
||||||
/**
|
/**
|
||||||
* The name of the asset (string)
|
* The name of the asset (string)
|
||||||
*/
|
*/
|
||||||
settlementAsset: positionSubscribe_positions_market_tradableInstrument_instrument_product_settlementAsset;
|
settlementAsset: PositionSubscribe_positions_market_tradableInstrument_instrument_product_settlementAsset;
|
||||||
/**
|
/**
|
||||||
* String representing the quote (e.g. BTCUSD -> USD is quote)
|
* String representing the quote (e.g. BTCUSD -> USD is quote)
|
||||||
*/
|
*/
|
||||||
quoteName: string;
|
quoteName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_tradableInstrument_instrument {
|
export interface PositionSubscribe_positions_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
/**
|
/**
|
||||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
@ -86,7 +86,7 @@ export interface positionSubscribe_positions_market_tradableInstrument_instrumen
|
|||||||
/**
|
/**
|
||||||
* Metadata for this instrument
|
* Metadata for this instrument
|
||||||
*/
|
*/
|
||||||
metadata: positionSubscribe_positions_market_tradableInstrument_instrument_metadata;
|
metadata: PositionSubscribe_positions_market_tradableInstrument_instrument_metadata;
|
||||||
/**
|
/**
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
*/
|
*/
|
||||||
@ -94,18 +94,18 @@ export interface positionSubscribe_positions_market_tradableInstrument_instrumen
|
|||||||
/**
|
/**
|
||||||
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
*/
|
*/
|
||||||
product: positionSubscribe_positions_market_tradableInstrument_instrument_product;
|
product: PositionSubscribe_positions_market_tradableInstrument_instrument_product;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market_tradableInstrument {
|
export interface PositionSubscribe_positions_market_tradableInstrument {
|
||||||
__typename: "TradableInstrument";
|
__typename: "TradableInstrument";
|
||||||
/**
|
/**
|
||||||
* An instance of or reference to a fully specified instrument.
|
* An instance of or reference to a fully specified instrument.
|
||||||
*/
|
*/
|
||||||
instrument: positionSubscribe_positions_market_tradableInstrument_instrument;
|
instrument: PositionSubscribe_positions_market_tradableInstrument_instrument;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions_market {
|
export interface PositionSubscribe_positions_market {
|
||||||
__typename: "Market";
|
__typename: "Market";
|
||||||
/**
|
/**
|
||||||
* Market ID
|
* Market ID
|
||||||
@ -118,7 +118,7 @@ export interface positionSubscribe_positions_market {
|
|||||||
/**
|
/**
|
||||||
* marketData for the given market
|
* marketData for the given market
|
||||||
*/
|
*/
|
||||||
data: positionSubscribe_positions_market_data | null;
|
data: PositionSubscribe_positions_market_data | null;
|
||||||
/**
|
/**
|
||||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||||
* number denominated in the currency of the Market. (uint64)
|
* number denominated in the currency of the Market. (uint64)
|
||||||
@ -139,10 +139,10 @@ export interface positionSubscribe_positions_market {
|
|||||||
/**
|
/**
|
||||||
* An instance of or reference to a tradable instrument.
|
* An instance of or reference to a tradable instrument.
|
||||||
*/
|
*/
|
||||||
tradableInstrument: positionSubscribe_positions_market_tradableInstrument;
|
tradableInstrument: PositionSubscribe_positions_market_tradableInstrument;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe_positions {
|
export interface PositionSubscribe_positions {
|
||||||
__typename: "Position";
|
__typename: "Position";
|
||||||
/**
|
/**
|
||||||
* Realised Profit and Loss (int64)
|
* Realised Profit and Loss (int64)
|
||||||
@ -163,16 +163,16 @@ export interface positionSubscribe_positions {
|
|||||||
/**
|
/**
|
||||||
* Market relating to this position
|
* Market relating to this position
|
||||||
*/
|
*/
|
||||||
market: positionSubscribe_positions_market;
|
market: PositionSubscribe_positions_market;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribe {
|
export interface PositionSubscribe {
|
||||||
/**
|
/**
|
||||||
* Subscribe to the positions updates
|
* Subscribe to the positions updates
|
||||||
*/
|
*/
|
||||||
positions: positionSubscribe_positions;
|
positions: PositionSubscribe_positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionSubscribeVariables {
|
export interface PositionSubscribeVariables {
|
||||||
partyId: string;
|
partyId: string;
|
||||||
}
|
}
|
@ -6,10 +6,10 @@
|
|||||||
import { MarketTradingMode } from "./globalTypes";
|
import { MarketTradingMode } from "./globalTypes";
|
||||||
|
|
||||||
// ====================================================
|
// ====================================================
|
||||||
// GraphQL query operation: positions
|
// GraphQL query operation: Positions
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface positions_party_positions_market_data_market {
|
export interface Positions_party_positions_market_data_market {
|
||||||
__typename: "Market";
|
__typename: "Market";
|
||||||
/**
|
/**
|
||||||
* Market ID
|
* Market ID
|
||||||
@ -17,7 +17,7 @@ export interface positions_party_positions_market_data_market {
|
|||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_data {
|
export interface Positions_party_positions_market_data {
|
||||||
__typename: "MarketData";
|
__typename: "MarketData";
|
||||||
/**
|
/**
|
||||||
* the mark price (actually an unsigned int)
|
* the mark price (actually an unsigned int)
|
||||||
@ -30,10 +30,10 @@ export interface positions_party_positions_market_data {
|
|||||||
/**
|
/**
|
||||||
* market id of the associated mark price
|
* market id of the associated mark price
|
||||||
*/
|
*/
|
||||||
market: positions_party_positions_market_data_market;
|
market: Positions_party_positions_market_data_market;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_tradableInstrument_instrument_metadata {
|
export interface Positions_party_positions_market_tradableInstrument_instrument_metadata {
|
||||||
__typename: "InstrumentMetadata";
|
__typename: "InstrumentMetadata";
|
||||||
/**
|
/**
|
||||||
* An arbitrary list of tags to associated to associate to the Instrument (string list)
|
* An arbitrary list of tags to associated to associate to the Instrument (string list)
|
||||||
@ -41,7 +41,7 @@ export interface positions_party_positions_market_tradableInstrument_instrument_
|
|||||||
tags: string[] | null;
|
tags: string[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_tradableInstrument_instrument_product_settlementAsset {
|
export interface Positions_party_positions_market_tradableInstrument_instrument_product_settlementAsset {
|
||||||
__typename: "Asset";
|
__typename: "Asset";
|
||||||
/**
|
/**
|
||||||
* The id of the asset
|
* The id of the asset
|
||||||
@ -61,19 +61,19 @@ export interface positions_party_positions_market_tradableInstrument_instrument_
|
|||||||
decimals: number;
|
decimals: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_tradableInstrument_instrument_product {
|
export interface Positions_party_positions_market_tradableInstrument_instrument_product {
|
||||||
__typename: "Future";
|
__typename: "Future";
|
||||||
/**
|
/**
|
||||||
* The name of the asset (string)
|
* The name of the asset (string)
|
||||||
*/
|
*/
|
||||||
settlementAsset: positions_party_positions_market_tradableInstrument_instrument_product_settlementAsset;
|
settlementAsset: Positions_party_positions_market_tradableInstrument_instrument_product_settlementAsset;
|
||||||
/**
|
/**
|
||||||
* String representing the quote (e.g. BTCUSD -> USD is quote)
|
* String representing the quote (e.g. BTCUSD -> USD is quote)
|
||||||
*/
|
*/
|
||||||
quoteName: string;
|
quoteName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_tradableInstrument_instrument {
|
export interface Positions_party_positions_market_tradableInstrument_instrument {
|
||||||
__typename: "Instrument";
|
__typename: "Instrument";
|
||||||
/**
|
/**
|
||||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
@ -86,7 +86,7 @@ export interface positions_party_positions_market_tradableInstrument_instrument
|
|||||||
/**
|
/**
|
||||||
* Metadata for this instrument
|
* Metadata for this instrument
|
||||||
*/
|
*/
|
||||||
metadata: positions_party_positions_market_tradableInstrument_instrument_metadata;
|
metadata: Positions_party_positions_market_tradableInstrument_instrument_metadata;
|
||||||
/**
|
/**
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
*/
|
*/
|
||||||
@ -94,18 +94,18 @@ export interface positions_party_positions_market_tradableInstrument_instrument
|
|||||||
/**
|
/**
|
||||||
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
*/
|
*/
|
||||||
product: positions_party_positions_market_tradableInstrument_instrument_product;
|
product: Positions_party_positions_market_tradableInstrument_instrument_product;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market_tradableInstrument {
|
export interface Positions_party_positions_market_tradableInstrument {
|
||||||
__typename: "TradableInstrument";
|
__typename: "TradableInstrument";
|
||||||
/**
|
/**
|
||||||
* An instance of or reference to a fully specified instrument.
|
* An instance of or reference to a fully specified instrument.
|
||||||
*/
|
*/
|
||||||
instrument: positions_party_positions_market_tradableInstrument_instrument;
|
instrument: Positions_party_positions_market_tradableInstrument_instrument;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions_market {
|
export interface Positions_party_positions_market {
|
||||||
__typename: "Market";
|
__typename: "Market";
|
||||||
/**
|
/**
|
||||||
* Market ID
|
* Market ID
|
||||||
@ -118,7 +118,7 @@ export interface positions_party_positions_market {
|
|||||||
/**
|
/**
|
||||||
* marketData for the given market
|
* marketData for the given market
|
||||||
*/
|
*/
|
||||||
data: positions_party_positions_market_data | null;
|
data: Positions_party_positions_market_data | null;
|
||||||
/**
|
/**
|
||||||
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||||
* number denominated in the currency of the Market. (uint64)
|
* number denominated in the currency of the Market. (uint64)
|
||||||
@ -139,10 +139,10 @@ export interface positions_party_positions_market {
|
|||||||
/**
|
/**
|
||||||
* An instance of or reference to a tradable instrument.
|
* An instance of or reference to a tradable instrument.
|
||||||
*/
|
*/
|
||||||
tradableInstrument: positions_party_positions_market_tradableInstrument;
|
tradableInstrument: Positions_party_positions_market_tradableInstrument;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party_positions {
|
export interface Positions_party_positions {
|
||||||
__typename: "Position";
|
__typename: "Position";
|
||||||
/**
|
/**
|
||||||
* Realised Profit and Loss (int64)
|
* Realised Profit and Loss (int64)
|
||||||
@ -163,10 +163,10 @@ export interface positions_party_positions {
|
|||||||
/**
|
/**
|
||||||
* Market relating to this position
|
* Market relating to this position
|
||||||
*/
|
*/
|
||||||
market: positions_party_positions_market;
|
market: Positions_party_positions_market;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions_party {
|
export interface Positions_party {
|
||||||
__typename: "Party";
|
__typename: "Party";
|
||||||
/**
|
/**
|
||||||
* Party identifier
|
* Party identifier
|
||||||
@ -175,16 +175,16 @@ export interface positions_party {
|
|||||||
/**
|
/**
|
||||||
* Trading positions relating to a party
|
* Trading positions relating to a party
|
||||||
*/
|
*/
|
||||||
positions: positions_party_positions[] | null;
|
positions: Positions_party_positions[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positions {
|
export interface Positions {
|
||||||
/**
|
/**
|
||||||
* An entity that is trading on the VEGA network
|
* An entity that is trading on the VEGA network
|
||||||
*/
|
*/
|
||||||
party: positions_party | null;
|
party: Positions_party | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface positionsVariables {
|
export interface PositionsVariables {
|
||||||
partyId: string;
|
partyId: string;
|
||||||
}
|
}
|
@ -1,14 +1,14 @@
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import {
|
import {
|
||||||
positions,
|
Positions,
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
} from '../__generated__/positions';
|
} from '../__generated__/Positions';
|
||||||
import { makeDataProvider } from './generic-data-provider';
|
import { makeDataProvider } from './generic-data-provider';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
positionSubscribe,
|
PositionSubscribe,
|
||||||
positionSubscribe_positions,
|
PositionSubscribe_positions,
|
||||||
} from '../__generated__/positionSubscribe';
|
} from '../__generated__/PositionSubscribe';
|
||||||
|
|
||||||
const POSITIONS_FRAGMENT = gql`
|
const POSITIONS_FRAGMENT = gql`
|
||||||
fragment PositionDetails on Position {
|
fragment PositionDetails on Position {
|
||||||
@ -54,7 +54,7 @@ const POSITIONS_FRAGMENT = gql`
|
|||||||
|
|
||||||
const POSITION_QUERY = gql`
|
const POSITION_QUERY = gql`
|
||||||
${POSITIONS_FRAGMENT}
|
${POSITIONS_FRAGMENT}
|
||||||
query positions($partyId: ID!) {
|
query Positions($partyId: ID!) {
|
||||||
party(id: $partyId) {
|
party(id: $partyId) {
|
||||||
id
|
id
|
||||||
positions {
|
positions {
|
||||||
@ -66,7 +66,7 @@ const POSITION_QUERY = gql`
|
|||||||
|
|
||||||
export const POSITIONS_SUB = gql`
|
export const POSITIONS_SUB = gql`
|
||||||
${POSITIONS_FRAGMENT}
|
${POSITIONS_FRAGMENT}
|
||||||
subscription positionSubscribe($partyId: ID!) {
|
subscription PositionSubscribe($partyId: ID!) {
|
||||||
positions(partyId: $partyId) {
|
positions(partyId: $partyId) {
|
||||||
...PositionDetails
|
...PositionDetails
|
||||||
}
|
}
|
||||||
@ -74,8 +74,8 @@ export const POSITIONS_SUB = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const update = (
|
const update = (
|
||||||
draft: positions_party_positions[],
|
draft: Positions_party_positions[],
|
||||||
delta: positionSubscribe_positions
|
delta: PositionSubscribe_positions
|
||||||
) => {
|
) => {
|
||||||
const index = draft.findIndex((m) => m.market.id === delta.market.id);
|
const index = draft.findIndex((m) => m.market.id === delta.market.id);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@ -84,15 +84,15 @@ const update = (
|
|||||||
draft.push(delta);
|
draft.push(delta);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const getData = (responseData: positions): positions_party_positions[] | null =>
|
const getData = (responseData: Positions): Positions_party_positions[] | null =>
|
||||||
responseData.party ? responseData.party.positions : null;
|
responseData.party ? responseData.party.positions : null;
|
||||||
const getDelta = (
|
const getDelta = (
|
||||||
subscriptionData: positionSubscribe
|
subscriptionData: PositionSubscribe
|
||||||
): positionSubscribe_positions => subscriptionData.positions;
|
): PositionSubscribe_positions => subscriptionData.positions;
|
||||||
|
|
||||||
export const positionsDataProvider = makeDataProvider<
|
export const positionsDataProvider = makeDataProvider<
|
||||||
positions,
|
Positions,
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
positionSubscribe,
|
PositionSubscribe,
|
||||||
positionSubscribe_positions
|
PositionSubscribe_positions
|
||||||
>(POSITION_QUERY, POSITIONS_SUB, update, getData, getDelta);
|
>(POSITION_QUERY, POSITIONS_SUB, update, getData, getDelta);
|
||||||
|
@ -14,8 +14,8 @@ export * from './__generated__/Orders';
|
|||||||
export * from './__generated__/OrderSub';
|
export * from './__generated__/OrderSub';
|
||||||
export * from './__generated__/PartyAssetsQuery';
|
export * from './__generated__/PartyAssetsQuery';
|
||||||
export * from './__generated__/PositionDetails';
|
export * from './__generated__/PositionDetails';
|
||||||
export * from './__generated__/positions';
|
export * from './__generated__/Positions';
|
||||||
export * from './__generated__/positionSubscribe';
|
export * from './__generated__/PositionSubscribe';
|
||||||
export * from './__generated__/ProposalsQuery';
|
export * from './__generated__/ProposalsQuery';
|
||||||
|
|
||||||
export * from './data-providers';
|
export * from './data-providers';
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { act, render, screen } from '@testing-library/react';
|
import { act, render, screen } from '@testing-library/react';
|
||||||
import PositionsTable from './positions-table';
|
import PositionsTable from './positions-table';
|
||||||
import {
|
import {
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
MarketTradingMode,
|
MarketTradingMode,
|
||||||
} from '@vegaprotocol/graphql';
|
} from '@vegaprotocol/graphql';
|
||||||
|
|
||||||
const singleRow: positions_party_positions = {
|
const singleRow: Positions_party_positions = {
|
||||||
realisedPNL: '5',
|
realisedPNL: '5',
|
||||||
openVolume: '100',
|
openVolume: '100',
|
||||||
unrealisedPNL: '895000',
|
unrealisedPNL: '895000',
|
||||||
|
@ -11,12 +11,12 @@ import { AgGridColumn } from 'ag-grid-react';
|
|||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import compact from 'lodash/compact';
|
import compact from 'lodash/compact';
|
||||||
import {
|
import {
|
||||||
positions_party_positions,
|
Positions_party_positions,
|
||||||
MarketTradingMode,
|
MarketTradingMode,
|
||||||
} from '@vegaprotocol/graphql';
|
} from '@vegaprotocol/graphql';
|
||||||
|
|
||||||
interface PositionsTableProps {
|
interface PositionsTableProps {
|
||||||
data: positions_party_positions[];
|
data: Positions_party_positions[];
|
||||||
onRowClicked: (marketId: string) => void;
|
onRowClicked: (marketId: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ export const getRowNodeId = (data: { market: { id: string } }) =>
|
|||||||
data.market.id;
|
data.market.id;
|
||||||
|
|
||||||
const sortByName = (
|
const sortByName = (
|
||||||
a: positions_party_positions,
|
a: Positions_party_positions,
|
||||||
b: positions_party_positions
|
b: Positions_party_positions
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
a.market.tradableInstrument.instrument.name <
|
a.market.tradableInstrument.instrument.name <
|
||||||
@ -45,7 +45,7 @@ const sortByName = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
interface PositionsTableValueFormatterParams extends ValueFormatterParams {
|
interface PositionsTableValueFormatterParams extends ValueFormatterParams {
|
||||||
data: positions_party_positions;
|
data: Positions_party_positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PositionsTable = forwardRef<AgGridReact, PositionsTableProps>(
|
export const PositionsTable = forwardRef<AgGridReact, PositionsTableProps>(
|
||||||
@ -64,7 +64,7 @@ export const PositionsTable = forwardRef<AgGridReact, PositionsTableProps>(
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
}}
|
}}
|
||||||
onRowClicked={({ data }: { data: positions_party_positions }) =>
|
onRowClicked={({ data }: { data: Positions_party_positions }) =>
|
||||||
onRowClicked(getRowNodeId(data))
|
onRowClicked(getRowNodeId(data))
|
||||||
}
|
}
|
||||||
components={{ PriceCell }}
|
components={{ PriceCell }}
|
||||||
|
Loading…
Reference in New Issue
Block a user