fix(trading): remove market value proxy and formatting (#4916)
This commit is contained in:
parent
0872a14f44
commit
8efadda98c
@ -87,7 +87,13 @@ context('Market page', { tags: '@regression' }, function () {
|
|||||||
// Liquidity
|
// Liquidity
|
||||||
cy.validate_element_from_table('Target Stake', '0.00 fUSDC');
|
cy.validate_element_from_table('Target Stake', '0.00 fUSDC');
|
||||||
cy.validate_element_from_table('Supplied Stake', '0.00 fUSDC');
|
cy.validate_element_from_table('Supplied Stake', '0.00 fUSDC');
|
||||||
cy.validate_element_from_table('Market Value Proxy', '0.00 fUSDC');
|
// Liquidity price range
|
||||||
|
cy.validate_element_from_table(
|
||||||
|
'Liquidity Price Range',
|
||||||
|
'1,000.00% of mid price'
|
||||||
|
);
|
||||||
|
cy.validate_element_from_table('Lowest Price', '0.00 fUSDC');
|
||||||
|
cy.validate_element_from_table('Highest Price', '0.00 fUSDC');
|
||||||
cy.getByTestId('oracle-spec-links')
|
cy.getByTestId('oracle-spec-links')
|
||||||
.should('have.attr', 'href')
|
.should('have.attr', 'href')
|
||||||
.and(
|
.and(
|
||||||
|
@ -12,10 +12,6 @@ import {
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { ExternalLink, Indicator } from '@vegaprotocol/ui-toolkit';
|
import { ExternalLink, Indicator } from '@vegaprotocol/ui-toolkit';
|
||||||
import { DocsLinks } from '@vegaprotocol/environment';
|
import { DocsLinks } from '@vegaprotocol/environment';
|
||||||
import {
|
|
||||||
NetworkParams,
|
|
||||||
useNetworkParams,
|
|
||||||
} from '@vegaprotocol/network-parameters';
|
|
||||||
import { useCheckLiquidityStatus } from '@vegaprotocol/liquidity';
|
import { useCheckLiquidityStatus } from '@vegaprotocol/liquidity';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
@ -31,12 +27,8 @@ export const LiquidityHeader = () => {
|
|||||||
const assetDecimalPlaces = asset?.decimals || 0;
|
const assetDecimalPlaces = asset?.decimals || 0;
|
||||||
const symbol = asset?.symbol;
|
const symbol = asset?.symbol;
|
||||||
|
|
||||||
const { params } = useNetworkParams([
|
|
||||||
NetworkParams.market_liquidity_stakeToCcyVolume,
|
|
||||||
NetworkParams.market_liquidity_targetstake_triggering_ratio,
|
|
||||||
]);
|
|
||||||
const triggeringRatio =
|
const triggeringRatio =
|
||||||
params.market_liquidity_targetstake_triggering_ratio || '1';
|
market?.liquidityMonitoringParameters.triggeringRatio || '1';
|
||||||
|
|
||||||
const { percentage, status } = useCheckLiquidityStatus({
|
const { percentage, status } = useCheckLiquidityStatus({
|
||||||
suppliedStake: suppliedStake || 0,
|
suppliedStake: suppliedStake || 0,
|
||||||
|
@ -61,7 +61,6 @@ describe('MarketSelectorItem', () => {
|
|||||||
indicativeVolume: '100',
|
indicativeVolume: '100',
|
||||||
marketState: MarketState.STATE_ACTIVE,
|
marketState: MarketState.STATE_ACTIVE,
|
||||||
marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
marketValueProxy: '100',
|
|
||||||
markPrice: '50000',
|
markPrice: '50000',
|
||||||
midPrice: '100',
|
midPrice: '100',
|
||||||
staticMidPrice: '100',
|
staticMidPrice: '100',
|
||||||
|
@ -126,10 +126,12 @@ export const MarketSelector = ({
|
|||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
noItems={
|
noItems={
|
||||||
filter.product === Product.Perpetual
|
filter.product === Product.Perpetual
|
||||||
? t('Perpetual markets coming soon.')
|
? t('No perpetual markets.')
|
||||||
: filter.product === Product.Spot
|
: filter.product === Product.Spot
|
||||||
? t('Spot markets coming soon.')
|
? t('Spot markets coming soon.')
|
||||||
: t('No markets')
|
: filter.product === Product.Future
|
||||||
|
? t('No future markets.')
|
||||||
|
: t('No markets.')
|
||||||
}
|
}
|
||||||
allProducts={allProducts}
|
allProducts={allProducts}
|
||||||
/>
|
/>
|
||||||
|
@ -11,6 +11,9 @@ export function generateMarket(override?: PartialDeep<Market>): Market {
|
|||||||
positionDecimalPlaces: 1,
|
positionDecimalPlaces: 1,
|
||||||
tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
state: Schema.MarketState.STATE_ACTIVE,
|
state: Schema.MarketState.STATE_ACTIVE,
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '1',
|
||||||
|
},
|
||||||
marketTimestamps: {
|
marketTimestamps: {
|
||||||
__typename: 'MarketTimestamps',
|
__typename: 'MarketTimestamps',
|
||||||
close: '',
|
close: '',
|
||||||
|
@ -42,6 +42,9 @@ export const generateFill = (override?: PartialDeep<Trade>) => {
|
|||||||
decimalPlaces: 5,
|
decimalPlaces: 5,
|
||||||
state: MarketState.STATE_ACTIVE,
|
state: MarketState.STATE_ACTIVE,
|
||||||
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '1',
|
||||||
|
},
|
||||||
fees: {
|
fees: {
|
||||||
__typename: 'Fees',
|
__typename: 'Fees',
|
||||||
factors: {
|
factors: {
|
||||||
|
10
libs/markets/src/lib/__generated__/market-data.ts
generated
10
libs/markets/src/lib/__generated__/market-data.ts
generated
@ -3,23 +3,23 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type MarketDataUpdateFieldsFragment = { __typename?: 'ObservableMarketData', marketId: string, auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, marketValueProxy: string, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null };
|
export type MarketDataUpdateFieldsFragment = { __typename?: 'ObservableMarketData', marketId: string, auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null };
|
||||||
|
|
||||||
export type MarketDataUpdateSubscriptionVariables = Types.Exact<{
|
export type MarketDataUpdateSubscriptionVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type MarketDataUpdateSubscription = { __typename?: 'Subscription', marketsData: Array<{ __typename?: 'ObservableMarketData', marketId: string, auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, marketValueProxy: string, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null }> };
|
export type MarketDataUpdateSubscription = { __typename?: 'Subscription', marketsData: Array<{ __typename?: 'ObservableMarketData', marketId: string, auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null }> };
|
||||||
|
|
||||||
export type MarketDataFieldsFragment = { __typename?: 'MarketData', auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, marketValueProxy: string, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, market: { __typename?: 'Market', id: string }, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null };
|
export type MarketDataFieldsFragment = { __typename?: 'MarketData', auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, market: { __typename?: 'Market', id: string }, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null };
|
||||||
|
|
||||||
export type MarketDataQueryVariables = Types.Exact<{
|
export type MarketDataQueryVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type MarketDataQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', data?: { __typename?: 'MarketData', auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, marketValueProxy: string, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, market: { __typename?: 'Market', id: string }, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null } }> } | null };
|
export type MarketDataQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', data?: { __typename?: 'MarketData', auctionEnd?: string | null, auctionStart?: string | null, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, indicativePrice: string, indicativeVolume: string, marketState: Types.MarketState, marketTradingMode: Types.MarketTradingMode, markPrice: string, midPrice: string, openInterest: string, staticMidPrice: string, suppliedStake?: string | null, targetStake?: string | null, trigger: Types.AuctionTrigger, lastTradedPrice: string, market: { __typename?: 'Market', id: string }, productData?: { __typename?: 'PerpetualData', fundingRate?: string | null, fundingPayment?: string | null, externalTwap?: string | null, internalTwap?: string | null } | null, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null } }> } | null };
|
||||||
|
|
||||||
export const MarketDataUpdateFieldsFragmentDoc = gql`
|
export const MarketDataUpdateFieldsFragmentDoc = gql`
|
||||||
fragment MarketDataUpdateFields on ObservableMarketData {
|
fragment MarketDataUpdateFields on ObservableMarketData {
|
||||||
@ -46,7 +46,6 @@ export const MarketDataUpdateFieldsFragmentDoc = gql`
|
|||||||
indicativeVolume
|
indicativeVolume
|
||||||
marketState
|
marketState
|
||||||
marketTradingMode
|
marketTradingMode
|
||||||
marketValueProxy
|
|
||||||
markPrice
|
markPrice
|
||||||
midPrice
|
midPrice
|
||||||
openInterest
|
openInterest
|
||||||
@ -94,7 +93,6 @@ export const MarketDataFieldsFragmentDoc = gql`
|
|||||||
indicativeVolume
|
indicativeVolume
|
||||||
marketState
|
marketState
|
||||||
marketTradingMode
|
marketTradingMode
|
||||||
marketValueProxy
|
|
||||||
markPrice
|
markPrice
|
||||||
midPrice
|
midPrice
|
||||||
openInterest
|
openInterest
|
||||||
|
7
libs/markets/src/lib/__generated__/markets.ts
generated
7
libs/markets/src/lib/__generated__/markets.ts
generated
File diff suppressed because one or more lines are too long
@ -6,226 +6,234 @@ import {
|
|||||||
import { DataSourceProof, SuccessionLineInfoPanel } from './market-info-panels';
|
import { DataSourceProof, SuccessionLineInfoPanel } from './market-info-panels';
|
||||||
import { MockedProvider } from '@apollo/react-testing';
|
import { MockedProvider } from '@apollo/react-testing';
|
||||||
import { SuccessorMarketIdsDocument } from '../../__generated__';
|
import { SuccessorMarketIdsDocument } from '../../__generated__';
|
||||||
|
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
||||||
|
|
||||||
jest.mock('../../hooks/use-oracle-markets', () => ({
|
jest.mock('../../hooks/use-oracle-markets', () => ({
|
||||||
useOracleMarkets: () => [],
|
useOracleMarkets: () => [],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('DataSourceProof', () => {
|
describe('MarketInfoPanels', () => {
|
||||||
const ORACLE_PUBKEY =
|
describe('DataSourceProof', () => {
|
||||||
'69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f';
|
const ORACLE_PUBKEY =
|
||||||
|
'69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f';
|
||||||
|
|
||||||
it('renders message if there are no providers', () => {
|
it('renders message if there are no providers', () => {
|
||||||
const props = {
|
const props = {
|
||||||
data: {
|
data: {
|
||||||
sourceType: {
|
|
||||||
__typename: 'DataSourceDefinitionExternal' as const,
|
|
||||||
sourceType: {
|
sourceType: {
|
||||||
__typename: 'DataSourceSpecConfiguration' as const,
|
__typename: 'DataSourceDefinitionExternal' as const,
|
||||||
signers: [
|
sourceType: {
|
||||||
{
|
__typename: 'DataSourceSpecConfiguration' as const,
|
||||||
__typename: 'Signer' as const,
|
signers: [
|
||||||
signer: {
|
{
|
||||||
__typename: 'PubKey' as const,
|
__typename: 'Signer' as const,
|
||||||
key: ORACLE_PUBKEY,
|
signer: {
|
||||||
|
__typename: 'PubKey' as const,
|
||||||
|
key: ORACLE_PUBKEY,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
providers: [],
|
||||||
providers: [],
|
type: 'termination' as const,
|
||||||
type: 'termination' as const,
|
};
|
||||||
};
|
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
||||||
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
expect(
|
||||||
expect(
|
screen.getByText('No oracle proof for termination')
|
||||||
screen.getByText('No oracle proof for termination')
|
).toBeInTheDocument();
|
||||||
).toBeInTheDocument();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('renders message if there are no matching proofs', () => {
|
it('renders message if there are no matching proofs', () => {
|
||||||
const props = {
|
const props = {
|
||||||
data: {
|
data: {
|
||||||
sourceType: {
|
|
||||||
__typename: 'DataSourceDefinitionExternal' as const,
|
|
||||||
sourceType: {
|
sourceType: {
|
||||||
__typename: 'DataSourceSpecConfiguration' as const,
|
__typename: 'DataSourceDefinitionExternal' as const,
|
||||||
signers: [
|
sourceType: {
|
||||||
{
|
__typename: 'DataSourceSpecConfiguration' as const,
|
||||||
__typename: 'Signer' as const,
|
signers: [
|
||||||
signer: {
|
{
|
||||||
__typename: 'PubKey' as const,
|
__typename: 'Signer' as const,
|
||||||
key: ORACLE_PUBKEY,
|
signer: {
|
||||||
|
__typename: 'PubKey' as const,
|
||||||
|
key: ORACLE_PUBKEY,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
providers: [
|
||||||
providers: [
|
{
|
||||||
{
|
name: 'Another oracle',
|
||||||
name: 'Another oracle',
|
url: 'https://zombo.com',
|
||||||
url: 'https://zombo.com',
|
description_markdown:
|
||||||
description_markdown:
|
'Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n',
|
||||||
'Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n',
|
oracle: {
|
||||||
oracle: {
|
status: 'GOOD' as const,
|
||||||
status: 'GOOD' as const,
|
status_reason: '',
|
||||||
status_reason: '',
|
first_verified: '2022-01-01T00:00:00.000Z',
|
||||||
first_verified: '2022-01-01T00:00:00.000Z',
|
last_verified: '2022-12-31T00:00:00.000Z',
|
||||||
last_verified: '2022-12-31T00:00:00.000Z',
|
|
||||||
type: 'public_key' as const,
|
|
||||||
public_key: 'not-the-pubkey',
|
|
||||||
},
|
|
||||||
proofs: [
|
|
||||||
{
|
|
||||||
format: 'signed_message' as const,
|
|
||||||
available: true,
|
|
||||||
type: 'public_key' as const,
|
type: 'public_key' as const,
|
||||||
public_key: 'not-the-pubkey',
|
public_key: 'not-the-pubkey',
|
||||||
message: 'SOMEHEX',
|
|
||||||
},
|
},
|
||||||
],
|
proofs: [
|
||||||
github_link: `https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/PubKey-${ORACLE_PUBKEY}.toml`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
type: 'settlementData' as const,
|
|
||||||
};
|
|
||||||
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
|
||||||
expect(
|
|
||||||
screen.getByText('No oracle proof for settlement data')
|
|
||||||
).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders message if no data source on market', () => {
|
|
||||||
const props = {
|
|
||||||
data: {
|
|
||||||
sourceType: {
|
|
||||||
__typename: 'Invalid',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
providers: [],
|
|
||||||
type: 'termination' as const,
|
|
||||||
};
|
|
||||||
// @ts-ignore types are invalid
|
|
||||||
render(<DataSourceProof {...props} />);
|
|
||||||
expect(screen.getByText('Invalid data source')).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders conditions for internal data sources', () => {
|
|
||||||
const condition = {
|
|
||||||
__typename: 'Condition' as const,
|
|
||||||
operator: ConditionOperator.OPERATOR_GREATER_THAN,
|
|
||||||
value: '100',
|
|
||||||
};
|
|
||||||
const props = {
|
|
||||||
data: {
|
|
||||||
sourceType: {
|
|
||||||
__typename: 'DataSourceDefinitionInternal' as const,
|
|
||||||
sourceType: {
|
|
||||||
__typename: 'DataSourceSpecConfigurationTime' as const,
|
|
||||||
conditions: [condition],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
providers: [],
|
|
||||||
type: 'termination' as const,
|
|
||||||
};
|
|
||||||
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
|
||||||
expect(screen.getByText('Internal conditions')).toBeInTheDocument();
|
|
||||||
expect(
|
|
||||||
screen.getByText(
|
|
||||||
`${ConditionOperatorMapping[condition.operator]} ${condition.value}`
|
|
||||||
)
|
|
||||||
).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('SuccessionLineInfoPanel', () => {
|
|
||||||
const mocks = [
|
|
||||||
{
|
|
||||||
request: {
|
|
||||||
query: SuccessorMarketIdsDocument,
|
|
||||||
},
|
|
||||||
result: {
|
|
||||||
data: {
|
|
||||||
__typename: 'Query',
|
|
||||||
marketsConnection: {
|
|
||||||
__typename: 'MarketConnection',
|
|
||||||
edges: [
|
|
||||||
{
|
{
|
||||||
__typename: 'MarketEdge',
|
format: 'signed_message' as const,
|
||||||
node: {
|
available: true,
|
||||||
__typename: 'Market',
|
type: 'public_key' as const,
|
||||||
id: 'abc',
|
public_key: 'not-the-pubkey',
|
||||||
successorMarketID: 'def',
|
message: 'SOMEHEX',
|
||||||
parentMarketID: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
__typename: 'MarketEdge',
|
|
||||||
node: {
|
|
||||||
__typename: 'Market',
|
|
||||||
id: 'def',
|
|
||||||
successorMarketID: 'ghi',
|
|
||||||
parentMarketID: 'abc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
__typename: 'MarketEdge',
|
|
||||||
node: {
|
|
||||||
__typename: 'Market',
|
|
||||||
id: 'ghi',
|
|
||||||
successorMarketID: null,
|
|
||||||
parentMarketID: 'def',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
github_link: `https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/PubKey-${ORACLE_PUBKEY}.toml`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
type: 'settlementData' as const,
|
||||||
|
};
|
||||||
|
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
||||||
|
expect(
|
||||||
|
screen.getByText('No oracle proof for settlement data')
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders message if no data source on market', () => {
|
||||||
|
const props = {
|
||||||
|
data: {
|
||||||
|
sourceType: {
|
||||||
|
__typename: 'Invalid',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
providers: [],
|
||||||
|
type: 'termination' as const,
|
||||||
|
};
|
||||||
|
// @ts-ignore types are invalid
|
||||||
|
render(<DataSourceProof {...props} />);
|
||||||
|
expect(screen.getByText('Invalid data source')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders conditions for internal data sources', () => {
|
||||||
|
const condition = {
|
||||||
|
__typename: 'Condition' as const,
|
||||||
|
operator: ConditionOperator.OPERATOR_GREATER_THAN,
|
||||||
|
value: '1696238009',
|
||||||
|
};
|
||||||
|
const props = {
|
||||||
|
data: {
|
||||||
|
sourceType: {
|
||||||
|
__typename: 'DataSourceDefinitionInternal' as const,
|
||||||
|
sourceType: {
|
||||||
|
__typename: 'DataSourceSpecConfigurationTime' as const,
|
||||||
|
conditions: [condition],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
providers: [],
|
||||||
|
type: 'termination' as const,
|
||||||
|
};
|
||||||
|
render(<DataSourceProof dataSourceSpecId={''} {...props} />);
|
||||||
|
expect(screen.getByText('Internal conditions')).toBeInTheDocument();
|
||||||
|
const dateFromUnixTimestamp = condition.value
|
||||||
|
? getDateTimeFormat().format(new Date(parseInt(condition.value)))
|
||||||
|
: '-';
|
||||||
|
expect(
|
||||||
|
screen.getByText(
|
||||||
|
`${
|
||||||
|
ConditionOperatorMapping[condition.operator]
|
||||||
|
} ${dateFromUnixTimestamp}`
|
||||||
|
)
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('SuccessionLineInfoPanel', () => {
|
||||||
|
const mocks = [
|
||||||
|
{
|
||||||
|
request: {
|
||||||
|
query: SuccessorMarketIdsDocument,
|
||||||
|
},
|
||||||
|
result: {
|
||||||
|
data: {
|
||||||
|
__typename: 'Query',
|
||||||
|
marketsConnection: {
|
||||||
|
__typename: 'MarketConnection',
|
||||||
|
edges: [
|
||||||
|
{
|
||||||
|
__typename: 'MarketEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'Market',
|
||||||
|
id: 'abc',
|
||||||
|
successorMarketID: 'def',
|
||||||
|
parentMarketID: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'MarketEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'Market',
|
||||||
|
id: 'def',
|
||||||
|
successorMarketID: 'ghi',
|
||||||
|
parentMarketID: 'abc',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'MarketEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'Market',
|
||||||
|
id: 'ghi',
|
||||||
|
successorMarketID: null,
|
||||||
|
parentMarketID: 'def',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
];
|
||||||
];
|
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['abc', 1],
|
['abc', 1],
|
||||||
['def', 2],
|
['def', 2],
|
||||||
['ghi', 3],
|
['ghi', 3],
|
||||||
])(
|
])(
|
||||||
'renders succession line for %s (current position %d)',
|
'renders succession line for %s (current position %d)',
|
||||||
async (id, number) => {
|
async (id, number) => {
|
||||||
render(
|
render(
|
||||||
<MockedProvider mocks={mocks}>
|
<MockedProvider mocks={mocks}>
|
||||||
<SuccessionLineInfoPanel
|
<SuccessionLineInfoPanel
|
||||||
market={{
|
market={{
|
||||||
id,
|
id,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</MockedProvider>
|
</MockedProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
const items = screen.getAllByTestId('succession-line-item');
|
const items = screen.getAllByTestId('succession-line-item');
|
||||||
expect(items.length).toBe(3);
|
expect(items.length).toBe(3);
|
||||||
expect(
|
expect(
|
||||||
items[0].querySelector(
|
items[0].querySelector(
|
||||||
'[data-testid="succession-line-item-market-id"]'
|
'[data-testid="succession-line-item-market-id"]'
|
||||||
)?.textContent
|
)?.textContent
|
||||||
).toBe('abc');
|
).toBe('abc');
|
||||||
expect(
|
expect(
|
||||||
items[1].querySelector(
|
items[1].querySelector(
|
||||||
'[data-testid="succession-line-item-market-id"]'
|
'[data-testid="succession-line-item-market-id"]'
|
||||||
)?.textContent
|
)?.textContent
|
||||||
).toBe('def');
|
).toBe('def');
|
||||||
expect(
|
expect(
|
||||||
items[2].querySelector(
|
items[2].querySelector(
|
||||||
'[data-testid="succession-line-item-market-id"]'
|
'[data-testid="succession-line-item-market-id"]'
|
||||||
)?.textContent
|
)?.textContent
|
||||||
).toBe('ghi');
|
).toBe('ghi');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
items[number - 1].querySelector('[data-testid="icon-bullet"]')
|
items[number - 1].querySelector('[data-testid="icon-bullet"]')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -858,7 +858,6 @@ export const LiquidityInfoPanel = ({ market, children }: MarketInfoProps) => {
|
|||||||
data={{
|
data={{
|
||||||
targetStake: data?.targetStake,
|
targetStake: data?.targetStake,
|
||||||
suppliedStake: data?.suppliedStake,
|
suppliedStake: data?.suppliedStake,
|
||||||
marketValueProxy: data?.marketValueProxy,
|
|
||||||
}}
|
}}
|
||||||
decimalPlaces={asset.decimals}
|
decimalPlaces={asset.decimals}
|
||||||
assetSymbol={asset.symbol}
|
assetSymbol={asset.symbol}
|
||||||
@ -1033,9 +1032,13 @@ export const DataSourceProof = ({
|
|||||||
<h3>{t('Internal conditions')}</h3>
|
<h3>{t('Internal conditions')}</h3>
|
||||||
{data.sourceType.sourceType?.conditions?.map((condition, i) => {
|
{data.sourceType.sourceType?.conditions?.map((condition, i) => {
|
||||||
if (!condition) return null;
|
if (!condition) return null;
|
||||||
|
const dateFromUnixTimestamp = condition.value
|
||||||
|
? getDateTimeFormat().format(new Date(parseInt(condition.value)))
|
||||||
|
: '-';
|
||||||
return (
|
return (
|
||||||
<p key={i}>
|
<p key={i}>
|
||||||
{ConditionOperatorMapping[condition.operator]} {condition.value}
|
{ConditionOperatorMapping[condition.operator]}{' '}
|
||||||
|
{dateFromUnixTimestamp}
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -22,7 +22,6 @@ fragment MarketDataUpdateFields on ObservableMarketData {
|
|||||||
indicativeVolume
|
indicativeVolume
|
||||||
marketState
|
marketState
|
||||||
marketTradingMode
|
marketTradingMode
|
||||||
marketValueProxy
|
|
||||||
markPrice
|
markPrice
|
||||||
midPrice
|
midPrice
|
||||||
openInterest
|
openInterest
|
||||||
@ -75,7 +74,6 @@ fragment MarketDataFields on MarketData {
|
|||||||
indicativeVolume
|
indicativeVolume
|
||||||
marketState
|
marketState
|
||||||
marketTradingMode
|
marketTradingMode
|
||||||
marketValueProxy
|
|
||||||
markPrice
|
markPrice
|
||||||
midPrice
|
midPrice
|
||||||
openInterest
|
openInterest
|
||||||
|
@ -58,7 +58,6 @@ const marketDataFields: MarketDataFieldsFragment = {
|
|||||||
indicativeVolume: '0',
|
indicativeVolume: '0',
|
||||||
marketState: Schema.MarketState.STATE_ACTIVE,
|
marketState: Schema.MarketState.STATE_ACTIVE,
|
||||||
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
marketValueProxy: '2000000',
|
|
||||||
markPrice: '4612690058',
|
markPrice: '4612690058',
|
||||||
midPrice: '4612690000',
|
midPrice: '4612690000',
|
||||||
openInterest: '0',
|
openInterest: '0',
|
||||||
@ -97,7 +96,6 @@ const marketDataUpdateFields: MarketDataUpdateFieldsFragment = {
|
|||||||
marketId: 'market-0',
|
marketId: 'market-0',
|
||||||
marketState: Schema.MarketState.STATE_ACTIVE,
|
marketState: Schema.MarketState.STATE_ACTIVE,
|
||||||
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
marketValueProxy: '',
|
|
||||||
markPrice: '4612690058',
|
markPrice: '4612690058',
|
||||||
midPrice: '0',
|
midPrice: '0',
|
||||||
lastTradedPrice: '0',
|
lastTradedPrice: '0',
|
||||||
|
@ -35,6 +35,9 @@ fragment MarketFields on Market {
|
|||||||
open
|
open
|
||||||
close
|
close
|
||||||
}
|
}
|
||||||
|
liquidityMonitoringParameters {
|
||||||
|
triggeringRatio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query Markets {
|
query Markets {
|
||||||
|
@ -53,6 +53,9 @@ export const createMarketFragment = (
|
|||||||
liquidityFee: '',
|
liquidityFee: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '1',
|
||||||
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
instrument: {
|
instrument: {
|
||||||
id: '',
|
id: '',
|
||||||
|
@ -20,6 +20,9 @@ export const generateOrder = (partialOrder?: PartialDeep<Order>) => {
|
|||||||
makerFee: '0.1',
|
makerFee: '0.1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '1',
|
||||||
|
},
|
||||||
marketTimestamps: {
|
marketTimestamps: {
|
||||||
__typename: 'MarketTimestamps',
|
__typename: 'MarketTimestamps',
|
||||||
close: '',
|
close: '',
|
||||||
|
@ -21,6 +21,9 @@ export const generateStopOrder = (
|
|||||||
__typename: 'Market',
|
__typename: 'Market',
|
||||||
id: 'market-id',
|
id: 'market-id',
|
||||||
decimalPlaces: 1,
|
decimalPlaces: 1,
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '0.7',
|
||||||
|
},
|
||||||
fees: {
|
fees: {
|
||||||
__typename: 'Fees',
|
__typename: 'Fees',
|
||||||
factors: {
|
factors: {
|
||||||
|
@ -31,6 +31,9 @@ describe('OrderViewDialog', () => {
|
|||||||
liquidityFee: '0.001',
|
liquidityFee: '0.001',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '1',
|
||||||
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
__typename: 'TradableInstrument',
|
__typename: 'TradableInstrument',
|
||||||
instrument: {
|
instrument: {
|
||||||
|
@ -149,6 +149,9 @@ describe('WithdrawFormContainer', () => {
|
|||||||
liquidityFee: '0.001',
|
liquidityFee: '0.001',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
liquidityMonitoringParameters: {
|
||||||
|
triggeringRatio: '0.7',
|
||||||
|
},
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
__typename: 'TradableInstrument',
|
__typename: 'TradableInstrument',
|
||||||
instrument: {
|
instrument: {
|
||||||
|
@ -105,7 +105,6 @@ When I look into market info I **Must** see following specification:
|
|||||||
- Liquidity: (<a name="6002-MDET-214" href="#6002-MDET-214">6002-MDET-214</a>)
|
- Liquidity: (<a name="6002-MDET-214" href="#6002-MDET-214">6002-MDET-214</a>)
|
||||||
- Target Stake
|
- Target Stake
|
||||||
- Supplied Stake
|
- Supplied Stake
|
||||||
- Market Value Proxy
|
|
||||||
- link to liquidity provision table
|
- link to liquidity provision table
|
||||||
- Liquidity price range: (<a name="6002-MDET-215" href="#6002-MDET-215">6002-MDET-215</a>)
|
- Liquidity price range: (<a name="6002-MDET-215" href="#6002-MDET-215">6002-MDET-215</a>)
|
||||||
- Liquidity Price Range
|
- Liquidity Price Range
|
||||||
|
Loading…
Reference in New Issue
Block a user