fix: rename tradesPaged to tradesConnection (#770)

* fix: rename tradesPaged to tradesConnection

* fix: add missing import

* fix: remove config url from trading app so e2e test runs
This commit is contained in:
Matthew Russell 2022-07-15 11:12:20 +01:00 committed by GitHub
parent 4edcdb8f1f
commit ca56d9393a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 86 additions and 57 deletions

View File

@ -69,7 +69,6 @@ describe('markets table', () => {
cy.get('[role="gridcell"][col-id=data]').contains('Active').click(); cy.get('[role="gridcell"][col-id=data]').contains('Active').click();
cy.wait('@Market'); cy.wait('@Market');
cy.get('.ag-root-wrapper').should('be.visible');
cy.contains('ACTIVE MARKET'); cy.contains('ACTIVE MARKET');
cy.url().should('include', '/markets/market-0'); cy.url().should('include', '/markets/market-0');

View File

@ -46,7 +46,7 @@ describe('fills', () => {
]; ];
const result = generateFills({ const result = generateFills({
party: { party: {
tradesPaged: { tradesConnection: {
edges: fills.map((f, i) => { edges: fills.map((f, i) => {
return { return {
__typename: 'TradeEdge', __typename: 'TradeEdge',

View File

@ -1,13 +1,13 @@
import type { import type {
Fills, Fills,
Fills_party_tradesPaged_edges_node, Fills_party_tradesConnection_edges_node,
} from '@vegaprotocol/fills'; } from '@vegaprotocol/fills';
import { Side } from '@vegaprotocol/types'; import { Side } from '@vegaprotocol/types';
import merge from 'lodash/merge'; import merge from 'lodash/merge';
import type { PartialDeep } from 'type-fest'; import type { PartialDeep } from 'type-fest';
export const generateFills = (override?: PartialDeep<Fills>): Fills => { export const generateFills = (override?: PartialDeep<Fills>): Fills => {
const fills: Fills_party_tradesPaged_edges_node[] = [ const fills: Fills_party_tradesConnection_edges_node[] = [
generateFill({ generateFill({
buyer: { buyer: {
id: Cypress.env('VEGA_PUBLIC_KEY'), id: Cypress.env('VEGA_PUBLIC_KEY'),
@ -49,7 +49,7 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
const defaultResult: Fills = { const defaultResult: Fills = {
party: { party: {
id: 'buyer-id', id: 'buyer-id',
tradesPaged: { tradesConnection: {
__typename: 'TradeConnection', __typename: 'TradeConnection',
totalCount: 1, totalCount: 1,
edges: fills.map((f) => { edges: fills.map((f) => {
@ -73,9 +73,9 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
}; };
export const generateFill = ( export const generateFill = (
override?: PartialDeep<Fills_party_tradesPaged_edges_node> override?: PartialDeep<Fills_party_tradesConnection_edges_node>
) => { ) => {
const defaultFill: Fills_party_tradesPaged_edges_node = { const defaultFill: Fills_party_tradesConnection_edges_node = {
__typename: 'Trade', __typename: 'Trade',
id: '0', id: '0',
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),

View File

@ -1,6 +1,5 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,6 +1,5 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
NX_VEGA_URL=https://lb.testnet.vega.xyz/query NX_VEGA_URL=https://lb.testnet.vega.xyz/query
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8

View File

@ -9,7 +9,7 @@ import { Pagination, Side } from "@vegaprotocol/types";
// GraphQL query operation: Fills // GraphQL query operation: Fills
// ==================================================== // ====================================================
export interface Fills_party_tradesPaged_edges_node_buyer { export interface Fills_party_tradesConnection_edges_node_buyer {
__typename: "Party"; __typename: "Party";
/** /**
* Party identifier * Party identifier
@ -17,7 +17,7 @@ export interface Fills_party_tradesPaged_edges_node_buyer {
id: string; id: string;
} }
export interface Fills_party_tradesPaged_edges_node_seller { export interface Fills_party_tradesConnection_edges_node_seller {
__typename: "Party"; __typename: "Party";
/** /**
* Party identifier * Party identifier
@ -25,7 +25,7 @@ export interface Fills_party_tradesPaged_edges_node_seller {
id: string; id: string;
} }
export interface Fills_party_tradesPaged_edges_node_buyerFee { export interface Fills_party_tradesConnection_edges_node_buyerFee {
__typename: "TradeFee"; __typename: "TradeFee";
/** /**
* The maker fee, aggressive party to the other party (the one who had an order in the book) * The maker fee, aggressive party to the other party (the one who had an order in the book)
@ -41,7 +41,7 @@ export interface Fills_party_tradesPaged_edges_node_buyerFee {
liquidityFee: string; liquidityFee: string;
} }
export interface Fills_party_tradesPaged_edges_node_sellerFee { export interface Fills_party_tradesConnection_edges_node_sellerFee {
__typename: "TradeFee"; __typename: "TradeFee";
/** /**
* The maker fee, aggressive party to the other party (the one who had an order in the book) * The maker fee, aggressive party to the other party (the one who had an order in the book)
@ -57,7 +57,7 @@ export interface Fills_party_tradesPaged_edges_node_sellerFee {
liquidityFee: string; liquidityFee: string;
} }
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset { export interface Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The id of the asset
@ -73,15 +73,15 @@ export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_in
decimals: number; decimals: number;
} }
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product { export interface Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product {
__typename: "Future"; __typename: "Future";
/** /**
* The name of the asset (string) * The name of the asset (string)
*/ */
settlementAsset: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset; settlementAsset: Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product_settlementAsset;
} }
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument { export interface Fills_party_tradesConnection_edges_node_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)
@ -94,18 +94,18 @@ export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_in
/** /**
* 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: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product; product: Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product;
} }
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument { export interface Fills_party_tradesConnection_edges_node_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: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument; instrument: Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument;
} }
export interface Fills_party_tradesPaged_edges_node_market { export interface Fills_party_tradesConnection_edges_node_market {
__typename: "Market"; __typename: "Market";
/** /**
* Market ID * Market ID
@ -141,10 +141,10 @@ export interface Fills_party_tradesPaged_edges_node_market {
/** /**
* An instance of or reference to a tradable instrument. * An instance of or reference to a tradable instrument.
*/ */
tradableInstrument: Fills_party_tradesPaged_edges_node_market_tradableInstrument; tradableInstrument: Fills_party_tradesConnection_edges_node_market_tradableInstrument;
} }
export interface Fills_party_tradesPaged_edges_node { export interface Fills_party_tradesConnection_edges_node {
__typename: "Trade"; __typename: "Trade";
/** /**
* The hash of the trade data * The hash of the trade data
@ -177,38 +177,38 @@ export interface Fills_party_tradesPaged_edges_node {
/** /**
* The party that bought * The party that bought
*/ */
buyer: Fills_party_tradesPaged_edges_node_buyer; buyer: Fills_party_tradesConnection_edges_node_buyer;
/** /**
* The party that sold * The party that sold
*/ */
seller: Fills_party_tradesPaged_edges_node_seller; seller: Fills_party_tradesConnection_edges_node_seller;
/** /**
* The fee paid by the buyer side of the trade * The fee paid by the buyer side of the trade
*/ */
buyerFee: Fills_party_tradesPaged_edges_node_buyerFee; buyerFee: Fills_party_tradesConnection_edges_node_buyerFee;
/** /**
* The fee paid by the seller side of the trade * The fee paid by the seller side of the trade
*/ */
sellerFee: Fills_party_tradesPaged_edges_node_sellerFee; sellerFee: Fills_party_tradesConnection_edges_node_sellerFee;
/** /**
* The market the trade occurred on * The market the trade occurred on
*/ */
market: Fills_party_tradesPaged_edges_node_market; market: Fills_party_tradesConnection_edges_node_market;
} }
export interface Fills_party_tradesPaged_edges { export interface Fills_party_tradesConnection_edges {
__typename: "TradeEdge"; __typename: "TradeEdge";
node: Fills_party_tradesPaged_edges_node; node: Fills_party_tradesConnection_edges_node;
cursor: string; cursor: string;
} }
export interface Fills_party_tradesPaged_pageInfo { export interface Fills_party_tradesConnection_pageInfo {
__typename: "PageInfo"; __typename: "PageInfo";
startCursor: string; startCursor: string;
endCursor: string; endCursor: string;
} }
export interface Fills_party_tradesPaged { export interface Fills_party_tradesConnection {
__typename: "TradeConnection"; __typename: "TradeConnection";
/** /**
* The total number of trades in this connection * The total number of trades in this connection
@ -217,11 +217,11 @@ export interface Fills_party_tradesPaged {
/** /**
* The trade in this connection * The trade in this connection
*/ */
edges: Fills_party_tradesPaged_edges[]; edges: Fills_party_tradesConnection_edges[];
/** /**
* The pagination information * The pagination information
*/ */
pageInfo: Fills_party_tradesPaged_pageInfo; pageInfo: Fills_party_tradesConnection_pageInfo;
} }
export interface Fills_party { export interface Fills_party {
@ -230,7 +230,7 @@ export interface Fills_party {
* Party identifier * Party identifier
*/ */
id: string; id: string;
tradesPaged: Fills_party_tradesPaged; tradesConnection: Fills_party_tradesConnection;
} }
export interface Fills { export interface Fills {

View File

@ -5,7 +5,7 @@ import type { PageInfo, Pagination } from '@vegaprotocol/react-helpers';
import type { FillFields } from './__generated__/FillFields'; import type { FillFields } from './__generated__/FillFields';
import type { import type {
Fills, Fills,
Fills_party_tradesPaged_edges, Fills_party_tradesConnection_edges,
} from './__generated__/Fills'; } from './__generated__/Fills';
import type { FillsSub } from './__generated__/FillsSub'; import type { FillsSub } from './__generated__/FillsSub';
@ -17,19 +17,41 @@ const FILL_FRAGMENT = gql`
size size
buyOrder buyOrder
sellOrder sellOrder
aggressor
buyer { buyer {
id id
} }
seller { seller {
id id
} }
buyerFee {
makerFee
infrastructureFee
liquidityFee
}
sellerFee {
makerFee
infrastructureFee
liquidityFee
}
market { market {
id id
name
decimalPlaces decimalPlaces
positionDecimalPlaces
tradableInstrument { tradableInstrument {
instrument { instrument {
id id
code code
product {
... on Future {
settlementAsset {
id
symbol
decimals
}
}
}
} }
} }
} }
@ -41,7 +63,7 @@ export const FILLS_QUERY = gql`
query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) { query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
party(id: $partyId) { party(id: $partyId) {
id id
tradesPaged(marketId: $marketId, pagination: $pagination) { tradesConnection(marketId: $marketId, pagination: $pagination) {
totalCount totalCount
edges { edges {
node { node {
@ -67,7 +89,10 @@ export const FILLS_SUB = gql`
} }
`; `;
const update = (data: Fills_party_tradesPaged_edges[], delta: FillFields[]) => { const update = (
data: Fills_party_tradesConnection_edges[],
delta: FillFields[]
) => {
return produce(data, (draft) => { return produce(data, (draft) => {
delta.forEach((node) => { delta.forEach((node) => {
const index = draft.findIndex((edge) => edge.node.id === node.id); const index = draft.findIndex((edge) => edge.node.id === node.id);
@ -80,21 +105,23 @@ const update = (data: Fills_party_tradesPaged_edges[], delta: FillFields[]) => {
}); });
}; };
const getData = (responseData: Fills): Fills_party_tradesPaged_edges[] | null => const getData = (
responseData.party?.tradesPaged.edges || null; responseData: Fills
): Fills_party_tradesConnection_edges[] | null =>
responseData.party?.tradesConnection.edges || null;
const getPageInfo = (responseData: Fills): PageInfo | null => const getPageInfo = (responseData: Fills): PageInfo | null =>
responseData.party?.tradesPaged.pageInfo || null; responseData.party?.tradesConnection.pageInfo || null;
const getTotalCount = (responseData: Fills): number | undefined => const getTotalCount = (responseData: Fills): number | undefined =>
responseData.party?.tradesPaged.totalCount; responseData.party?.tradesConnection.totalCount;
const getDelta = (subscriptionData: FillsSub) => subscriptionData.trades || []; const getDelta = (subscriptionData: FillsSub) => subscriptionData.trades || [];
const append = ( const append = (
data: Fills_party_tradesPaged_edges[] | null, data: Fills_party_tradesConnection_edges[] | null,
pageInfo: PageInfo, pageInfo: PageInfo,
insertionData: Fills_party_tradesPaged_edges[] | null, insertionData: Fills_party_tradesConnection_edges[] | null,
insertionPageInfo: PageInfo | null, insertionPageInfo: PageInfo | null,
pagination?: Pagination pagination?: Pagination
) => { ) => {

View File

@ -6,7 +6,7 @@ import { FillsTable } from './fills-table';
import type { IGetRowsParams } from 'ag-grid-community'; import type { IGetRowsParams } from 'ag-grid-community';
import { fillsDataProvider as dataProvider } from './fills-data-provider'; import { fillsDataProvider as dataProvider } from './fills-data-provider';
import type { Fills_party_tradesPaged_edges } from './__generated__/Fills'; import type { Fills_party_tradesConnection_edges } from './__generated__/Fills';
import type { FillsSub_trades } from './__generated__/FillsSub'; import type { FillsSub_trades } from './__generated__/FillsSub';
interface FillsManagerProps { interface FillsManagerProps {
@ -15,11 +15,11 @@ interface FillsManagerProps {
export const FillsManager = ({ partyId }: FillsManagerProps) => { export const FillsManager = ({ partyId }: FillsManagerProps) => {
const gridRef = useRef<AgGridReact | null>(null); const gridRef = useRef<AgGridReact | null>(null);
const dataRef = useRef<Fills_party_tradesPaged_edges[] | null>(null); const dataRef = useRef<Fills_party_tradesConnection_edges[] | null>(null);
const totalCountRef = useRef<number | undefined>(undefined); const totalCountRef = useRef<number | undefined>(undefined);
const update = useCallback( const update = useCallback(
({ data }: { data: Fills_party_tradesPaged_edges[] }) => { ({ data }: { data: Fills_party_tradesConnection_edges[] }) => {
if (!gridRef.current?.api) { if (!gridRef.current?.api) {
return false; return false;
} }
@ -35,7 +35,7 @@ export const FillsManager = ({ partyId }: FillsManagerProps) => {
data, data,
totalCount, totalCount,
}: { }: {
data: Fills_party_tradesPaged_edges[]; data: Fills_party_tradesConnection_edges[];
totalCount?: number; totalCount?: number;
}) => { }) => {
dataRef.current = data; dataRef.current = data;
@ -48,7 +48,7 @@ export const FillsManager = ({ partyId }: FillsManagerProps) => {
const variables = useMemo(() => ({ partyId }), [partyId]); const variables = useMemo(() => ({ partyId }), [partyId]);
const { data, error, loading, load, totalCount } = useDataProvider< const { data, error, loading, load, totalCount } = useDataProvider<
Fills_party_tradesPaged_edges[], Fills_party_tradesConnection_edges[],
FillsSub_trades[] FillsSub_trades[]
>({ dataProvider, update, insert, variables }); >({ dataProvider, update, insert, variables });
totalCountRef.current = totalCount; totalCountRef.current = totalCount;

View File

@ -16,7 +16,7 @@ Default.args = {
partyId: 'party-id', partyId: 'party-id',
datasource: { datasource: {
getRows: makeGetRows( getRows: makeGetRows(
fills.party?.tradesPaged.edges.map((e) => e.node) || [] fills.party?.tradesConnection.edges.map((e) => e.node) || []
), ),
}, },
}; };

View File

@ -1,14 +1,14 @@
import { Side } from '@vegaprotocol/types';
import merge from 'lodash/merge'; import merge from 'lodash/merge';
import type { IGetRowsParams } from 'ag-grid-community'; import type { IGetRowsParams } from 'ag-grid-community';
import type { PartialDeep } from 'type-fest'; import type { PartialDeep } from 'type-fest';
import type { import type {
Fills, Fills,
Fills_party_tradesPaged_edges_node, Fills_party_tradesConnection_edges_node,
} from './__generated__/Fills'; } from './__generated__/Fills';
import { Side } from '@vegaprotocol/types';
export const generateFills = (override?: PartialDeep<Fills>): Fills => { export const generateFills = (override?: PartialDeep<Fills>): Fills => {
const fills: Fills_party_tradesPaged_edges_node[] = [ const fills: Fills_party_tradesConnection_edges_node[] = [
generateFill({ generateFill({
buyer: { buyer: {
id: 'party-id', id: 'party-id',
@ -50,7 +50,7 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
const defaultResult: Fills = { const defaultResult: Fills = {
party: { party: {
id: 'buyer-id', id: 'buyer-id',
tradesPaged: { tradesConnection: {
__typename: 'TradeConnection', __typename: 'TradeConnection',
totalCount: 1, totalCount: 1,
edges: fills.map((f) => { edges: fills.map((f) => {
@ -74,9 +74,9 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
}; };
export const generateFill = ( export const generateFill = (
override?: PartialDeep<Fills_party_tradesPaged_edges_node> override?: PartialDeep<Fills_party_tradesConnection_edges_node>
) => { ) => {
const defaultFill: Fills_party_tradesPaged_edges_node = { const defaultFill: Fills_party_tradesConnection_edges_node = {
__typename: 'Trade', __typename: 'Trade',
id: '0', id: '0',
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
@ -135,7 +135,7 @@ export const generateFill = (
}; };
export const makeGetRows = export const makeGetRows =
(data: Fills_party_tradesPaged_edges_node[]) => (data: Fills_party_tradesConnection_edges_node[]) =>
({ successCallback }: IGetRowsParams) => { ({ successCallback }: IGetRowsParams) => {
successCallback(data, data.length); successCallback(data, data.length);
}; };

View File

@ -110,6 +110,7 @@ export enum MarketTradingMode {
BatchAuction = "BatchAuction", BatchAuction = "BatchAuction",
Continuous = "Continuous", Continuous = "Continuous",
MonitoringAuction = "MonitoringAuction", MonitoringAuction = "MonitoringAuction",
NoTrading = "NoTrading",
OpeningAuction = "OpeningAuction", OpeningAuction = "OpeningAuction",
} }
@ -211,6 +212,7 @@ export enum ProposalRejectionReason {
EnactTimeTooLate = "EnactTimeTooLate", EnactTimeTooLate = "EnactTimeTooLate",
EnactTimeTooSoon = "EnactTimeTooSoon", EnactTimeTooSoon = "EnactTimeTooSoon",
IncompatibleTimestamps = "IncompatibleTimestamps", IncompatibleTimestamps = "IncompatibleTimestamps",
InsufficientEquityLikeShare = "InsufficientEquityLikeShare",
InsufficientTokens = "InsufficientTokens", InsufficientTokens = "InsufficientTokens",
InvalidAsset = "InvalidAsset", InvalidAsset = "InvalidAsset",
InvalidAssetDetails = "InvalidAssetDetails", InvalidAssetDetails = "InvalidAssetDetails",
@ -218,6 +220,7 @@ export enum ProposalRejectionReason {
InvalidFutureMaturityTimestamp = "InvalidFutureMaturityTimestamp", InvalidFutureMaturityTimestamp = "InvalidFutureMaturityTimestamp",
InvalidFutureProduct = "InvalidFutureProduct", InvalidFutureProduct = "InvalidFutureProduct",
InvalidInstrumentSecurity = "InvalidInstrumentSecurity", InvalidInstrumentSecurity = "InvalidInstrumentSecurity",
InvalidMarket = "InvalidMarket",
InvalidRiskParameter = "InvalidRiskParameter", InvalidRiskParameter = "InvalidRiskParameter",
InvalidShape = "InvalidShape", InvalidShape = "InvalidShape",
MajorityThresholdNotReached = "MajorityThresholdNotReached", MajorityThresholdNotReached = "MajorityThresholdNotReached",
@ -236,6 +239,8 @@ export enum ProposalRejectionReason {
OpeningAuctionDurationTooSmall = "OpeningAuctionDurationTooSmall", OpeningAuctionDurationTooSmall = "OpeningAuctionDurationTooSmall",
ParticipationThresholdNotReached = "ParticipationThresholdNotReached", ParticipationThresholdNotReached = "ParticipationThresholdNotReached",
ProductMaturityIsPassed = "ProductMaturityIsPassed", ProductMaturityIsPassed = "ProductMaturityIsPassed",
TooManyMarketDecimalPlaces = "TooManyMarketDecimalPlaces",
TooManyPriceMonitoringTriggers = "TooManyPriceMonitoringTriggers",
UnsupportedProduct = "UnsupportedProduct", UnsupportedProduct = "UnsupportedProduct",
UnsupportedTradingMode = "UnsupportedTradingMode", UnsupportedTradingMode = "UnsupportedTradingMode",
} }