fix(markets): make trading app spot compatible (#6067)
This commit is contained in:
parent
3e61018d89
commit
8c383d8756
@ -14,6 +14,9 @@ fragment OracleMarketSpecFields on Market {
|
||||
... on Perpetual {
|
||||
...Perpetual
|
||||
}
|
||||
... on Spot {
|
||||
...Spot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
22
libs/markets/src/lib/__generated__/markets.ts
generated
22
libs/markets/src/lib/__generated__/markets.ts
generated
File diff suppressed because one or more lines are too long
@ -158,6 +158,16 @@ fragment Perpetual on Perpetual {
|
||||
}
|
||||
}
|
||||
|
||||
fragment Spot on Spot {
|
||||
baseAsset {
|
||||
...AssetListFields
|
||||
}
|
||||
quoteAsset {
|
||||
...AssetListFields
|
||||
}
|
||||
name
|
||||
}
|
||||
|
||||
query MarketInfoMainnet($marketId: ID!) {
|
||||
market(id: $marketId) {
|
||||
id
|
||||
@ -256,6 +266,9 @@ query MarketInfoMainnet($marketId: ID!) {
|
||||
... on Perpetual {
|
||||
...Perpetual
|
||||
}
|
||||
... on Spot {
|
||||
...Spot
|
||||
}
|
||||
}
|
||||
}
|
||||
riskModel {
|
||||
@ -388,6 +401,9 @@ query MarketInfo($marketId: ID!) {
|
||||
... on Perpetual {
|
||||
...Perpetual
|
||||
}
|
||||
... on Spot {
|
||||
...Spot
|
||||
}
|
||||
}
|
||||
}
|
||||
riskModel {
|
||||
|
File diff suppressed because one or more lines are too long
@ -25,8 +25,7 @@ export const getAsset = (market: Partial<Market>) => {
|
||||
}
|
||||
|
||||
if (product.__typename === 'Spot') {
|
||||
// TODO to handle baseAsset for Spots
|
||||
throw new Error('Failed to retrieve asset. Spots not yet implemented');
|
||||
return product.baseAsset;
|
||||
}
|
||||
|
||||
throw new Error('Failed to retrieve asset. Invalid product type');
|
||||
@ -62,8 +61,7 @@ export const getQuoteName = (market: Partial<Market>) => {
|
||||
}
|
||||
|
||||
if (product.__typename === 'Spot') {
|
||||
// TODO to handle baseAsset for Spots
|
||||
throw new Error('Failed to retrieve quoteName. Spots not yet implemented');
|
||||
return product.quoteAsset.symbol;
|
||||
}
|
||||
|
||||
throw new Error('Failed to retrieve quoteName. Invalid product type');
|
||||
|
@ -34,6 +34,9 @@ fragment MarketFieldsMainnet on Market {
|
||||
... on Perpetual {
|
||||
...Perpetual
|
||||
}
|
||||
... on Spot {
|
||||
...Spot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,6 +91,9 @@ fragment MarketFields on Market {
|
||||
... on Perpetual {
|
||||
...Perpetual
|
||||
}
|
||||
... on Spot {
|
||||
...Spot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,9 @@ query Symbol($marketId: ID!) {
|
||||
... on Perpetual {
|
||||
__typename
|
||||
}
|
||||
... on Spot {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export type SymbolQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type SymbolQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename: 'Future' } | { __typename: 'Perpetual' } | { __typename?: 'Spot' } } } } | null };
|
||||
export type SymbolQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null }, product: { __typename: 'Future' } | { __typename: 'Perpetual' } | { __typename: 'Spot' } } } } | null };
|
||||
|
||||
|
||||
export const SymbolDocument = gql`
|
||||
@ -31,6 +31,9 @@ export const SymbolDocument = gql`
|
||||
... on Perpetual {
|
||||
__typename
|
||||
}
|
||||
... on Spot {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
libs/types/src/__generated__/types.ts
generated
14
libs/types/src/__generated__/types.ts
generated
@ -887,8 +887,10 @@ export type DepositEdge = {
|
||||
|
||||
/** The status of a deposit */
|
||||
export enum DepositStatus {
|
||||
/** The deposit have been cancelled by the network, either because it expired, or something went wrong with the foreign chain */
|
||||
/** The deposit have been cancelled by the network, either because it expired, could not be verified, or something went wrong with the foreign chain */
|
||||
STATUS_CANCELLED = 'STATUS_CANCELLED',
|
||||
/** The deposit was rejected as a duplicate transaction */
|
||||
STATUS_DUPLICATE_REJECTED = 'STATUS_DUPLICATE_REJECTED',
|
||||
/** The deposit was finalised, it was valid, the foreign chain has executed it and the network updated all accounts */
|
||||
STATUS_FINALIZED = 'STATUS_FINALIZED',
|
||||
/** The deposit is open and being processed by the network */
|
||||
@ -7185,6 +7187,14 @@ export type UpdateReferralProgram = {
|
||||
windowLength: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type UpdateSpotInstrumentConfiguration = {
|
||||
__typename?: 'UpdateSpotInstrumentConfiguration';
|
||||
/** Instrument code, human-readable shortcode used to describe the instrument. */
|
||||
code: Scalars['String'];
|
||||
/** Instrument name */
|
||||
name: Scalars['String'];
|
||||
};
|
||||
|
||||
/** Update an existing spot market on Vega */
|
||||
export type UpdateSpotMarket = {
|
||||
__typename?: 'UpdateSpotMarket';
|
||||
@ -7196,6 +7206,8 @@ export type UpdateSpotMarket = {
|
||||
|
||||
export type UpdateSpotMarketConfiguration = {
|
||||
__typename?: 'UpdateSpotMarketConfiguration';
|
||||
/** Updated spot market instrument configuration. */
|
||||
instrument: UpdateSpotInstrumentConfiguration;
|
||||
/** Specifies how the liquidity fee for the market will be calculated */
|
||||
liquidityFeeSettings?: Maybe<LiquidityFeeSettings>;
|
||||
/** Specifies the liquidity provision SLA parameters */
|
||||
|
@ -107,6 +107,7 @@ export const DepositStatusMapping: {
|
||||
STATUS_CANCELLED: 'Cancelled',
|
||||
STATUS_FINALIZED: 'Finalized',
|
||||
STATUS_OPEN: 'Open',
|
||||
STATUS_DUPLICATE_REJECTED: 'Rejected due to duplicate',
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user