Compare commits
6
Commits
foo
...
fix/api-changes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
308bd406a6 | ||
|
|
4ffff8a9c7 | ||
|
|
ac4b48610c | ||
|
|
2b28b29820 | ||
|
|
bf5e428460 | ||
|
|
73359e9ff7 |
@@ -68,5 +68,5 @@ export interface Deposits {
|
||||
/**
|
||||
* The list of all assets in use in the Vega network or the specified asset if ID is provided
|
||||
*/
|
||||
assetsConnection: Deposits_assetsConnection;
|
||||
assetsConnection: Deposits_assetsConnection | null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type DepositsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type DepositsQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } };
|
||||
export type DepositsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null };
|
||||
|
||||
|
||||
export const DepositsDocument = gql`
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
fragment SimpleMarketDataFields on MarketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
}
|
||||
fragment SimpleMarketDataFields on ObservableMarketData {
|
||||
marketId
|
||||
marketState
|
||||
}
|
||||
|
||||
query SimpleMarkets($CandleSince: String!) {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
state
|
||||
data {
|
||||
...SimpleMarketDataFields
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
code
|
||||
metadata {
|
||||
tags
|
||||
@@ -37,8 +32,8 @@ query SimpleMarkets($CandleSince: String!) {
|
||||
}
|
||||
}
|
||||
|
||||
subscription SimpleMarketDataSub {
|
||||
marketData {
|
||||
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
...SimpleMarketDataFields
|
||||
}
|
||||
}
|
||||
|
||||
Generated
-30
@@ -1,30 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { MarketState } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: SimpleMarketDataFields
|
||||
// ====================================================
|
||||
|
||||
export interface SimpleMarketDataFields_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Current state of the market
|
||||
*/
|
||||
state: MarketState;
|
||||
}
|
||||
|
||||
export interface SimpleMarketDataFields {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
*/
|
||||
market: SimpleMarketDataFields_market;
|
||||
}
|
||||
Generated
+10
-14
@@ -9,29 +9,25 @@ import { MarketState } from "@vegaprotocol/types";
|
||||
// GraphQL subscription operation: SimpleMarketDataSub
|
||||
// ====================================================
|
||||
|
||||
export interface SimpleMarketDataSub_marketData_market {
|
||||
__typename: "Market";
|
||||
export interface SimpleMarketDataSub_marketsData {
|
||||
__typename: "ObservableMarketData";
|
||||
/**
|
||||
* Market ID
|
||||
* current state of the market
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Current state of the market
|
||||
*/
|
||||
state: MarketState;
|
||||
}
|
||||
|
||||
export interface SimpleMarketDataSub_marketData {
|
||||
__typename: "MarketData";
|
||||
marketState: MarketState;
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
*/
|
||||
market: SimpleMarketDataSub_marketData_market;
|
||||
marketId: string;
|
||||
}
|
||||
|
||||
export interface SimpleMarketDataSub {
|
||||
/**
|
||||
* Subscribe to the mark price changes
|
||||
*/
|
||||
marketData: SimpleMarketDataSub_marketData;
|
||||
marketsData: SimpleMarketDataSub_marketsData[];
|
||||
}
|
||||
|
||||
export interface SimpleMarketDataSubVariables {
|
||||
marketIds: string[];
|
||||
}
|
||||
|
||||
+15
-17
@@ -3,39 +3,36 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type SimpleMarketDataFieldsFragment = { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } };
|
||||
export type SimpleMarketDataFieldsFragment = { __typename?: 'ObservableMarketData', marketId: string, marketState: Types.MarketState };
|
||||
|
||||
export type SimpleMarketsQueryVariables = Types.Exact<{
|
||||
CandleSince: Types.Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
export type SimpleMarketsQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, state: Types.MarketState, data?: { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', symbol: string } } } }, candles?: Array<{ __typename?: 'Candle', open: string, close: string } | null> | null }> | null };
|
||||
export type SimpleMarketsQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', symbol: string } } } }, candles?: Array<{ __typename?: 'Candle', open: string, close: string } | null> | null }> | null };
|
||||
|
||||
export type SimpleMarketDataSubSubscriptionVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
export type SimpleMarketDataSubSubscriptionVariables = Types.Exact<{
|
||||
marketIds: Array<Types.Scalars['ID']> | Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type SimpleMarketDataSubSubscription = { __typename?: 'Subscription', marketData: { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } } };
|
||||
export type SimpleMarketDataSubSubscription = { __typename?: 'Subscription', marketsData: Array<{ __typename?: 'ObservableMarketData', marketId: string, marketState: Types.MarketState }> };
|
||||
|
||||
export const SimpleMarketDataFieldsFragmentDoc = gql`
|
||||
fragment SimpleMarketDataFields on MarketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
}
|
||||
fragment SimpleMarketDataFields on ObservableMarketData {
|
||||
marketId
|
||||
marketState
|
||||
}
|
||||
`;
|
||||
export const SimpleMarketsDocument = gql`
|
||||
query SimpleMarkets($CandleSince: String!) {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
state
|
||||
data {
|
||||
...SimpleMarketDataFields
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
code
|
||||
metadata {
|
||||
tags
|
||||
@@ -57,7 +54,7 @@ export const SimpleMarketsDocument = gql`
|
||||
}
|
||||
}
|
||||
}
|
||||
${SimpleMarketDataFieldsFragmentDoc}`;
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useSimpleMarketsQuery__
|
||||
@@ -87,8 +84,8 @@ export type SimpleMarketsQueryHookResult = ReturnType<typeof useSimpleMarketsQue
|
||||
export type SimpleMarketsLazyQueryHookResult = ReturnType<typeof useSimpleMarketsLazyQuery>;
|
||||
export type SimpleMarketsQueryResult = Apollo.QueryResult<SimpleMarketsQuery, SimpleMarketsQueryVariables>;
|
||||
export const SimpleMarketDataSubDocument = gql`
|
||||
subscription SimpleMarketDataSub {
|
||||
marketData {
|
||||
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
...SimpleMarketDataFields
|
||||
}
|
||||
}
|
||||
@@ -106,10 +103,11 @@ export const SimpleMarketDataSubDocument = gql`
|
||||
* @example
|
||||
* const { data, loading, error } = useSimpleMarketDataSubSubscription({
|
||||
* variables: {
|
||||
* marketIds: // value for 'marketIds'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useSimpleMarketDataSubSubscription(baseOptions?: Apollo.SubscriptionHookOptions<SimpleMarketDataSubSubscription, SimpleMarketDataSubSubscriptionVariables>) {
|
||||
export function useSimpleMarketDataSubSubscription(baseOptions: Apollo.SubscriptionHookOptions<SimpleMarketDataSubSubscription, SimpleMarketDataSubSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<SimpleMarketDataSubSubscription, SimpleMarketDataSubSubscriptionVariables>(SimpleMarketDataSubDocument, options);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,10 @@ export const MARKETS_QUERY = gql`
|
||||
`;
|
||||
|
||||
const MARKET_DATA_SUB = gql`
|
||||
subscription SimpleMarketDataSub {
|
||||
marketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
}
|
||||
subscription SimpleMarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
marketState
|
||||
marketId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -103,7 +103,7 @@ export interface PartyMarketData_party {
|
||||
/**
|
||||
* Margin levels for a market
|
||||
*/
|
||||
marginsConnection: PartyMarketData_party_marginsConnection;
|
||||
marginsConnection: PartyMarketData_party_marginsConnection | null;
|
||||
}
|
||||
|
||||
export interface PartyMarketData {
|
||||
|
||||
@@ -91,7 +91,7 @@ export interface MarketPositions_party {
|
||||
/**
|
||||
* Trading positions relating to a party
|
||||
*/
|
||||
positionsConnection: MarketPositions_party_positionsConnection;
|
||||
positionsConnection: MarketPositions_party_positionsConnection | null;
|
||||
}
|
||||
|
||||
export interface MarketPositions {
|
||||
|
||||
@@ -8,7 +8,7 @@ export type MarketPositionsQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketPositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, positionsConnection: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', openVolume: string, market: { __typename?: 'Market', id: string } } }> | null } } | null };
|
||||
export type MarketPositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, positionsConnection?: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', openVolume: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
|
||||
|
||||
export const MarketPositionsDocument = gql`
|
||||
|
||||
@@ -8,7 +8,7 @@ export type PartyMarketDataQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type PartyMarketDataQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, marginsConnection: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', initialLevel: string, maintenanceLevel: string, searchLevel: string, market: { __typename?: 'Market', id: string } } }> | null } } | null };
|
||||
export type PartyMarketDataQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, marginsConnection?: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', initialLevel: string, maintenanceLevel: string, searchLevel: string, market: { __typename?: 'Market', id: string } } }> | null } | null } | null };
|
||||
|
||||
|
||||
export const PartyMarketDataDocument = gql`
|
||||
|
||||
@@ -96,5 +96,5 @@ export interface AssetsQuery {
|
||||
/**
|
||||
* The list of all assets in use in the Vega network or the specified asset if ID is provided
|
||||
*/
|
||||
assetsConnection: AssetsQuery_assetsConnection;
|
||||
assetsConnection: AssetsQuery_assetsConnection | null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type AssetsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } } } | null> | null } };
|
||||
export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } } } | null> | null } | null };
|
||||
|
||||
|
||||
export const AssetsQueryDocument = gql`
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import compact from 'lodash/compact';
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { getAssets, t } from '@vegaprotocol/react-helpers';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import React from 'react';
|
||||
import { RouteTitle } from '../../components/route-title';
|
||||
import { SubHeading } from '../../components/sub-heading';
|
||||
@@ -39,7 +40,7 @@ export const ASSETS_QUERY = gql`
|
||||
const Assets = () => {
|
||||
const { data } = useQuery<AssetsQuery>(ASSETS_QUERY);
|
||||
|
||||
const assets = getAssets(data);
|
||||
const assets = compact(data?.assetsConnection?.edges).map((e) => e.node);
|
||||
|
||||
return (
|
||||
<section>
|
||||
|
||||
@@ -302,5 +302,5 @@ export interface ProposalsQuery {
|
||||
/**
|
||||
* All governance proposals in the Vega network
|
||||
*/
|
||||
proposalsConnection: ProposalsQuery_proposalsConnection;
|
||||
proposalsConnection: ProposalsQuery_proposalsConnection | null;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import compact from 'lodash/compact';
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import React from 'react';
|
||||
@@ -99,9 +100,10 @@ const Governance = () => {
|
||||
const { data } = useQuery<ProposalsQuery>(PROPOSALS_QUERY, {
|
||||
errorPolicy: 'ignore',
|
||||
});
|
||||
const proposals = getProposals(
|
||||
data
|
||||
) as ProposalsQuery_proposalsConnection_edges_node[];
|
||||
|
||||
const proposals = compact(data?.proposalsConnection?.edges).map(
|
||||
(e) => e.node
|
||||
);
|
||||
|
||||
if (!data) return null;
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
query MarketsQuery {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
fees {
|
||||
factors {
|
||||
makerFee
|
||||
|
||||
@@ -6,14 +6,13 @@ const defaultOptions = {} as const;
|
||||
export type MarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'Account', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null };
|
||||
export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'Account', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null };
|
||||
|
||||
|
||||
export const MarketsQueryDocument = gql`
|
||||
query MarketsQuery {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
fees {
|
||||
factors {
|
||||
makerFee
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct_
|
||||
export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct {
|
||||
__typename: "FutureProduct";
|
||||
/**
|
||||
* Product asset ID
|
||||
* Product asset
|
||||
*/
|
||||
settlementAsset: ProposalFields_terms_change_NewMarket_instrument_futureProduct_settlementAsset;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export type ProposalQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type ProposalQuery = { __typename?: 'Query', proposal: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', name: string, symbol: string, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array<string> | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } } };
|
||||
export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', name: string, symbol: string, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array<string> | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } } | null };
|
||||
|
||||
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ProposalVotesTable } from '../proposal-votes-table';
|
||||
import { VoteDetails } from '../vote-details';
|
||||
|
||||
interface ProposalProps {
|
||||
proposal: Proposal_proposal;
|
||||
proposal: Proposal_proposal | null;
|
||||
}
|
||||
|
||||
export const Proposal = ({ proposal }: ProposalProps) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu
|
||||
export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct {
|
||||
__typename: "FutureProduct";
|
||||
/**
|
||||
* Product asset ID
|
||||
* Product asset
|
||||
*/
|
||||
settlementAsset: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_settlementAsset;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ export interface Proposal {
|
||||
/**
|
||||
* A governance proposal located by either its ID or reference. If both are set, ID is used.
|
||||
*/
|
||||
proposal: Proposal_proposal;
|
||||
proposal: Proposal_proposal | null;
|
||||
}
|
||||
|
||||
export interface ProposalVariables {
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket
|
||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct {
|
||||
__typename: "FutureProduct";
|
||||
/**
|
||||
* Product asset ID
|
||||
* Product asset
|
||||
*/
|
||||
settlementAsset: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct_settlementAsset;
|
||||
}
|
||||
@@ -334,5 +334,5 @@ export interface Proposals {
|
||||
/**
|
||||
* All governance proposals in the Vega network
|
||||
*/
|
||||
proposalsConnection: Proposals_proposalsConnection;
|
||||
proposalsConnection: Proposals_proposalsConnection | null;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import compact from 'lodash/compact';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { gql, useQuery } from '@apollo/client';
|
||||
import { getNotRejectedProposals } from '@vegaprotocol/governance';
|
||||
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||
import { useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { SplashLoader } from '../../../components/splash-loader';
|
||||
import { ProposalsList } from '../components/proposals-list';
|
||||
import { PROPOSAL_FRAGMENT } from '../proposal-fragment';
|
||||
import type { Proposals } from './__generated__/Proposals';
|
||||
import { ProposalState } from '@vegaprotocol/types';
|
||||
|
||||
export const PROPOSALS_QUERY = gql`
|
||||
${PROPOSAL_FRAGMENT}
|
||||
@@ -30,7 +31,18 @@ export const ProposalsContainer = () => {
|
||||
errorPolicy: 'ignore',
|
||||
});
|
||||
|
||||
const proposals = useMemo(() => getNotRejectedProposals(data), [data]);
|
||||
const proposals = compact(data?.proposalsConnection?.edges)
|
||||
.map((e) => e.node)
|
||||
.filter((p) => p.state !== ProposalState.STATE_REJECTED);
|
||||
const orderedProposals = orderBy(
|
||||
proposals,
|
||||
[
|
||||
(p) => new Date(p.terms.enactmentDatetime || 0).getTime(), // has to be defaulted to 0 because new Date(null).getTime() -> NaN which is first when ordered.
|
||||
(p) => new Date(p.terms.closingDatetime).getTime(),
|
||||
(p) => p.id,
|
||||
],
|
||||
['desc', 'desc', 'desc']
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
@@ -48,5 +60,5 @@ export const ProposalsContainer = () => {
|
||||
);
|
||||
}
|
||||
|
||||
return <ProposalsList proposals={proposals} />;
|
||||
return <ProposalsList proposals={orderedProposals} />;
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import compact from 'lodash/compact';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||
import { useMemo } from 'react';
|
||||
@@ -5,15 +7,26 @@ import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { SplashLoader } from '../../../components/splash-loader';
|
||||
import { RejectedProposalsList } from '../components/proposals-list';
|
||||
import { getRejectedProposals } from '@vegaprotocol/governance';
|
||||
import { PROPOSALS_QUERY } from '../proposals';
|
||||
import type { Proposals } from '../proposals/__generated__/Proposals';
|
||||
import { ProposalState } from '@vegaprotocol/types';
|
||||
|
||||
export const RejectedProposalsContainer = () => {
|
||||
const { t } = useTranslation();
|
||||
const { data, loading, error } = useQuery<Proposals>(PROPOSALS_QUERY);
|
||||
|
||||
const proposals = useMemo(() => getRejectedProposals(data), [data]);
|
||||
const proposals = compact(data?.proposalsConnection?.edges)
|
||||
.map((e) => e.node)
|
||||
.filter((p) => p.state === ProposalState.STATE_REJECTED);
|
||||
const orderedProposals = orderBy(
|
||||
proposals,
|
||||
[
|
||||
(p) => new Date(p.terms.enactmentDatetime || 0).getTime(), // has to be defaulted to 0 because new Date(null).getTime() -> NaN which is first when ordered.
|
||||
(p) => new Date(p.terms.closingDatetime).getTime(),
|
||||
(p) => p.id,
|
||||
],
|
||||
['desc', 'desc', 'desc']
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
@@ -31,5 +44,5 @@ export const RejectedProposalsContainer = () => {
|
||||
);
|
||||
}
|
||||
|
||||
return <RejectedProposalsList proposals={proposals} />;
|
||||
return <RejectedProposalsList proposals={orderedProposals} />;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('markets table', () => {
|
||||
}
|
||||
|
||||
function verifyMarketSummaryDisplayed() {
|
||||
const marketSummaryBlock = 'market-summary';
|
||||
const marketSummaryBlock = 'header-summary';
|
||||
const percentageValue = 'price-change-percentage';
|
||||
const priceChangeValue = 'price-change';
|
||||
const tradingVolume = 'trading-volume';
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql
|
||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
||||
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://ropsten.etherscan.io
|
||||
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const Footer = () => {
|
||||
return (
|
||||
<footer className="px-4 py-2 text-xs border-t border-neutral-300 dark:border-neutral-600 bg-neutral-100 dark:bg-neutral-800">
|
||||
<footer className="px-4 py-2 text-xs border-t border-default bg-neutral-100 dark:bg-neutral-800">
|
||||
<div className="flex justify-between">
|
||||
<div>Status</div>
|
||||
</div>
|
||||
|
||||
@@ -5,19 +5,20 @@ import { cloneElement } from 'react';
|
||||
|
||||
interface TradeMarketHeaderProps {
|
||||
title: ReactNode;
|
||||
children: ReactElement[];
|
||||
children: Array<ReactElement | null>;
|
||||
}
|
||||
|
||||
export const Header = ({ title, children }: TradeMarketHeaderProps) => {
|
||||
return (
|
||||
<header className="w-screen xl:px-4 pt-4 border-b border-neutral-300 dark:border-neutral-600">
|
||||
<header className="w-screen xl:px-4 pt-4 border-b border-default">
|
||||
<div className="xl:flex xl:gap-4 items-start">
|
||||
<div className="px-4 mb-2">{title}</div>
|
||||
<div className="mb-4 xl:mb-0">{title}</div>
|
||||
<div
|
||||
data-testid="market-summary"
|
||||
data-testid="header-summary"
|
||||
className="flex flex-nowrap items-start xl:flex-1 w-full overflow-x-auto text-xs "
|
||||
>
|
||||
{Children.map(children, (child, index) => {
|
||||
if (!child) return null;
|
||||
return cloneElement(child, {
|
||||
id: `header-stat-${index}`,
|
||||
});
|
||||
@@ -40,17 +41,17 @@ export const HeaderStat = ({
|
||||
description?: string | ReactNode;
|
||||
}) => {
|
||||
const itemClass =
|
||||
'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-neutral-300 dark:border-neutral-600';
|
||||
const itemHeading = 'text-neutral-400';
|
||||
'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-default';
|
||||
const itemHeading = 'text-neutral-500 dark:text-neutral-400';
|
||||
|
||||
return (
|
||||
<div className={itemClass}>
|
||||
<div id={id}>{heading}</div>
|
||||
<Tooltip description={description}>
|
||||
<div id={id} className={itemHeading}>
|
||||
{heading}
|
||||
<div aria-labelledby={id} className={itemHeading}>
|
||||
{children}
|
||||
</div>
|
||||
</Tooltip>
|
||||
<div aria-labelledby={id}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import classNames from 'classnames';
|
||||
|
||||
export function Vega({ className }: { className?: string }) {
|
||||
const svgClasses = classNames(className, 'fill-white');
|
||||
const svgClasses = classNames(className, 'fill-current');
|
||||
return (
|
||||
<svg
|
||||
width="86"
|
||||
|
||||
@@ -20,7 +20,7 @@ export const Navbar = ({ theme, toggleTheme }: NavbarProps) => {
|
||||
}));
|
||||
const tradingPath = marketId ? `/markets/${marketId}` : '/markets';
|
||||
return (
|
||||
<div className="px-4 flex items-stretch border-b border-neutral-300 dark:border-neutral-400 bg-black">
|
||||
<div className="px-4 flex items-stretch border-b border-default bg-black text-white">
|
||||
<div className="flex gap-4 mr-4 items-center h-full">
|
||||
<Link href="/" passHref={true}>
|
||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
||||
@@ -28,7 +28,7 @@ export const Navbar = ({ theme, toggleTheme }: NavbarProps) => {
|
||||
<Vega className="w-13" />
|
||||
</a>
|
||||
</Link>
|
||||
<NetworkSwitcher fixedBg="dark" />
|
||||
<NetworkSwitcher theme="dark" />
|
||||
</div>
|
||||
<nav className="flex items-center">
|
||||
{[
|
||||
|
||||
@@ -30,7 +30,6 @@ export const VegaWalletConnectButton = ({
|
||||
return (
|
||||
<DropdownMenu open={dropdownOpen}>
|
||||
<DropdownMenuTrigger
|
||||
className="text-white hover:!bg-neutral-700"
|
||||
data-testid="manage-vega-wallet"
|
||||
onClick={() => setDropdownOpen((curr) => !curr)}
|
||||
>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
query Market($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
name
|
||||
tradingMode
|
||||
state
|
||||
decimalPlaces
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ export interface Market_market_data_market {
|
||||
export interface Market_market_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
* market of the associated mark price
|
||||
*/
|
||||
market: Market_market_data_market;
|
||||
/**
|
||||
@@ -202,14 +202,14 @@ export interface Market_market {
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
|
||||
@@ -10,14 +10,13 @@ export type MarketQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, tradingMode: Types.MarketTradingMode, state: Types.MarketState, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', auctionStart?: string | null, auctionEnd?: string | null, markPrice: string, indicativeVolume: string, indicativePrice: string, suppliedStake?: string | null, targetStake?: string | null, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, volume: string } | null> | null } | null };
|
||||
export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, tradingMode: Types.MarketTradingMode, state: Types.MarketState, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', auctionStart?: string | null, auctionEnd?: string | null, markPrice: string, indicativeVolume: string, indicativePrice: string, suppliedStake?: string | null, targetStake?: string | null, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, volume: string } | null> | null } | null };
|
||||
|
||||
|
||||
export const MarketDocument = gql`
|
||||
query Market($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
name
|
||||
tradingMode
|
||||
state
|
||||
decimalPlaces
|
||||
@@ -57,6 +56,7 @@ export const MarketDocument = gql`
|
||||
id
|
||||
symbol
|
||||
name
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
ResizableGrid,
|
||||
ResizableGridPanel,
|
||||
ButtonLink,
|
||||
Tooltip,
|
||||
PriceCellChange,
|
||||
Link,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
@@ -41,6 +40,7 @@ import {
|
||||
} from '@vegaprotocol/types';
|
||||
import { TradingModeTooltip } from '../../components/trading-mode-tooltip';
|
||||
import { useRouter } from 'next/router';
|
||||
import { Header, HeaderStat } from '../../components/header';
|
||||
|
||||
const TradingViews = {
|
||||
Candles: CandlesChartContainer,
|
||||
@@ -62,15 +62,16 @@ type ExpiryLabelProps = {
|
||||
};
|
||||
|
||||
const ExpiryLabel = ({ market }: ExpiryLabelProps) => {
|
||||
let content = null;
|
||||
if (market.marketTimestamps.close === null) {
|
||||
return <>{t('Not time-based')}</>;
|
||||
content = t('Not time-based');
|
||||
} else {
|
||||
const closeDate = new Date(market.marketTimestamps.close);
|
||||
const isExpired = Date.now() - closeDate.valueOf() > 0;
|
||||
const expiryDate = getDateFormat().format(closeDate);
|
||||
content = `${isExpired ? `${t('Expired')} ` : ''} ${expiryDate}`;
|
||||
}
|
||||
|
||||
const closeDate = new Date(market.marketTimestamps.close);
|
||||
const isExpired = Date.now() - closeDate.valueOf() > 0;
|
||||
const expiryDate = getDateFormat().format(closeDate);
|
||||
|
||||
return <>{`${isExpired ? `${t('Expired')} ` : ''} ${expiryDate}`}</>;
|
||||
return <div data-testid="trading-expiry">{content}</div>;
|
||||
};
|
||||
|
||||
type ExpiryTooltipContentProps = {
|
||||
@@ -115,6 +116,7 @@ export const TradeMarketHeader = ({
|
||||
market,
|
||||
onSelect,
|
||||
}: TradeMarketHeaderProps) => {
|
||||
const { push } = useRouter();
|
||||
const { VEGA_EXPLORER_URL } = useEnvironment();
|
||||
const { setAssetDetailsDialogOpen, setAssetDetailsDialogSymbol } =
|
||||
useAssetDetailsDialogStore();
|
||||
@@ -122,123 +124,92 @@ export const TradeMarketHeader = ({
|
||||
const candlesClose: string[] = (market?.candles || [])
|
||||
.map((candle) => candle?.close)
|
||||
.filter((c): c is CandleClose => c !== null);
|
||||
const hasExpiry = market.marketTimestamps.close !== null;
|
||||
const symbol =
|
||||
market.tradableInstrument.instrument.product?.settlementAsset?.symbol;
|
||||
|
||||
const itemClass =
|
||||
'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-neutral-300 dark:border-neutral-600';
|
||||
const itemHeading = 'text-neutral-500 dark:text-neutral-400';
|
||||
const { push } = useRouter();
|
||||
|
||||
return (
|
||||
<header className="w-screen px-4 border-b border-neutral-300 dark:border-neutral-600">
|
||||
<div className="xl:flex xl:gap-4 items-start">
|
||||
<div>
|
||||
<SelectMarketPopover
|
||||
marketName={market.tradableInstrument.instrument.name}
|
||||
onSelect={onSelect}
|
||||
<Header
|
||||
title={
|
||||
<SelectMarketPopover
|
||||
marketName={market.tradableInstrument.instrument.name}
|
||||
onSelect={onSelect}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<HeaderStat
|
||||
heading={t('Expiry')}
|
||||
description={
|
||||
<ExpiryTooltipContent
|
||||
market={market}
|
||||
explorerUrl={VEGA_EXPLORER_URL}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<ExpiryLabel market={market} />
|
||||
</HeaderStat>
|
||||
<HeaderStat heading={t('Change (24h)')}>
|
||||
<PriceCellChange
|
||||
candles={candlesClose}
|
||||
decimalPlaces={market.decimalPlaces}
|
||||
/>
|
||||
</HeaderStat>
|
||||
<HeaderStat heading={t('Volume')}>
|
||||
<div data-testid="trading-volume">
|
||||
{market.data && market.data.indicativeVolume !== '0'
|
||||
? addDecimalsFormatNumber(
|
||||
market.data.indicativeVolume,
|
||||
market.positionDecimalPlaces
|
||||
)
|
||||
: '-'}
|
||||
</div>
|
||||
<div
|
||||
data-testid="market-summary"
|
||||
className="flex flex-nowrap items-start mt-3 xl:flex-1 w-full overflow-x-auto text-xs "
|
||||
>
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Expiry')}</div>
|
||||
<Tooltip
|
||||
align="start"
|
||||
description={
|
||||
<ExpiryTooltipContent
|
||||
market={market}
|
||||
explorerUrl={VEGA_EXPLORER_URL}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div
|
||||
data-testid="trading-expiry"
|
||||
className={classNames({
|
||||
'underline decoration-dashed': !hasExpiry,
|
||||
})}
|
||||
>
|
||||
<ExpiryLabel market={market} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Change (24h)')}</div>
|
||||
<PriceCellChange
|
||||
candles={candlesClose}
|
||||
decimalPlaces={market.decimalPlaces}
|
||||
/>
|
||||
</div>
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Volume')}</div>
|
||||
<div data-testid="trading-volume">
|
||||
{market.data && market.data.indicativeVolume !== '0'
|
||||
? addDecimalsFormatNumber(
|
||||
market.data.indicativeVolume,
|
||||
market.positionDecimalPlaces
|
||||
)
|
||||
: '-'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Trading mode')}</div>
|
||||
<Tooltip
|
||||
align="start"
|
||||
description={
|
||||
<TradingModeTooltip
|
||||
market={market}
|
||||
onSelect={(marketId: string) => {
|
||||
onSelect(marketId);
|
||||
push(`/liquidity/${marketId}`);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div data-testid="trading-mode">
|
||||
{market.tradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
market.data?.trigger &&
|
||||
market.data.trigger !==
|
||||
AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||
? `${MarketTradingModeMapping[market.tradingMode]}
|
||||
</HeaderStat>
|
||||
<HeaderStat
|
||||
heading={t('Trading mode')}
|
||||
description={
|
||||
<TradingModeTooltip
|
||||
market={market}
|
||||
onSelect={(marketId: string) => {
|
||||
onSelect(marketId);
|
||||
push(`/liquidity/${marketId}`);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div data-testid="trading-mode">
|
||||
{market.tradingMode ===
|
||||
MarketTradingMode.TRADING_MODE_MONITORING_AUCTION &&
|
||||
market.data?.trigger &&
|
||||
market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||
? `${MarketTradingModeMapping[market.tradingMode]}
|
||||
- ${AuctionTriggerMapping[market.data.trigger]}`
|
||||
: MarketTradingModeMapping[market.tradingMode]}
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Price')}</div>
|
||||
<div data-testid="mark-price">
|
||||
{market.data && market.data.markPrice !== '0'
|
||||
? addDecimalsFormatNumber(
|
||||
market.data.markPrice,
|
||||
market.decimalPlaces
|
||||
)
|
||||
: '-'}
|
||||
</div>
|
||||
</div>
|
||||
{symbol && (
|
||||
<div className={itemClass}>
|
||||
<div className={itemHeading}>{t('Settlement asset')}</div>
|
||||
<div data-testid="trading-mode">
|
||||
<ButtonLink
|
||||
onClick={() => {
|
||||
setAssetDetailsDialogOpen(true);
|
||||
setAssetDetailsDialogSymbol(symbol);
|
||||
}}
|
||||
>
|
||||
{symbol}
|
||||
</ButtonLink>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
: MarketTradingModeMapping[market.tradingMode]}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</HeaderStat>
|
||||
<HeaderStat heading={t('Price')}>
|
||||
<div data-testid="mark-price">
|
||||
{market.data && market.data.markPrice !== '0'
|
||||
? addDecimalsFormatNumber(
|
||||
market.data.markPrice,
|
||||
market.decimalPlaces
|
||||
)
|
||||
: '-'}
|
||||
</div>
|
||||
</HeaderStat>
|
||||
{symbol ? (
|
||||
<HeaderStat heading={t('Settlement asset')}>
|
||||
<div data-testid="trading-mode">
|
||||
<ButtonLink
|
||||
onClick={() => {
|
||||
setAssetDetailsDialogOpen(true);
|
||||
setAssetDetailsDialogSymbol(symbol);
|
||||
}}
|
||||
>
|
||||
{symbol}
|
||||
</ButtonLink>
|
||||
</div>
|
||||
</HeaderStat>
|
||||
) : null}
|
||||
</Header>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -346,14 +317,7 @@ const TradeGridChild = ({ children }: TradeGridChildProps) => {
|
||||
return (
|
||||
<section className="h-full">
|
||||
<AutoSizer>
|
||||
{({ width, height }) => (
|
||||
<div
|
||||
style={{ width, height }}
|
||||
className="overflow-auto border-[1px] dark:border-neutral-600"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)}
|
||||
{({ width, height }) => <div style={{ width, height }}>{children}</div>}
|
||||
</AutoSizer>
|
||||
</section>
|
||||
);
|
||||
@@ -398,7 +362,7 @@ export const TradePanels = ({ market, onSelect }: TradePanelsProps) => {
|
||||
)}
|
||||
</AutoSizer>
|
||||
</div>
|
||||
<div className="flex flex-nowrap overflow-x-auto max-w-full border-t border-neutral-300 dark:border-neutral-600">
|
||||
<div className="flex flex-nowrap overflow-x-auto max-w-full border-t border-default">
|
||||
{Object.keys(TradingViews).map((key) => {
|
||||
const isActive = view === key;
|
||||
const className = classNames('p-4 min-w-[100px] capitalize', {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: AssetFields
|
||||
// ====================================================
|
||||
|
||||
export interface AssetFields_source_BuiltinAsset {
|
||||
__typename: "BuiltinAsset";
|
||||
}
|
||||
|
||||
export interface AssetFields_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
}
|
||||
|
||||
export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_source_ERC20;
|
||||
|
||||
export interface AssetFields {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The full name of the asset (e.g: Great British Pound)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
* The origin source of the asset (e.g: an ERC20 asset)
|
||||
*/
|
||||
source: AssetFields_source;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { AccountType } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: WithdrawFormQuery
|
||||
// ====================================================
|
||||
|
||||
export interface WithdrawFormQuery_party_withdrawals {
|
||||
__typename: "Withdrawal";
|
||||
/**
|
||||
* The Vega internal ID of the withdrawal
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Hash of the transaction on the foreign chain
|
||||
*/
|
||||
txHash: string | null;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery_party_accounts_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery_party_accounts {
|
||||
__typename: "Account";
|
||||
/**
|
||||
* Account type (General, Margin, etc)
|
||||
*/
|
||||
type: AccountType;
|
||||
/**
|
||||
* Balance as string - current account balance (approx. as balances can be updated several times per second)
|
||||
*/
|
||||
balance: string;
|
||||
/**
|
||||
* Asset, the 'currency'
|
||||
*/
|
||||
asset: WithdrawFormQuery_party_accounts_asset;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery_party {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The list of all withdrawals initiated by the party
|
||||
*/
|
||||
withdrawals: WithdrawFormQuery_party_withdrawals[] | null;
|
||||
/**
|
||||
* Collateral accounts relating to a party
|
||||
*/
|
||||
accounts: WithdrawFormQuery_party_accounts[] | null;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery_assets_source_BuiltinAsset {
|
||||
__typename: "BuiltinAsset";
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery_assets_source_ERC20 {
|
||||
__typename: "ERC20";
|
||||
/**
|
||||
* The address of the ERC20 contract
|
||||
*/
|
||||
contractAddress: string;
|
||||
}
|
||||
|
||||
export type WithdrawFormQuery_assets_source = WithdrawFormQuery_assets_source_BuiltinAsset | WithdrawFormQuery_assets_source_ERC20;
|
||||
|
||||
export interface WithdrawFormQuery_assets {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The full name of the asset (e.g: Great British Pound)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
/**
|
||||
* The origin source of the asset (e.g: an ERC20 asset)
|
||||
*/
|
||||
source: WithdrawFormQuery_assets_source;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQuery {
|
||||
/**
|
||||
* An entity that is trading on the Vega network
|
||||
*/
|
||||
party: WithdrawFormQuery_party | null;
|
||||
/**
|
||||
* The list of all assets in use in the Vega network
|
||||
*/
|
||||
assets: WithdrawFormQuery_assets[] | null;
|
||||
}
|
||||
|
||||
export interface WithdrawFormQueryVariables {
|
||||
partyId: string;
|
||||
}
|
||||
@@ -68,5 +68,5 @@ export interface DepositPage {
|
||||
/**
|
||||
* The list of all assets in use in the Vega network or the specified asset if ID is provided
|
||||
*/
|
||||
assetsConnection: DepositPage_assetsConnection;
|
||||
assetsConnection: DepositPage_assetsConnection | null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type DepositPageQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type DepositPageQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } };
|
||||
export type DepositPageQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null };
|
||||
|
||||
|
||||
export const DepositPageDocument = gql`
|
||||
|
||||
@@ -18,3 +18,7 @@ html.dark {
|
||||
--focus-border: theme('colors.vega.yellow');
|
||||
--separator-border: theme('colors.neutral.600');
|
||||
}
|
||||
|
||||
.border-default {
|
||||
@apply border-neutral-300 dark:border-neutral-600;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
fragment AccountFields on Account {
|
||||
fragment AccountFields on AccountUpdate {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
assetId
|
||||
marketId
|
||||
}
|
||||
|
||||
query Accounts($partyId: ID!) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accounts {
|
||||
...AccountFields
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,5 +31,7 @@ query Accounts($partyId: ID!) {
|
||||
subscription AccountEvents($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
...AccountFields
|
||||
marketId
|
||||
assetId
|
||||
}
|
||||
}
|
||||
|
||||
+23
-18
@@ -3,7 +3,7 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } };
|
||||
export type AccountFieldsFragment = { __typename?: 'AccountUpdate', type: Types.AccountType, balance: string, assetId: string, marketId?: string | null };
|
||||
|
||||
export type AccountsQueryVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
@@ -17,25 +17,14 @@ export type AccountEventsSubscriptionVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } };
|
||||
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: Array<{ __typename?: 'AccountUpdate', marketId?: string | null, assetId: string, type: Types.AccountType, balance: string }> };
|
||||
|
||||
export const AccountFieldsFragmentDoc = gql`
|
||||
fragment AccountFields on Account {
|
||||
fragment AccountFields on AccountUpdate {
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
assetId
|
||||
marketId
|
||||
}
|
||||
`;
|
||||
export const AccountsDocument = gql`
|
||||
@@ -43,11 +32,25 @@ export const AccountsDocument = gql`
|
||||
party(id: $partyId) {
|
||||
id
|
||||
accounts {
|
||||
...AccountFields
|
||||
type
|
||||
balance
|
||||
market {
|
||||
id
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${AccountFieldsFragmentDoc}`;
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useAccountsQuery__
|
||||
@@ -80,6 +83,8 @@ export const AccountEventsDocument = gql`
|
||||
subscription AccountEvents($partyId: ID!) {
|
||||
accounts(partyId: $partyId) {
|
||||
...AccountFields
|
||||
marketId
|
||||
assetId
|
||||
}
|
||||
}
|
||||
${AccountFieldsFragmentDoc}`;
|
||||
@@ -2,51 +2,90 @@ import produce from 'immer';
|
||||
import {
|
||||
AccountsDocument,
|
||||
AccountEventsDocument,
|
||||
} from './__generated__/Accounts';
|
||||
} from './__generated___/Accounts';
|
||||
import type {
|
||||
AccountFieldsFragment,
|
||||
AccountsQuery,
|
||||
AccountEventsSubscription,
|
||||
} from './__generated__/Accounts';
|
||||
AccountFieldsFragment,
|
||||
} from './__generated___/Accounts';
|
||||
import { makeDataProvider } from '@vegaprotocol/react-helpers';
|
||||
import type { AccountType } from '@vegaprotocol/types';
|
||||
|
||||
export const getId = (data: AccountFieldsFragment) =>
|
||||
interface Account {
|
||||
type: AccountType;
|
||||
balance: string;
|
||||
market: {
|
||||
id: string;
|
||||
name: string;
|
||||
} | null;
|
||||
asset: {
|
||||
symbol: string;
|
||||
decimals: number;
|
||||
};
|
||||
}
|
||||
|
||||
export const getId = (data: Account) =>
|
||||
`${data.type}-${data.asset.symbol}-${data.market?.id ?? 'null'}`;
|
||||
|
||||
const update = (
|
||||
data: AccountFieldsFragment[],
|
||||
delta: AccountFieldsFragment
|
||||
) => {
|
||||
const update = (data: Account[], delta: Account[]) => {
|
||||
return produce(data, (draft) => {
|
||||
// @ts-ignore FIXME stagnet3 update
|
||||
const id = getId(delta);
|
||||
const index = draft.findIndex((a) => getId(a) === id);
|
||||
if (index !== -1) {
|
||||
// @ts-ignore FIXME stagnet3 update
|
||||
draft[index] = delta;
|
||||
} else {
|
||||
// @ts-ignore FIXME stagnet3 update
|
||||
draft.push(delta);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getData = (
|
||||
responseData: AccountsQuery
|
||||
): AccountFieldsFragment[] | null => {
|
||||
return responseData.party?.accounts ?? null;
|
||||
const getData = (responseData: AccountsQuery): Account[] | null => {
|
||||
if (!responseData?.party?.accounts?.length) return null;
|
||||
return responseData.party?.accounts?.map((a) => {
|
||||
return {
|
||||
type: a.type,
|
||||
balance: a.balance,
|
||||
market: a.market
|
||||
? {
|
||||
id: a.market.id,
|
||||
name: a.market.tradableInstrument.instrument.name,
|
||||
}
|
||||
: null,
|
||||
asset: {
|
||||
symbol: a.asset.symbol,
|
||||
decimals: a.asset.decimals,
|
||||
},
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const getDelta = (
|
||||
subscriptionData: AccountEventsSubscription
|
||||
): AccountFieldsFragment => subscriptionData.accounts;
|
||||
const getDelta = (subscriptionData: AccountEventsSubscription): Account[] => {
|
||||
// return subscriptionData.accounts
|
||||
|
||||
// what to do here?
|
||||
// @ts-ignore how to retrieve market data for each account?
|
||||
return subscriptionData.accounts.map((a) => ({
|
||||
type: a.type,
|
||||
balance: a.balance,
|
||||
asset: {},
|
||||
market: a.marketId ? {} : null,
|
||||
}));
|
||||
};
|
||||
|
||||
export const accountsDataProvider = makeDataProvider<
|
||||
AccountsQuery,
|
||||
AccountFieldsFragment[],
|
||||
Account[],
|
||||
AccountEventsSubscription,
|
||||
AccountFieldsFragment
|
||||
>({
|
||||
query: AccountsDocument,
|
||||
subscriptionQuery: AccountEventsDocument,
|
||||
// @ts-ignore FIXME stagnet3 update
|
||||
update,
|
||||
getData,
|
||||
// @ts-ignore FIXME stagnet3 update
|
||||
getDelta,
|
||||
});
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ const defaultOptions = {} as const;
|
||||
export type AssetsConnectionQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type AssetsConnectionQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } | null> | null } };
|
||||
export type AssetsConnectionQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } | null> | null } | null };
|
||||
|
||||
|
||||
export const AssetsConnectionDocument = gql`
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
Splash,
|
||||
Tooltip,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { useAssetsConnectionQuery } from './__generated__/Assets';
|
||||
import type { Schema } from '@vegaprotocol/types';
|
||||
import create from 'zustand';
|
||||
import { useAssetsConnectionQuery } from './__generated___/Assets';
|
||||
|
||||
export type AssetDetailsDialogStore = {
|
||||
isAssetDetailsDialogOpen: boolean;
|
||||
@@ -54,7 +54,7 @@ export const AssetDetailsDialog = ({
|
||||
const { data } = useAssetsConnectionQuery();
|
||||
const symbol =
|
||||
typeof assetSymbol === 'string' ? assetSymbol : assetSymbol.symbol;
|
||||
const asset = data?.assetsConnection.edges?.find(
|
||||
const asset = data?.assetsConnection?.edges?.find(
|
||||
(e) => e?.node.symbol === symbol
|
||||
);
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './__generated__/Assets';
|
||||
export * from './__generated___/Assets';
|
||||
export * from './asset-details-dialog';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
query DealTicketQuery($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
state
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
query MarketNames {
|
||||
query DealTicketMarketNames {
|
||||
markets {
|
||||
id
|
||||
state
|
||||
|
||||
@@ -8,14 +8,13 @@ export type DealTicketQueryQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null };
|
||||
export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null };
|
||||
|
||||
|
||||
export const DealTicketQueryDocument = gql`
|
||||
query DealTicketQuery($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
state
|
||||
|
||||
@@ -3,14 +3,14 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type MarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
export type DealTicketMarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null };
|
||||
export type DealTicketMarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null };
|
||||
|
||||
|
||||
export const MarketNamesDocument = gql`
|
||||
query MarketNames {
|
||||
export const DealTicketMarketNamesDocument = gql`
|
||||
query DealTicketMarketNames {
|
||||
markets {
|
||||
id
|
||||
state
|
||||
@@ -33,28 +33,28 @@ export const MarketNamesDocument = gql`
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useMarketNamesQuery__
|
||||
* __useDealTicketMarketNamesQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useMarketNamesQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useMarketNamesQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||
* To run a query within a React component, call `useDealTicketMarketNamesQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useDealTicketMarketNamesQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useMarketNamesQuery({
|
||||
* const { data, loading, error } = useDealTicketMarketNamesQuery({
|
||||
* variables: {
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useMarketNamesQuery(baseOptions?: Apollo.QueryHookOptions<MarketNamesQuery, MarketNamesQueryVariables>) {
|
||||
export function useDealTicketMarketNamesQuery(baseOptions?: Apollo.QueryHookOptions<DealTicketMarketNamesQuery, DealTicketMarketNamesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<MarketNamesQuery, MarketNamesQueryVariables>(MarketNamesDocument, options);
|
||||
return Apollo.useQuery<DealTicketMarketNamesQuery, DealTicketMarketNamesQueryVariables>(DealTicketMarketNamesDocument, options);
|
||||
}
|
||||
export function useMarketNamesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<MarketNamesQuery, MarketNamesQueryVariables>) {
|
||||
export function useDealTicketMarketNamesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<DealTicketMarketNamesQuery, DealTicketMarketNamesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<MarketNamesQuery, MarketNamesQueryVariables>(MarketNamesDocument, options);
|
||||
return Apollo.useLazyQuery<DealTicketMarketNamesQuery, DealTicketMarketNamesQueryVariables>(DealTicketMarketNamesDocument, options);
|
||||
}
|
||||
export type MarketNamesQueryHookResult = ReturnType<typeof useMarketNamesQuery>;
|
||||
export type MarketNamesLazyQueryHookResult = ReturnType<typeof useMarketNamesLazyQuery>;
|
||||
export type MarketNamesQueryResult = Apollo.QueryResult<MarketNamesQuery, MarketNamesQueryVariables>;
|
||||
export type DealTicketMarketNamesQueryHookResult = ReturnType<typeof useDealTicketMarketNamesQuery>;
|
||||
export type DealTicketMarketNamesLazyQueryHookResult = ReturnType<typeof useDealTicketMarketNamesLazyQuery>;
|
||||
export type DealTicketMarketNamesQueryResult = Apollo.QueryResult<DealTicketMarketNamesQuery, DealTicketMarketNamesQueryVariables>;
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './DealTicketQuery';
|
||||
export * from './MarketNames';
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { DepositStatus } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL query operation: Deposits
|
||||
// ====================================================
|
||||
|
||||
export interface Deposits_party_depositsConnection_edges_node_asset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface Deposits_party_depositsConnection_edges_node {
|
||||
__typename: "Deposit";
|
||||
/**
|
||||
* The Vega internal ID of the deposit
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The current status of the deposit
|
||||
*/
|
||||
status: DepositStatus;
|
||||
/**
|
||||
* The amount to be withdrawn
|
||||
*/
|
||||
amount: string;
|
||||
/**
|
||||
* The asset to be withdrawn
|
||||
*/
|
||||
asset: Deposits_party_depositsConnection_edges_node_asset;
|
||||
/**
|
||||
* RFC3339Nano time at which the deposit was created
|
||||
*/
|
||||
createdTimestamp: string;
|
||||
/**
|
||||
* RFC3339Nano time at which the deposit was finalised
|
||||
*/
|
||||
creditedTimestamp: string | null;
|
||||
/**
|
||||
* Hash of the transaction on the foreign chain
|
||||
*/
|
||||
txHash: string | null;
|
||||
}
|
||||
|
||||
export interface Deposits_party_depositsConnection_edges {
|
||||
__typename: "DepositEdge";
|
||||
node: Deposits_party_depositsConnection_edges_node;
|
||||
}
|
||||
|
||||
export interface Deposits_party_depositsConnection {
|
||||
__typename: "DepositsConnection";
|
||||
/**
|
||||
* The deposits
|
||||
*/
|
||||
edges: (Deposits_party_depositsConnection_edges | null)[] | null;
|
||||
}
|
||||
|
||||
export interface Deposits_party {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The list of all deposits for a party by the party
|
||||
*/
|
||||
depositsConnection: Deposits_party_depositsConnection;
|
||||
}
|
||||
|
||||
export interface Deposits {
|
||||
/**
|
||||
* An entity that is trading on the Vega network
|
||||
*/
|
||||
party: Deposits_party | null;
|
||||
}
|
||||
|
||||
export interface DepositsVariables {
|
||||
partyId: string;
|
||||
}
|
||||
+1
-1
@@ -79,7 +79,7 @@ export interface DepositsQuery_party {
|
||||
/**
|
||||
* The list of all deposits for a party by the party
|
||||
*/
|
||||
depositsConnection: DepositsQuery_party_depositsConnection;
|
||||
depositsConnection: DepositsQuery_party_depositsConnection | null;
|
||||
}
|
||||
|
||||
export interface DepositsQuery {
|
||||
|
||||
@@ -11,7 +11,10 @@ import type {
|
||||
DepositEventSub_busEvents_event,
|
||||
DepositEventSub_busEvents_event_Deposit,
|
||||
} from './__generated__/DepositEventSub';
|
||||
import type { Deposits, DepositsVariables } from './__generated__/Deposits';
|
||||
import type {
|
||||
DepositsQuery,
|
||||
DepositsQueryVariables,
|
||||
} from './__generated__/DepositsQuery';
|
||||
|
||||
const DEPOSIT_FRAGMENT = gql`
|
||||
fragment DepositFields on Deposit {
|
||||
@@ -61,15 +64,15 @@ const DEPOSITS_BUS_EVENT_SUB = gql`
|
||||
export const useDeposits = () => {
|
||||
const { keypair } = useVegaWallet();
|
||||
const { data, loading, error, subscribeToMore } = useQuery<
|
||||
Deposits,
|
||||
DepositsVariables
|
||||
DepositsQuery,
|
||||
DepositsQueryVariables
|
||||
>(DEPOSITS_QUERY, {
|
||||
variables: { partyId: keypair?.pub || '' },
|
||||
skip: !keypair?.pub,
|
||||
});
|
||||
|
||||
const deposits = useMemo(() => {
|
||||
if (!data?.party?.depositsConnection.edges?.length) {
|
||||
if (!data?.party?.depositsConnection?.edges?.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -98,7 +101,7 @@ export const useDeposits = () => {
|
||||
};
|
||||
|
||||
const updateQuery: UpdateQueryFn<
|
||||
Deposits,
|
||||
DepositsQuery,
|
||||
DepositEventSubVariables,
|
||||
DepositEventSub
|
||||
> = (prev, { subscriptionData, variables }) => {
|
||||
@@ -108,7 +111,7 @@ const updateQuery: UpdateQueryFn<
|
||||
}
|
||||
|
||||
const curr =
|
||||
compact(prev.party?.depositsConnection.edges?.map((e) => e?.node)) || [];
|
||||
compact(prev.party?.depositsConnection?.edges?.map((e) => e?.node)) || [];
|
||||
const incoming = subscriptionData.data.busEvents
|
||||
.map((e) => e.event)
|
||||
.filter(isDepositEvent);
|
||||
|
||||
@@ -69,11 +69,7 @@ const NetworkLabel = ({
|
||||
</span>
|
||||
);
|
||||
|
||||
export const NetworkSwitcher = ({
|
||||
fixedBg,
|
||||
}: {
|
||||
fixedBg?: 'dark' | 'light';
|
||||
}) => {
|
||||
export const NetworkSwitcher = ({ theme }: { theme?: 'dark' | 'light' }) => {
|
||||
const { VEGA_ENV, VEGA_NETWORKS } = useEnvironment();
|
||||
const [isOpen, setOpen] = useState(false);
|
||||
const [isAdvancedView, setAdvancedView] = useState(false);
|
||||
@@ -88,10 +84,9 @@ export const NetworkSwitcher = ({
|
||||
[setOpen, setAdvancedView]
|
||||
);
|
||||
|
||||
const dropdownTriggerClasses = classNames('hover:!bg-neutral-700', {
|
||||
'dark:text-white dark:bg-black text-black bg-white': !fixedBg,
|
||||
'text-black bg-white': fixedBg === 'light',
|
||||
'text-white bg-black': fixedBg === 'dark',
|
||||
const dropdownTriggerClasses = classNames({
|
||||
'text-black hover:!bg-neutral-300': theme === 'light',
|
||||
'text-white hover:!bg-neutral-700': theme === 'dark',
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
@@ -23,7 +23,7 @@ export const getMockBusEventsResult = (): BlockTime => ({
|
||||
busEvents: [
|
||||
{
|
||||
__typename: 'BusEvent',
|
||||
eventId: '0',
|
||||
id: '0',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ export interface BlockTime_busEvents {
|
||||
/**
|
||||
* the ID for this event
|
||||
*/
|
||||
eventId: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface BlockTime {
|
||||
|
||||
@@ -14,7 +14,7 @@ export const STATS_QUERY = gql`
|
||||
export const TIME_UPDATE_SUBSCRIPTION = gql`
|
||||
subscription BlockTime {
|
||||
busEvents(types: TimeUpdate, batchSize: 1) {
|
||||
eventId
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './lib/fills-container';
|
||||
export * from './lib/__generated__/FillFields';
|
||||
export * from './lib/__generated__/Fills';
|
||||
export * from './lib/__generated__/FillsSub';
|
||||
|
||||
@@ -1,57 +1,52 @@
|
||||
fragment FillFields on Trade {
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
market {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
tradesConnection(marketId: $marketId, pagination: $pagination) {
|
||||
edges {
|
||||
node {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor
|
||||
}
|
||||
@@ -67,6 +62,25 @@ query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
|
||||
|
||||
subscription FillsSub($partyId: ID!) {
|
||||
trades(partyId: $partyId) {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyerId
|
||||
sellerId
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
marketId
|
||||
}
|
||||
}
|
||||
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { Side } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: FillFields
|
||||
// ====================================================
|
||||
|
||||
export interface FillFields_buyer {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface FillFields_seller {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface FillFields_buyerFee {
|
||||
__typename: "TradeFee";
|
||||
/**
|
||||
* The maker fee, paid by the aggressive party to the other party (the one who had an order in the book)
|
||||
*/
|
||||
makerFee: string;
|
||||
/**
|
||||
* The infrastructure fee, a fee paid to the validators to maintain the Vega network
|
||||
*/
|
||||
infrastructureFee: string;
|
||||
/**
|
||||
* The fee paid to the liquidity providers that committed liquidity to the market
|
||||
*/
|
||||
liquidityFee: string;
|
||||
}
|
||||
|
||||
export interface FillFields_sellerFee {
|
||||
__typename: "TradeFee";
|
||||
/**
|
||||
* The maker fee, paid by the aggressive party to the other party (the one who had an order in the book)
|
||||
*/
|
||||
makerFee: string;
|
||||
/**
|
||||
* The infrastructure fee, a fee paid to the validators to maintain the Vega network
|
||||
*/
|
||||
infrastructureFee: string;
|
||||
/**
|
||||
* The fee paid to the liquidity providers that committed liquidity to the market
|
||||
*/
|
||||
liquidityFee: string;
|
||||
}
|
||||
|
||||
export interface FillFields_market_tradableInstrument_instrument_product_settlementAsset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface FillFields_market_tradableInstrument_instrument_product {
|
||||
__typename: "Future";
|
||||
/**
|
||||
* The name of the asset (string)
|
||||
*/
|
||||
settlementAsset: FillFields_market_tradableInstrument_instrument_product_settlementAsset;
|
||||
}
|
||||
|
||||
export interface FillFields_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||
*/
|
||||
product: FillFields_market_tradableInstrument_instrument_product;
|
||||
}
|
||||
|
||||
export interface FillFields_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: FillFields_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface FillFields_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||
* This sets how big the smallest order / position on the market can be.
|
||||
*/
|
||||
positionDecimalPlaces: number;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: FillFields_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface FillFields {
|
||||
__typename: "Trade";
|
||||
/**
|
||||
* The hash of the trade data
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* RFC3339Nano time for when the trade occurred
|
||||
*/
|
||||
createdAt: string;
|
||||
/**
|
||||
* The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64)
|
||||
*/
|
||||
price: string;
|
||||
/**
|
||||
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||
*/
|
||||
size: string;
|
||||
/**
|
||||
* The order that bought
|
||||
*/
|
||||
buyOrder: string;
|
||||
/**
|
||||
* The order that sold
|
||||
*/
|
||||
sellOrder: string;
|
||||
/**
|
||||
* The aggressor indicates whether this trade was related to a BUY or SELL
|
||||
*/
|
||||
aggressor: Side;
|
||||
/**
|
||||
* The party that bought
|
||||
*/
|
||||
buyer: FillFields_buyer;
|
||||
/**
|
||||
* The party that sold
|
||||
*/
|
||||
seller: FillFields_seller;
|
||||
/**
|
||||
* The fee paid by the buyer side of the trade
|
||||
*/
|
||||
buyerFee: FillFields_buyerFee;
|
||||
/**
|
||||
* The fee paid by the seller side of the trade
|
||||
*/
|
||||
sellerFee: FillFields_sellerFee;
|
||||
/**
|
||||
* The market the trade occurred on
|
||||
*/
|
||||
market: FillFields_market;
|
||||
}
|
||||
+25
-25
@@ -9,22 +9,6 @@ import { Pagination, Side } from "@vegaprotocol/types";
|
||||
// GraphQL query operation: Fills
|
||||
// ====================================================
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_buyer {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_seller {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_buyerFee {
|
||||
__typename: "TradeFee";
|
||||
/**
|
||||
@@ -57,6 +41,22 @@ export interface Fills_party_tradesConnection_edges_node_sellerFee {
|
||||
liquidityFee: string;
|
||||
}
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_buyer {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_seller {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product_settlementAsset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
@@ -175,14 +175,6 @@ export interface Fills_party_tradesConnection_edges_node {
|
||||
* The aggressor indicates whether this trade was related to a BUY or SELL
|
||||
*/
|
||||
aggressor: Side;
|
||||
/**
|
||||
* The party that bought
|
||||
*/
|
||||
buyer: Fills_party_tradesConnection_edges_node_buyer;
|
||||
/**
|
||||
* The party that sold
|
||||
*/
|
||||
seller: Fills_party_tradesConnection_edges_node_seller;
|
||||
/**
|
||||
* The fee paid by the buyer side of the trade
|
||||
*/
|
||||
@@ -191,6 +183,14 @@ export interface Fills_party_tradesConnection_edges_node {
|
||||
* The fee paid by the seller side of the trade
|
||||
*/
|
||||
sellerFee: Fills_party_tradesConnection_edges_node_sellerFee;
|
||||
/**
|
||||
* The party that bought
|
||||
*/
|
||||
buyer: Fills_party_tradesConnection_edges_node_buyer;
|
||||
/**
|
||||
* The party that sold
|
||||
*/
|
||||
seller: Fills_party_tradesConnection_edges_node_seller;
|
||||
/**
|
||||
* The market the trade occurred on
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ export interface Fills_party {
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
tradesConnection: Fills_party_tradesConnection;
|
||||
tradesConnection: Fills_party_tradesConnection | null;
|
||||
}
|
||||
|
||||
export interface Fills {
|
||||
|
||||
+8
-112
@@ -9,22 +9,6 @@ import { Side } from "@vegaprotocol/types";
|
||||
// GraphQL subscription operation: FillsSub
|
||||
// ====================================================
|
||||
|
||||
export interface FillsSub_trades_buyer {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_seller {
|
||||
__typename: "Party";
|
||||
/**
|
||||
* Party identifier
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_buyerFee {
|
||||
__typename: "TradeFee";
|
||||
/**
|
||||
@@ -57,96 +41,8 @@ export interface FillsSub_trades_sellerFee {
|
||||
liquidityFee: string;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset {
|
||||
__typename: "Asset";
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The symbol of the asset (e.g: GBP)
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18
|
||||
*/
|
||||
decimals: number;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_market_tradableInstrument_instrument_product {
|
||||
__typename: "Future";
|
||||
/**
|
||||
* The name of the asset (string)
|
||||
*/
|
||||
settlementAsset: FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||
*/
|
||||
product: FillsSub_trades_market_tradableInstrument_instrument_product;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: FillsSub_trades_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||
* This sets how big the smallest order / position on the market can be.
|
||||
*/
|
||||
positionDecimalPlaces: number;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: FillsSub_trades_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface FillsSub_trades {
|
||||
__typename: "Trade";
|
||||
__typename: "TradeUpdate";
|
||||
/**
|
||||
* The hash of the trade data
|
||||
*/
|
||||
@@ -160,7 +56,7 @@ export interface FillsSub_trades {
|
||||
*/
|
||||
price: string;
|
||||
/**
|
||||
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||
* The number of units traded, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||
*/
|
||||
size: string;
|
||||
/**
|
||||
@@ -178,11 +74,15 @@ export interface FillsSub_trades {
|
||||
/**
|
||||
* The party that bought
|
||||
*/
|
||||
buyer: FillsSub_trades_buyer;
|
||||
buyerId: string;
|
||||
/**
|
||||
* The party that sold
|
||||
*/
|
||||
seller: FillsSub_trades_seller;
|
||||
sellerId: string;
|
||||
/**
|
||||
* The market the trade occurred on
|
||||
*/
|
||||
marketId: string;
|
||||
/**
|
||||
* The fee paid by the buyer side of the trade
|
||||
*/
|
||||
@@ -191,10 +91,6 @@ export interface FillsSub_trades {
|
||||
* The fee paid by the seller side of the trade
|
||||
*/
|
||||
sellerFee: FillsSub_trades_sellerFee;
|
||||
/**
|
||||
* The market the trade occurred on
|
||||
*/
|
||||
market: FillsSub_trades_market;
|
||||
}
|
||||
|
||||
export interface FillsSub {
|
||||
|
||||
@@ -3,8 +3,6 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type FillFieldsFragment = { __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } };
|
||||
|
||||
export type FillsQueryVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
marketId?: Types.InputMaybe<Types.Scalars['ID']>;
|
||||
@@ -12,63 +10,16 @@ export type FillsQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type FillsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, tradesConnection: { __typename?: 'TradeConnection', edges: Array<{ __typename?: 'TradeEdge', cursor: string, node: { __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } } }>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } } | null };
|
||||
export type FillsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, tradesConnection?: { __typename?: 'TradeConnection', edges: Array<{ __typename?: 'TradeEdge', cursor: string, node: { __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } } }>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } | null } | null };
|
||||
|
||||
export type FillsSubSubscriptionVariables = Types.Exact<{
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type FillsSubSubscription = { __typename?: 'Subscription', trades?: Array<{ __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } }> | null };
|
||||
export type FillsSubSubscription = { __typename?: 'Subscription', trades?: Array<{ __typename?: 'TradeUpdate', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyerId: string, sellerId: string, marketId: string, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string } }> | null };
|
||||
|
||||
|
||||
export const FillFieldsFragmentDoc = gql`
|
||||
fragment FillFields on Trade {
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
market {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const FillsDocument = gql`
|
||||
query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
|
||||
party(id: $partyId) {
|
||||
@@ -76,7 +27,49 @@ export const FillsDocument = gql`
|
||||
tradesConnection(marketId: $marketId, pagination: $pagination) {
|
||||
edges {
|
||||
node {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor
|
||||
}
|
||||
@@ -89,7 +82,7 @@ export const FillsDocument = gql`
|
||||
}
|
||||
}
|
||||
}
|
||||
${FillFieldsFragmentDoc}`;
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useFillsQuery__
|
||||
@@ -123,10 +116,29 @@ export type FillsQueryResult = Apollo.QueryResult<FillsQuery, FillsQueryVariable
|
||||
export const FillsSubDocument = gql`
|
||||
subscription FillsSub($partyId: ID!) {
|
||||
trades(partyId: $partyId) {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyerId
|
||||
sellerId
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
marketId
|
||||
}
|
||||
}
|
||||
${FillFieldsFragmentDoc}`;
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useFillsSubSubscription__
|
||||
|
||||
@@ -6,72 +6,64 @@ import {
|
||||
defaultAppend as append,
|
||||
} from '@vegaprotocol/react-helpers';
|
||||
import type { PageInfo } from '@vegaprotocol/react-helpers';
|
||||
import type { FillFields } from './__generated__/FillFields';
|
||||
import type {
|
||||
Fills,
|
||||
Fills_party_tradesConnection_edges,
|
||||
Fills_party_tradesConnection_edges_node,
|
||||
} from './__generated__/Fills';
|
||||
import type { FillsSub } from './__generated__/FillsSub';
|
||||
|
||||
const FILL_FRAGMENT = gql`
|
||||
fragment FillFields on Trade {
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
name
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
import type { FillsSub, FillsSub_trades } from './__generated__/FillsSub';
|
||||
|
||||
export const FILLS_QUERY = gql`
|
||||
${FILL_FRAGMENT}
|
||||
query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
tradesConnection(marketId: $marketId, pagination: $pagination) {
|
||||
edges {
|
||||
node {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
buyer {
|
||||
id
|
||||
}
|
||||
seller {
|
||||
id
|
||||
}
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
name
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor
|
||||
}
|
||||
@@ -87,17 +79,35 @@ export const FILLS_QUERY = gql`
|
||||
`;
|
||||
|
||||
export const FILLS_SUB = gql`
|
||||
${FILL_FRAGMENT}
|
||||
subscription FillsSub($partyId: ID!) {
|
||||
trades(partyId: $partyId) {
|
||||
...FillFields
|
||||
id
|
||||
createdAt
|
||||
price
|
||||
size
|
||||
buyOrder
|
||||
sellOrder
|
||||
aggressor
|
||||
buyerId
|
||||
sellerId
|
||||
marketId
|
||||
buyerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
sellerFee {
|
||||
makerFee
|
||||
infrastructureFee
|
||||
liquidityFee
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const update = (
|
||||
data: (Fills_party_tradesConnection_edges | null)[],
|
||||
delta: FillFields[]
|
||||
delta: FillsSub_trades[]
|
||||
) => {
|
||||
return produce(data, (draft) => {
|
||||
orderBy(delta, 'createdAt').forEach((node) => {
|
||||
@@ -122,10 +132,10 @@ const update = (
|
||||
const getData = (
|
||||
responseData: Fills
|
||||
): Fills_party_tradesConnection_edges[] | null =>
|
||||
responseData.party?.tradesConnection.edges || null;
|
||||
responseData.party?.tradesConnection?.edges || null;
|
||||
|
||||
const getPageInfo = (responseData: Fills): PageInfo | null =>
|
||||
responseData.party?.tradesConnection.pageInfo || null;
|
||||
responseData.party?.tradesConnection?.pageInfo || null;
|
||||
|
||||
const getDelta = (subscriptionData: FillsSub) => subscriptionData.trades || [];
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export const getProposals = (data?: ProposalsConnection) => {
|
||||
return proposals ? (proposals as Proposal[]) : [];
|
||||
};
|
||||
|
||||
const orderByDate = (arr: Proposal[]) =>
|
||||
export const orderByDate = (arr: Proposal[]) =>
|
||||
orderBy(
|
||||
arr,
|
||||
[
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
query MarketLiquidity($marketId: ID!, $partyId: String) {
|
||||
query MarketLiquidity($marketId: ID!, $partyId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
liquidityProvisionsConnection(party: $partyId) {
|
||||
liquidityProvisionsConnection(partyId: $partyId) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
|
||||
+8
-8
@@ -46,7 +46,7 @@ export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node
|
||||
/**
|
||||
* Collateral accounts relating to a party
|
||||
*/
|
||||
accountsConnection: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection;
|
||||
accountsConnection: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection | null;
|
||||
}
|
||||
|
||||
export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node {
|
||||
@@ -56,7 +56,7 @@ export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node
|
||||
*/
|
||||
id: string | null;
|
||||
/**
|
||||
* The Id of the party making this commitment
|
||||
* The party making this commitment
|
||||
*/
|
||||
party: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party;
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node
|
||||
*/
|
||||
commitmentAmount: string;
|
||||
/**
|
||||
* Nominated liquidity fee factor, which is an input to the calculation of maker fees on the market, as per setting fees and rewarding liquidity providers.
|
||||
* Nominated liquidity fee factor, which is an input to the calculation of liquidity fees on the market, as per setting fees and rewarding liquidity providers.
|
||||
*/
|
||||
fee: string;
|
||||
/**
|
||||
@@ -174,7 +174,7 @@ export interface MarketLiquidity_market_data_liquidityProviderFeeShare {
|
||||
export interface MarketLiquidity_market_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
* market of the associated mark price
|
||||
*/
|
||||
market: MarketLiquidity_market_data_market;
|
||||
/**
|
||||
@@ -208,14 +208,14 @@ export interface MarketLiquidity_market {
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
@@ -232,7 +232,7 @@ export interface MarketLiquidity_market {
|
||||
/**
|
||||
* The list of the liquidity provision commitments for this market
|
||||
*/
|
||||
liquidityProvisionsConnection: MarketLiquidity_market_liquidityProvisionsConnection;
|
||||
liquidityProvisionsConnection: MarketLiquidity_market_liquidityProvisionsConnection | null;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
@@ -252,5 +252,5 @@ export interface MarketLiquidity {
|
||||
|
||||
export interface MarketLiquidityVariables {
|
||||
marketId: string;
|
||||
partyId?: string | null;
|
||||
partyId: string;
|
||||
}
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
export * from './MarketLiquidity';
|
||||
@@ -0,0 +1,106 @@
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type MarketLiquidityQueryVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
partyId: Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketLiquidityQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, liquidityProvisionsConnection?: { __typename?: 'LiquidityProvisionsConnection', edges?: Array<{ __typename?: 'LiquidityProvisionsEdge', node: { __typename?: 'LiquidityProvision', id?: string | null, createdAt: string, updatedAt?: string | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'Account', type: Types.AccountType, balance: string } } | null> | null } | null } } } | null> | null } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } }, data?: { __typename?: 'MarketData', suppliedStake?: string | null, openInterest: string, targetStake?: string | null, marketValueProxy: string, market: { __typename?: 'Market', id: string }, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null } | null };
|
||||
|
||||
|
||||
export const MarketLiquidityDocument = gql`
|
||||
query MarketLiquidity($marketId: ID!, $partyId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
liquidityProvisionsConnection(partyId: $partyId) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
party {
|
||||
id
|
||||
accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) {
|
||||
edges {
|
||||
node {
|
||||
type
|
||||
balance
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
commitmentAmount
|
||||
fee
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
code
|
||||
name
|
||||
product {
|
||||
... on Future {
|
||||
settlementAsset {
|
||||
id
|
||||
symbol
|
||||
decimals
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data {
|
||||
market {
|
||||
id
|
||||
}
|
||||
suppliedStake
|
||||
openInterest
|
||||
targetStake
|
||||
marketValueProxy
|
||||
liquidityProviderFeeShare {
|
||||
party {
|
||||
id
|
||||
}
|
||||
equityLikeShare
|
||||
averageEntryValuation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useMarketLiquidityQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useMarketLiquidityQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useMarketLiquidityQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useMarketLiquidityQuery({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* partyId: // value for 'partyId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useMarketLiquidityQuery(baseOptions: Apollo.QueryHookOptions<MarketLiquidityQuery, MarketLiquidityQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<MarketLiquidityQuery, MarketLiquidityQueryVariables>(MarketLiquidityDocument, options);
|
||||
}
|
||||
export function useMarketLiquidityLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<MarketLiquidityQuery, MarketLiquidityQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<MarketLiquidityQuery, MarketLiquidityQueryVariables>(MarketLiquidityDocument, options);
|
||||
}
|
||||
export type MarketLiquidityQueryHookResult = ReturnType<typeof useMarketLiquidityQuery>;
|
||||
export type MarketLiquidityLazyQueryHookResult = ReturnType<typeof useMarketLiquidityLazyQuery>;
|
||||
export type MarketLiquidityQueryResult = Apollo.QueryResult<MarketLiquidityQuery, MarketLiquidityQueryVariables>;
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from './__generated__';
|
||||
export * from './__generated__/MarketLiquidity';
|
||||
export * from './liquidity-data-provider';
|
||||
export * from './liquidity-table';
|
||||
|
||||
@@ -6,17 +6,17 @@ import BigNumber from 'bignumber.js';
|
||||
import type {
|
||||
MarketLiquidity,
|
||||
MarketLiquidity_market_data_liquidityProviderFeeShare,
|
||||
} from './__generated__';
|
||||
} from './__generated__/MarketLiquidity';
|
||||
|
||||
const SISKA_NETWORK_PARAMETER = 'market.liquidity.stakeToCcySiskas';
|
||||
|
||||
const MARKET_LIQUIDITY_QUERY = gql`
|
||||
query MarketLiquidity($marketId: ID!, $partyId: String) {
|
||||
query MarketLiquidity($marketId: ID!, $partyId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
liquidityProvisionsConnection(party: $partyId) {
|
||||
liquidityProvisionsConnection(partyId: $partyId) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
@@ -123,11 +123,11 @@ export const useLiquidityProvision = ({
|
||||
) // if partyId is provided, filter out other parties
|
||||
.map((provider: MarketLiquidity_market_data_liquidityProviderFeeShare) => {
|
||||
const liquidityProvisionConnection =
|
||||
data?.market?.liquidityProvisionsConnection.edges?.find(
|
||||
data?.market?.liquidityProvisionsConnection?.edges?.find(
|
||||
(e) => e?.node.party.id === provider.party.id
|
||||
);
|
||||
const balance =
|
||||
liquidityProvisionConnection?.node?.party.accountsConnection.edges?.reduce(
|
||||
liquidityProvisionConnection?.node?.party.accountsConnection?.edges?.reduce(
|
||||
(acc, e) => {
|
||||
return e?.node.type === AccountType.ACCOUNT_TYPE_BOND // just an extra check to make sure we only use bond accounts
|
||||
? acc.plus(new BigNumber(e?.node.balance ?? 0))
|
||||
|
||||
@@ -33,23 +33,9 @@ query MarketDepth($marketId: ID!) {
|
||||
}
|
||||
}
|
||||
|
||||
subscription MarketDepthSubscription($marketId: ID!) {
|
||||
marketDepthUpdate(marketId: $marketId) {
|
||||
market {
|
||||
id
|
||||
positionDecimalPlaces
|
||||
data {
|
||||
staticMidPrice
|
||||
marketTradingMode
|
||||
indicativeVolume
|
||||
indicativePrice
|
||||
bestStaticBidPrice
|
||||
bestStaticOfferPrice
|
||||
market {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
subscription MarketDepthSubscription($marketIds: [ID!]!) {
|
||||
marketsDepthUpdate(marketIds: $marketIds) {
|
||||
marketId
|
||||
sell {
|
||||
price
|
||||
volume
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ export interface MarketDepth_market_data {
|
||||
*/
|
||||
staticMidPrice: string;
|
||||
/**
|
||||
* what state the market is in (auction, continuous, etc)
|
||||
* what mode the market is in (auction, continuous, etc)
|
||||
*/
|
||||
marketTradingMode: MarketTradingMode;
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ export interface MarketDepth_market_data {
|
||||
*/
|
||||
bestStaticOfferPrice: string;
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
* market of the associated mark price
|
||||
*/
|
||||
market: MarketDepth_market_data_market;
|
||||
}
|
||||
|
||||
@@ -3,72 +3,11 @@
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { MarketTradingMode } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL subscription operation: MarketDepthSubscription
|
||||
// ====================================================
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate_market_data_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate_market_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* the arithmetic average of the best static bid price and best static offer price
|
||||
*/
|
||||
staticMidPrice: string;
|
||||
/**
|
||||
* what state the market is in (auction, continuous, etc)
|
||||
*/
|
||||
marketTradingMode: MarketTradingMode;
|
||||
/**
|
||||
* indicative volume if the auction ended now, 0 if not in auction mode
|
||||
*/
|
||||
indicativeVolume: string;
|
||||
/**
|
||||
* indicative price if the auction ended now, 0 if not in auction mode
|
||||
*/
|
||||
indicativePrice: string;
|
||||
/**
|
||||
* the highest price level on an order book for buy orders not including pegged orders.
|
||||
*/
|
||||
bestStaticBidPrice: string;
|
||||
/**
|
||||
* the lowest price level on an order book for offer orders not including pegged orders.
|
||||
*/
|
||||
bestStaticOfferPrice: string;
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
*/
|
||||
market: MarketDepthSubscription_marketDepthUpdate_market_data_market;
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||
* This sets how big the smallest order / position on the market can be.
|
||||
*/
|
||||
positionDecimalPlaces: number;
|
||||
/**
|
||||
* marketData for the given market
|
||||
*/
|
||||
data: MarketDepthSubscription_marketDepthUpdate_market_data | null;
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate_sell {
|
||||
export interface MarketDepthSubscription_marketsDepthUpdate_sell {
|
||||
__typename: "PriceLevel";
|
||||
/**
|
||||
* The price of all the orders at this level (uint64)
|
||||
@@ -84,7 +23,7 @@ export interface MarketDepthSubscription_marketDepthUpdate_sell {
|
||||
numberOfOrders: string;
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate_buy {
|
||||
export interface MarketDepthSubscription_marketsDepthUpdate_buy {
|
||||
__typename: "PriceLevel";
|
||||
/**
|
||||
* The price of all the orders at this level (uint64)
|
||||
@@ -100,20 +39,20 @@ export interface MarketDepthSubscription_marketDepthUpdate_buy {
|
||||
numberOfOrders: string;
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscription_marketDepthUpdate {
|
||||
__typename: "MarketDepthUpdate";
|
||||
export interface MarketDepthSubscription_marketsDepthUpdate {
|
||||
__typename: "ObservableMarketDepthUpdate";
|
||||
/**
|
||||
* Market
|
||||
* Market ID
|
||||
*/
|
||||
market: MarketDepthSubscription_marketDepthUpdate_market;
|
||||
marketId: string;
|
||||
/**
|
||||
* Sell side price levels (if available)
|
||||
*/
|
||||
sell: MarketDepthSubscription_marketDepthUpdate_sell[] | null;
|
||||
sell: MarketDepthSubscription_marketsDepthUpdate_sell[] | null;
|
||||
/**
|
||||
* Buy side price levels (if available)
|
||||
*/
|
||||
buy: MarketDepthSubscription_marketDepthUpdate_buy[] | null;
|
||||
buy: MarketDepthSubscription_marketsDepthUpdate_buy[] | null;
|
||||
/**
|
||||
* Sequence number for the current snapshot of the market depth. It is always increasing but not monotonic.
|
||||
*/
|
||||
@@ -124,7 +63,7 @@ export interface MarketDepthSubscription {
|
||||
/**
|
||||
* Subscribe to price level market depth updates
|
||||
*/
|
||||
marketDepthUpdate: MarketDepthSubscription_marketDepthUpdate;
|
||||
marketsDepthUpdate: MarketDepthSubscription_marketsDepthUpdate[];
|
||||
}
|
||||
|
||||
export interface MarketDepthSubscriptionVariables {
|
||||
|
||||
@@ -11,11 +11,11 @@ export type MarketDepthQueryVariables = Types.Exact<{
|
||||
export type MarketDepthQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', staticMidPrice: string, marketTradingMode: Types.MarketTradingMode, indicativeVolume: string, indicativePrice: string, bestStaticBidPrice: string, bestStaticOfferPrice: string, market: { __typename?: 'Market', id: string } } | null, depth: { __typename?: 'MarketDepth', sequenceNumber: string, lastTrade?: { __typename?: 'Trade', price: string } | null, sell?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null, buy?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null } } | null };
|
||||
|
||||
export type MarketDepthSubscriptionSubscriptionVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
marketIds: Array<Types.Scalars['ID']> | Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketDepthSubscriptionSubscription = { __typename?: 'Subscription', marketDepthUpdate: { __typename?: 'MarketDepthUpdate', sequenceNumber: string, market: { __typename?: 'Market', id: string, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', staticMidPrice: string, marketTradingMode: Types.MarketTradingMode, indicativeVolume: string, indicativePrice: string, bestStaticBidPrice: string, bestStaticOfferPrice: string, market: { __typename?: 'Market', id: string } } | null }, sell?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null, buy?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null } };
|
||||
export type MarketDepthSubscriptionSubscription = { __typename?: 'Subscription', marketsDepthUpdate: Array<{ __typename?: 'ObservableMarketDepthUpdate', marketId: string, sequenceNumber: string, sell?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null, buy?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null }> };
|
||||
|
||||
|
||||
export const MarketDepthDocument = gql`
|
||||
@@ -83,23 +83,9 @@ export type MarketDepthQueryHookResult = ReturnType<typeof useMarketDepthQuery>;
|
||||
export type MarketDepthLazyQueryHookResult = ReturnType<typeof useMarketDepthLazyQuery>;
|
||||
export type MarketDepthQueryResult = Apollo.QueryResult<MarketDepthQuery, MarketDepthQueryVariables>;
|
||||
export const MarketDepthSubscriptionDocument = gql`
|
||||
subscription MarketDepthSubscription($marketId: ID!) {
|
||||
marketDepthUpdate(marketId: $marketId) {
|
||||
market {
|
||||
id
|
||||
positionDecimalPlaces
|
||||
data {
|
||||
staticMidPrice
|
||||
marketTradingMode
|
||||
indicativeVolume
|
||||
indicativePrice
|
||||
bestStaticBidPrice
|
||||
bestStaticOfferPrice
|
||||
market {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
subscription MarketDepthSubscription($marketIds: [ID!]!) {
|
||||
marketsDepthUpdate(marketIds: $marketIds) {
|
||||
marketId
|
||||
sell {
|
||||
price
|
||||
volume
|
||||
@@ -127,7 +113,7 @@ export const MarketDepthSubscriptionDocument = gql`
|
||||
* @example
|
||||
* const { data, loading, error } = useMarketDepthSubscriptionSubscription({
|
||||
* variables: {
|
||||
* marketId: // value for 'marketId'
|
||||
* marketIds: // value for 'marketIds'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
|
||||
@@ -16,9 +16,9 @@ import {
|
||||
useState,
|
||||
useContext,
|
||||
} from 'react';
|
||||
import type { MarketDepthSubscription_marketDepthUpdate } from './__generated__/MarketDepthSubscription';
|
||||
import type { DepthChartProps } from 'pennant';
|
||||
import { parseLevel, updateLevels } from './depth-chart-utils';
|
||||
import type { MarketDepthSubscription_marketsDepthUpdate } from './__generated__/MarketDepthSubscription';
|
||||
|
||||
interface DepthChartManagerProps {
|
||||
marketId: string;
|
||||
@@ -40,7 +40,7 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
||||
|
||||
// Apply updates to the table
|
||||
const update = useCallback(
|
||||
({ delta }: { delta: MarketDepthSubscription_marketDepthUpdate }) => {
|
||||
({ delta }: { delta: MarketDepthSubscription_marketsDepthUpdate }) => {
|
||||
if (!dataRef.current) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,22 +50,8 @@ const MARKET_DEPTH_QUERY = gql`
|
||||
|
||||
export const MARKET_DEPTH_SUBSCRIPTION_QUERY = gql`
|
||||
subscription MarketDepthSubscription($marketId: ID!) {
|
||||
marketDepthUpdate(marketId: $marketId) {
|
||||
market {
|
||||
id
|
||||
positionDecimalPlaces
|
||||
data {
|
||||
staticMidPrice
|
||||
marketTradingMode
|
||||
indicativeVolume
|
||||
indicativePrice
|
||||
bestStaticBidPrice
|
||||
bestStaticOfferPrice
|
||||
market {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
marketsDepthUpdate(marketIds: [$marketId]) {
|
||||
marketId
|
||||
sell {
|
||||
price
|
||||
volume
|
||||
|
||||
@@ -8,10 +8,11 @@ import {
|
||||
useState,
|
||||
useMemo,
|
||||
useCallback,
|
||||
useContext,
|
||||
} from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { formatNumber, t, useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
||||
import { formatNumber, t, ThemeContext } from '@vegaprotocol/react-helpers';
|
||||
import { MarketTradingMode } from '@vegaprotocol/types';
|
||||
import { OrderbookRow } from './orderbook-row';
|
||||
import { createRow, getPriceLevel } from './orderbook-data';
|
||||
@@ -27,7 +28,7 @@ interface OrderbookProps extends OrderbookData {
|
||||
|
||||
const HorizontalLine = ({ top, testId }: { top: string; testId: string }) => (
|
||||
<div
|
||||
className="absolute border-b border-neutral-300 dark:border-neutral-600 inset-x-0"
|
||||
className="absolute border-b border-default inset-x-0"
|
||||
style={{ top }}
|
||||
data-testid={testId}
|
||||
/>
|
||||
@@ -106,7 +107,7 @@ export const Orderbook = ({
|
||||
resolution,
|
||||
onResolutionChange,
|
||||
}: OrderbookProps) => {
|
||||
const [theme] = useThemeSwitcher();
|
||||
const theme = useContext(ThemeContext);
|
||||
const scrollElement = useRef<HTMLDivElement>(null);
|
||||
// scroll offset for which rendered rows are selected, will change after user will scroll to margin of rendered data
|
||||
const [scrollOffset, setScrollOffset] = useState(0);
|
||||
@@ -320,7 +321,7 @@ export const Orderbook = ({
|
||||
data-testid="scroll"
|
||||
>
|
||||
<div
|
||||
className="sticky top-0 grid grid-cols-4 gap-2 text-right border-b pt-2 bg-white dark:bg-black z-10 border-neutral-300 dark:border-neutral-600"
|
||||
className="sticky top-0 grid grid-cols-4 gap-2 text-right border-b pt-2 bg-white dark:bg-black z-10 border-default"
|
||||
style={{ gridAutoRows: '17px' }}
|
||||
>
|
||||
<div>{t('Bid vol')}</div>
|
||||
@@ -344,7 +345,7 @@ export const Orderbook = ({
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="sticky bottom-0 grid grid-cols-4 gap-2 border-t-[1px] border-neutral-300 dark:border-neutral-600 mt-2 z-10 bg-white dark:bg-black"
|
||||
className="sticky bottom-0 grid grid-cols-4 gap-2 border-t-[1px] border-default mt-2 z-10 bg-white dark:bg-black"
|
||||
style={{ gridAutoRows: '17px' }}
|
||||
>
|
||||
<div className="col-start-2">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
query MarketNames {
|
||||
query MarketInfoMarketNames {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
state
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
code
|
||||
name
|
||||
metadata {
|
||||
tags
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Schema as Types } from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type MarketInfoMarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type MarketInfoMarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null };
|
||||
|
||||
|
||||
export const MarketInfoMarketNamesDocument = gql`
|
||||
query MarketInfoMarketNames {
|
||||
markets {
|
||||
id
|
||||
state
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
code
|
||||
name
|
||||
metadata {
|
||||
tags
|
||||
}
|
||||
product {
|
||||
... on Future {
|
||||
quoteName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useMarketInfoMarketNamesQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useMarketInfoMarketNamesQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useMarketInfoMarketNamesQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||
* you can use to render your UI.
|
||||
*
|
||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||
*
|
||||
* @example
|
||||
* const { data, loading, error } = useMarketInfoMarketNamesQuery({
|
||||
* variables: {
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useMarketInfoMarketNamesQuery(baseOptions?: Apollo.QueryHookOptions<MarketInfoMarketNamesQuery, MarketInfoMarketNamesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<MarketInfoMarketNamesQuery, MarketInfoMarketNamesQueryVariables>(MarketInfoMarketNamesDocument, options);
|
||||
}
|
||||
export function useMarketInfoMarketNamesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<MarketInfoMarketNamesQuery, MarketInfoMarketNamesQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<MarketInfoMarketNamesQuery, MarketInfoMarketNamesQueryVariables>(MarketInfoMarketNamesDocument, options);
|
||||
}
|
||||
export type MarketInfoMarketNamesQueryHookResult = ReturnType<typeof useMarketInfoMarketNamesQuery>;
|
||||
export type MarketInfoMarketNamesLazyQueryHookResult = ReturnType<typeof useMarketInfoMarketNamesLazyQuery>;
|
||||
export type MarketInfoMarketNamesQueryResult = Apollo.QueryResult<MarketInfoMarketNamesQuery, MarketInfoMarketNamesQueryVariables>;
|
||||
+1
-21
@@ -119,22 +119,6 @@ export interface MarketInfoQuery_market_priceMonitoringSettings {
|
||||
parameters: MarketInfoQuery_market_priceMonitoringSettings_parameters | null;
|
||||
}
|
||||
|
||||
export interface MarketInfoQuery_market_riskFactors {
|
||||
__typename: "RiskFactor";
|
||||
/**
|
||||
* market the risk factor was emitted for
|
||||
*/
|
||||
market: string;
|
||||
/**
|
||||
* short factor
|
||||
*/
|
||||
short: string;
|
||||
/**
|
||||
* long factor
|
||||
*/
|
||||
long: string;
|
||||
}
|
||||
|
||||
export interface MarketInfoQuery_market_data_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
@@ -184,7 +168,7 @@ export interface MarketInfoQuery_market_data_priceMonitoringBounds {
|
||||
export interface MarketInfoQuery_market_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
* market of the associated mark price
|
||||
*/
|
||||
market: MarketInfoQuery_market_data_market;
|
||||
/**
|
||||
@@ -507,10 +491,6 @@ export interface MarketInfoQuery_market {
|
||||
* Price monitoring settings for the market
|
||||
*/
|
||||
priceMonitoringSettings: MarketInfoQuery_market_priceMonitoringSettings;
|
||||
/**
|
||||
* risk factors for the market
|
||||
*/
|
||||
riskFactors: MarketInfoQuery_market_riskFactors | null;
|
||||
/**
|
||||
* marketData for the given market
|
||||
*/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './MarketInfoQuery';
|
||||
@@ -335,7 +335,7 @@ export const Info = ({ market, onSelect }: InfoProps) => {
|
||||
<p className={headerClassName}>{t('Market data')}</p>
|
||||
<Accordion panels={marketDataPanels} />
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<div className="mb-8">
|
||||
<p className={headerClassName}>{t('Market specification')}</p>
|
||||
<Accordion panels={marketSpecPanels} />
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
fragment MarketDataFields on MarketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
tradingMode
|
||||
}
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
|
||||
query MarketList($interval: Interval!, $since: String!) {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
state
|
||||
@@ -68,8 +54,13 @@ query MarketList($interval: Interval!, $since: String!) {
|
||||
}
|
||||
}
|
||||
|
||||
subscription MarketDataSub {
|
||||
marketData {
|
||||
...MarketDataFields
|
||||
subscription MarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
marketId
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { MarketState, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: MarketDataFields
|
||||
// ====================================================
|
||||
|
||||
export interface MarketDataFields_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Current state of the market
|
||||
*/
|
||||
state: MarketState;
|
||||
/**
|
||||
* Current mode of execution of the market
|
||||
*/
|
||||
tradingMode: MarketTradingMode;
|
||||
}
|
||||
|
||||
export interface MarketDataFields {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
*/
|
||||
market: MarketDataFields_market;
|
||||
/**
|
||||
* the highest price level on an order book for buy orders.
|
||||
*/
|
||||
bestBidPrice: string;
|
||||
/**
|
||||
* the lowest price level on an order book for offer orders.
|
||||
*/
|
||||
bestOfferPrice: string;
|
||||
/**
|
||||
* the mark price (an unsigned integer)
|
||||
*/
|
||||
markPrice: string;
|
||||
/**
|
||||
* what triggered an auction (if an auction was started)
|
||||
*/
|
||||
trigger: AuctionTrigger;
|
||||
/**
|
||||
* indicative volume if the auction ended now, 0 if not in auction mode
|
||||
*/
|
||||
indicativeVolume: string;
|
||||
}
|
||||
+16
-20
@@ -9,28 +9,20 @@ import { MarketState, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/ty
|
||||
// GraphQL subscription operation: MarketDataSub
|
||||
// ====================================================
|
||||
|
||||
export interface MarketDataSub_marketData_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Current state of the market
|
||||
*/
|
||||
state: MarketState;
|
||||
/**
|
||||
* Current mode of execution of the market
|
||||
*/
|
||||
tradingMode: MarketTradingMode;
|
||||
}
|
||||
|
||||
export interface MarketDataSub_marketData {
|
||||
__typename: "MarketData";
|
||||
export interface MarketDataSub_marketsData {
|
||||
__typename: "ObservableMarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
*/
|
||||
market: MarketDataSub_marketData_market;
|
||||
marketId: string;
|
||||
/**
|
||||
* current state of the market
|
||||
*/
|
||||
marketState: MarketState;
|
||||
/**
|
||||
* what mode the market is in (auction, continuous etc)
|
||||
*/
|
||||
marketTradingMode: MarketTradingMode;
|
||||
/**
|
||||
* the highest price level on an order book for buy orders.
|
||||
*/
|
||||
@@ -57,5 +49,9 @@ export interface MarketDataSub {
|
||||
/**
|
||||
* Subscribe to the mark price changes
|
||||
*/
|
||||
marketData: MarketDataSub_marketData;
|
||||
marketsData: MarketDataSub_marketsData[];
|
||||
}
|
||||
|
||||
export interface MarketDataSubVariables {
|
||||
marketIds: string[];
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ export interface MarketList_markets_data_market {
|
||||
export interface MarketList_markets_data {
|
||||
__typename: "MarketData";
|
||||
/**
|
||||
* market ID of the associated mark price
|
||||
* market of the associated mark price
|
||||
*/
|
||||
market: MarketList_markets_data_market;
|
||||
/**
|
||||
|
||||
@@ -3,40 +3,26 @@ import { Schema as Types } from '@vegaprotocol/types';
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type MarketDataFieldsFragment = { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } };
|
||||
|
||||
export type MarketListQueryVariables = Types.Exact<{
|
||||
interval: Types.Interval;
|
||||
since: Types.Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketListQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, data?: { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', symbol: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, high: string, low: string } | null> | null }> | null };
|
||||
export type MarketListQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, data?: { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', symbol: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, high: string, low: string } | null> | null }> | null };
|
||||
|
||||
export type MarketDataSubSubscriptionVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
export type MarketDataSubSubscriptionVariables = Types.Exact<{
|
||||
marketIds: Array<Types.Scalars['ID']> | Types.Scalars['ID'];
|
||||
}>;
|
||||
|
||||
|
||||
export type MarketDataSubSubscription = { __typename?: 'Subscription', marketData: { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } } };
|
||||
export type MarketDataSubSubscription = { __typename?: 'Subscription', marketsData: Array<{ __typename?: 'ObservableMarketData', marketId: string, bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string }> };
|
||||
|
||||
|
||||
export const MarketDataFieldsFragmentDoc = gql`
|
||||
fragment MarketDataFields on MarketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
tradingMode
|
||||
}
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
`;
|
||||
export const MarketListDocument = gql`
|
||||
query MarketList($interval: Interval!, $since: String!) {
|
||||
markets {
|
||||
id
|
||||
name
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
state
|
||||
@@ -120,12 +106,17 @@ export type MarketListQueryHookResult = ReturnType<typeof useMarketListQuery>;
|
||||
export type MarketListLazyQueryHookResult = ReturnType<typeof useMarketListLazyQuery>;
|
||||
export type MarketListQueryResult = Apollo.QueryResult<MarketListQuery, MarketListQueryVariables>;
|
||||
export const MarketDataSubDocument = gql`
|
||||
subscription MarketDataSub {
|
||||
marketData {
|
||||
...MarketDataFields
|
||||
subscription MarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
marketId
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
}
|
||||
${MarketDataFieldsFragmentDoc}`;
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useMarketDataSubSubscription__
|
||||
@@ -139,10 +130,11 @@ export const MarketDataSubDocument = gql`
|
||||
* @example
|
||||
* const { data, loading, error } = useMarketDataSubSubscription({
|
||||
* variables: {
|
||||
* marketIds: // value for 'marketIds'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useMarketDataSubSubscription(baseOptions?: Apollo.SubscriptionHookOptions<MarketDataSubSubscription, MarketDataSubSubscriptionVariables>) {
|
||||
export function useMarketDataSubSubscription(baseOptions: Apollo.SubscriptionHookOptions<MarketDataSubSubscription, MarketDataSubSubscriptionVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useSubscription<MarketDataSubSubscription, MarketDataSubSubscriptionVariables>(MarketDataSubDocument, options);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import type {
|
||||
} from '../__generated__/MarketList';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
export const cellClassNames = 'px-0 py-1 first:text-left text-right';
|
||||
export const cellClassNames = 'py-1 first:text-left text-right';
|
||||
|
||||
const FeesInfo = () => {
|
||||
return (
|
||||
|
||||
@@ -7,7 +7,7 @@ export const SelectMarketTableHeader = ({
|
||||
headers = columnHeaders,
|
||||
}) => {
|
||||
return (
|
||||
<tr className="sticky top-0 z-10 border-b border-neutral-300 dark:border-neutral-600 bg-inherit">
|
||||
<tr className="sticky top-0 z-10 border-b border-default bg-inherit">
|
||||
{headers.map(({ value, className, onlyOnDetailed }, i) => {
|
||||
const thClass = classNames(
|
||||
'font-normal text-neutral-500 dark:text-neutral-400',
|
||||
|
||||
@@ -76,7 +76,7 @@ export const SelectAllMarketsTableBody = ({
|
||||
if (!data) return null;
|
||||
return (
|
||||
<>
|
||||
<thead className="bg-neutral-50 dark:bg-neutral-800">
|
||||
<thead className="bg-neutral-100 dark:bg-neutral-800">
|
||||
<SelectMarketTableHeader detailed={true} headers={headers} />
|
||||
</thead>
|
||||
{/* Border styles required to create space between tbody elements margin/padding dont work */}
|
||||
@@ -101,7 +101,7 @@ export const SelectMarketPopover = ({
|
||||
onSelect: (id: string) => void;
|
||||
}) => {
|
||||
const triggerClasses =
|
||||
'sm:text-lg md:text-xl lg:text-2xl font-medium flex items-center gap-4 whitespace-nowrap my-3 hover:text-neutral-500 dark:hover:text-neutral-300';
|
||||
'sm:text-lg md:text-xl lg:text-2xl flex items-center gap-2 whitespace-nowrap hover:text-neutral-500 dark:hover:text-neutral-300';
|
||||
const { keypair } = useVegaWallet();
|
||||
const [open, setOpen] = useState(false);
|
||||
const { data, loading: marketsLoading } = useMarketList();
|
||||
|
||||
@@ -27,21 +27,6 @@ export const useMarketList = () => {
|
||||
};
|
||||
};
|
||||
|
||||
const MARKET_DATA_FRAGMENT = gql`
|
||||
fragment MarketDataFields on MarketData {
|
||||
market {
|
||||
id
|
||||
state
|
||||
tradingMode
|
||||
}
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
`;
|
||||
|
||||
export const MARKET_LIST_QUERY = gql`
|
||||
query MarketList($interval: Interval!, $since: String!) {
|
||||
markets {
|
||||
@@ -101,10 +86,16 @@ export const MARKET_LIST_QUERY = gql`
|
||||
`;
|
||||
|
||||
const MARKET_DATA_SUB = gql`
|
||||
${MARKET_DATA_FRAGMENT}
|
||||
subscription MarketDataSub {
|
||||
marketData {
|
||||
...MarketDataFields
|
||||
subscription MarketDataSub($marketIds: [ID!]!) {
|
||||
marketsData(marketIds: $marketIds) {
|
||||
marketId
|
||||
marketState
|
||||
marketTradingMode
|
||||
bestBidPrice
|
||||
bestOfferPrice
|
||||
markPrice
|
||||
trigger
|
||||
indicativeVolume
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @generated
|
||||
// This file was automatically generated and should not be edited.
|
||||
|
||||
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "@vegaprotocol/types";
|
||||
|
||||
// ====================================================
|
||||
// GraphQL fragment: OrderFields
|
||||
// ====================================================
|
||||
|
||||
export interface OrderFields_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface OrderFields_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: OrderFields_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface OrderFields_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||
* This sets how big the smallest order / position on the market can be.
|
||||
*/
|
||||
positionDecimalPlaces: number;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: OrderFields_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface OrderFields {
|
||||
__typename: "Order";
|
||||
/**
|
||||
* Hash of the order data
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The market the order is trading on (probably stored internally as a hash of the market details)
|
||||
*/
|
||||
market: OrderFields_market;
|
||||
/**
|
||||
* Type the order type (defaults to PARTY)
|
||||
*/
|
||||
type: OrderType | null;
|
||||
/**
|
||||
* Whether the order is to buy or sell
|
||||
*/
|
||||
side: Side;
|
||||
/**
|
||||
* Total number of contracts that may be bought or sold (immutable) (uint64)
|
||||
*/
|
||||
size: string;
|
||||
/**
|
||||
* The status of an order, for example 'Active'
|
||||
*/
|
||||
status: OrderStatus;
|
||||
/**
|
||||
* Reason for the order to be rejected
|
||||
*/
|
||||
rejectionReason: OrderRejectionReason | null;
|
||||
/**
|
||||
* The worst price the order will trade at (e.g. buy for price or less, sell for price or more) (uint64)
|
||||
*/
|
||||
price: string;
|
||||
/**
|
||||
* The timeInForce of order (determines how and if it executes, and whether it persists on the book)
|
||||
*/
|
||||
timeInForce: OrderTimeInForce;
|
||||
/**
|
||||
* Number of contracts remaining of the total that have not yet been bought or sold (uint64)
|
||||
*/
|
||||
remaining: string;
|
||||
/**
|
||||
* Expiration time of this order (ISO-8601 RFC3339+Nano formatted date)
|
||||
*/
|
||||
expiresAt: string | null;
|
||||
/**
|
||||
* RFC3339Nano formatted date and time for when the order was created (timestamp)
|
||||
*/
|
||||
createdAt: string;
|
||||
/**
|
||||
* RFC3339Nano time the order was altered
|
||||
*/
|
||||
updatedAt: string | null;
|
||||
}
|
||||
+9
-69
@@ -9,78 +9,14 @@ import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce }
|
||||
// GraphQL subscription operation: OrderSub
|
||||
// ====================================================
|
||||
|
||||
export interface OrderSub_orders_market_tradableInstrument_instrument {
|
||||
__typename: "Instrument";
|
||||
/**
|
||||
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* Full and fairly descriptive name for the instrument
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface OrderSub_orders_market_tradableInstrument {
|
||||
__typename: "TradableInstrument";
|
||||
/**
|
||||
* An instance of, or reference to, a fully specified instrument.
|
||||
*/
|
||||
instrument: OrderSub_orders_market_tradableInstrument_instrument;
|
||||
}
|
||||
|
||||
export interface OrderSub_orders_market {
|
||||
__typename: "Market";
|
||||
/**
|
||||
* Market ID
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
* Examples:
|
||||
* Currency Balance decimalPlaces Real Balance
|
||||
* GBP 100 0 GBP 100
|
||||
* GBP 100 2 GBP 1.00
|
||||
* GBP 100 4 GBP 0.01
|
||||
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||
*
|
||||
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||
*/
|
||||
decimalPlaces: number;
|
||||
/**
|
||||
* positionDecimalPlaces indicates the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||
* This sets how big the smallest order / position on the market can be.
|
||||
*/
|
||||
positionDecimalPlaces: number;
|
||||
/**
|
||||
* An instance of, or reference to, a tradable instrument.
|
||||
*/
|
||||
tradableInstrument: OrderSub_orders_market_tradableInstrument;
|
||||
}
|
||||
|
||||
export interface OrderSub_orders {
|
||||
__typename: "Order";
|
||||
__typename: "OrderUpdate";
|
||||
/**
|
||||
* Hash of the order data
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The market the order is trading on (probably stored internally as a hash of the market details)
|
||||
*/
|
||||
market: OrderSub_orders_market;
|
||||
/**
|
||||
* Type the order type (defaults to PARTY)
|
||||
* The order type
|
||||
*/
|
||||
type: OrderType | null;
|
||||
/**
|
||||
@@ -88,7 +24,7 @@ export interface OrderSub_orders {
|
||||
*/
|
||||
side: Side;
|
||||
/**
|
||||
* Total number of contracts that may be bought or sold (immutable) (uint64)
|
||||
* Total number of units that may be bought or sold (immutable) (uint64)
|
||||
*/
|
||||
size: string;
|
||||
/**
|
||||
@@ -96,7 +32,7 @@ export interface OrderSub_orders {
|
||||
*/
|
||||
status: OrderStatus;
|
||||
/**
|
||||
* Reason for the order to be rejected
|
||||
* Why the order was rejected
|
||||
*/
|
||||
rejectionReason: OrderRejectionReason | null;
|
||||
/**
|
||||
@@ -108,7 +44,7 @@ export interface OrderSub_orders {
|
||||
*/
|
||||
timeInForce: OrderTimeInForce;
|
||||
/**
|
||||
* Number of contracts remaining of the total that have not yet been bought or sold (uint64)
|
||||
* Number of units remaining of the total that have not yet been bought or sold (uint64)
|
||||
*/
|
||||
remaining: string;
|
||||
/**
|
||||
@@ -123,6 +59,10 @@ export interface OrderSub_orders {
|
||||
* RFC3339Nano time the order was altered
|
||||
*/
|
||||
updatedAt: string | null;
|
||||
/**
|
||||
* The market the order is trading on (probably stored internally as a hash of the market details)
|
||||
*/
|
||||
marketId: string;
|
||||
}
|
||||
|
||||
export interface OrderSub {
|
||||
|
||||
+9
-9
@@ -76,11 +76,7 @@ export interface Orders_party_ordersConnection_edges_node {
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The market the order is trading on (probably stored internally as a hash of the market details)
|
||||
*/
|
||||
market: Orders_party_ordersConnection_edges_node_market;
|
||||
/**
|
||||
* Type the order type (defaults to PARTY)
|
||||
* The order type
|
||||
*/
|
||||
type: OrderType | null;
|
||||
/**
|
||||
@@ -88,7 +84,7 @@ export interface Orders_party_ordersConnection_edges_node {
|
||||
*/
|
||||
side: Side;
|
||||
/**
|
||||
* Total number of contracts that may be bought or sold (immutable) (uint64)
|
||||
* Total number of units that may be bought or sold (immutable) (uint64)
|
||||
*/
|
||||
size: string;
|
||||
/**
|
||||
@@ -96,7 +92,7 @@ export interface Orders_party_ordersConnection_edges_node {
|
||||
*/
|
||||
status: OrderStatus;
|
||||
/**
|
||||
* Reason for the order to be rejected
|
||||
* Why the order was rejected
|
||||
*/
|
||||
rejectionReason: OrderRejectionReason | null;
|
||||
/**
|
||||
@@ -108,7 +104,7 @@ export interface Orders_party_ordersConnection_edges_node {
|
||||
*/
|
||||
timeInForce: OrderTimeInForce;
|
||||
/**
|
||||
* Number of contracts remaining of the total that have not yet been bought or sold (uint64)
|
||||
* Number of units remaining of the total that have not yet been bought or sold (uint64)
|
||||
*/
|
||||
remaining: string;
|
||||
/**
|
||||
@@ -123,6 +119,10 @@ export interface Orders_party_ordersConnection_edges_node {
|
||||
* RFC3339Nano time the order was altered
|
||||
*/
|
||||
updatedAt: string | null;
|
||||
/**
|
||||
* The market the order is trading on (probably stored internally as a hash of the market details)
|
||||
*/
|
||||
market: Orders_party_ordersConnection_edges_node_market;
|
||||
}
|
||||
|
||||
export interface Orders_party_ordersConnection_edges {
|
||||
@@ -160,7 +160,7 @@ export interface Orders_party {
|
||||
/**
|
||||
* Orders relating to a party
|
||||
*/
|
||||
ordersConnection: Orders_party_ordersConnection;
|
||||
ordersConnection: Orders_party_ordersConnection | null;
|
||||
}
|
||||
|
||||
export interface Orders {
|
||||
|
||||
@@ -10,48 +10,40 @@ import type { PageInfo } from '@vegaprotocol/react-helpers';
|
||||
import type {
|
||||
Orders,
|
||||
Orders_party_ordersConnection_edges,
|
||||
OrderSub,
|
||||
OrderFields,
|
||||
} from '../';
|
||||
|
||||
const ORDER_FRAGMENT = gql`
|
||||
fragment OrderFields on Order {
|
||||
id
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
type
|
||||
side
|
||||
size
|
||||
status
|
||||
rejectionReason
|
||||
price
|
||||
timeInForce
|
||||
remaining
|
||||
expiresAt
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
`;
|
||||
} from './__generated__/Orders';
|
||||
import type { OrderSub, OrderSub_orders } from './__generated__/OrderSub';
|
||||
|
||||
export const ORDERS_QUERY = gql`
|
||||
${ORDER_FRAGMENT}
|
||||
query Orders($partyId: ID!, $pagination: Pagination) {
|
||||
party(id: $partyId) {
|
||||
id
|
||||
ordersConnection(pagination: $pagination) {
|
||||
edges {
|
||||
node {
|
||||
...OrderFields
|
||||
id
|
||||
type
|
||||
side
|
||||
size
|
||||
status
|
||||
rejectionReason
|
||||
price
|
||||
timeInForce
|
||||
remaining
|
||||
expiresAt
|
||||
createdAt
|
||||
updatedAt
|
||||
market {
|
||||
id
|
||||
decimalPlaces
|
||||
positionDecimalPlaces
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
code
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor
|
||||
}
|
||||
@@ -67,17 +59,28 @@ export const ORDERS_QUERY = gql`
|
||||
`;
|
||||
|
||||
export const ORDERS_SUB = gql`
|
||||
${ORDER_FRAGMENT}
|
||||
subscription OrderSub($partyId: ID!) {
|
||||
orders(partyId: $partyId) {
|
||||
...OrderFields
|
||||
id
|
||||
type
|
||||
side
|
||||
size
|
||||
status
|
||||
rejectionReason
|
||||
price
|
||||
timeInForce
|
||||
remaining
|
||||
expiresAt
|
||||
createdAt
|
||||
updatedAt
|
||||
marketId
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const update = (
|
||||
data: Orders_party_ordersConnection_edges[],
|
||||
delta: OrderFields[]
|
||||
delta: OrderSub_orders[]
|
||||
) => {
|
||||
return produce(data, (draft) => {
|
||||
// A single update can contain the same order with multiple updates, so we need to find
|
||||
@@ -108,12 +111,12 @@ export const update = (
|
||||
const getData = (
|
||||
responseData: Orders
|
||||
): Orders_party_ordersConnection_edges[] | null =>
|
||||
responseData?.party?.ordersConnection.edges || null;
|
||||
responseData?.party?.ordersConnection?.edges || null;
|
||||
|
||||
const getDelta = (subscriptionData: OrderSub) => subscriptionData.orders || [];
|
||||
|
||||
const getPageInfo = (responseData: Orders): PageInfo | null =>
|
||||
responseData.party?.ordersConnection.pageInfo || null;
|
||||
responseData.party?.ordersConnection?.pageInfo || null;
|
||||
|
||||
export const ordersDataProvider = makeDataProvider({
|
||||
query: ORDERS_QUERY,
|
||||
|
||||
@@ -87,34 +87,32 @@ export const OrderEditDialog = ({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 py-4">
|
||||
<form onSubmit={handleSubmit(onSubmit)} data-testid="edit-order">
|
||||
<FormGroup label={t('Entry price')} labelFor="entryPrice">
|
||||
<Input
|
||||
type="number"
|
||||
step={step}
|
||||
{...register('entryPrice', {
|
||||
required: t('You need to provide a price'),
|
||||
validate: {
|
||||
min: (value) =>
|
||||
Number(value) > 0
|
||||
? true
|
||||
: t('The price cannot be negative'),
|
||||
},
|
||||
})}
|
||||
id="entryPrice"
|
||||
/>
|
||||
{errors.entryPrice?.message && (
|
||||
<InputError intent="danger">
|
||||
{errors.entryPrice.message}
|
||||
</InputError>
|
||||
)}
|
||||
</FormGroup>
|
||||
<Button variant="primary" size="md" type="submit">
|
||||
{t('Update')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
data-testid="edit-order"
|
||||
className="w-1/2 mt-4"
|
||||
>
|
||||
<FormGroup label={t('Entry price')} labelFor="entryPrice">
|
||||
<Input
|
||||
type="number"
|
||||
step={step}
|
||||
{...register('entryPrice', {
|
||||
required: t('You need to provide a price'),
|
||||
validate: {
|
||||
min: (value) =>
|
||||
Number(value) > 0 ? true : t('The price cannot be negative'),
|
||||
},
|
||||
})}
|
||||
id="entryPrice"
|
||||
/>
|
||||
{errors.entryPrice?.message && (
|
||||
<InputError intent="danger">{errors.entryPrice.message}</InputError>
|
||||
)}
|
||||
</FormGroup>
|
||||
<Button variant="primary" size="md" type="submit">
|
||||
{t('Update')}
|
||||
</Button>
|
||||
</form>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user