diff --git a/.prettierignore b/.prettierignore index ffbc7ade5..16b8bff30 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,5 +7,5 @@ __generated__ apps/static/src/assets/devnet-tranches.json apps/static/src/assets/mainnet-tranches.json apps/static/src/assets/stagnet1-tranches.json -apps/static/src/assets/stagnet2-tranches.json +apps/static/src/assets/stagnet3-tranches.json apps/static/src/assets/testnet-tranches.json diff --git a/README.md b/README.md index 45f24a40d..d245dd5eb 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Run `nx serve my-app` for a dev server. Navigate to the port specified in `app/< In order to generate the schemas for your GraphQL queries, you can run `NX_VEGA_URL=[YOUR URL HERE] nx run types:generate`. ```bash -export NX_VEGA_URL=https://lb.testnet.vega.xyz/query +export NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql yarn nx run types:generate ``` diff --git a/apps/explorer-e2e/.env.stagnet2 b/apps/explorer-e2e/.env.stagnet3 similarity index 86% rename from apps/explorer-e2e/.env.stagnet2 rename to apps/explorer-e2e/.env.stagnet3 index c55daeed5..d48301ed4 100644 --- a/apps/explorer-e2e/.env.stagnet2 +++ b/apps/explorer-e2e/.env.stagnet3 @@ -1,10 +1,10 @@ # App configuration variables NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api -NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm -NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query -NX_VEGA_ENV=STAGNET2 -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest +NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm +NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query +NX_VEGA_ENV=STAGNET3 +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest # App flags NX_EXPLORER_ASSETS=1 diff --git a/apps/explorer-e2e/.env.testnet b/apps/explorer-e2e/.env.testnet index 3b5c6f537..0878cdcd6 100644 --- a/apps/explorer-e2e/.env.testnet +++ b/apps/explorer-e2e/.env.testnet @@ -1,10 +1,10 @@ # App configuration variables NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api -NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm +NX_TENDERMINT_URL=https://tm.n06.testnet.vega.xyz/tm NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz # App flags NX_EXPLORER_ASSETS=1 diff --git a/apps/explorer-e2e/src/integration/validator.cy.js b/apps/explorer-e2e/src/integration/validator.cy.js index a97bb7a62..1529670b4 100644 --- a/apps/explorer-e2e/src/integration/validator.cy.js +++ b/apps/explorer-e2e/src/integration/validator.cy.js @@ -21,8 +21,7 @@ context('Validator page', function () { 'have.text', 'Tendermint data' ); - cy.get('[data-testid="vega-header"]').should('have.text', 'Vega data'); - cy.get('[data-testid="vega-data"]').should('not.be.empty'); + cy.get('[data-testid="tendermint-data"]').should('not.be.empty'); } }); }); diff --git a/apps/explorer/.env b/apps/explorer/.env index 844001e0f..455137895 100644 --- a/apps/explorer/.env +++ b/apps/explorer/.env @@ -6,13 +6,13 @@ NX_VEGA_ENV=CUSTOM NX_VEGA_REST=http://localhost:3029 NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api -NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm -NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket -NX_VEGA_URL=https://lb.testnet.vega.xyz/query -NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm +NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' -CYPRESS_VEGA_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm +NX_VEGA_ENV=STAGNET3 +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions # App flags diff --git a/apps/explorer/.env.stagnet2 b/apps/explorer/.env.stagnet3 similarity index 76% rename from apps/explorer/.env.stagnet2 rename to apps/explorer/.env.stagnet3 index a55708673..b955fba9c 100644 --- a/apps/explorer/.env.stagnet2 +++ b/apps/explorer/.env.stagnet3 @@ -1,10 +1,10 @@ # App configuration variables NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api -NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm -NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query +NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm +NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' -NX_VEGA_ENV=STAGNET2 -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest +NX_VEGA_ENV=STAGNET3 +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/explorer/.env.testnet b/apps/explorer/.env.testnet index 68a985352..e162d687f 100644 --- a/apps/explorer/.env.testnet +++ b/apps/explorer/.env.testnet @@ -1,10 +1,10 @@ # App configuration variables NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api -NX_TENDERMINT_URL=https://lb.testnet.vega.xyz/tm +NX_TENDERMINT_URL=https://tm.n06.testnet.vega.xyz/tm NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/explorer/README.md b/apps/explorer/README.md index f16ef2536..5969e2b64 100644 --- a/apps/explorer/README.md +++ b/apps/explorer/README.md @@ -36,7 +36,7 @@ Example configurations are provided here: - [Capsule](./.env.capsule) - [Testnet](./.env.testnet) - [Stagnet1](./.env.stagnet1) -- [Stagnet2](./.env.stagnet2) +- [Stagnet3](./.env.stagnet3) For convenience, you can boot the app injecting one of the configurations above by running: diff --git a/apps/explorer/src/app/lib/apollo-client.tsx b/apps/explorer/src/app/lib/apollo-client.tsx index 2b2ed69bd..d5de5e727 100644 --- a/apps/explorer/src/app/lib/apollo-client.tsx +++ b/apps/explorer/src/app/lib/apollo-client.tsx @@ -6,9 +6,8 @@ export function createClient(base?: string) { if (!base) { throw new Error('Base must be passed into createClient!'); } - const gqlPath = 'query'; - const urlHTTP = new URL(gqlPath, base); - const urlWS = new URL(gqlPath, base); + const urlHTTP = new URL(base); + const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); diff --git a/apps/explorer/src/app/routes/assets/__generated__/AssetsQuery.ts b/apps/explorer/src/app/routes/assets/__generated__/AssetsQuery.ts index a6e9fbab9..7425e42ea 100644 --- a/apps/explorer/src/app/routes/assets/__generated__/AssetsQuery.ts +++ b/apps/explorer/src/app/routes/assets/__generated__/AssetsQuery.ts @@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types"; export interface AssetsQuery_assets_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -54,7 +54,7 @@ export interface AssetsQuery_assets_infrastructureFeeAccount { export interface AssetsQuery_assets { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -66,11 +66,11 @@ export interface AssetsQuery_assets { */ symbol: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: AssetsQuery_assets_source; /** @@ -81,7 +81,7 @@ export interface AssetsQuery_assets { export interface AssetsQuery { /** - * The list of all assets in use in the vega network + * The list of all assets in use in the Vega network */ assets: AssetsQuery_assets[] | null; } diff --git a/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts b/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts index 0b6f0dbec..7e6d2b10b 100644 --- a/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts +++ b/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts @@ -17,8 +17,8 @@ export interface ProposalsQuery_proposals_party { id: string; } -export interface ProposalsQuery_proposals_terms_change_NewFreeform { - __typename: "NewFreeform"; +export interface ProposalsQuery_proposals_terms_change_UpdateAsset { + __typename: "UpdateAsset" | "NewFreeform"; } export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { @@ -53,7 +53,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAs export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -67,7 +67,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset { */ symbol: string; /** - * the source of the new Asset + * The source of the new asset */ source: ProposalsQuery_proposals_terms_change_NewAsset_source; } @@ -89,7 +89,7 @@ export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter { networkParameter: ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter; } -export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_NewFreeform | ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter; +export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_UpdateAsset | ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter; export interface ProposalsQuery_proposals_terms { __typename: "ProposalTerms"; @@ -101,8 +101,9 @@ export interface ProposalsQuery_proposals_terms { /** * RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time. * Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + * Note: Optional as free form proposals do not require it. */ - enactmentDatetime: string; + enactmentDatetime: string | null; /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ @@ -148,15 +149,15 @@ export interface ProposalsQuery_proposals_votes_yes_votes { export interface ProposalsQuery_proposals_votes_yes { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: ProposalsQuery_proposals_votes_yes_votes[] | null; } @@ -200,15 +201,15 @@ export interface ProposalsQuery_proposals_votes_no_votes { export interface ProposalsQuery_proposals_votes_no { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: ProposalsQuery_proposals_votes_no_votes[] | null; } @@ -228,11 +229,11 @@ export interface ProposalsQuery_proposals_votes { export interface ProposalsQuery_proposals { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; /** - * A UUID reference to aid tracking proposals on VEGA + * A UUID reference to aid tracking proposals on Vega */ reference: string; /** @@ -263,7 +264,7 @@ export interface ProposalsQuery_proposals { export interface ProposalsQuery { /** - * All governance proposals in the VEGA network + * All governance proposals in the Vega network */ proposals: ProposalsQuery_proposals[] | null; } diff --git a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts index b2d3e6f96..8d6afc124 100644 --- a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts +++ b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts @@ -52,7 +52,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -60,7 +60,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett */ name: string; /** - * The precision of the asset + * 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; /** @@ -108,11 +108,11 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk */ r: number; /** - * sigma parameter + * sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number */ sigma: number; /** - * mu parameter + * mu parameter, annualised growth rate of the underlying asset */ mu: number; } @@ -120,15 +120,15 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel { __typename: "LogNormalRiskModel"; /** - * Tau parameter of the risk model + * Tau parameter of the risk model, projection horizon measured as a year fraction used in the expected shortfall calculation to obtain the maintenance margin, must be a strictly non-negative real number */ tau: number; /** - * Lambda parameter of the risk model + * Lambda parameter of the risk model, probability confidence level used in expected shortfall calculation when obtaining the maintenance margin level, must be strictly greater than 0 and strictly smaller than 1 */ riskAversionParameter: number; /** - * Params for the log normal risk model + * Parameters for the log normal risk model */ params: MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params; } @@ -166,7 +166,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalin */ initialMargin: number; /** - * The scaling factor that determines the overflow margin level + * the scaling factor that determines the overflow margin level */ collateralRelease: number; } @@ -182,7 +182,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator { export interface MarketsQuery_markets_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: MarketsQuery_markets_tradableInstrument_instrument; /** @@ -219,7 +219,7 @@ export interface MarketsQuery_markets_priceMonitoringSettings_parameters_trigger probability: number; /** * Price monitoring auction extension duration in seconds should the price - * breach it's theoretical level over the specified horizon at the specified + * breach its theoretical level over the specified horizon at the specified * probability level (> 0) */ auctionExtensionSecs: number; @@ -239,10 +239,6 @@ export interface MarketsQuery_markets_priceMonitoringSettings { * Specified a set of PriceMonitoringParameters to be use for price monitoring purposes */ parameters: MarketsQuery_markets_priceMonitoringSettings_parameters | null; - /** - * How often (in seconds) the price monitoring bounds should be updated - */ - updateFrequencySecs: number; } export interface MarketsQuery_markets_liquidityMonitoringParameters_targetStakeParameters { @@ -272,7 +268,7 @@ export interface MarketsQuery_markets_liquidityMonitoringParameters { export interface MarketsQuery_markets_proposal { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; } @@ -280,7 +276,7 @@ export interface MarketsQuery_markets_proposal { export interface MarketsQuery_markets_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -309,7 +305,7 @@ export interface MarketsQuery_markets_data_priceMonitoringBounds_trigger { __typename: "PriceMonitoringTrigger"; /** * Price monitoring auction extension duration in seconds should the price - * breach it's theoretical level over the specified horizon at the specified + * breach its theoretical level over the specified horizon at the specified * probability level (> 0) */ auctionExtensionSecs: number; @@ -350,15 +346,15 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare_party { export interface MarketsQuery_markets_data_liquidityProviderFeeShare { __typename: "LiquidityProviderFeeShare"; /** - * The liquidity provider party id + * The liquidity provider party ID */ party: MarketsQuery_markets_data_liquidityProviderFeeShare_party; /** - * The share own by this liquidity provider (float) + * The share owned by this liquidity provider (float) */ equityLikeShare: string; /** - * the average entry valuation of the liquidity provider for the market + * The average entry valuation of the liquidity provider for the market */ averageEntryValuation: string; } @@ -366,7 +362,7 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare { export interface MarketsQuery_markets_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** @@ -450,7 +446,7 @@ export interface MarketsQuery_markets_data { */ suppliedStake: string | null; /** - * A list of valid price ranges per associated trigger + * a list of valid price ranges per associated trigger */ priceMonitoringBounds: MarketsQuery_markets_data_priceMonitoringBounds[] | null; /** @@ -478,12 +474,12 @@ export interface MarketsQuery_markets { */ fees: MarketsQuery_markets_fees; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: MarketsQuery_markets_tradableInstrument; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct - * number denominated in the currency of the Market. (uint64) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -520,7 +516,7 @@ export interface MarketsQuery_markets { */ state: MarketState; /** - * The proposal which initiated this market + * The proposal that initiated this market */ proposal: MarketsQuery_markets_proposal | null; /** diff --git a/apps/explorer/src/app/routes/markets/index.tsx b/apps/explorer/src/app/routes/markets/index.tsx index 65fe3e5fb..5f8fe8f4d 100644 --- a/apps/explorer/src/app/routes/markets/index.tsx +++ b/apps/explorer/src/app/routes/markets/index.tsx @@ -78,7 +78,6 @@ const MARKETS_QUERY = gql` auctionExtensionSecs } } - updateFrequencySecs } liquidityMonitoringParameters { triggeringRatio diff --git a/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts index 676ebde9b..cecdb1a11 100644 --- a/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts +++ b/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts @@ -61,7 +61,7 @@ export interface OracleSpecs_oracleSpecs { */ status: OracleSpecStatus; /** - * id is a hash generated from the OracleSpec data. + * ID is a hash generated from the OracleSpec data. */ id: string; /** diff --git a/apps/explorer/src/app/routes/parties/id/__generated__/PartyAssetsQuery.ts b/apps/explorer/src/app/routes/parties/id/__generated__/PartyAssetsQuery.ts index cadc28733..8f43167b7 100644 --- a/apps/explorer/src/app/routes/parties/id/__generated__/PartyAssetsQuery.ts +++ b/apps/explorer/src/app/routes/parties/id/__generated__/PartyAssetsQuery.ts @@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types"; export interface PartyAssetsQuery_party_delegations_node { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; name: string; @@ -49,7 +49,7 @@ export interface PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset { export interface PartyAssetsQuery_party_accounts_asset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -63,11 +63,11 @@ export interface PartyAssetsQuery_party_accounts_asset { */ name: string; /** - * The id of the asset + * The ID of the asset */ id: string; /** - * The precision of the asset + * 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; /** @@ -75,7 +75,7 @@ export interface PartyAssetsQuery_party_accounts_asset { */ symbol: string; /** - * The origin source of the asset (e.g: an erc20 asset) + * The origin source of the asset (e.g: an ERC20 asset) */ source: PartyAssetsQuery_party_accounts_asset_source; } @@ -115,7 +115,7 @@ export interface PartyAssetsQuery_party { export interface PartyAssetsQuery { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: PartyAssetsQuery_party | null; } diff --git a/apps/explorer/src/app/routes/pending/index.tsx b/apps/explorer/src/app/routes/pending/index.tsx index 07563d51c..88dcf5800 100644 --- a/apps/explorer/src/app/routes/pending/index.tsx +++ b/apps/explorer/src/app/routes/pending/index.tsx @@ -17,7 +17,7 @@ const PendingTxs = () => { {t('Unconfirmed transactions')} - https://lb.testnet.vega.xyz/tm/unconfirmed_txs + https://tm.n06.testnet.vega.xyz/tm/unconfirmed_txs
{t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}

diff --git a/apps/explorer/src/app/routes/validators/__generated__/NodesQuery.ts b/apps/explorer/src/app/routes/validators/__generated__/NodesQuery.ts index 10b3a1a46..a84f39207 100644 --- a/apps/explorer/src/app/routes/validators/__generated__/NodesQuery.ts +++ b/apps/explorer/src/app/routes/validators/__generated__/NodesQuery.ts @@ -28,33 +28,33 @@ export interface NodesQuery_nodes_epochData { export interface NodesQuery_nodes { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; name: string; /** - * URL where I can find out more info on the node. Will this be possible? + * URL from which you can get more info about the node. */ infoUrl: string; avatarUrl: string | null; /** - * Pubkey of the node operator + * Public key of the node operator */ pubkey: string; /** - * Public key of Tendermint + * Tendermint public key of the node */ tmPubkey: string; /** * Ethereum public key of the node */ - ethereumAdddress: string; + ethereumAddress: string; /** * Country code for the location of the node */ location: string; /** - * The amount the node has put up themselves + * The amount of stake the node has put up themselves */ stakedByOperator: string; /** diff --git a/apps/explorer/src/app/routes/validators/index.tsx b/apps/explorer/src/app/routes/validators/index.tsx index baf2e0569..9220dc767 100644 --- a/apps/explorer/src/app/routes/validators/index.tsx +++ b/apps/explorer/src/app/routes/validators/index.tsx @@ -18,7 +18,7 @@ const NODES_QUERY = gql` avatarUrl pubkey tmPubkey - ethereumAdddress + ethereumAddress location stakedByOperator stakedByDelegates diff --git a/apps/simple-trading-app-e2e/.env b/apps/simple-trading-app-e2e/.env index 979b577d6..b844da7b2 100644 --- a/apps/simple-trading-app-e2e/.env +++ b/apps/simple-trading-app-e2e/.env @@ -21,7 +21,7 @@ NX_URL=$URL NX_DEPLOY_URL=$DEPLOY_URL NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz NX_VEGA_WALLET_URL=http://localhost:1789/api/v1 diff --git a/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts index 59c1dfa01..d61fd96c6 100644 --- a/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts +++ b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts @@ -3,7 +3,7 @@ import { connectVegaWallet } from '../support/connect-wallet'; describe('market selector', () => { let markets; before(() => { - cy.intercept('POST', '/query', (req) => { + cy.intercept('POST', '/graphql', (req) => { const { body } = req; if (body.operationName === 'SimpleMarkets') { req.alias = `gqlSimpleMarketsQuery`; diff --git a/apps/simple-trading-app/.env b/apps/simple-trading-app/.env index a3687bfec..70a5992d9 100644 --- a/apps/simple-trading-app/.env +++ b/apps/simple-trading-app/.env @@ -19,7 +19,7 @@ NX_DEPLOY_URL=$DEPLOY_URL NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json" NX_VEGA_ENV = 'TESTNET' -NX_VEGA_URL="https://lb.testnet.vega.xyz/query" +NX_VEGA_URL="https://api.n11.testnet.vega.xyz/graphql" NX_VEGA_WALLET_URL=http://localhost:1789/api/v1 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/simple-trading-app/.env.stagnet2 b/apps/simple-trading-app/.env.stagnet3 similarity index 56% rename from apps/simple-trading-app/.env.stagnet2 rename to apps/simple-trading-app/.env.stagnet3 index a6cd1a51b..0f7d3aeaa 100644 --- a/apps/simple-trading-app/.env.stagnet2 +++ b/apps/simple-trading-app/.env.stagnet3 @@ -1,9 +1,8 @@ # App configuration variables -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query -NX_VEGA_ENV=STAGNET2 -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest -NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query +NX_VEGA_ENV=STAGNET3 +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz diff --git a/apps/simple-trading-app/.env.testnet b/apps/simple-trading-app/.env.testnet index 8779709d9..53daf2876 100644 --- a/apps/simple-trading-app/.env.testnet +++ b/apps/simple-trading-app/.env.testnet @@ -1,8 +1,8 @@ # App configuration variables NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/MarketTags.ts b/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/MarketTags.ts index 36694839a..7373c78cd 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/MarketTags.ts +++ b/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/MarketTags.ts @@ -26,7 +26,7 @@ export interface MarketTags_market_tradableInstrument_instrument { export interface MarketTags_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: MarketTags_market_tradableInstrument_instrument; } @@ -34,14 +34,14 @@ export interface MarketTags_market_tradableInstrument { export interface MarketTags_market { __typename: "Market"; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: MarketTags_market_tradableInstrument; } export interface MarketTags { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: MarketTags_market | null; } diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/PartyBalanceQuery.ts b/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/PartyBalanceQuery.ts index c78a46b9b..0db423392 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/PartyBalanceQuery.ts +++ b/apps/simple-trading-app/src/app/components/deal-ticket/__generated__/PartyBalanceQuery.ts @@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types"; export interface PartyBalanceQuery_party_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -24,7 +24,7 @@ export interface PartyBalanceQuery_party_accounts_asset { */ name: string; /** - * The precision of the asset + * 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; } @@ -55,7 +55,7 @@ export interface PartyBalanceQuery_party { export interface PartyBalanceQuery { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: PartyBalanceQuery_party | null; } diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.spec.tsx b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.spec.tsx index 35c61e88f..b751b2829 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.spec.tsx +++ b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.spec.tsx @@ -18,7 +18,7 @@ const tDAI: PartyBalanceQuery_party_accounts_asset = { const accounts: PartyBalanceQuery_party_accounts[] = [ { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '1000000', asset: tDAI, }, diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.tsx b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.tsx index b636260fd..5b61e5bfd 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.tsx +++ b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-balance.tsx @@ -24,7 +24,7 @@ export const DealTicketBalance = ({ const settlementAccount = useSettlementAccount( settlementAssetId, accounts, - AccountType.General + AccountType.ACCOUNT_TYPE_GENERAL ); const formatedNumber = settlementAccount?.balance && diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/review-trade.tsx b/apps/simple-trading-app/src/app/components/deal-ticket/review-trade.tsx index 8abe66d8f..721238a72 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/review-trade.tsx +++ b/apps/simple-trading-app/src/app/components/deal-ticket/review-trade.tsx @@ -9,7 +9,6 @@ import classNames from 'classnames'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; import type { Order } from '@vegaprotocol/orders'; import { SIDE_NAMES } from './side-selector'; -import { VegaWalletOrderSide } from '@vegaprotocol/wallet'; import SimpleMarketExpires from '../simple-market-list/simple-market-expires'; import { gql, useQuery } from '@apollo/client'; import type { @@ -17,6 +16,7 @@ import type { MarketTagsVariables, } from './__generated__/MarketTags'; import { DealTicketEstimates } from './deal-ticket-estimates'; +import { Side } from '@vegaprotocol/types'; export const MARKET_TAGS_QUERY = gql` query MarketTags($marketId: ID!) { @@ -71,10 +71,9 @@ export default ({
void; + value: Side; + onSelect: (side: Side) => void; } -export const SIDE_NAMES: Record = { - [VegaWalletOrderSide.Buy]: t('Long'), - [VegaWalletOrderSide.Sell]: t('Short'), +export const SIDE_NAMES: Record = { + [Side.SIDE_BUY]: t('Long'), + [Side.SIDE_SELL]: t('Short'), }; export default ({ value, onSelect }: SideSelectorProps) => { @@ -31,9 +31,9 @@ export default ({ value, onSelect }: SideSelectorProps) => { className={classNames( 'py-8', 'buyButton hover:buyButton dark:buyButtonDark dark:hover:buyButtonDark', - { selected: value === VegaWalletOrderSide.Buy } + { selected: value === Side.SIDE_BUY } )} - onClick={() => onSelect(VegaWalletOrderSide.Buy)} + onClick={() => onSelect(Side.SIDE_BUY)} > {t('Long')} @@ -43,9 +43,9 @@ export default ({ value, onSelect }: SideSelectorProps) => { className={classNames( 'py-8', 'sellButton hover:sellButton dark:sellButtonDark dark:hover:sellButtonDark', - { selected: value === VegaWalletOrderSide.Sell } + { selected: value === Side.SIDE_SELL } )} - onClick={() => onSelect(VegaWalletOrderSide.Sell)} + onClick={() => onSelect(Side.SIDE_SELL)} > {t('Short')} diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataFields.ts b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataFields.ts index 0a772162b..542171b20 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataFields.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataFields.ts @@ -24,7 +24,7 @@ export interface SimpleMarketDataFields_market { export interface SimpleMarketDataFields { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: SimpleMarketDataFields_market; } diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataSub.ts b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataSub.ts index 6f56a6d6c..0f78b5f53 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataSub.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarketDataSub.ts @@ -24,7 +24,7 @@ export interface SimpleMarketDataSub_marketData_market { export interface SimpleMarketDataSub_marketData { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: SimpleMarketDataSub_marketData_market; } diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts index 956cb607a..af40a39fc 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts @@ -24,7 +24,7 @@ export interface SimpleMarkets_markets_data_market { export interface SimpleMarkets_markets_data { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: SimpleMarkets_markets_data_market; } @@ -76,7 +76,7 @@ export interface SimpleMarkets_markets_tradableInstrument_instrument { export interface SimpleMarkets_markets_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: SimpleMarkets_markets_tradableInstrument_instrument; } @@ -108,11 +108,11 @@ export interface SimpleMarkets_markets { */ data: SimpleMarkets_markets_data | null; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: SimpleMarkets_markets_tradableInstrument; /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by params + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters */ candles: (SimpleMarkets_markets_candles | null)[] | null; } diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts b/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts index 95c890260..9a0999eb6 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts @@ -45,7 +45,7 @@ export const MARKETS_QUERY = gql` } } } - candles(interval: I1H, since: $CandleSince) { + candles(interval: INTERVAL_I1H, since: $CandleSince) { open close } @@ -64,7 +64,7 @@ const MARKET_DATA_SUB = gql` export const CANDLE_SUB = gql` subscription CandleLive($marketId: ID!) { - candles(marketId: $marketId, interval: I1H) { + candles(marketId: $marketId, interval: INTERVAL_I1H) { close } } diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx index 4ca385b64..27c910e8e 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx @@ -10,7 +10,6 @@ import { import { MockedProvider } from '@apollo/client/testing'; import type { MockedResponse } from '@apollo/client/testing'; import { BrowserRouter } from 'react-router-dom'; -import { MarketState } from '@vegaprotocol/types'; import SimpleMarketList from './simple-market-list'; import { MARKETS_QUERY } from './data-provider'; import type { @@ -68,7 +67,7 @@ describe('SimpleMarketList', () => { id: '1', data: { market: { - state: MarketState.Active, + state: 'Active', }, }, tradableInstrument: { @@ -88,7 +87,7 @@ describe('SimpleMarketList', () => { id: '2', data: { market: { - state: MarketState.Active, + state: 'Active', }, }, tradableInstrument: { @@ -131,6 +130,7 @@ describe('SimpleMarketList', () => { document.querySelector('.ag-center-cols-container') ).toBeInTheDocument(); }); + screen.debug(); await waitFor(() => { const container = document.querySelector('.ag-center-cols-container'); expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2); diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx index d12c45dd4..f2c653a06 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx @@ -79,7 +79,7 @@ const SimpleMarketToolbar = ({ data }: Props) => { data-testid="market-products-menu" aria-label={t('Product type')} > -
  • +
  • { @@ -81,7 +81,7 @@ describe('useMaximumPositionSize Hook', () => { it('should return correct size when open positions and opposite side', () => { const price = '50'; - mockOrder.side = VegaWalletOrderSide.Sell; + mockOrder.side = Side.SIDE_SELL; mockMarketPositions = defaultMockMarketPositions; const expected = 4001; const { result } = renderHook(() => diff --git a/apps/simple-trading-app/src/app/hooks/use-maximum-position-size.ts b/apps/simple-trading-app/src/app/hooks/use-maximum-position-size.ts index 603d2eafd..14aee773c 100644 --- a/apps/simple-trading-app/src/app/hooks/use-maximum-position-size.ts +++ b/apps/simple-trading-app/src/app/hooks/use-maximum-position-size.ts @@ -2,8 +2,7 @@ import useMarketPositions from './use-market-positions'; import type { Order } from '@vegaprotocol/orders'; import type { PartyBalanceQuery_party_accounts } from '../components/deal-ticket/__generated__/PartyBalanceQuery'; import { useSettlementAccount } from './use-settlement-account'; -import { AccountType } from '@vegaprotocol/types'; -import { VegaWalletOrderSide } from '@vegaprotocol/wallet'; +import { AccountType, Side } from '@vegaprotocol/types'; import { BigNumber } from 'bignumber.js'; interface Props { @@ -29,7 +28,7 @@ export default ({ const settlementAccount = useSettlementAccount( settlementAssetId, accounts, - AccountType.General + AccountType.ACCOUNT_TYPE_GENERAL ); const marketPositions = useMarketPositions({ marketId: marketId, partyId }); @@ -48,10 +47,8 @@ export default ({ } const isSameSide = - (marketPositions.openVolume.isPositive() && - order.side === VegaWalletOrderSide.Buy) || - (marketPositions.openVolume.isNegative() && - order.side === VegaWalletOrderSide.Sell); + (marketPositions.openVolume.isPositive() && order.side === Side.SIDE_BUY) || + (marketPositions.openVolume.isNegative() && order.side === Side.SIDE_SELL); const adjustedForVolume = new BigNumber(size)[isSameSide ? 'minus' : 'plus']( marketPositions.openVolume diff --git a/apps/simple-trading-app/src/app/hooks/use-order-closeout.ts b/apps/simple-trading-app/src/app/hooks/use-order-closeout.ts index 050c4b108..f46e4d5a5 100644 --- a/apps/simple-trading-app/src/app/hooks/use-order-closeout.ts +++ b/apps/simple-trading-app/src/app/hooks/use-order-closeout.ts @@ -3,7 +3,7 @@ import type { Order } from '@vegaprotocol/orders'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; import type { PartyBalanceQuery } from '../components/deal-ticket/__generated__/PartyBalanceQuery'; import { useSettlementAccount } from './use-settlement-account'; -import { useVegaWallet, VegaWalletOrderSide } from '@vegaprotocol/wallet'; +import { useVegaWallet } from '@vegaprotocol/wallet'; import { addDecimal, formatNumber } from '@vegaprotocol/react-helpers'; import { gql, useQuery } from '@apollo/client'; import useMarketPositions from './use-market-positions'; @@ -12,6 +12,7 @@ import type { PartyMarketData, PartyMarketDataVariables, } from './__generated__/PartyMarketData'; +import { Side } from '@vegaprotocol/types'; const CLOSEOUT_PRICE_QUERY = gql` query PartyMarketData($partyId: ID!) { @@ -96,7 +97,7 @@ const useOrderCloseOut = ({ order, market, partyData }: Props): string => { marketPositions?.openVolume.toNumber() || 0, market.positionDecimalPlaces ) - )[order.side === VegaWalletOrderSide.Buy ? 'plus' : 'minus'](order.size); + )[order.side === Side.SIDE_BUY ? 'plus' : 'minus'](order.size); const markPrice = new BigNumber( addDecimal( markPriceData?.market?.data?.markPrice || 0, diff --git a/apps/simple-trading-app/src/app/hooks/use-order-margin.ts b/apps/simple-trading-app/src/app/hooks/use-order-margin.ts index 7d4aba614..0a574a0fc 100644 --- a/apps/simple-trading-app/src/app/hooks/use-order-margin.ts +++ b/apps/simple-trading-app/src/app/hooks/use-order-margin.ts @@ -7,12 +7,7 @@ import type { EstimateOrder_estimateOrder_fee, } from './__generated__/estimateOrder'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; -import { OrderTimeInForce, OrderType, Side } from '@vegaprotocol/types'; -import { - VegaWalletOrderSide, - VegaWalletOrderTimeInForce, - VegaWalletOrderType, -} from '@vegaprotocol/wallet'; +import { Side } from '@vegaprotocol/types'; import { addDecimal, removeDecimal } from '@vegaprotocol/react-helpers'; import useMarketPositions from './use-market-positions'; import useMarketData from './use-market-data'; @@ -56,20 +51,6 @@ interface Props { partyId: string; } -const times: Record = { - [VegaWalletOrderTimeInForce.GTC]: OrderTimeInForce.GTC, - [VegaWalletOrderTimeInForce.GTT]: OrderTimeInForce.GTT, - [VegaWalletOrderTimeInForce.IOC]: OrderTimeInForce.IOC, - [VegaWalletOrderTimeInForce.FOK]: OrderTimeInForce.FOK, - [VegaWalletOrderTimeInForce.GFN]: OrderTimeInForce.GFN, - [VegaWalletOrderTimeInForce.GFA]: OrderTimeInForce.GFA, -}; - -const types: Record = { - [VegaWalletOrderType.Market]: OrderType.Market, - [VegaWalletOrderType.Limit]: OrderType.Limit, -}; - const addFees = (feeObj: EstimateOrder_estimateOrder_fee) => { return new BigNumber(feeObj.makerFee) .plus(feeObj.liquidityFee) @@ -99,14 +80,14 @@ const useOrderMargin = ({ BigNumber.maximum( 0, new BigNumber(marketPositions?.openVolume || 0)[ - order.side === VegaWalletOrderSide.Buy ? 'plus' : 'minus' + order.side === Side.SIDE_BUY ? 'plus' : 'minus' ](order.size) ).toString(), market.positionDecimalPlaces ), - side: order.side === VegaWalletOrderSide.Buy ? Side.Buy : Side.Sell, - timeInForce: times[order.timeInForce], - type: types[order.type], + side: order.side === Side.SIDE_BUY ? Side.SIDE_BUY : Side.SIDE_SELL, + timeInForce: order.timeInForce, + type: order.type, }, skip: !partyId || diff --git a/apps/simple-trading-app/src/app/hooks/use-settlement-account.spec.tsx b/apps/simple-trading-app/src/app/hooks/use-settlement-account.spec.tsx index de0e4b040..eddc74544 100644 --- a/apps/simple-trading-app/src/app/hooks/use-settlement-account.spec.tsx +++ b/apps/simple-trading-app/src/app/hooks/use-settlement-account.spec.tsx @@ -8,7 +8,7 @@ describe('useSettlementAccount Hook', () => { const accounts: PartyBalanceQuery_party_accounts[] = [ { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '2000000000000000000000', asset: { __typename: 'Asset', @@ -20,7 +20,7 @@ describe('useSettlementAccount Hook', () => { }, { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '1000000000', asset: { __typename: 'Asset', @@ -32,7 +32,7 @@ describe('useSettlementAccount Hook', () => { }, { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '5000000000000000000', asset: { __typename: 'Asset', @@ -44,7 +44,7 @@ describe('useSettlementAccount Hook', () => { }, { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, balance: '5000000000000000000', asset: { __typename: 'Asset', @@ -67,7 +67,7 @@ describe('useSettlementAccount Hook', () => { expect(resultDai.current?.asset).toEqual(accounts[1].asset); const { result: resultVega } = renderHook(() => - useSettlementAccount(vega, accounts, AccountType.Margin) + useSettlementAccount(vega, accounts, AccountType.ACCOUNT_TYPE_MARGIN) ); expect(resultVega.current?.balance).toBe(accounts[3].balance); diff --git a/apps/simple-trading-app/src/app/lib/apollo-client.tsx b/apps/simple-trading-app/src/app/lib/apollo-client.tsx index 8163dcdf5..c2f0d09cc 100644 --- a/apps/simple-trading-app/src/app/lib/apollo-client.tsx +++ b/apps/simple-trading-app/src/app/lib/apollo-client.tsx @@ -15,9 +15,8 @@ export function createClient(base?: string) { if (!base) { throw new Error('Base must be passed into createClient!'); } - const gqlPath = 'query'; - const urlHTTP = new URL(gqlPath, base); - const urlWS = new URL(gqlPath, base); + const urlHTTP = new URL(base); + const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); diff --git a/apps/static/src/assets/stagnet2-tranches.json b/apps/static/src/assets/stagnet2-tranches.json deleted file mode 100644 index 626451c00..000000000 --- a/apps/static/src/assets/stagnet2-tranches.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "tranche_id": 1, - "tranche_start": "2022-02-04T14:08:37.000Z", - "tranche_end": "2023-02-04T14:08:37.000Z", - "total_added": "0", - "total_removed": "0", - "locked_amount": "0", - "deposits": [], - "withdrawals": [], - "users": [] - } -] \ No newline at end of file diff --git a/apps/static/src/assets/stagnet2-network.json b/apps/static/src/assets/stagnet3-network.json similarity index 100% rename from apps/static/src/assets/stagnet2-network.json rename to apps/static/src/assets/stagnet3-network.json index 7d61d8ca1..10150bfef 100644 --- a/apps/static/src/assets/stagnet2-network.json +++ b/apps/static/src/assets/stagnet3-network.json @@ -1,3 +1,3 @@ { - "hosts": ["https://n03.stagnet2.vega.xyz/query"] + "hosts": ["https://n01.stagnet3.vega.xyz/query"] } diff --git a/apps/static/src/assets/stagnet3-tranches.json b/apps/static/src/assets/stagnet3-tranches.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/apps/static/src/assets/stagnet3-tranches.json @@ -0,0 +1 @@ +[] diff --git a/apps/stats-e2e/.env b/apps/stats-e2e/.env index f104f9091..eee0d3285 100644 --- a/apps/stats-e2e/.env +++ b/apps/stats-e2e/.env @@ -1,4 +1,4 @@ # App configuration variables NX_VEGA_ENV=TESTNET CYPRESS_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz diff --git a/apps/stats-e2e/.env.stagnet2 b/apps/stats-e2e/.env.stagnet2 deleted file mode 100644 index 37df99309..000000000 --- a/apps/stats-e2e/.env.stagnet2 +++ /dev/null @@ -1,4 +0,0 @@ -# App configuration variables -NX_VEGA_ENV=STAGNET 2 -CYPRESS_VEGA_ENV=STAGNET 2 -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest diff --git a/apps/stats-e2e/.env.stagnet3 b/apps/stats-e2e/.env.stagnet3 new file mode 100644 index 000000000..c3b8d2454 --- /dev/null +++ b/apps/stats-e2e/.env.stagnet3 @@ -0,0 +1,4 @@ +# App configuration variables +NX_VEGA_ENV=STAGNET 3 +CYPRESS_VEGA_ENV=STAGNET 3 +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest diff --git a/apps/stats-e2e/.env.testnet b/apps/stats-e2e/.env.testnet index f104f9091..eee0d3285 100644 --- a/apps/stats-e2e/.env.testnet +++ b/apps/stats-e2e/.env.testnet @@ -1,4 +1,4 @@ # App configuration variables NX_VEGA_ENV=TESTNET CYPRESS_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz diff --git a/apps/stats/.env.stagnet2 b/apps/stats/.env.stagnet2 deleted file mode 100644 index 22a6dcf71..000000000 --- a/apps/stats/.env.stagnet2 +++ /dev/null @@ -1,3 +0,0 @@ -# App configuration variables -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest; -NX_VEGA_ENV=STAGNET2; diff --git a/apps/stats/.env.stagnet3 b/apps/stats/.env.stagnet3 new file mode 100644 index 000000000..225a0073a --- /dev/null +++ b/apps/stats/.env.stagnet3 @@ -0,0 +1,3 @@ +# App configuration variables +NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest; +NX_VEGA_ENV=STAGNET3; diff --git a/apps/stats/.env.testnet b/apps/stats/.env.testnet index dca7b5de5..b5296c3b5 100644 --- a/apps/stats/.env.testnet +++ b/apps/stats/.env.testnet @@ -1,3 +1,3 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz diff --git a/apps/token-e2e/.env b/apps/token-e2e/.env index 56481a4fb..daa771340 100644 --- a/apps/token-e2e/.env +++ b/apps/token-e2e/.env @@ -3,7 +3,7 @@ NX_VEGA_ENV=TESTNET NX_ETHEREUM_PROVIDER_URL=http://localhost:8545 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_FAIRGROUND=false -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' +NX_VEGA_NETWORKS={} NX_VEGA_URL=http://localhost:3028/query NX_VEGA_REST=http://localhost:3029 diff --git a/apps/token-e2e/.env.stagnet2 b/apps/token-e2e/.env.stagnet3 similarity index 90% rename from apps/token-e2e/.env.stagnet2 rename to apps/token-e2e/.env.stagnet3 index 813dce012..df702a149 100644 --- a/apps/token-e2e/.env.stagnet2 +++ b/apps/token-e2e/.env.stagnet3 @@ -1,5 +1,5 @@ # App configuration variables -NX_VEGA_ENV=STAGNET2 -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query +NX_VEGA_ENV=STAGNET3 +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/token-e2e/.env.testnet b/apps/token-e2e/.env.testnet index 9da0c78ab..4e315df7d 100644 --- a/apps/token-e2e/.env.testnet +++ b/apps/token-e2e/.env.testnet @@ -1,5 +1,5 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/token-e2e/src/integration/view/staking.cy.js b/apps/token-e2e/src/integration/view/staking.cy.js index 730c68e9e..bc94bdcf8 100644 --- a/apps/token-e2e/src/integration/view/staking.cy.js +++ b/apps/token-e2e/src/integration/view/staking.cy.js @@ -124,7 +124,7 @@ context('Staking Page - verify elements on page', function () { }); // 1002-STKE-050 - describe('Should be able to see static information about a validator', function () { + describe.skip('Should be able to see static information about a validator', function () { before('connect wallets and click on validator', function () { cy.vega_wallet_import(); cy.vega_wallet_connect(); diff --git a/apps/token/.env b/apps/token/.env index 1006a709c..1ed515c79 100644 --- a/apps/token/.env +++ b/apps/token/.env @@ -1,10 +1,10 @@ # App configuration variables NX_VEGA_ENV=TESTNET NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz NX_FAIRGROUND=false NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/token/.env.devnet b/apps/token/.env.devnet index d382c6a58..80e18b4fb 100644 --- a/apps/token/.env.devnet +++ b/apps/token/.env.devnet @@ -3,7 +3,7 @@ NX_VEGA_ENV=DEVNET NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json NX_VEGA_URL=https://n04.d.vega.xyz/query NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' +NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET3":"staging3.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/token/.env.mainnet b/apps/token/.env.mainnet index dcfd45f1b..c966afad9 100644 --- a/apps/token/.env.mainnet +++ b/apps/token/.env.mainnet @@ -2,7 +2,7 @@ NX_VEGA_ENV=MAINNET NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json NX_VEGA_URL=https://api.token.vega.xyz/query -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' +NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET3":"staging3.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/token/.env.stagnet1 b/apps/token/.env.stagnet1 index c4761fbff..ba8ad7823 100644 --- a/apps/token/.env.stagnet1 +++ b/apps/token/.env.stagnet1 @@ -2,7 +2,7 @@ NX_VEGA_ENV=STAGNET NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json NX_VEGA_URL=https://n03.s.vega.xyz/query -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' +NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET3":"staging3.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/token/.env.stagnet2 b/apps/token/.env.stagnet2 deleted file mode 100644 index 4b29fc41d..000000000 --- a/apps/token/.env.stagnet2 +++ /dev/null @@ -1,9 +0,0 @@ -# App configuration variables -NX_VEGA_ENV=STAGNET2 -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' -NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 -NX_ETHERSCAN_URL=https://ropsten.etherscan.io -NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions -NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest diff --git a/apps/token/.env.stagnet3 b/apps/token/.env.stagnet3 new file mode 100644 index 000000000..35db07ad9 --- /dev/null +++ b/apps/token/.env.stagnet3 @@ -0,0 +1,19 @@ +# App configuration variables +NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api +NX_TENDERMINT_URL=https://tm.n01.stagnet3.vega.xyz/ +NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet3.vega.xyz/websocket +NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/query +NX_VEGA_ENV=STAGNET3 +NX_VEGA_REST=https://api.n01.stagnet3.vega.xyz +NX_VEGA_NETWORKS="{}" + +# App flags +NX_EXPLORER_ASSETS=1 +NX_EXPLORER_GENESIS=1 +NX_EXPLORER_GOVERNANCE=1 +NX_EXPLORER_NETWORK_PARAMETERS=1 +NX_EXPLORER_PARTIES=1 +NX_EXPLORER_VALIDATORS=1 +NX_EXPLORER_MARKETS=1 +NX_EXPLORER_ORACLES=1 +NX_EXPLORER_TXS_LIST=1 diff --git a/apps/token/.env.testnet b/apps/token/.env.testnet index 57c002ec7..bd5fbcdbc 100644 --- a/apps/token/.env.testnet +++ b/apps/token/.env.testnet @@ -1,9 +1,9 @@ # App configuration variables NX_VEGA_ENV=TESTNET NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_URL=https://lb.testnet.vega.xyz/query -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET2":"staging2.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql +NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET":"https://dev.token.vega.xyz","STAGNET3":"staging3.token.vega.xyz","TESTNET":"token.fairground.wtf","MAINNET":"token.vega.xyz"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions -NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest +NX_VEGA_REST=https://api.n11.testnet.vega.xyz diff --git a/apps/token/README.md b/apps/token/README.md index 75dfbb223..a9079fdec 100644 --- a/apps/token/README.md +++ b/apps/token/README.md @@ -28,7 +28,7 @@ Example configurations are provided here: - [Devnet](./.env.devnet) - [Testnet](./.env.testnet) - [Stagnet1](./.env.stagnet1) -- [Stagnet2](./.env.stagnet2) +- [Stagnet3](./.env.stagnet3) For convenience, you can boot the app injecting one of the configurations above by running: diff --git a/apps/token/src/__generated__/globalTypes.ts b/apps/token/src/__generated__/globalTypes.ts deleted file mode 100644 index 255819b46..000000000 --- a/apps/token/src/__generated__/globalTypes.ts +++ /dev/null @@ -1,120 +0,0 @@ - -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -//============================================================== -// START Enums and Input Objects -//============================================================== - -/** - * The various account types we have (used by collateral) - */ -export enum AccountType { - Bond = "Bond", - External = "External", - FeeInfrastructure = "FeeInfrastructure", - FeeLiquidity = "FeeLiquidity", - FeeMaker = "FeeMaker", - General = "General", - GlobalInsurance = "GlobalInsurance", - GlobalReward = "GlobalReward", - Insurance = "Insurance", - LockWithdraw = "LockWithdraw", - Margin = "Margin", - PendingTransfers = "PendingTransfers", - RewardLpReceivedFees = "RewardLpReceivedFees", - RewardMakerReceivedFees = "RewardMakerReceivedFees", - RewardMarketProposers = "RewardMarketProposers", - RewardTakerPaidFees = "RewardTakerPaidFees", - Settlement = "Settlement", -} - -export enum NodeStatus { - NonValidator = "NonValidator", - Validator = "Validator", -} - -/** - * Reason for the proposal being rejected by the core node - */ -export enum ProposalRejectionReason { - CloseTimeTooLate = "CloseTimeTooLate", - CloseTimeTooSoon = "CloseTimeTooSoon", - CouldNotInstantiateMarket = "CouldNotInstantiateMarket", - EnactTimeTooLate = "EnactTimeTooLate", - EnactTimeTooSoon = "EnactTimeTooSoon", - IncompatibleTimestamps = "IncompatibleTimestamps", - InsufficientTokens = "InsufficientTokens", - InvalidAsset = "InvalidAsset", - InvalidAssetDetails = "InvalidAssetDetails", - InvalidFeeAmount = "InvalidFeeAmount", - InvalidFutureMaturityTimestamp = "InvalidFutureMaturityTimestamp", - InvalidFutureProduct = "InvalidFutureProduct", - InvalidInstrumentSecurity = "InvalidInstrumentSecurity", - InvalidRiskParameter = "InvalidRiskParameter", - InvalidShape = "InvalidShape", - MajorityThresholdNotReached = "MajorityThresholdNotReached", - MarketMissingLiquidityCommitment = "MarketMissingLiquidityCommitment", - MissingBuiltinAssetField = "MissingBuiltinAssetField", - MissingCommitmentAmount = "MissingCommitmentAmount", - MissingERC20ContractAddress = "MissingERC20ContractAddress", - NetworkParameterInvalidKey = "NetworkParameterInvalidKey", - NetworkParameterInvalidValue = "NetworkParameterInvalidValue", - NetworkParameterValidationFailed = "NetworkParameterValidationFailed", - NoProduct = "NoProduct", - NoRiskParameters = "NoRiskParameters", - NoTradingMode = "NoTradingMode", - NodeValidationFailed = "NodeValidationFailed", - OpeningAuctionDurationTooLarge = "OpeningAuctionDurationTooLarge", - OpeningAuctionDurationTooSmall = "OpeningAuctionDurationTooSmall", - ParticipationThresholdNotReached = "ParticipationThresholdNotReached", - ProductMaturityIsPassed = "ProductMaturityIsPassed", - UnsupportedProduct = "UnsupportedProduct", - UnsupportedTradingMode = "UnsupportedTradingMode", -} - -/** - * Various states a proposal can transition through: - * Open -> - * - Passed -> Enacted. - * - Rejected. - * Proposal can enter Failed state from any other state. - */ -export enum ProposalState { - Declined = "Declined", - Enacted = "Enacted", - Failed = "Failed", - Open = "Open", - Passed = "Passed", - Rejected = "Rejected", - WaitingForNodeVote = "WaitingForNodeVote", -} - -/** - * The status of the stake linking - */ -export enum StakeLinkingStatus { - Accepted = "Accepted", - Pending = "Pending", - Rejected = "Rejected", -} - -export enum VoteValue { - No = "No", - Yes = "Yes", -} - -/** - * The status of a withdrawal - */ -export enum WithdrawalStatus { - Finalized = "Finalized", - Open = "Open", - Rejected = "Rejected", -} - -//============================================================== -// END Enums and Input Objects -//============================================================== diff --git a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts b/apps/token/src/components/vega-wallet/__generated__/Delegations.ts index bf9dbd096..0648b1180 100644 --- a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts +++ b/apps/token/src/components/vega-wallet/__generated__/Delegations.ts @@ -20,7 +20,7 @@ export interface Delegations_epoch { export interface Delegations_party_delegations_node { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; name: string; @@ -59,7 +59,7 @@ export interface Delegations_party_accounts_asset_source_BuiltinAsset { export interface Delegations_party_accounts_asset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -73,11 +73,11 @@ export interface Delegations_party_accounts_asset { */ name: string; /** - * The id of the asset + * The ID of the asset */ id: string; /** - * The precision of the asset + * 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; /** @@ -85,7 +85,7 @@ export interface Delegations_party_accounts_asset { */ symbol: string; /** - * The origin source of the asset (e.g: an erc20 asset) + * The origin source of the asset (e.g: an ERC20 asset) */ source: Delegations_party_accounts_asset_source; } @@ -125,11 +125,11 @@ export interface Delegations_party { export interface Delegations { /** - * get data for a specific epoch, if id omitted it gets the current epoch. If the string is 'next', fetch the next epoch + * get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch */ epoch: Delegations_epoch; /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Delegations_party | null; } diff --git a/apps/token/src/components/vega-wallet/hooks.ts b/apps/token/src/components/vega-wallet/hooks.ts index 54a3b3a59..840a7c7e8 100644 --- a/apps/token/src/components/vega-wallet/hooks.ts +++ b/apps/token/src/components/vega-wallet/hooks.ts @@ -5,7 +5,6 @@ import uniq from 'lodash/uniq'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { AccountType } from '../../__generated__/globalTypes'; import noIcon from '../../images/token-no-icon.png'; import vegaBlack from '../../images/vega_black.png'; import { BigNumber } from '../../lib/bignumber'; @@ -19,6 +18,7 @@ import type { import { useVegaWallet } from '@vegaprotocol/wallet'; import { useContracts } from '../../contexts/contracts/contracts-context'; import { isAssetTypeERC20 } from '@vegaprotocol/react-helpers'; +import { AccountType } from '@vegaprotocol/types'; const DELEGATIONS_QUERY = gql` query Delegations($partyId: ID!) { @@ -115,7 +115,7 @@ export const usePollForDelegations = () => { const accounts = res.data.party?.accounts || []; setAccounts( accounts - .filter((a) => a.type === AccountType.General) + .filter((a) => a.type === AccountType.ACCOUNT_TYPE_GENERAL) .map((a) => { const isVega = isAssetTypeERC20(a.asset) && diff --git a/apps/token/src/config/env.ts b/apps/token/src/config/env.ts index ab0387b3a..ae96a7b1a 100644 --- a/apps/token/src/config/env.ts +++ b/apps/token/src/config/env.ts @@ -32,7 +32,7 @@ export const ContractAddresses: { claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error lockedAddress: '0x0', // TODO not deployed to this env }, - STAGNET2: { + STAGNET3: { claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error lockedAddress: '0x0', // TODO not deployed to this env }, diff --git a/apps/token/src/hooks/use-tranches.ts b/apps/token/src/hooks/use-tranches.ts index da9b94d42..1b6740744 100644 --- a/apps/token/src/hooks/use-tranches.ts +++ b/apps/token/src/hooks/use-tranches.ts @@ -10,7 +10,7 @@ const TRANCHES_URLS: { [N in Networks]: string } = { MAINNET: 'https://static.vega.xyz/assets/mainnet-tranches.json', TESTNET: 'https://static.vega.xyz/assets/testnet-tranches.json', STAGNET: 'https://static.vega.xyz/assets/stagnet1-tranches.json', - STAGNET2: 'https://static.vega.xyz/assets/stagnet2-tranches.json', + STAGNET3: 'https://static.vega.xyz/assets/stagnet2-tranches.json', DEVNET: 'https://static.vega.xyz/assets/devnet-tranches.json', CUSTOM: 'https://static.vega.xyz/assets/testnet-tranches.json', }; diff --git a/apps/token/src/lib/get-data-node-url.ts b/apps/token/src/lib/get-data-node-url.ts index c09a4e2e9..7de56faff 100644 --- a/apps/token/src/lib/get-data-node-url.ts +++ b/apps/token/src/lib/get-data-node-url.ts @@ -5,9 +5,8 @@ export function getDataNodeUrl() { if (!base) { throw new Error('Environment variable NX_VEGA_URL must be set'); } - const gqlPath = 'query'; - const urlHTTP = new URL(gqlPath, base); - const urlWS = new URL(gqlPath, base); + const urlHTTP = new URL(base); + const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); diff --git a/apps/token/src/routes/governance/__generated__/ProposalFields.ts b/apps/token/src/routes/governance/__generated__/ProposalFields.ts index 345357466..bf2740a4d 100644 --- a/apps/token/src/routes/governance/__generated__/ProposalFields.ts +++ b/apps/token/src/routes/governance/__generated__/ProposalFields.ts @@ -17,8 +17,8 @@ export interface ProposalFields_party { id: string; } -export interface ProposalFields_terms_change_NewFreeform { - __typename: "NewFreeform"; +export interface ProposalFields_terms_change_UpdateAsset { + __typename: "UpdateAsset" | "NewFreeform"; } export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct_settlementAsset { @@ -56,7 +56,7 @@ export interface ProposalFields_terms_change_NewMarket_instrument { export interface ProposalFields_terms_change_NewMarket { __typename: "NewMarket"; /** - * Decimal places used for the new market + * Decimal places used for the new market, sets the smallest price increment on the book */ decimalPlaces: number; /** @@ -85,7 +85,7 @@ export interface ProposalFields_terms_change_NewAsset_source_BuiltinAsset { export interface ProposalFields_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -103,7 +103,7 @@ export interface ProposalFields_terms_change_NewAsset { */ symbol: string; /** - * the source of the new Asset + * The source of the new asset */ source: ProposalFields_terms_change_NewAsset_source; } @@ -125,7 +125,7 @@ export interface ProposalFields_terms_change_UpdateNetworkParameter { networkParameter: ProposalFields_terms_change_UpdateNetworkParameter_networkParameter; } -export type ProposalFields_terms_change = ProposalFields_terms_change_NewFreeform | ProposalFields_terms_change_NewMarket | ProposalFields_terms_change_UpdateMarket | ProposalFields_terms_change_NewAsset | ProposalFields_terms_change_UpdateNetworkParameter; +export type ProposalFields_terms_change = ProposalFields_terms_change_UpdateAsset | ProposalFields_terms_change_NewMarket | ProposalFields_terms_change_UpdateMarket | ProposalFields_terms_change_NewAsset | ProposalFields_terms_change_UpdateNetworkParameter; export interface ProposalFields_terms { __typename: "ProposalTerms"; @@ -137,8 +137,9 @@ export interface ProposalFields_terms { /** * RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time. * Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + * Note: Optional as free form proposals do not require it. */ - enactmentDatetime: string; + enactmentDatetime: string | null; /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ @@ -184,15 +185,15 @@ export interface ProposalFields_votes_yes_votes { export interface ProposalFields_votes_yes { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: ProposalFields_votes_yes_votes[] | null; } @@ -236,15 +237,15 @@ export interface ProposalFields_votes_no_votes { export interface ProposalFields_votes_no { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: ProposalFields_votes_no_votes[] | null; } @@ -264,11 +265,11 @@ export interface ProposalFields_votes { export interface ProposalFields { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; /** - * A UUID reference to aid tracking proposals on VEGA + * A UUID reference to aid tracking proposals on Vega */ reference: string; /** diff --git a/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx b/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx index 93dbaf4cc..09fe38921 100644 --- a/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx +++ b/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx @@ -1,4 +1,4 @@ -import { ProposalState } from '../../../../__generated__/globalTypes'; +import { ProposalState } from '@vegaprotocol/types'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; export const CurrentProposalState = ({ @@ -10,14 +10,14 @@ export const CurrentProposalState = ({ let className = 'text-white'; if ( - state === ProposalState.Declined || - state === ProposalState.Failed || - state === ProposalState.Rejected + state === ProposalState.STATE_DECLINED || + state === ProposalState.STATE_FAILED || + state === ProposalState.STATE_REJECTED ) { className = 'text-danger'; } else if ( - state === ProposalState.Enacted || - state === ProposalState.Passed + state === ProposalState.STATE_ENACTED || + state === ProposalState.STATE_PASSED ) { className = 'text-white'; } diff --git a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx index 19d064ac2..6a6fcba27 100644 --- a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx +++ b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { formatDistanceToNow } from 'date-fns'; import { useTranslation } from 'react-i18next'; -import { ProposalState } from '../../../../__generated__/globalTypes'; +import { ProposalState } from '@vegaprotocol/types'; import { useVoteInformation } from '../../hooks'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; @@ -29,12 +29,13 @@ export const CurrentProposalStatus = ({ { addSuffix: true } ); - const daysEnactedAgo = formatDistanceToNow( - new Date(proposal.terms.enactmentDatetime), - { addSuffix: true } - ); + const daysEnactedAgo = + proposal.terms.enactmentDatetime && + formatDistanceToNow(new Date(proposal.terms.enactmentDatetime), { + addSuffix: true, + }); - if (proposal.state === ProposalState.Open) { + if (proposal.state === ProposalState.STATE_OPEN) { if (willPass) { return ( <> @@ -53,9 +54,9 @@ export const CurrentProposalStatus = ({ } if ( - proposal.state === ProposalState.Failed || - proposal.state === ProposalState.Declined || - proposal.state === ProposalState.Rejected + proposal.state === ProposalState.STATE_FAILED || + proposal.state === ProposalState.STATE_DECLINED || + proposal.state === ProposalState.STATE_REJECTED ) { if (!participationMet) { return ( @@ -86,8 +87,8 @@ export const CurrentProposalStatus = ({ ); } if ( - proposal.state === ProposalState.Enacted || - proposal.state === ProposalState.Passed + proposal.state === ProposalState.STATE_ENACTED || + proposal.state === ProposalState.STATE_PASSED ) { return ( <> @@ -95,7 +96,7 @@ export const CurrentProposalStatus = ({  {proposal.state}   - {proposal.state === ProposalState.Enacted + {proposal.state === ProposalState.STATE_ENACTED ? daysEnactedAgo : daysClosedAgo} . @@ -104,7 +105,7 @@ export const CurrentProposalStatus = ({ ); } - if (proposal.state === ProposalState.WaitingForNodeVote) { + if (proposal.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE) { return ( {t('subjectToFurtherActions', { daysAgo: daysClosedAgo })} ); diff --git a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.spec.tsx b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.spec.tsx index 903625cbe..c846c1272 100644 --- a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.spec.tsx +++ b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.spec.tsx @@ -1,10 +1,7 @@ import { render, screen } from '@testing-library/react'; +import { ProposalRejectionReason, ProposalState } from '@vegaprotocol/types'; import { format } from 'date-fns'; -import { - ProposalRejectionReason, - ProposalState, -} from '../../../../__generated__/globalTypes'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { generateProposal } from '../../test-helpers/generate-proposals'; import { ProposalChangeTable } from './proposal-change-table'; @@ -22,7 +19,7 @@ it('Renders all data for table', () => { expect(screen.getByText(proposal.id as string)).toBeInTheDocument(); expect(screen.getByText('State')).toBeInTheDocument(); - expect(screen.getByText('Open')).toBeInTheDocument(); + expect(screen.getByText('STATE_OPEN')).toBeInTheDocument(); expect(screen.getByText('Closes on')).toBeInTheDocument(); expect( @@ -34,7 +31,10 @@ it('Renders all data for table', () => { expect(screen.getByText('Proposed enactment')).toBeInTheDocument(); expect( screen.getByText( - format(new Date(proposal.terms.enactmentDatetime), DATE_FORMAT_DETAILED) + format( + new Date(proposal.terms.enactmentDatetime || 0), + DATE_FORMAT_DETAILED + ) ) ).toBeInTheDocument(); @@ -54,12 +54,12 @@ it('Renders all data for table', () => { it('Changes data based on if data is in future or past', () => { const proposal = generateProposal({ - state: ProposalState.Enacted, + state: ProposalState.STATE_ENACTED, }); render(); expect(screen.getByText('State')).toBeInTheDocument(); - expect(screen.getByText('Enacted')).toBeInTheDocument(); + expect(screen.getByText('STATE_ENACTED')).toBeInTheDocument(); expect(screen.getByText('Closed on')).toBeInTheDocument(); expect( @@ -71,7 +71,10 @@ it('Changes data based on if data is in future or past', () => { expect(screen.getByText('Enacted on')).toBeInTheDocument(); expect( screen.getByText( - format(new Date(proposal.terms.enactmentDatetime), DATE_FORMAT_DETAILED) + format( + new Date(proposal.terms.enactmentDatetime || 0), + DATE_FORMAT_DETAILED + ) ) ).toBeInTheDocument(); }); @@ -80,7 +83,7 @@ it('Renders error details and rejection reason if present', () => { const errorDetails = 'Error message'; const proposal = generateProposal({ errorDetails, - rejectionReason: ProposalRejectionReason.CloseTimeTooLate, + rejectionReason: ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE, }); render(); expect(screen.getByText('Error details')).toBeInTheDocument(); @@ -88,6 +91,6 @@ it('Renders error details and rejection reason if present', () => { expect(screen.getByText('Rejection reason')).toBeInTheDocument(); expect( - screen.getByText(ProposalRejectionReason.CloseTimeTooLate) + screen.getByText(ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE) ).toBeInTheDocument(); }); diff --git a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx index a6bc7e3e3..095be26ce 100644 --- a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx +++ b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx @@ -32,10 +32,10 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => { {format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)} - {isFuture(new Date(terms.enactmentDatetime)) + {isFuture(new Date(terms.enactmentDatetime || 0)) ? t('proposedEnactment') : t('enactedOn')} - {format(new Date(terms.enactmentDatetime), DATE_FORMAT_DETAILED)} + {format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)} {t('proposedBy')} diff --git a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx index 19df0d1ad..30b9da678 100644 --- a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx +++ b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx @@ -56,7 +56,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Enacted, + state: ProposalState.STATE_ENACTED, terms: { enactmentDatetime: lastWeek.toString(), }, @@ -73,7 +73,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Passed, + state: ProposalState.STATE_PASSED, terms: { closingDatetime: lastWeek.toString(), enactmentDatetime: nextWeek.toString(), @@ -91,7 +91,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.WaitingForNodeVote, + state: ProposalState.STATE_WAITING_FOR_NODE_VOTE, terms: { enactmentDatetime: nextWeek.toString(), }, @@ -110,7 +110,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, terms: { closingDatetime: fiveMinutes.toString(), }, @@ -127,7 +127,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, terms: { closingDatetime: fiveHours.toString(), }, @@ -144,7 +144,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, terms: { closingDatetime: fiveDays.toString(), }, @@ -161,14 +161,14 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, votes: { __typename: 'ProposalVotes', yes: { votes: [ { __typename: 'Vote', - value: VoteValue.Yes, + value: VoteValue.VALUE_YES, datetime: lastWeek.toString(), party: { __typename: 'Party', @@ -199,14 +199,14 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, votes: { __typename: 'ProposalVotes', no: { votes: [ { __typename: 'Vote', - value: VoteValue.No, + value: VoteValue.VALUE_NO, datetime: lastWeek.toString(), party: { __typename: 'Party', @@ -237,7 +237,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, terms: { enactmentDatetime: nextWeek.toString(), }, @@ -258,7 +258,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, terms: { enactmentDatetime: nextWeek.toString(), }, @@ -279,7 +279,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, votes: { __typename: 'ProposalVotes', yes: generateYesVotes(3000, 1000000000000000000), @@ -299,7 +299,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, votes: { __typename: 'ProposalVotes', yes: generateYesVotes(0), @@ -319,7 +319,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Declined, + state: ProposalState.STATE_DECLINED, terms: { enactmentDatetime: lastWeek.toString(), }, @@ -340,7 +340,7 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Declined, + state: ProposalState.STATE_DECLINED, terms: { enactmentDatetime: lastWeek.toString(), }, @@ -361,17 +361,18 @@ describe('Proposals list item details', () => { render( renderComponent( generateProposal({ - state: ProposalState.Rejected, + state: ProposalState.STATE_REJECTED, terms: { enactmentDatetime: lastWeek.toString(), }, - rejectionReason: ProposalRejectionReason.InvalidFutureProduct, + rejectionReason: + ProposalRejectionReason.PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT, }) ) ); expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected'); expect(screen.getByTestId('vote-status')).toHaveTextContent( - 'Invalid future product' + 'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT' ); }); }); diff --git a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx index cb12ae611..e9ba0afd1 100644 --- a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx +++ b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx @@ -10,9 +10,9 @@ import { import { format, formatDistanceToNowStrict } from 'date-fns'; import { useTranslation } from 'react-i18next'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; -import { ProposalState } from '../../../../__generated__/globalTypes'; import type { ReactNode } from 'react'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import { ProposalState } from '@vegaprotocol/types'; const MajorityNotReached = () => { const { t } = useTranslation(); @@ -52,13 +52,13 @@ export const ProposalsListItemDetails = ({ let voteStatus: ReactNode; switch (state) { - case ProposalState.Enacted: { + case ProposalState.STATE_ENACTED: { proposalStatus = ( <> {t('voteState_Enacted')} ); - voteDetails = ( + voteDetails = proposal.terms.enactmentDatetime && ( <> {format( new Date(proposal.terms.enactmentDatetime), @@ -68,7 +68,7 @@ export const ProposalsListItemDetails = ({ ); break; } - case ProposalState.Passed: { + case ProposalState.STATE_PASSED: { proposalStatus = ( <> {t('voteState_Passed')} @@ -77,15 +77,16 @@ export const ProposalsListItemDetails = ({ voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && ( <> {t('toEnactOn')}{' '} - {format( - new Date(proposal.terms.enactmentDatetime), - DATE_FORMAT_DETAILED - )} + {proposal.terms.enactmentDatetime && + format( + new Date(proposal.terms.enactmentDatetime), + DATE_FORMAT_DETAILED + )} ); break; } - case ProposalState.WaitingForNodeVote: { + case ProposalState.STATE_WAITING_FOR_NODE_VOTE: { proposalStatus = ( <> {t('voteState_WaitingForNodeVote')} @@ -94,15 +95,16 @@ export const ProposalsListItemDetails = ({ voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && ( <> {t('toEnactOn')}{' '} - {format( - new Date(proposal.terms.enactmentDatetime), - DATE_FORMAT_DETAILED - )} + {proposal.terms.enactmentDatetime && + format( + new Date(proposal.terms.enactmentDatetime), + DATE_FORMAT_DETAILED + )} ); break; } - case ProposalState.Open: { + case ProposalState.STATE_OPEN: { proposalStatus = ( <> {t('voteState_Open')} @@ -140,7 +142,7 @@ export const ProposalsListItemDetails = ({ )); break; } - case ProposalState.Declined: { + case ProposalState.STATE_DECLINED: { proposalStatus = ( <> {t('voteState_Declined')} @@ -151,7 +153,7 @@ export const ProposalsListItemDetails = ({ (!majorityMet && ); break; } - case ProposalState.Rejected: { + case ProposalState.STATE_REJECTED: { proposalStatus = ( <> {t('voteState_Rejected')}{' '} diff --git a/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx b/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx index a6d228c59..1709a8297 100644 --- a/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx @@ -18,7 +18,7 @@ import type { Proposals_proposals } from '../../proposals/__generated__/Proposal const openProposalClosesNextMonth = generateProposal({ id: 'proposal1', - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, party: { id: 'zxcv', }, @@ -30,7 +30,7 @@ const openProposalClosesNextMonth = generateProposal({ const openProposalClosesNextWeek = generateProposal({ id: 'proposal2', - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, party: { id: 'bvcx', }, @@ -42,7 +42,7 @@ const openProposalClosesNextWeek = generateProposal({ const enactedProposalClosedLastWeek = generateProposal({ id: 'proposal3', - state: ProposalState.Enacted, + state: ProposalState.STATE_ENACTED, terms: { closingDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(), @@ -51,7 +51,7 @@ const enactedProposalClosedLastWeek = generateProposal({ const rejectedProposalClosedLastMonth = generateProposal({ id: 'proposal4', - state: ProposalState.Rejected, + state: ProposalState.STATE_REJECTED, terms: { closingDatetime: lastMonth.toString(), enactmentDatetime: lastMonth.toString(), @@ -60,7 +60,7 @@ const rejectedProposalClosedLastMonth = generateProposal({ const failedProposal = generateProposal({ id: 'proposal5', - state: ProposalState.Failed, + state: ProposalState.STATE_FAILED, }); const renderComponent = (proposals: Proposals_proposals[]) => ( diff --git a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx index 91af002db..c1e16fb8a 100644 --- a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx @@ -8,6 +8,7 @@ import type { Proposals_proposals } from '../../proposals/__generated__/Proposal import Routes from '../../../routes'; import { Button } from '@vegaprotocol/ui-toolkit'; import { Link } from 'react-router-dom'; +import { ProposalState } from '@vegaprotocol/types'; interface ProposalsListProps { proposals: Proposals_proposals[]; @@ -23,7 +24,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => { const [filterString, setFilterString] = useState(''); const failedProposalsCulled = proposals.filter( - ({ state }) => state !== 'Failed' + ({ state }) => state !== ProposalState.STATE_FAILED ); const sortedProposals = failedProposalsCulled.reduce( diff --git a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts index e81ad4d01..c15e858c8 100644 --- a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts +++ b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts @@ -30,7 +30,7 @@ export interface VoteButtons_party { export interface VoteButtons { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: VoteButtons_party | null; } diff --git a/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx b/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx index bb1a095c6..675d02f38 100644 --- a/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx +++ b/apps/token/src/routes/governance/components/vote-details/use-user-vote.tsx @@ -1,8 +1,8 @@ import { captureException, captureMessage } from '@sentry/minimal'; import * as React from 'react'; -import { VoteValue } from '../../../../__generated__/globalTypes'; -import { useVegaWallet, VegaWalletVoteValue } from '@vegaprotocol/wallet'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import { VoteValue } from '@vegaprotocol/types'; export type Vote = { value: VoteValue; @@ -64,7 +64,7 @@ export function useUserVote( setVoteState(VoteState.NotCast); } else { setVoteState( - userVote.value === VoteValue.Yes ? VoteState.Yes : VoteState.No + userVote.value === VoteValue.VALUE_YES ? VoteState.Yes : VoteState.No ); } }, [userVote]); @@ -100,7 +100,7 @@ export function useUserVote( pubKey: keypair.pub, propagate: true, voteSubmission: { - value: VegaWalletVoteValue[value], + value: value, proposalId, }, }; diff --git a/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx b/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx index ef588ed0a..fb100c910 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-buttons.tsx @@ -3,8 +3,6 @@ import { format } from 'date-fns'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; -import { ProposalState } from '../../../../__generated__/globalTypes'; -import { VoteValue } from '../../../../__generated__/globalTypes'; import { AppStateActionType, useAppState, @@ -18,6 +16,7 @@ import type { import { VoteState } from './use-user-vote'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { Button } from '@vegaprotocol/ui-toolkit'; +import { ProposalState, VoteValue } from '@vegaprotocol/types'; interface VoteButtonsContainerProps { voteState: VoteState | null; @@ -78,7 +77,7 @@ export const VoteButtons = ({ const [changeVote, setChangeVote] = React.useState(false); const cantVoteUI = React.useMemo(() => { - if (proposalState !== ProposalState.Open) { + if (proposalState !== ProposalState.STATE_OPEN) { return t('youDidNotVote'); } @@ -146,7 +145,7 @@ export const VoteButtons = ({ {voteDatetime ? ( {format(voteDatetime, DATE_FORMAT_LONG)}. ) : null} - {proposalState === ProposalState.Open ? ( + {proposalState === ProposalState.STATE_OPEN ? ( -
  • diff --git a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx index 5f7ff29b5..0c631e973 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx @@ -1,7 +1,6 @@ import { formatDistanceToNow } from 'date-fns'; import { useTranslation } from 'react-i18next'; -import { ProposalState } from '../../../../__generated__/globalTypes'; import { formatNumber } from '../../../../lib/format-number'; import { ConnectToVega } from '../../../staking/connect-to-vega'; import { useVoteInformation } from '../../hooks'; @@ -11,6 +10,7 @@ import { useUserVote } from './use-user-vote'; import { VoteButtonsContainer } from './vote-buttons'; import { VoteProgress } from './vote-progress'; import { useVegaWallet } from '@vegaprotocol/wallet'; +import { ProposalState } from '@vegaprotocol/types'; interface VoteDetailsProps { proposal: Proposal_proposal; @@ -50,7 +50,7 @@ export const VoteDetails = ({ proposal }: VoteDetailsProps) => { {'. '} - {proposal.state === ProposalState.Open ? daysLeft : null} + {proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}

    diff --git a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts index 3baa46224..b882b7854 100644 --- a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts +++ b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts @@ -17,8 +17,8 @@ export interface Proposal_proposal_party { id: string; } -export interface Proposal_proposal_terms_change_NewFreeform { - __typename: "NewFreeform"; +export interface Proposal_proposal_terms_change_UpdateAsset { + __typename: "UpdateAsset" | "NewFreeform"; } export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_settlementAsset { @@ -56,7 +56,7 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument { export interface Proposal_proposal_terms_change_NewMarket { __typename: "NewMarket"; /** - * Decimal places used for the new market + * Decimal places used for the new market, sets the smallest price increment on the book */ decimalPlaces: number; /** @@ -85,7 +85,7 @@ export interface Proposal_proposal_terms_change_NewAsset_source_BuiltinAsset { export interface Proposal_proposal_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -103,7 +103,7 @@ export interface Proposal_proposal_terms_change_NewAsset { */ symbol: string; /** - * the source of the new Asset + * The source of the new asset */ source: Proposal_proposal_terms_change_NewAsset_source; } @@ -125,7 +125,7 @@ export interface Proposal_proposal_terms_change_UpdateNetworkParameter { networkParameter: Proposal_proposal_terms_change_UpdateNetworkParameter_networkParameter; } -export type Proposal_proposal_terms_change = Proposal_proposal_terms_change_NewFreeform | Proposal_proposal_terms_change_NewMarket | Proposal_proposal_terms_change_UpdateMarket | Proposal_proposal_terms_change_NewAsset | Proposal_proposal_terms_change_UpdateNetworkParameter; +export type Proposal_proposal_terms_change = Proposal_proposal_terms_change_UpdateAsset | Proposal_proposal_terms_change_NewMarket | Proposal_proposal_terms_change_UpdateMarket | Proposal_proposal_terms_change_NewAsset | Proposal_proposal_terms_change_UpdateNetworkParameter; export interface Proposal_proposal_terms { __typename: "ProposalTerms"; @@ -137,8 +137,9 @@ export interface Proposal_proposal_terms { /** * RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time. * Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + * Note: Optional as free form proposals do not require it. */ - enactmentDatetime: string; + enactmentDatetime: string | null; /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ @@ -184,15 +185,15 @@ export interface Proposal_proposal_votes_yes_votes { export interface Proposal_proposal_votes_yes { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: Proposal_proposal_votes_yes_votes[] | null; } @@ -236,15 +237,15 @@ export interface Proposal_proposal_votes_no_votes { export interface Proposal_proposal_votes_no { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: Proposal_proposal_votes_no_votes[] | null; } @@ -264,11 +265,11 @@ export interface Proposal_proposal_votes { export interface Proposal_proposal { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; /** - * A UUID reference to aid tracking proposals on VEGA + * A UUID reference to aid tracking proposals on Vega */ reference: string; /** @@ -303,7 +304,7 @@ export interface Proposal_proposal { export interface Proposal { /** - * A governance proposal located by either its id or reference. If both are set, id is used. + * A governance proposal located by either its ID or reference. If both are set, ID is used. */ proposal: Proposal_proposal; } diff --git a/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts b/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts index 951146baa..892f399c5 100644 --- a/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts +++ b/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts @@ -17,8 +17,8 @@ export interface Proposals_proposals_party { id: string; } -export interface Proposals_proposals_terms_change_NewFreeform { - __typename: "NewFreeform"; +export interface Proposals_proposals_terms_change_UpdateAsset { + __typename: "UpdateAsset" | "NewFreeform"; } export interface Proposals_proposals_terms_change_NewMarket_instrument_futureProduct_settlementAsset { @@ -56,7 +56,7 @@ export interface Proposals_proposals_terms_change_NewMarket_instrument { export interface Proposals_proposals_terms_change_NewMarket { __typename: "NewMarket"; /** - * Decimal places used for the new market + * Decimal places used for the new market, sets the smallest price increment on the book */ decimalPlaces: number; /** @@ -85,7 +85,7 @@ export interface Proposals_proposals_terms_change_NewAsset_source_BuiltinAsset { export interface Proposals_proposals_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -103,7 +103,7 @@ export interface Proposals_proposals_terms_change_NewAsset { */ symbol: string; /** - * the source of the new Asset + * The source of the new asset */ source: Proposals_proposals_terms_change_NewAsset_source; } @@ -125,7 +125,7 @@ export interface Proposals_proposals_terms_change_UpdateNetworkParameter { networkParameter: Proposals_proposals_terms_change_UpdateNetworkParameter_networkParameter; } -export type Proposals_proposals_terms_change = Proposals_proposals_terms_change_NewFreeform | Proposals_proposals_terms_change_NewMarket | Proposals_proposals_terms_change_UpdateMarket | Proposals_proposals_terms_change_NewAsset | Proposals_proposals_terms_change_UpdateNetworkParameter; +export type Proposals_proposals_terms_change = Proposals_proposals_terms_change_UpdateAsset | Proposals_proposals_terms_change_NewMarket | Proposals_proposals_terms_change_UpdateMarket | Proposals_proposals_terms_change_NewAsset | Proposals_proposals_terms_change_UpdateNetworkParameter; export interface Proposals_proposals_terms { __typename: "ProposalTerms"; @@ -137,8 +137,9 @@ export interface Proposals_proposals_terms { /** * RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time. * Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + * Note: Optional as free form proposals do not require it. */ - enactmentDatetime: string; + enactmentDatetime: string | null; /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ @@ -184,15 +185,15 @@ export interface Proposals_proposals_votes_yes_votes { export interface Proposals_proposals_votes_yes { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: Proposals_proposals_votes_yes_votes[] | null; } @@ -236,15 +237,15 @@ export interface Proposals_proposals_votes_no_votes { export interface Proposals_proposals_votes_no { __typename: "ProposalVoteSide"; /** - * Total tokens of governance token from the votes casted for this side + * Total number of governance tokens from the votes cast for this side */ totalTokens: string; /** - * Total number of votes casted for this side + * Total number of votes cast for this side */ totalNumber: string; /** - * All votes casted for this side + * All votes cast for this side */ votes: Proposals_proposals_votes_no_votes[] | null; } @@ -264,11 +265,11 @@ export interface Proposals_proposals_votes { export interface Proposals_proposals { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; /** - * A UUID reference to aid tracking proposals on VEGA + * A UUID reference to aid tracking proposals on Vega */ reference: string; /** @@ -303,7 +304,7 @@ export interface Proposals_proposals { export interface Proposals { /** - * All governance proposals in the VEGA network + * All governance proposals in the Vega network */ proposals: Proposals_proposals[] | null; } diff --git a/apps/token/src/routes/governance/test-helpers/generate-proposals.ts b/apps/token/src/routes/governance/test-helpers/generate-proposals.ts index 83e4550ce..fd8dcaff2 100644 --- a/apps/token/src/routes/governance/test-helpers/generate-proposals.ts +++ b/apps/token/src/routes/governance/test-helpers/generate-proposals.ts @@ -1,8 +1,8 @@ +import { ProposalState, VoteValue } from '@vegaprotocol/types'; import * as faker from 'faker'; import isArray from 'lodash/isArray'; import mergeWith from 'lodash/mergeWith'; -import { ProposalState, VoteValue } from '../../../__generated__/globalTypes'; import type { DeepPartial } from '../../../lib/type-helpers'; import type { ProposalFields, @@ -17,7 +17,7 @@ export function generateProposal( __typename: 'Proposal', id: faker.datatype.uuid(), reference: 'ref' + faker.datatype.uuid(), - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, datetime: faker.date.past().toISOString(), rejectionReason: null, errorDetails: null, @@ -29,14 +29,14 @@ export function generateProposal( __typename: 'ProposalTerms', closingDatetime: !override.state || // defaults to Open - override.state === ProposalState.Open || - override.state === ProposalState.WaitingForNodeVote + override.state === ProposalState.STATE_OPEN || + override.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE ? faker.date.soon().toISOString() : faker.date.past().toISOString(), enactmentDatetime: !override.state || // defaults to Open - override.state === ProposalState.Open || - override.state === ProposalState.WaitingForNodeVote + override.state === ProposalState.STATE_OPEN || + override.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE ? faker.date.future().toISOString() : faker.date.past().toISOString(), change: { @@ -80,7 +80,7 @@ export const generateYesVotes = ( votes: Array.from(Array(numberOfVotes)).map(() => { return { __typename: 'Vote', - value: VoteValue.Yes, + value: VoteValue.VALUE_YES, party: { id: faker.datatype.uuid(), __typename: 'Party', @@ -115,7 +115,7 @@ export const generateNoVotes = ( votes: Array.from(Array(numberOfVotes)).map(() => { return { __typename: 'Vote', - value: VoteValue.No, + value: VoteValue.VALUE_NO, party: { id: faker.datatype.uuid(), __typename: 'Party', diff --git a/apps/token/src/routes/rewards/home/__generated__/Rewards.ts b/apps/token/src/routes/rewards/home/__generated__/Rewards.ts index 765e911e3..63d4cb34a 100644 --- a/apps/token/src/routes/rewards/home/__generated__/Rewards.ts +++ b/apps/token/src/routes/rewards/home/__generated__/Rewards.ts @@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types"; export interface Rewards_party_rewardDetails_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -24,7 +24,7 @@ export interface Rewards_party_rewardDetails_asset { export interface Rewards_party_rewardDetails_rewards_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; } @@ -144,18 +144,18 @@ export interface Rewards_epoch { */ id: string; /** - * Timestamps for start/end etc + * Timestamps for start and end of epochs */ timestamps: Rewards_epoch_timestamps; } export interface Rewards { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Rewards_party | null; /** - * get data for a specific epoch, if id omitted it gets the current epoch. If the string is 'next', fetch the next epoch + * get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch */ epoch: Rewards_epoch; } diff --git a/apps/token/src/routes/staking/__generated__/Nodes.ts b/apps/token/src/routes/staking/__generated__/Nodes.ts index 75f78a189..3c08e0f34 100644 --- a/apps/token/src/routes/staking/__generated__/Nodes.ts +++ b/apps/token/src/routes/staking/__generated__/Nodes.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { ValidatorStatus } from "@vegaprotocol/types"; + // ==================================================== // GraphQL query operation: Nodes // ==================================================== @@ -22,25 +24,25 @@ export interface Nodes_nodes_rankingScore { */ performanceScore: string; /** - * The tendermint voting power of the validator (uint32) + * The Tendermint voting power of the validator (uint32) */ votingPower: string; /** * The current validation status of the validator */ - status: string; + status: ValidatorStatus; } export interface Nodes_nodes { __typename: "Node"; avatarUrl: string | null; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; name: string; /** - * Pubkey of the node operator + * Public key of the node operator */ pubkey: string; /** diff --git a/apps/token/src/routes/staking/__generated__/PartyDelegations.ts b/apps/token/src/routes/staking/__generated__/PartyDelegations.ts index 27487b4fa..ff1d7c7d3 100644 --- a/apps/token/src/routes/staking/__generated__/PartyDelegations.ts +++ b/apps/token/src/routes/staking/__generated__/PartyDelegations.ts @@ -10,7 +10,7 @@ export interface PartyDelegations_party_delegations_node { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; } @@ -51,11 +51,11 @@ export interface PartyDelegations_epoch { export interface PartyDelegations { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: PartyDelegations_party | null; /** - * get data for a specific epoch, if id omitted it gets the current epoch. If the string is 'next', fetch the next epoch + * get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch */ epoch: PartyDelegations_epoch; } diff --git a/apps/token/src/routes/staking/__generated__/Staking.ts b/apps/token/src/routes/staking/__generated__/Staking.ts index b4460ea44..506f1f57b 100644 --- a/apps/token/src/routes/staking/__generated__/Staking.ts +++ b/apps/token/src/routes/staking/__generated__/Staking.ts @@ -21,7 +21,7 @@ export interface Staking_party_stake { export interface Staking_party_delegations_node { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; } @@ -79,7 +79,7 @@ export interface Staking_epoch { */ id: string; /** - * Timestamps for start/end etc + * Timestamps for start and end of epochs */ timestamps: Staking_epoch_timestamps; } @@ -115,7 +115,7 @@ export interface Staking_nodes_rankingScore { */ performanceScore: string; /** - * The tendermint voting power of the validator (uint32) + * The Tendermint voting power of the validator (uint32) */ votingPower: string; } @@ -123,16 +123,16 @@ export interface Staking_nodes_rankingScore { export interface Staking_nodes { __typename: "Node"; /** - * The node url eg n01.vega.xyz + * The node URL eg n01.vega.xyz */ id: string; name: string; /** - * Pubkey of the node operator + * Public key of the node operator */ pubkey: string; /** - * URL where I can find out more info on the node. Will this be possible? + * URL from which you can get more info about the node. */ infoUrl: string; /** @@ -142,9 +142,9 @@ export interface Staking_nodes { /** * Ethereum public key of the node */ - ethereumAdddress: string; + ethereumAddress: string; /** - * The amount the node has put up themselves + * The amount of stake the node has put up themselves */ stakedByOperator: string; /** @@ -198,11 +198,11 @@ export interface Staking_nodeData { export interface Staking { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Staking_party | null; /** - * get data for a specific epoch, if id omitted it gets the current epoch. If the string is 'next', fetch the next epoch + * get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch */ epoch: Staking_epoch; /** diff --git a/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts b/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts index 8df21d336..1e107d22b 100644 --- a/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts +++ b/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts @@ -44,7 +44,7 @@ export interface PartyStakeLinkings_party { export interface PartyStakeLinkings { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: PartyStakeLinkings_party | null; } diff --git a/apps/token/src/routes/staking/associate/hooks.ts b/apps/token/src/routes/staking/associate/hooks.ts index 29dec6586..3a5cd29f3 100644 --- a/apps/token/src/routes/staking/associate/hooks.ts +++ b/apps/token/src/routes/staking/associate/hooks.ts @@ -2,7 +2,6 @@ import { gql, useApolloClient } from '@apollo/client'; import * as Sentry from '@sentry/react'; import React from 'react'; -import { StakeLinkingStatus } from '../../../__generated__/globalTypes'; import { StakingMethod } from '../../../components/staking-method-radio'; import { useContracts } from '../../../contexts/contracts/contracts-context'; import { TxState } from '../../../hooks/transaction-reducer'; @@ -16,6 +15,7 @@ import type { } from './__generated__/PartyStakeLinkings'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { StakeLinkingStatus } from '@vegaprotocol/types'; export const useAddStake = ( address: string, @@ -99,7 +99,7 @@ export const usePollForStakeLinking = ( .query({ query: PARTY_STAKE_LINKINGS, variables: { partyId }, - // 'network-only' doesn't work here. Pretty wierd. no-cache just means its network only plus + // 'network-only' doesn't work here. no-cache just means its network only plus // the result is not stored in the cache fetchPolicy: 'no-cache', }) @@ -110,7 +110,8 @@ export const usePollForStakeLinking = ( const matchingLinking = linkings?.find((l) => { return ( - l.txHash === txHash && l.status === StakeLinkingStatus.Accepted + l.txHash === txHash && + l.status === StakeLinkingStatus.STATUS_ACCEPTED ); }); diff --git a/apps/token/src/routes/staking/staking-nodes-container.tsx b/apps/token/src/routes/staking/staking-nodes-container.tsx index 7f360593e..29cad5031 100644 --- a/apps/token/src/routes/staking/staking-nodes-container.tsx +++ b/apps/token/src/routes/staking/staking-nodes-container.tsx @@ -38,7 +38,7 @@ export const STAKING_QUERY = gql` pubkey infoUrl location - ethereumAdddress + ethereumAddress stakedByOperator stakedByDelegates stakedTotal diff --git a/apps/token/src/routes/staking/validator-table.tsx b/apps/token/src/routes/staking/validator-table.tsx index 0e6df03db..780a884d8 100644 --- a/apps/token/src/routes/staking/validator-table.tsx +++ b/apps/token/src/routes/staking/validator-table.tsx @@ -72,10 +72,10 @@ export const ValidatorTable = ({ - {node.ethereumAdddress} + {node.ethereumAddress} diff --git a/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts b/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts index bb6f1aacf..d0f20f582 100644 --- a/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts +++ b/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts @@ -16,7 +16,7 @@ export interface WithdrawPage_party_accounts_asset_source_BuiltinAsset { export interface WithdrawPage_party_accounts_asset_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -26,7 +26,7 @@ export type WithdrawPage_party_accounts_asset_source = WithdrawPage_party_accoun export interface WithdrawPage_party_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -38,11 +38,11 @@ export interface WithdrawPage_party_accounts_asset { */ symbol: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: WithdrawPage_party_accounts_asset_source; } @@ -67,7 +67,7 @@ export interface WithdrawPage_party_accounts { export interface WithdrawPage_party_withdrawals_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -75,7 +75,7 @@ export interface WithdrawPage_party_withdrawals_asset { */ symbol: string; /** - * The precision of the asset + * 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; } @@ -91,7 +91,7 @@ export interface WithdrawPage_party_withdrawals_details { export interface WithdrawPage_party_withdrawals { __typename: "Withdrawal"; /** - * The Vega internal id of the withdrawal + * The Vega internal ID of the withdrawal */ id: string; /** @@ -111,7 +111,7 @@ export interface WithdrawPage_party_withdrawals { */ createdTimestamp: string; /** - * RFC3339Nano time at which the withdrawal was finalized + * RFC3339Nano time at which the withdrawal was finalised */ withdrawnTimestamp: string | null; /** @@ -147,7 +147,7 @@ export interface WithdrawPage_assets_source_BuiltinAsset { export interface WithdrawPage_assets_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -157,7 +157,7 @@ export type WithdrawPage_assets_source = WithdrawPage_assets_source_BuiltinAsset export interface WithdrawPage_assets { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -169,22 +169,22 @@ export interface WithdrawPage_assets { */ name: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: WithdrawPage_assets_source; } export interface WithdrawPage { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: WithdrawPage_party | null; /** - * The list of all assets in use in the vega network + * The list of all assets in use in the Vega network */ assets: WithdrawPage_assets[] | null; } diff --git a/apps/token/src/routes/withdraw/index.tsx b/apps/token/src/routes/withdraw/index.tsx index f6737e3b8..167c629f8 100644 --- a/apps/token/src/routes/withdraw/index.tsx +++ b/apps/token/src/routes/withdraw/index.tsx @@ -4,7 +4,6 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { AccountType } from '../../__generated__/globalTypes'; import { Heading } from '../../components/heading'; import { SplashLoader } from '../../components/splash-loader'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; @@ -15,6 +14,7 @@ import type { WithdrawPageVariables, } from './__generated__/WithdrawPage'; import { WithdrawManager } from '@vegaprotocol/withdraws'; +import { AccountType } from '@vegaprotocol/types'; const Withdraw = () => { const { t } = useTranslation(); @@ -105,7 +105,9 @@ export const WithdrawContainer = ({ currVegaKey }: WithdrawContainerProps) => { const accounts = React.useMemo(() => { if (!data?.party?.accounts) return []; // You can only withdraw from general accounts - return data.party.accounts.filter((a) => a.type === AccountType.General); + return data.party.accounts.filter( + (a) => a.type === AccountType.ACCOUNT_TYPE_GENERAL + ); }, [data]); // Note there is a small period where the withdrawal might have a tx hash but is technically diff --git a/apps/token/src/routes/withdrawals/index.tsx b/apps/token/src/routes/withdrawals/index.tsx index 750665742..63b64e4cf 100644 --- a/apps/token/src/routes/withdrawals/index.tsx +++ b/apps/token/src/routes/withdrawals/index.tsx @@ -16,7 +16,7 @@ import { addDecimal } from '../../lib/decimals'; import { truncateMiddle } from '../../lib/truncate-middle'; import type { Withdrawals_party_withdrawals } from '@vegaprotocol/withdraws'; import { useCompleteWithdraw, useWithdrawals } from '@vegaprotocol/withdraws'; -import { WithdrawalStatus } from '../../__generated__/globalTypes'; +import { WithdrawalStatus } from '@vegaprotocol/types'; const Withdrawals = () => { const { t } = useTranslation(); @@ -106,7 +106,7 @@ export const Withdrawal = ({ withdrawal, complete }: WithdrawalProps) => { {t('withdrawalsCompleteButton')} ); - } else if (withdrawal.status === WithdrawalStatus.Finalized) { + } else if (withdrawal.status === WithdrawalStatus.STATUS_FINALIZED) { if (withdrawal.txHash) { status = t('Complete'); } else { diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index 725a94668..0ea87fdc1 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -28,7 +28,7 @@ describe('home', () => { aliasQuery(req, 'MarketList', marketList); // Mock all market page queries - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/'); @@ -121,7 +121,7 @@ describe('home', () => { aliasQuery(req, 'Markets', generateMarkets()); // Mock all market page queries - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/'); diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index 898ae14cd..b4a49cb80 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -8,7 +8,7 @@ const marketTitle = 'accordion-title'; describe('market info is displayed', () => { before(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); cy.wait('@Market'); @@ -46,8 +46,8 @@ describe('market info is displayed', () => { validateMarketDataRow(0, 'Name', 'ETHBTC Quarterly (30 Jun 2022)'); validateMarketDataRow(1, 'Decimal Places', '2'); validateMarketDataRow(2, 'Position Decimal Places', '0'); - validateMarketDataRow(3, 'Trading Mode', 'Continuous'); - validateMarketDataRow(4, 'State', 'Active'); + validateMarketDataRow(3, 'Trading Mode', 'Trading mode continuous'); + validateMarketDataRow(4, 'State', 'STATE_ACTIVE'); validateMarketDataRow(5, 'Market ID', 'market-0'); }); diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index 6be9f5b64..4025264b7 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -34,7 +34,7 @@ describe('markets table', () => { it('Able to select market from dropdown', () => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); openMarketDropDown(); @@ -59,7 +59,7 @@ describe('markets table', () => { ]; cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); diff --git a/apps/trading-e2e/src/integration/portfolio-fills.cy.ts b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts index e9d964d89..e52d20767 100644 --- a/apps/trading-e2e/src/integration/portfolio-fills.cy.ts +++ b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts @@ -17,7 +17,7 @@ describe('fills', () => { seller: { id: Cypress.env('VEGA_PUBLIC_KEY'), }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, buyerFee: { infrastructureFee: '5000', }, @@ -31,11 +31,11 @@ describe('fills', () => { seller: { id: Cypress.env('VEGA_PUBLIC_KEY'), }, - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, }), generateFill({ id: '3', - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, market: { name: 'ETHBTC Quarterly (30 Jun 2022)', }, diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index 5d7da6044..65974c458 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -4,13 +4,14 @@ import { connectVegaWallet } from '../support/vega-wallet'; beforeEach(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); }); describe('accounts', () => { it('renders accounts', () => { + const tradingAccountRowId = '[row-id="ACCOUNT_TYPE_GENERAL-tEURO-null"]'; cy.getByTestId('Collateral').click(); cy.getByTestId('tab-accounts').contains('Please connect Vega wallet'); @@ -19,25 +20,25 @@ describe('accounts', () => { cy.getByTestId('tab-accounts').should('be.visible'); cy.getByTestId('tab-accounts') .should('be.visible') - .get(`[row-id='General-tEURO-null']`) + .get(tradingAccountRowId) .find('[col-id="asset.symbol"]') .should('have.text', 'tEURO'); cy.getByTestId('tab-accounts') .should('be.visible') - .get(`[row-id='General-tEURO-null']`) + .get(tradingAccountRowId) .find('[col-id="type"]') - .should('have.text', 'General'); + .should('have.text', 'ACCOUNT_TYPE_GENERAL'); cy.getByTestId('tab-accounts') .should('be.visible') - .get(`[row-id='General-tEURO-null']`) + .get(tradingAccountRowId) .find('[col-id="market.name"]') .should('have.text', '—'); cy.getByTestId('tab-accounts') .should('be.visible') - .get(`[row-id='General-tEURO-null']`) + .get(tradingAccountRowId) .find('[col-id="balance"]') .should('have.text', '1,000.00000'); }); diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts index f467d0652..c33efb617 100644 --- a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts +++ b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts @@ -30,7 +30,7 @@ const mockTx = { describe('deal ticket orders', () => { before(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); connectVegaWallet(); @@ -159,7 +159,7 @@ describe('deal ticket orders', () => { describe('deal ticket validation', () => { before(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); }); diff --git a/apps/trading-e2e/src/integration/trading-orders.cy.ts b/apps/trading-e2e/src/integration/trading-orders.cy.ts index ef04e8242..4f7a112ca 100644 --- a/apps/trading-e2e/src/integration/trading-orders.cy.ts +++ b/apps/trading-e2e/src/integration/trading-orders.cy.ts @@ -4,7 +4,7 @@ import { connectVegaWallet } from '../support/vega-wallet'; beforeEach(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); }); diff --git a/apps/trading-e2e/src/integration/trading-positions.cy.ts b/apps/trading-e2e/src/integration/trading-positions.cy.ts index 75900fc6b..6eb1a7dd8 100644 --- a/apps/trading-e2e/src/integration/trading-positions.cy.ts +++ b/apps/trading-e2e/src/integration/trading-positions.cy.ts @@ -4,7 +4,7 @@ import { connectVegaWallet } from '../support/vega-wallet'; beforeEach(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); }); diff --git a/apps/trading-e2e/src/integration/trading-trades.cy.ts b/apps/trading-e2e/src/integration/trading-trades.cy.ts index 4db0e7580..32772300f 100644 --- a/apps/trading-e2e/src/integration/trading-trades.cy.ts +++ b/apps/trading-e2e/src/integration/trading-trades.cy.ts @@ -3,7 +3,7 @@ import { mockTradingPage } from '../support/trading'; beforeEach(() => { cy.mockGQL((req) => { - mockTradingPage(req, MarketState.Active); + mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/markets/market-0'); }); diff --git a/apps/trading-e2e/src/support/mocks/generate-accounts.ts b/apps/trading-e2e/src/support/mocks/generate-accounts.ts index 531da4f4f..7c0c8ef72 100644 --- a/apps/trading-e2e/src/support/mocks/generate-accounts.ts +++ b/apps/trading-e2e/src/support/mocks/generate-accounts.ts @@ -13,7 +13,7 @@ export const generateAccounts = ( accounts: [ { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '100000000', market: null, asset: { diff --git a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts index 1f168a45d..651cd12e9 100644 --- a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts @@ -13,8 +13,8 @@ export const generateDealTicketQuery = ( name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 2, positionDecimalPlaces: 0, - state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, tradableInstrument: { __typename: 'TradableInstrument', instrument: { diff --git a/apps/trading-e2e/src/support/mocks/generate-fills.ts b/apps/trading-e2e/src/support/mocks/generate-fills.ts index 94b1d1abc..987e50653 100644 --- a/apps/trading-e2e/src/support/mocks/generate-fills.ts +++ b/apps/trading-e2e/src/support/mocks/generate-fills.ts @@ -18,7 +18,7 @@ export const generateFills = (override?: PartialDeep): Fills => { seller: { id: Cypress.env('VEGA_PUBLIC_KEY'), }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, buyerFee: { infrastructureFee: '5000', }, @@ -32,11 +32,11 @@ export const generateFills = (override?: PartialDeep): Fills => { seller: { id: Cypress.env('VEGA_PUBLIC_KEY'), }, - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, }), generateFill({ id: '3', - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, market: { name: 'ETHBTC Quarterly (30 Jun 2022)', }, @@ -84,7 +84,7 @@ export const generateFill = ( size: '50000', buyOrder: 'buy-order', sellOrder: 'sell-order', - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, buyer: { __typename: 'Party', id: 'buyer-id', diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index 5365332f1..502c00da1 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -17,11 +17,11 @@ export const generateMarketInfoQuery = ( name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 2, positionDecimalPlaces: 0, - state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, accounts: [ { - type: AccountType.Insurance, + type: AccountType.ACCOUNT_TYPE_INSURANCE, asset: { id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', __typename: 'Asset', @@ -30,7 +30,7 @@ export const generateMarketInfoQuery = ( __typename: 'Account', }, { - type: AccountType.FeeLiquidity, + type: AccountType.ACCOUNT_TYPE_FEES_LIQUIDITY, asset: { id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', __typename: 'Asset', @@ -61,7 +61,6 @@ export const generateMarketInfoQuery = ( }, ], }, - updateFrequencySecs: 1, }, riskFactors: { __typename: 'RiskFactor', diff --git a/apps/trading-e2e/src/support/mocks/generate-market-list.ts b/apps/trading-e2e/src/support/mocks/generate-market-list.ts index 1ab9cb83c..fddd8902e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-list.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-list.ts @@ -16,49 +16,34 @@ export const generateMarketList = ( name: 'BTCUSD Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, - state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, - positionDecimalPlaces: 2, - name: 'Market 0', + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, fees: { - __typename: 'Fees', factors: { - __typename: 'FeeFactors', - makerFee: '0.001', + makerFee: '0.0002', + infrastructureFee: '0.0005', liquidityFee: '0.001', - infrastructureFee: '0.001', + __typename: 'FeeFactors', }, + __typename: 'Fees', }, data: { market: { id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35', - state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, __typename: 'Market', - state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, }, bestBidPrice: '2411432389', bestOfferPrice: '2346732714', markPrice: '4612690058', - trigger: AuctionTrigger.Price, + trigger: AuctionTrigger.AUCTION_TRIGGER_PRICE, indicativeVolume: '1216', __typename: 'MarketData', - bestBidPrice: '4612690058', - bestOfferPrice: '4612690058', - trigger: AuctionTrigger.Liquidity, - indicativeVolume: '0', }, tradableInstrument: { instrument: { - id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35', - product: { - __typename: 'Future', - settlementAsset: { - __typename: 'Asset', - symbol: 'ETH', - }, - }, + id: 'BTCUSD.MF21', name: 'BTC/USD Monthly', code: 'BTCUSD.MF21', metadata: { @@ -97,50 +82,25 @@ export const generateMarketList = ( name: 'SOL/USD', decimalPlaces: 2, positionDecimalPlaces: 0, - state: MarketState.Suspended, - tradingMode: MarketTradingMode.MonitoringAuction, - name: 'BTC/USD Monthly', - positionDecimalPlaces: 2, - fees: { - __typename: 'Fees', - factors: { - __typename: 'FeeFactors', - makerFee: '0.001', - liquidityFee: '0.001', - infrastructureFee: '0.001', - }, - }, + state: MarketState.STATE_SUSPENDED, + tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, data: { market: { id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed', - state: MarketState.Suspended, - tradingMode: MarketTradingMode.MonitoringAuction, + state: MarketState.STATE_SUSPENDED, + tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, __typename: 'Market', - state: MarketState.Suspended, - tradingMode: MarketTradingMode.MonitoringAuction, }, bestBidPrice: '17065127', bestOfferPrice: '17017654', markPrice: '8441', indicativeVolume: '249', __typename: 'MarketData', - bestBidPrice: '4612690058', - bestOfferPrice: '4612690058', - trigger: AuctionTrigger.Liquidity, - - indicativeVolume: '0', }, tradableInstrument: { instrument: { - product: { - __typename: 'Future', - settlementAsset: { - __typename: 'Asset', - symbol: 'ETH', - }, - }, + id: 'SOLUSD', name: 'SOL/USD', - id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed', code: 'SOLUSD', metadata: { __typename: 'InstrumentMetadata', diff --git a/apps/trading-e2e/src/support/mocks/generate-market.ts b/apps/trading-e2e/src/support/mocks/generate-market.ts index b9e7f6339..5ad6ce026 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market.ts @@ -13,8 +13,8 @@ export const generateMarket = (override?: PartialDeep): Market => { market: { id: 'market-0', name: 'ACTIVE MARKET', - tradingMode: MarketTradingMode.MonitoringAuction, - state: MarketState.Active, + tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + state: MarketState.STATE_ACTIVE, decimalPlaces: 5, positionDecimalPlaces: 0, data: { @@ -33,7 +33,7 @@ export const generateMarket = (override?: PartialDeep): Market => { bestOfferVolume: '100', bestStaticBidVolume: '482', bestStaticOfferVolume: '2188', - trigger: AuctionTrigger.Liquidity, + trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY, __typename: 'MarketData', }, tradableInstrument: { diff --git a/apps/trading-e2e/src/support/mocks/generate-markets-landing.ts b/apps/trading-e2e/src/support/mocks/generate-markets-landing.ts index e6bbdaffb..4b4ca4d53 100644 --- a/apps/trading-e2e/src/support/mocks/generate-markets-landing.ts +++ b/apps/trading-e2e/src/support/mocks/generate-markets-landing.ts @@ -25,7 +25,7 @@ export const generateMarketsLanding = ( const markets: MarketsLanding_markets[] = [ { id: 'market-0', - tradingMode: MarketTradingMode.Continuous, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, marketTimestamps: { __typename: 'MarketTimestamps', open: '1', @@ -34,7 +34,7 @@ export const generateMarketsLanding = ( }, { id: 'market-1', - tradingMode: MarketTradingMode.OpeningAuction, + tradingMode: MarketTradingMode.TRADING_MODE_OPENING_AUCTION, marketTimestamps: { __typename: 'MarketTimestamps', open: '2', diff --git a/apps/trading-e2e/src/support/mocks/generate-markets.ts b/apps/trading-e2e/src/support/mocks/generate-markets.ts index 8c4d4653d..8763658a6 100644 --- a/apps/trading-e2e/src/support/mocks/generate-markets.ts +++ b/apps/trading-e2e/src/support/mocks/generate-markets.ts @@ -17,13 +17,13 @@ export const generateMarkets = (override?: PartialDeep): Markets => { market: { id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35', state: MarketState.Active, - tradingMode: MarketTradingMode.Continuous, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, __typename: 'Market', }, bestBidPrice: '0', bestOfferPrice: '0', markPrice: '4612690058', - trigger: AuctionTrigger.Unspecified, + trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, __typename: 'MarketData', }, tradableInstrument: { @@ -49,14 +49,14 @@ export const generateMarkets = (override?: PartialDeep): Markets => { data: { market: { id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed', - state: MarketState.Suspended, - tradingMode: MarketTradingMode.Continuous, + state: MarketState.STATE_SUSPENDED, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, __typename: 'Market', }, bestBidPrice: '0', bestOfferPrice: '0', markPrice: '8441', - trigger: AuctionTrigger.Unspecified, + trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, __typename: 'MarketData', }, tradableInstrument: { diff --git a/apps/trading-e2e/src/support/mocks/generate-order-book.ts b/apps/trading-e2e/src/support/mocks/generate-order-book.ts index 1249a75b1..763072179 100644 --- a/apps/trading-e2e/src/support/mocks/generate-order-book.ts +++ b/apps/trading-e2e/src/support/mocks/generate-order-book.ts @@ -15,7 +15,7 @@ export const generateOrderBook = ( positionDecimalPlaces: 0, data: { staticMidPrice: '826337', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, indicativeVolume: '0', indicativePrice: '0', bestStaticBidPrice: '826336', diff --git a/apps/trading-e2e/src/support/mocks/generate-orders.ts b/apps/trading-e2e/src/support/mocks/generate-orders.ts index 1340f7f11..5ba47c08c 100644 --- a/apps/trading-e2e/src/support/mocks/generate-orders.ts +++ b/apps/trading-e2e/src/support/mocks/generate-orders.ts @@ -31,12 +31,12 @@ export const generateOrders = (override?: PartialDeep): Orders => { }, }, size: '10', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '20000000', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2020, 1, 30).toISOString(), updatedAt: null, expiresAt: null, @@ -60,12 +60,12 @@ export const generateOrders = (override?: PartialDeep): Orders => { }, }, size: '1', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '100', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2020, 1, 29).toISOString(), updatedAt: null, expiresAt: null, @@ -89,12 +89,12 @@ export const generateOrders = (override?: PartialDeep): Orders => { }, }, size: '1', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '20000', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2020, 1, 28).toISOString(), updatedAt: null, expiresAt: null, @@ -118,12 +118,12 @@ export const generateOrders = (override?: PartialDeep): Orders => { }, }, size: '1', - type: OrderType.Limit, - status: OrderStatus.Active, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_ACTIVE, + side: Side.SIDE_BUY, remaining: '0', price: '100000', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2020, 1, 27).toISOString(), updatedAt: null, expiresAt: null, diff --git a/apps/trading-e2e/src/support/mocks/generate-positions-metrics.ts b/apps/trading-e2e/src/support/mocks/generate-positions-metrics.ts index 9bce0811f..e8fd4c317 100644 --- a/apps/trading-e2e/src/support/mocks/generate-positions-metrics.ts +++ b/apps/trading-e2e/src/support/mocks/generate-positions-metrics.ts @@ -19,7 +19,7 @@ export const generatePositionsMetrics = ( market: { id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', name: 'UNIDAI Monthly (30 Jun 2022)', - tradingMode: MarketTradingMode.Continuous, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '17588787', __typename: 'MarketData', @@ -46,7 +46,7 @@ export const generatePositionsMetrics = ( market: { id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', name: 'Tesla Quarterly (30 Jun 2022)', - tradingMode: MarketTradingMode.Continuous, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '84377569', __typename: 'MarketData', @@ -72,7 +72,7 @@ export const generatePositionsMetrics = ( accounts: [ { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '100000000', market: null, asset: { @@ -83,7 +83,7 @@ export const generatePositionsMetrics = ( }, { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, balance: '1000', market: { __typename: 'Market', @@ -97,7 +97,7 @@ export const generatePositionsMetrics = ( }, { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, balance: '1000', market: { __typename: 'Market', diff --git a/apps/trading-e2e/src/support/mocks/generate-positions.ts b/apps/trading-e2e/src/support/mocks/generate-positions.ts index e822d4c79..8ea19177e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-positions.ts +++ b/apps/trading-e2e/src/support/mocks/generate-positions.ts @@ -20,7 +20,7 @@ export const generatePositions = ( name: 'UNIDAI Monthly (30 Jun 2022)', data: { markPrice: '17588787', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, __typename: 'MarketData', market: { __typename: 'Market', id: '123' }, }, @@ -71,7 +71,7 @@ export const generatePositions = ( name: 'Tesla Quarterly (30 Jun 2022)', data: { markPrice: '84377569', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, __typename: 'MarketData', market: { __typename: 'Market', diff --git a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts index 9c4770149..cca2449bf 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts @@ -18,7 +18,7 @@ export const generateWithdrawPageQuery = ( ], accounts: [ { - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '100000000', asset: { __typename: 'Asset', diff --git a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts index e2c07e407..a134200b4 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts @@ -12,7 +12,7 @@ export const generateWithdrawals = ( withdrawals: [ { id: 'withdrawal-0', - status: WithdrawalStatus.Finalized, + status: WithdrawalStatus.STATUS_FINALIZED, amount: '100', txHash: null, createdTimestamp: new Date('2022-02-02').toISOString(), @@ -31,7 +31,7 @@ export const generateWithdrawals = ( }, { id: 'withdrawal-1', - status: WithdrawalStatus.Finalized, + status: WithdrawalStatus.STATUS_FINALIZED, amount: '100', txHash: '0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03', diff --git a/apps/trading/.env b/apps/trading/.env index cf3e5ef66..005b9b8e6 100644 --- a/apps/trading/.env +++ b/apps/trading/.env @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.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\"} diff --git a/apps/trading/.env.stagnet2 b/apps/trading/.env.stagnet3 similarity index 67% rename from apps/trading/.env.stagnet2 rename to apps/trading/.env.stagnet3 index 4c5893943..c999e5de5 100644 --- a/apps/trading/.env.stagnet2 +++ b/apps/trading/.env.stagnet3 @@ -1,8 +1,8 @@ # App configuration variables -NX_VEGA_ENV=STAGNET2 -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json -NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query +NX_VEGA_ENV=STAGNET3 +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io -NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz +NX_VEGA_EXPLORER_URL=https://staging3.explorer.vega.xyz diff --git a/apps/trading/.env.testnet b/apps/trading/.env.testnet index 72559a518..502a98025 100644 --- a/apps/trading/.env.testnet +++ b/apps/trading/.env.testnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://lb.testnet.vega.xyz/query +NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/trading/README.md b/apps/trading/README.md index 23f29e98f..6205c14e5 100644 --- a/apps/trading/README.md +++ b/apps/trading/README.md @@ -22,7 +22,7 @@ Example configurations are provided here: - [Devnet](./.env.devnet) - [Testnet](./.env.testnet) - [Stagnet1](./.env.stagnet1) -- [Stagnet2](./.env.stagnet2) +- [Stagnet3](./.env.stagnet3) For convenience, you can boot the app injecting one of the configurations above by running: diff --git a/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx b/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx index 3112be7c5..e06923785 100644 --- a/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx +++ b/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx @@ -48,8 +48,8 @@ const formatStake = (value: string, market: Market_market) => { const compileGridData = (market: Market_market) => { const grid: MarketDataGridProps['grid'] = []; const isLiquidityMonitoringAuction = - market.tradingMode === MarketTradingMode.MonitoringAuction && - market.data?.trigger === AuctionTrigger.Liquidity; + market.tradingMode === MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && + market.data?.trigger === AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY; if (!market.data) return grid; @@ -116,7 +116,7 @@ type TradingModeTooltipProps = { export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { switch (market.tradingMode) { - case MarketTradingMode.Continuous: { + case MarketTradingMode.TRADING_MODE_CONTINUOUS: { return ( <> {t( @@ -125,7 +125,7 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { ); } - case MarketTradingMode.OpeningAuction: { + case MarketTradingMode.TRADING_MODE_OPENING_AUCTION: { return ( <>

    @@ -145,9 +145,9 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { ); } - case MarketTradingMode.MonitoringAuction: { + case MarketTradingMode.TRADING_MODE_MONITORING_AUCTION: { switch (market.data?.trigger) { - case AuctionTrigger.Liquidity: { + case AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY: { return ( <>

    @@ -167,7 +167,7 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { ); } - case AuctionTrigger.Price: { + case AuctionTrigger.AUCTION_TRIGGER_PRICE: { return ( <>

    @@ -190,10 +190,10 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { } } } - case MarketTradingMode.NoTrading: { + case MarketTradingMode.TRADING_MODE_NO_TRADING: { return <>{t('No trading enabled for this market.')}; } - case MarketTradingMode.BatchAuction: + case MarketTradingMode.TRADING_MODE_BATCH_AUCTION: default: { return null; } diff --git a/apps/trading/lib/__generated__/AssetFields.ts b/apps/trading/lib/__generated__/AssetFields.ts index b3fcc69e0..8a0b8f28b 100644 --- a/apps/trading/lib/__generated__/AssetFields.ts +++ b/apps/trading/lib/__generated__/AssetFields.ts @@ -14,7 +14,7 @@ export interface AssetFields_source_BuiltinAsset { export interface AssetFields_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -24,7 +24,7 @@ export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_s export interface AssetFields { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -36,11 +36,11 @@ export interface AssetFields { */ name: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: AssetFields_source; } diff --git a/apps/trading/lib/apollo-client.ts b/apps/trading/lib/apollo-client.ts index 671262243..35dbfc61f 100644 --- a/apps/trading/lib/apollo-client.ts +++ b/apps/trading/lib/apollo-client.ts @@ -16,9 +16,8 @@ export function createClient(base?: string) { if (!base) { throw new Error('Base must be passed into createClient!'); } - const gqlPath = 'query'; - const urlHTTP = new URL(gqlPath, base); - const urlWS = new URL(gqlPath, base); + const urlHTTP = new URL(base); + const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 25364135c..3f3ce94c1 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -102,7 +102,7 @@ const MarketPage = ({ id }: { id?: string }) => { options={{ variables: { marketId, - interval: Interval.I1H, + interval: Interval.INTERVAL_I1H, since: yTimestamp, }, fetchPolicy: 'network-only', diff --git a/apps/trading/pages/markets/__generated__/Market.ts b/apps/trading/pages/markets/__generated__/Market.ts index 74a04c52d..a5ed203da 100644 --- a/apps/trading/pages/markets/__generated__/Market.ts +++ b/apps/trading/pages/markets/__generated__/Market.ts @@ -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 ID of the associated mark price */ market: Market_market_data_market; /** @@ -32,7 +32,7 @@ export interface Market_market_data { */ auctionEnd: string | null; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** @@ -84,7 +84,7 @@ export interface Market_market_tradableInstrument_instrument_metadata { export interface Market_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -136,7 +136,7 @@ export interface Market_market_tradableInstrument_instrument { export interface Market_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: Market_market_tradableInstrument_instrument; } @@ -189,7 +189,7 @@ export interface Market_market { state: MarketState; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct - * number denominated in the currency of the Market. (uint64) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -205,9 +205,10 @@ export interface Market_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -215,7 +216,7 @@ export interface Market_market { */ data: Market_market_data | null; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: Market_market_tradableInstrument; /** @@ -223,14 +224,14 @@ export interface Market_market { */ marketTimestamps: Market_market_marketTimestamps; /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by params + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters */ candles: (Market_market_candles | null)[] | null; } export interface Market { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: Market_market | null; } diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index 1ca7e24ee..ed23f9313 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -119,9 +119,11 @@ export const TradeMarketHeader = ({

    {t('Trading mode')} - {market.tradingMode === MarketTradingMode.MonitoringAuction && + {market.tradingMode === + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && market.data?.trigger && - market.data.trigger !== AuctionTrigger.Unspecified + market.data.trigger !== + AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED ? `${formatLabel( market.tradingMode )} - ${market.data?.trigger.toLowerCase()}` diff --git a/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts b/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts index e2c9a2bf2..b2e16b21c 100644 --- a/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts +++ b/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts @@ -14,7 +14,7 @@ export interface DepositPage_assets_source_BuiltinAsset { export interface DepositPage_assets_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -24,7 +24,7 @@ export type DepositPage_assets_source = DepositPage_assets_source_BuiltinAsset | export interface DepositPage_assets { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -36,18 +36,18 @@ export interface DepositPage_assets { */ name: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: DepositPage_assets_source; } export interface DepositPage { /** - * The list of all assets in use in the vega network + * The list of all assets in use in the Vega network */ assets: DepositPage_assets[] | null; } diff --git a/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts b/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts index 73b17a363..c64b4f3ba 100644 --- a/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts +++ b/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts @@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types"; export interface WithdrawPageQuery_party_withdrawals { __typename: "Withdrawal"; /** - * The Vega internal id of the withdrawal + * The Vega internal ID of the withdrawal */ id: string; /** @@ -24,7 +24,7 @@ export interface WithdrawPageQuery_party_withdrawals { export interface WithdrawPageQuery_party_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -72,7 +72,7 @@ export interface WithdrawPageQuery_assets_source_BuiltinAsset { export interface WithdrawPageQuery_assets_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; } @@ -82,7 +82,7 @@ export type WithdrawPageQuery_assets_source = WithdrawPageQuery_assets_source_Bu export interface WithdrawPageQuery_assets { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -94,22 +94,22 @@ export interface WithdrawPageQuery_assets { */ name: string; /** - * The precision of the asset + * 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) + * The origin source of the asset (e.g: an ERC20 asset) */ source: WithdrawPageQuery_assets_source; } export interface WithdrawPageQuery { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: WithdrawPageQuery_party | null; /** - * The list of all assets in use in the vega network + * The list of all assets in use in the Vega network */ assets: WithdrawPageQuery_assets[] | null; } diff --git a/libs/accounts/src/lib/__generated__/AccountFields.ts b/libs/accounts/src/lib/__generated__/AccountFields.ts index 94b155b9a..ef318db37 100644 --- a/libs/accounts/src/lib/__generated__/AccountFields.ts +++ b/libs/accounts/src/lib/__generated__/AccountFields.ts @@ -24,7 +24,7 @@ export interface AccountFields_market { export interface AccountFields_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -32,7 +32,7 @@ export interface AccountFields_asset { */ symbol: string; /** - * The precision of the asset + * 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; } diff --git a/libs/accounts/src/lib/__generated__/AccountSubscribe.ts b/libs/accounts/src/lib/__generated__/AccountSubscribe.ts index 72c2b26bf..d874321ec 100644 --- a/libs/accounts/src/lib/__generated__/AccountSubscribe.ts +++ b/libs/accounts/src/lib/__generated__/AccountSubscribe.ts @@ -24,7 +24,7 @@ export interface AccountSubscribe_accounts_market { export interface AccountSubscribe_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -32,7 +32,7 @@ export interface AccountSubscribe_accounts_asset { */ symbol: string; /** - * The precision of the asset + * 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; } diff --git a/libs/accounts/src/lib/__generated__/Accounts.ts b/libs/accounts/src/lib/__generated__/Accounts.ts index 893009d1c..e39ae8d1b 100644 --- a/libs/accounts/src/lib/__generated__/Accounts.ts +++ b/libs/accounts/src/lib/__generated__/Accounts.ts @@ -24,7 +24,7 @@ export interface Accounts_party_accounts_market { export interface Accounts_party_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -32,7 +32,7 @@ export interface Accounts_party_accounts_asset { */ symbol: string; /** - * The precision of the asset + * 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; } @@ -71,7 +71,7 @@ export interface Accounts_party { export interface Accounts { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Accounts_party | null; } diff --git a/libs/accounts/src/lib/accounts-table.spec.tsx b/libs/accounts/src/lib/accounts-table.spec.tsx index 8dda506aa..1cf0953bf 100644 --- a/libs/accounts/src/lib/accounts-table.spec.tsx +++ b/libs/accounts/src/lib/accounts-table.spec.tsx @@ -5,7 +5,7 @@ import { AccountType } from '@vegaprotocol/types'; const singleRow: Accounts_party_accounts = { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, balance: '125600000', market: { __typename: 'Market', diff --git a/libs/candles-chart/src/lib/__generated__/Candles.ts b/libs/candles-chart/src/lib/__generated__/Candles.ts index 118405874..21f13dcbc 100644 --- a/libs/candles-chart/src/lib/__generated__/Candles.ts +++ b/libs/candles-chart/src/lib/__generated__/Candles.ts @@ -28,7 +28,7 @@ export interface Candles_market_tradableInstrument_instrument { export interface Candles_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: Candles_market_tradableInstrument_instrument; } @@ -69,7 +69,7 @@ export interface Candles_market { 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -85,18 +85,18 @@ export interface Candles_market { */ decimalPlaces: number; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: Candles_market_tradableInstrument; /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by params + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters */ candles: (Candles_market_candles | null)[] | null; } export interface Candles { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: Candles_market | null; } diff --git a/libs/candles-chart/src/lib/__generated__/Chart.ts b/libs/candles-chart/src/lib/__generated__/Chart.ts index 8b204633c..e7dbd0c80 100644 --- a/libs/candles-chart/src/lib/__generated__/Chart.ts +++ b/libs/candles-chart/src/lib/__generated__/Chart.ts @@ -26,7 +26,7 @@ export interface Chart_market_data_priceMonitoringBounds { export interface Chart_market_data { __typename: "MarketData"; /** - * A list of valid price ranges per associated trigger + * a list of valid price ranges per associated trigger */ priceMonitoringBounds: Chart_market_data_priceMonitoringBounds[] | null; } @@ -35,7 +35,7 @@ export interface Chart_market { __typename: "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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -58,7 +58,7 @@ export interface Chart_market { export interface Chart { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: Chart_market | null; } diff --git a/libs/candles-chart/src/lib/data-source.ts b/libs/candles-chart/src/lib/data-source.ts index 88b5d8f6e..84095bd56 100644 --- a/libs/candles-chart/src/lib/data-source.ts +++ b/libs/candles-chart/src/lib/data-source.ts @@ -1,6 +1,7 @@ import type { ApolloClient } from '@apollo/client'; import { gql } from '@apollo/client'; import type { Candle, DataSource } from 'pennant'; +import { Interval as PennantInterval } from 'pennant'; import { addDecimal } from '@vegaprotocol/react-helpers'; import type { Chart, ChartVariables } from './__generated__/Chart'; @@ -13,6 +14,15 @@ import type { import type { Subscription } from 'zen-observable-ts'; import { Interval } from '@vegaprotocol/types'; +const INTERVAL_TO_PENNANT_MAP = { + [PennantInterval.I1M]: Interval.INTERVAL_I1M, + [PennantInterval.I5M]: Interval.INTERVAL_I5M, + [PennantInterval.I15M]: Interval.INTERVAL_I15M, + [PennantInterval.I1H]: Interval.INTERVAL_I1H, + [PennantInterval.I6H]: Interval.INTERVAL_I6H, + [PennantInterval.I1D]: Interval.INTERVAL_I1D, +}; + export const CANDLE_FRAGMENT = gql` fragment CandleFields on Candle { datetime @@ -71,12 +81,12 @@ const CHART_QUERY = gql` const defaultConfig = { decimalPlaces: 5, supportedIntervals: [ - Interval.I1D, - Interval.I6H, - Interval.I1H, - Interval.I15M, - Interval.I5M, - Interval.I1M, + PennantInterval.I1D, + PennantInterval.I6H, + PennantInterval.I1H, + PennantInterval.I15M, + PennantInterval.I5M, + PennantInterval.I1M, ], priceMonitoringBounds: [], }; @@ -135,12 +145,12 @@ export class VegaDataSource implements DataSource { return { decimalPlaces: this._decimalPlaces, supportedIntervals: [ - Interval.I1D, - Interval.I6H, - Interval.I1H, - Interval.I15M, - Interval.I5M, - Interval.I1M, + PennantInterval.I1D, + PennantInterval.I6H, + PennantInterval.I1H, + PennantInterval.I15M, + PennantInterval.I5M, + PennantInterval.I1M, ], priceMonitoringBounds: data.market.data.priceMonitoringBounds?.map((bounds) => ({ @@ -166,13 +176,13 @@ export class VegaDataSource implements DataSource { /** * Used by the charting library to get historical data. */ - async query(interval: Interval, from: string) { + async query(interval: PennantInterval, from: string) { try { const { data } = await this.client.query({ query: CANDLES_QUERY, variables: { marketId: this.marketId, - interval, + interval: INTERVAL_TO_PENNANT_MAP[interval], since: from, }, fetchPolicy: 'no-cache', @@ -198,12 +208,15 @@ export class VegaDataSource implements DataSource { * Used by the charting library to create a subscription to streaming data. */ subscribeData( - interval: Interval, + interval: PennantInterval, onSubscriptionData: (data: Candle) => void ) { const res = this.client.subscribe({ query: CANDLES_SUB, - variables: { marketId: this.marketId, interval }, + variables: { + marketId: this.marketId, + interval: INTERVAL_TO_PENNANT_MAP[interval], + }, }); this.candlesSub = res.subscribe(({ data }) => { diff --git a/libs/cypress/src/lib/commands/mock-gql.ts b/libs/cypress/src/lib/commands/mock-gql.ts index f4ba03b4a..ae41ae4da 100644 --- a/libs/cypress/src/lib/commands/mock-gql.ts +++ b/libs/cypress/src/lib/commands/mock-gql.ts @@ -12,8 +12,10 @@ declare global { export function addMockGQLCommand() { Cypress.Commands.add('mockGQL', (handler: RouteHandler) => { - cy.intercept('POST', 'https://lb.testnet.vega.xyz/query', handler).as( - 'GQL' - ); + cy.intercept( + 'POST', + 'https://api.n11.testnet.vega.xyz/graphql', + handler + ).as('GQL'); }); } diff --git a/libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts b/libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts index 6ef458eb1..283cdaa4d 100644 --- a/libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts +++ b/libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts @@ -12,7 +12,7 @@ import { MarketState, MarketTradingMode } from "@vegaprotocol/types"; export interface DealTicketQuery_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -52,7 +52,7 @@ export interface DealTicketQuery_market_tradableInstrument_instrument { export interface DealTicketQuery_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: DealTicketQuery_market_tradableInstrument_instrument; } @@ -85,7 +85,7 @@ export interface DealTicketQuery_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -101,9 +101,10 @@ export interface DealTicketQuery_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -115,7 +116,7 @@ export interface DealTicketQuery_market { */ tradingMode: MarketTradingMode; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: DealTicketQuery_market_tradableInstrument; /** @@ -126,7 +127,7 @@ export interface DealTicketQuery_market { export interface DealTicketQuery { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: DealTicketQuery_market | null; } diff --git a/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts b/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts index f9383bb90..cff632bba 100644 --- a/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts +++ b/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts @@ -12,7 +12,7 @@ import { MarketState, MarketTradingMode, AccountType } from "@vegaprotocol/types export interface MarketInfoQuery_market_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; } @@ -69,7 +69,7 @@ export interface MarketInfoQuery_market_priceMonitoringSettings_parameters_trigg probability: number; /** * Price monitoring auction extension duration in seconds should the price - * breach it's theoretical level over the specified horizon at the specified + * breach its theoretical level over the specified horizon at the specified * probability level (> 0) */ auctionExtensionSecs: number; @@ -89,10 +89,6 @@ export interface MarketInfoQuery_market_priceMonitoringSettings { * Specified a set of PriceMonitoringParameters to be use for price monitoring purposes */ parameters: MarketInfoQuery_market_priceMonitoringSettings_parameters | null; - /** - * How often (in seconds) the price monitoring bounds should be updated - */ - updateFrequencySecs: number; } export interface MarketInfoQuery_market_riskFactors { @@ -122,11 +118,11 @@ export interface MarketInfoQuery_market_data_market { export interface MarketInfoQuery_market_data { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: MarketInfoQuery_market_data_market; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** @@ -190,7 +186,7 @@ export interface MarketInfoQuery_market_tradableInstrument_instrument_metadata { export interface MarketInfoQuery_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -206,7 +202,7 @@ export interface MarketInfoQuery_market_tradableInstrument_instrument_product_se export interface MarketInfoQuery_market_tradableInstrument_instrument_product_oracleSpecForSettlementPrice { __typename: "OracleSpec"; /** - * id is a hash generated from the OracleSpec data. + * ID is a hash generated from the OracleSpec data. */ id: string; } @@ -214,7 +210,7 @@ export interface MarketInfoQuery_market_tradableInstrument_instrument_product_or export interface MarketInfoQuery_market_tradableInstrument_instrument_product_oracleSpecForTradingTermination { __typename: "OracleSpec"; /** - * id is a hash generated from the OracleSpec data. + * ID is a hash generated from the OracleSpec data. */ id: string; } @@ -280,11 +276,11 @@ export interface MarketInfoQuery_market_tradableInstrument_riskModel_LogNormalRi */ r: number; /** - * sigma parameter + * sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number */ sigma: number; /** - * mu parameter + * mu parameter, annualised growth rate of the underlying asset */ mu: number; } @@ -292,15 +288,15 @@ export interface MarketInfoQuery_market_tradableInstrument_riskModel_LogNormalRi export interface MarketInfoQuery_market_tradableInstrument_riskModel_LogNormalRiskModel { __typename: "LogNormalRiskModel"; /** - * Tau parameter of the risk model + * Tau parameter of the risk model, projection horizon measured as a year fraction used in the expected shortfall calculation to obtain the maintenance margin, must be a strictly non-negative real number */ tau: number; /** - * Lambda parameter of the risk model + * Lambda parameter of the risk model, probability confidence level used in expected shortfall calculation when obtaining the maintenance margin level, must be strictly greater than 0 and strictly smaller than 1 */ riskAversionParameter: number; /** - * Params for the log normal risk model + * Parameters for the log normal risk model */ params: MarketInfoQuery_market_tradableInstrument_riskModel_LogNormalRiskModel_params; } @@ -330,7 +326,7 @@ export type MarketInfoQuery_market_tradableInstrument_riskModel = MarketInfoQuer export interface MarketInfoQuery_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: MarketInfoQuery_market_tradableInstrument_instrument; /** @@ -367,7 +363,7 @@ export interface MarketInfoQuery_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -383,9 +379,10 @@ export interface MarketInfoQuery_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -421,7 +418,7 @@ export interface MarketInfoQuery_market { */ liquidityMonitoringParameters: MarketInfoQuery_market_liquidityMonitoringParameters; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: MarketInfoQuery_market_tradableInstrument; /** @@ -432,7 +429,7 @@ export interface MarketInfoQuery_market { export interface MarketInfoQuery { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: MarketInfoQuery_market | null; } diff --git a/libs/deal-ticket/src/components/__generated__/MarketNames.ts b/libs/deal-ticket/src/components/__generated__/MarketNames.ts index d0b182a0d..d61c7f220 100644 --- a/libs/deal-ticket/src/components/__generated__/MarketNames.ts +++ b/libs/deal-ticket/src/components/__generated__/MarketNames.ts @@ -42,7 +42,7 @@ export interface MarketNames_markets_tradableInstrument_instrument { export interface MarketNames_markets_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: MarketNames_markets_tradableInstrument_instrument; } @@ -58,7 +58,7 @@ export interface MarketNames_markets { */ name: string; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: MarketNames_markets_tradableInstrument; } diff --git a/libs/deal-ticket/src/components/deal-ticket-amount.tsx b/libs/deal-ticket/src/components/deal-ticket-amount.tsx index f16e8558f..e3f288aeb 100644 --- a/libs/deal-ticket/src/components/deal-ticket-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-amount.tsx @@ -1,12 +1,12 @@ import type { UseFormRegister } from 'react-hook-form'; -import { VegaWalletOrderType } from '@vegaprotocol/wallet'; import type { Order } from '@vegaprotocol/orders'; import { DealTicketMarketAmount } from './deal-ticket-market-amount'; import { DealTicketLimitAmount } from './deal-ticket-limit-amount'; import type { DealTicketQuery_market } from './__generated__/DealTicketQuery'; +import { OrderType } from '@vegaprotocol/types'; export interface DealTicketAmountProps { - orderType: VegaWalletOrderType; + orderType: OrderType; market: DealTicketQuery_market; register: UseFormRegister; quoteName: string; @@ -18,9 +18,9 @@ export const DealTicketAmount = ({ ...props }: DealTicketAmountProps) => { switch (orderType) { - case VegaWalletOrderType.Market: + case OrderType.TYPE_MARKET: return ; - case VegaWalletOrderType.Limit: + case OrderType.TYPE_LIMIT: return ; default: { throw new Error('Invalid ticket type'); diff --git a/libs/deal-ticket/src/components/deal-ticket-manager.tsx b/libs/deal-ticket/src/components/deal-ticket-manager.tsx index e1a0b36fa..736403ed9 100644 --- a/libs/deal-ticket/src/components/deal-ticket-manager.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-manager.tsx @@ -52,21 +52,21 @@ export const getOrderDialogTitle = ( } switch (status) { - case OrderStatus.Active: + case OrderStatus.STATUS_ACTIVE: return t('Order submitted'); - case OrderStatus.Filled: + case OrderStatus.STATUS_FILLED: return t('Order filled'); - case OrderStatus.PartiallyFilled: + case OrderStatus.STATUS_PARTIALLY_FILLED: return t('Order partially filled'); - case OrderStatus.Parked: + case OrderStatus.STATUS_PARKED: return t('Order parked'); - case OrderStatus.Stopped: + case OrderStatus.STATUS_STOPPED: return t('Order stopped'); - case OrderStatus.Cancelled: + case OrderStatus.STATUS_CANCELLED: return t('Order cancelled'); - case OrderStatus.Expired: + case OrderStatus.STATUS_EXPIRED: return t('Order expired'); - case OrderStatus.Rejected: + case OrderStatus.STATUS_REJECTED: return t('Order rejected'); default: return t('Submission failed'); @@ -80,16 +80,16 @@ export const getOrderDialogIntent = ( return; } switch (status) { - case OrderStatus.Parked: - case OrderStatus.Expired: - case OrderStatus.PartiallyFilled: + case OrderStatus.STATUS_PARKED: + case OrderStatus.STATUS_EXPIRED: + case OrderStatus.STATUS_PARTIALLY_FILLED: return Intent.Warning; - case OrderStatus.Rejected: - case OrderStatus.Stopped: - case OrderStatus.Cancelled: + case OrderStatus.STATUS_REJECTED: + case OrderStatus.STATUS_STOPPED: + case OrderStatus.STATUS_CANCELLED: return Intent.Danger; - case OrderStatus.Filled: - case OrderStatus.Active: + case OrderStatus.STATUS_FILLED: + case OrderStatus.STATUS_ACTIVE: return Intent.Success; default: return; @@ -104,12 +104,12 @@ export const getOrderDialogIcon = ( } switch (status) { - case OrderStatus.Parked: - case OrderStatus.Expired: + case OrderStatus.STATUS_PARKED: + case OrderStatus.STATUS_EXPIRED: return ; - case OrderStatus.Rejected: - case OrderStatus.Stopped: - case OrderStatus.Cancelled: + case OrderStatus.STATUS_REJECTED: + case OrderStatus.STATUS_STOPPED: + case OrderStatus.STATUS_CANCELLED: return ; default: return; diff --git a/libs/deal-ticket/src/components/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket.spec.tsx index cdb1f78ea..bc7c792e8 100644 --- a/libs/deal-ticket/src/components/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket.spec.tsx @@ -1,13 +1,14 @@ -import { - VegaWalletContext, - VegaWalletOrderTimeInForce, - VegaWalletOrderType, -} from '@vegaprotocol/wallet'; +import { VegaWalletContext } from '@vegaprotocol/wallet'; import { addDecimal } from '@vegaprotocol/react-helpers'; import { fireEvent, render, screen, act } from '@testing-library/react'; import { DealTicket } from './deal-ticket'; import type { DealTicketQuery_market } from './__generated__/DealTicketQuery'; -import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; +import { + MarketState, + MarketTradingMode, + OrderTimeInForce, + OrderType, +} from '@vegaprotocol/types'; import type { Order } from '@vegaprotocol/orders'; const market: DealTicketQuery_market = { @@ -16,8 +17,8 @@ const market: DealTicketQuery_market = { name: 'market-name', decimalPlaces: 2, positionDecimalPlaces: 1, - tradingMode: MarketTradingMode.Continuous, - state: MarketState.Active, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + state: MarketState.STATE_ACTIVE, tradableInstrument: { __typename: 'TradableInstrument', instrument: { @@ -65,7 +66,7 @@ describe('DealTicket', () => { // Assert defaults are used expect( - screen.getByTestId(`order-type-${VegaWalletOrderType.Market}-selected`) + screen.getByTestId(`order-type-${OrderType.TYPE_MARKET}-selected`) ).toBeInTheDocument(); expect( screen.queryByTestId('order-side-SIDE_BUY-selected') @@ -77,7 +78,7 @@ describe('DealTicket', () => { String(1 / Math.pow(10, market.positionDecimalPlaces)) ); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.IOC + OrderTimeInForce.TIME_IN_FORCE_IOC ); // Assert last price is shown @@ -104,10 +105,10 @@ describe('DealTicket', () => { expect(screen.getByTestId('order-size')).toHaveDisplayValue('200'); fireEvent.change(screen.getByTestId('order-tif'), { - target: { value: VegaWalletOrderTimeInForce.IOC }, + target: { value: OrderTimeInForce.TIME_IN_FORCE_IOC }, }); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.IOC + OrderTimeInForce.TIME_IN_FORCE_IOC ); // Switch to limit order @@ -118,7 +119,7 @@ describe('DealTicket', () => { // Check all TIF options shown expect(screen.getByTestId('order-tif').children).toHaveLength( - Object.keys(VegaWalletOrderTimeInForce).length + Object.keys(OrderTimeInForce).length ); }); @@ -130,40 +131,40 @@ describe('DealTicket', () => { Array.from(screen.getByTestId('order-tif').children).map( (o) => o.textContent ) - ).toEqual(['Immediate or Cancel (IOC)', 'Fill or Kill (FOK)']); + ).toEqual(['Fill or Kill (FOK)', 'Immediate or Cancel (IOC)']); // Switch to limit order and check all TIF options shown fireEvent.click(screen.getByTestId('order-type-TYPE_LIMIT')); expect(screen.getByTestId('order-tif').children).toHaveLength( - Object.keys(VegaWalletOrderTimeInForce).length + Object.keys(OrderTimeInForce).length ); // Change to GTC fireEvent.change(screen.getByTestId('order-tif'), { - target: { value: VegaWalletOrderTimeInForce.GTC }, + target: { value: OrderTimeInForce.TIME_IN_FORCE_GTC }, }); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.GTC + OrderTimeInForce.TIME_IN_FORCE_GTC ); // Switch back to market order and TIF should now be IOC fireEvent.click(screen.getByTestId('order-type-TYPE_MARKET')); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.IOC + OrderTimeInForce.TIME_IN_FORCE_IOC ); // Switch tif to FOK fireEvent.change(screen.getByTestId('order-tif'), { - target: { value: VegaWalletOrderTimeInForce.FOK }, + target: { value: OrderTimeInForce.TIME_IN_FORCE_FOK }, }); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.FOK + OrderTimeInForce.TIME_IN_FORCE_FOK ); // Change back to limit and check we are still on FOK fireEvent.click(screen.getByTestId('order-type-TYPE_LIMIT')); expect(screen.getByTestId('order-tif')).toHaveValue( - VegaWalletOrderTimeInForce.GTC + OrderTimeInForce.TIME_IN_FORCE_GTC ); }); }); diff --git a/libs/deal-ticket/src/components/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket.tsx index 17d6ae993..36ae4b286 100644 --- a/libs/deal-ticket/src/components/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket.tsx @@ -1,9 +1,5 @@ import { useCallback } from 'react'; import { useForm, Controller } from 'react-hook-form'; -import { - VegaWalletOrderType, - VegaWalletOrderTimeInForce, -} from '@vegaprotocol/wallet'; import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; import { Button, InputError } from '@vegaprotocol/ui-toolkit'; import { TypeSelector } from './type-selector'; @@ -14,6 +10,7 @@ import type { DealTicketQuery_market } from './__generated__/DealTicketQuery'; import { ExpirySelector } from './expiry-selector'; import type { Order } from '@vegaprotocol/orders'; import { getDefaultOrder, useOrderValidation } from '@vegaprotocol/orders'; +import { OrderTimeInForce, OrderType } from '@vegaprotocol/types'; export type TransactionStatus = 'default' | 'pending'; @@ -69,10 +66,10 @@ export const DealTicket = ({ { - if (type === VegaWalletOrderType.Limit) { - setValue('timeInForce', VegaWalletOrderTimeInForce.GTC); + if (type === OrderType.TYPE_LIMIT) { + setValue('timeInForce', OrderTimeInForce.TIME_IN_FORCE_GTC); } else { - setValue('timeInForce', VegaWalletOrderTimeInForce.IOC); + setValue('timeInForce', OrderTimeInForce.TIME_IN_FORCE_IOC); } field.onChange(type); }} @@ -111,8 +108,8 @@ export const DealTicket = ({ /> )} /> - {orderType === VegaWalletOrderType.Limit && - orderTimeInForce === VegaWalletOrderTimeInForce.GTT && ( + {orderType === OrderType.TYPE_LIMIT && + orderTimeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT && ( void; + value: Side; + onSelect: (side: Side) => void; } export const SideSelector = ({ value, onSelect }: SideSelectorProps) => { - const toggles = Object.entries(VegaWalletOrderSide).map(([label, value]) => ({ - label: label === 'Buy' ? 'Long' : 'Short', - value, - })); + const toggles = [ + { label: t('Long'), value: Side.SIDE_BUY }, + { label: t('Short'), value: Side.SIDE_SELL }, + ]; return ( @@ -21,7 +21,7 @@ export const SideSelector = ({ value, onSelect }: SideSelectorProps) => { name="order-side" toggles={toggles} checkedValue={value} - onChange={(e) => onSelect(e.target.value as VegaWalletOrderSide)} + onChange={(e) => onSelect(e.target.value as Side)} /> ); diff --git a/libs/deal-ticket/src/components/time-in-force-selector.tsx b/libs/deal-ticket/src/components/time-in-force-selector.tsx index 152197644..f4f200be1 100644 --- a/libs/deal-ticket/src/components/time-in-force-selector.tsx +++ b/libs/deal-ticket/src/components/time-in-force-selector.tsx @@ -1,31 +1,28 @@ import { FormGroup, Select } from '@vegaprotocol/ui-toolkit'; -import { - VegaWalletOrderTimeInForce, - VegaWalletOrderType, -} from '@vegaprotocol/wallet'; +import { OrderTimeInForce, OrderType } from '@vegaprotocol/types'; import { t } from '@vegaprotocol/react-helpers'; interface TimeInForceSelectorProps { - value: VegaWalletOrderTimeInForce; - orderType: VegaWalletOrderType; - onSelect: (tif: VegaWalletOrderTimeInForce) => void; + value: OrderTimeInForce; + orderType: OrderType; + onSelect: (tif: OrderTimeInForce) => void; } // More detail in https://docs.vega.xyz/docs/mainnet/graphql/enums/order-time-in-force export const timeInForceLabel = (tif: string) => { switch (tif) { - case VegaWalletOrderTimeInForce.GTC: - return t(`Good 'til Cancelled`); - case VegaWalletOrderTimeInForce.IOC: - return t('Immediate or Cancel'); - case VegaWalletOrderTimeInForce.FOK: - return t('Fill or Kill'); - case VegaWalletOrderTimeInForce.GTT: - return t(`Good 'til Time`); - case VegaWalletOrderTimeInForce.GFN: - return t('Good for Normal'); - case VegaWalletOrderTimeInForce.GFA: - return t('Good for Auction'); + case OrderTimeInForce.TIME_IN_FORCE_GTC: + return t(`Good 'til Cancelled (GTC)`); + case OrderTimeInForce.TIME_IN_FORCE_IOC: + return t('Immediate or Cancel (IOC)'); + case OrderTimeInForce.TIME_IN_FORCE_FOK: + return t('Fill or Kill (FOK)'); + case OrderTimeInForce.TIME_IN_FORCE_GTT: + return t(`Good 'til Time (GTT)`); + case OrderTimeInForce.TIME_IN_FORCE_GFN: + return t('Good for Normal (GFN)'); + case OrderTimeInForce.TIME_IN_FORCE_GFA: + return t('Good for Auction (GFA)'); default: return t(tif); } @@ -37,12 +34,12 @@ export const TimeInForceSelector = ({ onSelect, }: TimeInForceSelectorProps) => { const options = - orderType === VegaWalletOrderType.Limit - ? Object.entries(VegaWalletOrderTimeInForce) - : Object.entries(VegaWalletOrderTimeInForce).filter( + orderType === OrderType.TYPE_LIMIT + ? Object.entries(OrderTimeInForce) + : Object.entries(OrderTimeInForce).filter( ([_, timeInForce]) => - timeInForce === VegaWalletOrderTimeInForce.FOK || - timeInForce === VegaWalletOrderTimeInForce.IOC + timeInForce === OrderTimeInForce.TIME_IN_FORCE_FOK || + timeInForce === OrderTimeInForce.TIME_IN_FORCE_IOC ); return ( @@ -50,13 +47,13 @@ export const TimeInForceSelector = ({ diff --git a/libs/deal-ticket/src/components/type-selector.tsx b/libs/deal-ticket/src/components/type-selector.tsx index b457bfe66..d45ba800a 100644 --- a/libs/deal-ticket/src/components/type-selector.tsx +++ b/libs/deal-ticket/src/components/type-selector.tsx @@ -1,17 +1,17 @@ import { FormGroup } from '@vegaprotocol/ui-toolkit'; import { t } from '@vegaprotocol/react-helpers'; -import { VegaWalletOrderType } from '@vegaprotocol/wallet'; +import { OrderType } from '@vegaprotocol/types'; import { Toggle } from '@vegaprotocol/ui-toolkit'; interface TypeSelectorProps { - value: VegaWalletOrderType; - onSelect: (type: VegaWalletOrderType) => void; + value: OrderType; + onSelect: (type: OrderType) => void; } -const toggles = Object.entries(VegaWalletOrderType).map(([label, value]) => ({ - label, - value, -})); +const toggles = [ + { label: t('Market'), value: OrderType.TYPE_MARKET }, + { label: t('Limit'), value: OrderType.TYPE_LIMIT }, +]; export const TypeSelector = ({ value, onSelect }: TypeSelectorProps) => { return ( @@ -21,7 +21,7 @@ export const TypeSelector = ({ value, onSelect }: TypeSelectorProps) => { name="order-type" toggles={toggles} checkedValue={value} - onChange={(e) => onSelect(e.target.value as VegaWalletOrderType)} + onChange={(e) => onSelect(e.target.value as OrderType)} /> ); diff --git a/libs/deposits/src/lib/__generated__/DepositEvent.ts b/libs/deposits/src/lib/__generated__/DepositEvent.ts index d8cb0b6b8..aaa0265b2 100644 --- a/libs/deposits/src/lib/__generated__/DepositEvent.ts +++ b/libs/deposits/src/lib/__generated__/DepositEvent.ts @@ -16,7 +16,7 @@ export interface DepositEvent_busEvents_event_TimeUpdate { export interface DepositEvent_busEvents_event_Deposit { __typename: "Deposit"; /** - * The Vega internal id of the deposit + * The Vega internal ID of the deposit */ id: string; /** diff --git a/libs/deposits/src/lib/use-submit-deposit.tsx b/libs/deposits/src/lib/use-submit-deposit.tsx index cae10003d..3b80f82da 100644 --- a/libs/deposits/src/lib/use-submit-deposit.tsx +++ b/libs/deposits/src/lib/use-submit-deposit.tsx @@ -76,7 +76,7 @@ export const useSubmitDeposit = () => { // Note there is a bug in data node where the subscription is not emitted when the status // changes from 'Open' to 'Finalized' as a result the deposit UI will hang in a pending state right now // https://github.com/vegaprotocol/data-node/issues/460 - e.event.status === DepositStatus.Finalized + e.event.status === DepositStatus.STATUS_FINALIZED ) { return true; } diff --git a/libs/environment/src/hooks/use-environment-errors.spec.tsx b/libs/environment/src/hooks/use-environment-errors.spec.tsx index 82dc7f792..7c5d9452e 100644 --- a/libs/environment/src/hooks/use-environment-errors.spec.tsx +++ b/libs/environment/src/hooks/use-environment-errors.spec.tsx @@ -158,7 +158,8 @@ describe('throws error', () => { wrapper: MockWrapper, }); expect(result).toThrow( - `All keys in NX_VEGA_NETWORKS must represent a valid environment: CUSTOM | TESTNET | STAGNET | STAGNET2 | DEVNET | MAINNET` + `Error processing the vega app environment: + - All keys in NX_VEGA_NETWORKS must represent a valid environment: CUSTOM | TESTNET | STAGNET | STAGNET3 | DEVNET | MAINNET` ); }); @@ -181,7 +182,8 @@ describe('throws error', () => { wrapper: MockWrapper, }); expect(result).toThrow( - `NX_VEGA_ENV is invalid, received "undefined" instead of: 'CUSTOM' | 'TESTNET' | 'STAGNET' | 'STAGNET2' | 'DEVNET' | 'MAINNET'` + `Error processing the vega app environment: + - NX_VEGA_ENV is invalid, received "undefined" instead of: 'CUSTOM' | 'TESTNET' | 'STAGNET' | 'STAGNET3' | 'DEVNET' | 'MAINNET'` ); }); diff --git a/libs/environment/src/utils/__generated__/BlockTime.ts b/libs/environment/src/utils/__generated__/BlockTime.ts index 7f6cc2895..40fa9807b 100644 --- a/libs/environment/src/utils/__generated__/BlockTime.ts +++ b/libs/environment/src/utils/__generated__/BlockTime.ts @@ -10,7 +10,7 @@ export interface BlockTime_busEvents { __typename: "BusEvent"; /** - * the id for this event + * the ID for this event */ eventId: string; } diff --git a/libs/environment/src/utils/__generated__/Statistics.ts b/libs/environment/src/utils/__generated__/Statistics.ts index 90d1d3ea2..97582021e 100644 --- a/libs/environment/src/utils/__generated__/Statistics.ts +++ b/libs/environment/src/utils/__generated__/Statistics.ts @@ -10,7 +10,7 @@ export interface Statistics_statistics { __typename: "Statistics"; /** - * Current chain id + * Current chain ID */ chainId: string; /** @@ -21,7 +21,7 @@ export interface Statistics_statistics { export interface Statistics { /** - * get statistics about the vega node + * get statistics about the Vega node */ statistics: Statistics_statistics; } diff --git a/libs/environment/src/utils/apollo-client.tsx b/libs/environment/src/utils/apollo-client.tsx index 35e6c27bf..684394999 100644 --- a/libs/environment/src/utils/apollo-client.tsx +++ b/libs/environment/src/utils/apollo-client.tsx @@ -14,14 +14,12 @@ import { RetryLink } from '@apollo/client/link/retry'; const isBrowser = typeof window !== 'undefined'; -export const GQL_PATH = 'query'; - export default function createClient(base?: string) { if (!base) { throw new Error('Base must be passed into createClient!'); } - const urlHTTP = new URL(GQL_PATH, base); - const urlWS = new URL(GQL_PATH, base); + const urlHTTP = new URL(base); + const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); diff --git a/libs/environment/src/utils/initialize-node.tsx b/libs/environment/src/utils/initialize-node.tsx index e19a1f023..025ac3dad 100644 --- a/libs/environment/src/utils/initialize-node.tsx +++ b/libs/environment/src/utils/initialize-node.tsx @@ -2,10 +2,9 @@ import type { Dispatch } from 'react'; import { ACTIONS } from '../hooks/use-nodes'; import type { Action } from '../hooks/use-nodes'; import { requestNode } from './request-node'; -import { GQL_PATH } from './apollo-client'; const getResponseTime = (url: string) => { - const requestUrl = new URL(GQL_PATH, url); + const requestUrl = new URL(url); const requests = window.performance.getEntriesByName(requestUrl.href); const { duration } = (requests.length && requests[requests.length - 1]) || {}; return duration; diff --git a/libs/environment/src/utils/validate-environment.ts b/libs/environment/src/utils/validate-environment.ts index d3a659c6d..added30f5 100644 --- a/libs/environment/src/utils/validate-environment.ts +++ b/libs/environment/src/utils/validate-environment.ts @@ -7,7 +7,7 @@ export enum Networks { CUSTOM = 'CUSTOM', TESTNET = 'TESTNET', STAGNET = 'STAGNET', - STAGNET2 = 'STAGNET2', + STAGNET3 = 'STAGNET3', DEVNET = 'DEVNET', MAINNET = 'MAINNET', } diff --git a/libs/fills/src/lib/__generated__/FillFields.ts b/libs/fills/src/lib/__generated__/FillFields.ts index 426e600ee..39ea81610 100644 --- a/libs/fills/src/lib/__generated__/FillFields.ts +++ b/libs/fills/src/lib/__generated__/FillFields.ts @@ -28,15 +28,15 @@ export interface FillFields_seller { export interface FillFields_buyerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -44,15 +44,15 @@ export interface FillFields_buyerFee { export interface FillFields_sellerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -60,7 +60,7 @@ export interface FillFields_sellerFee { export interface FillFields_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -68,7 +68,7 @@ export interface FillFields_market_tradableInstrument_instrument_product_settlem */ symbol: string; /** - * The precision of the asset + * 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; } @@ -100,7 +100,7 @@ export interface FillFields_market_tradableInstrument_instrument { export interface FillFields_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: FillFields_market_tradableInstrument_instrument; } @@ -117,7 +117,7 @@ export interface FillFields_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -133,13 +133,14 @@ export interface FillFields_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: FillFields_market_tradableInstrument; } diff --git a/libs/fills/src/lib/__generated__/Fills.ts b/libs/fills/src/lib/__generated__/Fills.ts index a1d40b511..05cc287ca 100644 --- a/libs/fills/src/lib/__generated__/Fills.ts +++ b/libs/fills/src/lib/__generated__/Fills.ts @@ -28,15 +28,15 @@ export interface Fills_party_tradesConnection_edges_node_seller { export interface Fills_party_tradesConnection_edges_node_buyerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -44,15 +44,15 @@ export interface Fills_party_tradesConnection_edges_node_buyerFee { export interface Fills_party_tradesConnection_edges_node_sellerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -60,7 +60,7 @@ export interface Fills_party_tradesConnection_edges_node_sellerFee { export interface Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -68,7 +68,7 @@ export interface Fills_party_tradesConnection_edges_node_market_tradableInstrume */ symbol: string; /** - * The precision of the asset + * 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; } @@ -100,7 +100,7 @@ export interface Fills_party_tradesConnection_edges_node_market_tradableInstrume export interface Fills_party_tradesConnection_edges_node_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: Fills_party_tradesConnection_edges_node_market_tradableInstrument_instrument; } @@ -117,7 +117,7 @@ export interface Fills_party_tradesConnection_edges_node_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -133,13 +133,14 @@ export interface Fills_party_tradesConnection_edges_node_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: Fills_party_tradesConnection_edges_node_market_tradableInstrument; } @@ -233,7 +234,7 @@ export interface Fills_party { export interface Fills { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Fills_party | null; } diff --git a/libs/fills/src/lib/__generated__/FillsSub.ts b/libs/fills/src/lib/__generated__/FillsSub.ts index c1b056cf0..7765a85ed 100644 --- a/libs/fills/src/lib/__generated__/FillsSub.ts +++ b/libs/fills/src/lib/__generated__/FillsSub.ts @@ -28,15 +28,15 @@ export interface FillsSub_trades_seller { export interface FillsSub_trades_buyerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -44,15 +44,15 @@ export interface FillsSub_trades_buyerFee { export interface FillsSub_trades_sellerFee { __typename: "TradeFee"; /** - * The maker fee, aggressive party to the other party (the one who had an order in the book) + * 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 node runner to maintain the vega network + * The infrastructure fee, a fee paid to the validators to maintain the Vega network */ infrastructureFee: string; /** - * The fee paid to the market makers to provide liquidity in the market + * The fee paid to the liquidity providers that committed liquidity to the market */ liquidityFee: string; } @@ -60,7 +60,7 @@ export interface FillsSub_trades_sellerFee { export interface FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -68,7 +68,7 @@ export interface FillsSub_trades_market_tradableInstrument_instrument_product_se */ symbol: string; /** - * The precision of the asset + * 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; } @@ -100,7 +100,7 @@ export interface FillsSub_trades_market_tradableInstrument_instrument { export interface FillsSub_trades_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: FillsSub_trades_market_tradableInstrument_instrument; } @@ -117,7 +117,7 @@ export interface FillsSub_trades_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -133,13 +133,14 @@ export interface FillsSub_trades_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: FillsSub_trades_market_tradableInstrument; } diff --git a/libs/fills/src/lib/fills-table.spec.tsx b/libs/fills/src/lib/fills-table.spec.tsx index db1a71236..25c054124 100644 --- a/libs/fills/src/lib/fills-table.spec.tsx +++ b/libs/fills/src/lib/fills-table.spec.tsx @@ -73,7 +73,7 @@ describe('FillsTable', () => { buyer: { id: partyId, }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, buyerFee: { makerFee: '2', infrastructureFee: '2', @@ -110,7 +110,7 @@ describe('FillsTable', () => { buyer: { id: partyId, }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, buyerFee: { makerFee: '2', infrastructureFee: '2', @@ -148,7 +148,7 @@ describe('FillsTable', () => { seller: { id: partyId, }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, sellerFee: { makerFee: '1', infrastructureFee: '1', @@ -186,7 +186,7 @@ describe('FillsTable', () => { seller: { id: partyId, }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, }); const { rerender } = render( @@ -205,7 +205,7 @@ describe('FillsTable', () => { seller: { id: partyId, }, - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, }); rerender(); diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index b11ac682a..deee381c0 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -172,13 +172,13 @@ const formatRole = (partyId: string) => { const taker = t('Taker'); const maker = t('Maker'); if (data?.buyer.id === partyId) { - if (value === Side.Buy) { + if (value === Side.SIDE_BUY) { return taker; } else { return maker; } } else if (data?.seller.id === partyId) { - if (value === Side.Sell) { + if (value === Side.SIDE_SELL) { return taker; } else { return maker; diff --git a/libs/fills/src/lib/test-helpers.ts b/libs/fills/src/lib/test-helpers.ts index 3862fcb9a..6fde09c43 100644 --- a/libs/fills/src/lib/test-helpers.ts +++ b/libs/fills/src/lib/test-helpers.ts @@ -18,7 +18,7 @@ export const generateFills = (override?: PartialDeep): Fills => { seller: { id: 'party-id', }, - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, buyerFee: { infrastructureFee: '5000', }, @@ -32,11 +32,11 @@ export const generateFills = (override?: PartialDeep): Fills => { seller: { id: 'party-id', }, - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, }), generateFill({ id: '3', - aggressor: Side.Sell, + aggressor: Side.SIDE_SELL, market: { name: 'ETHBTC Quarterly (30 Jun 2022)', }, @@ -84,7 +84,7 @@ export const generateFill = ( size: '50000', buyOrder: 'buy-order', sellOrder: 'sell-order', - aggressor: Side.Buy, + aggressor: Side.SIDE_BUY, buyer: { __typename: 'Party', id: 'buyer-id', diff --git a/libs/governance/src/lib/proposal-form.spec.tsx b/libs/governance/src/lib/proposal-form.spec.tsx index d0c3d858e..4760889ce 100644 --- a/libs/governance/src/lib/proposal-form.spec.tsx +++ b/libs/governance/src/lib/proposal-form.spec.tsx @@ -31,8 +31,9 @@ describe('ProposalForm', () => { __typename: 'Proposal', id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50', reference: 'proposal-reference', - state: ProposalState.Open, - rejectionReason: ProposalRejectionReason.CloseTimeTooLate, + state: ProposalState.STATE_OPEN, + rejectionReason: + ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE, errorDetails: 'error-details', }, }, diff --git a/libs/governance/src/lib/proposals-hooks/__generated__/ProposalEvent.ts b/libs/governance/src/lib/proposals-hooks/__generated__/ProposalEvent.ts index 76d25e7bf..088e4b4b8 100644 --- a/libs/governance/src/lib/proposals-hooks/__generated__/ProposalEvent.ts +++ b/libs/governance/src/lib/proposals-hooks/__generated__/ProposalEvent.ts @@ -16,11 +16,11 @@ export interface ProposalEvent_busEvents_event_TimeUpdate { export interface ProposalEvent_busEvents_event_Proposal { __typename: "Proposal"; /** - * Proposal ID that is filled by VEGA once proposal reaches the network + * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; /** - * A UUID reference to aid tracking proposals on VEGA + * A UUID reference to aid tracking proposals on Vega */ reference: string; /** @@ -42,7 +42,7 @@ export type ProposalEvent_busEvents_event = ProposalEvent_busEvents_event_TimeUp export interface ProposalEvent_busEvents { __typename: "BusEvent"; /** - * the type of event we're dealing with + * the type of event */ type: BusEventType; /** diff --git a/libs/governance/src/utils/proposal-dialog-helpers.tsx b/libs/governance/src/utils/proposal-dialog-helpers.tsx index e94692656..177f19dba 100644 --- a/libs/governance/src/utils/proposal-dialog-helpers.tsx +++ b/libs/governance/src/utils/proposal-dialog-helpers.tsx @@ -11,19 +11,19 @@ export const getProposalDialogTitle = ( } switch (status) { - case ProposalState.Open: + case ProposalState.STATE_OPEN: return t('Proposal submitted'); - case ProposalState.WaitingForNodeVote: + case ProposalState.STATE_WAITING_FOR_NODE_VOTE: return t('Proposal waiting for node vote'); - case ProposalState.Passed: + case ProposalState.STATE_PASSED: return t('Proposal passed'); - case ProposalState.Enacted: + case ProposalState.STATE_ENACTED: return t('Proposal enacted'); - case ProposalState.Declined: + case ProposalState.STATE_DECLINED: return t('Proposal declined'); - case ProposalState.Rejected: + case ProposalState.STATE_REJECTED: return t('Proposal rejected'); - case ProposalState.Failed: + case ProposalState.STATE_FAILED: return t('Proposal failed'); default: return t('Submission failed'); @@ -38,15 +38,15 @@ export const getProposalDialogIntent = ( } switch (status) { - case ProposalState.Passed: - case ProposalState.Enacted: + case ProposalState.STATE_PASSED: + case ProposalState.STATE_ENACTED: return Intent.Success; - case ProposalState.Open: - case ProposalState.WaitingForNodeVote: + case ProposalState.STATE_OPEN: + case ProposalState.STATE_WAITING_FOR_NODE_VOTE: return Intent.None; - case ProposalState.Rejected: - case ProposalState.Failed: - case ProposalState.Declined: + case ProposalState.STATE_REJECTED: + case ProposalState.STATE_FAILED: + case ProposalState.STATE_DECLINED: return Intent.Danger; default: return; @@ -61,12 +61,12 @@ export const getProposalDialogIcon = ( } switch (status) { - case ProposalState.Passed: - case ProposalState.Enacted: + case ProposalState.STATE_PASSED: + case ProposalState.STATE_ENACTED: return ; - case ProposalState.Rejected: - case ProposalState.Failed: - case ProposalState.Declined: + case ProposalState.STATE_REJECTED: + case ProposalState.STATE_FAILED: + case ProposalState.STATE_DECLINED: return ; default: return; diff --git a/libs/market-depth/src/lib/__generated__/MarketDepth.ts b/libs/market-depth/src/lib/__generated__/MarketDepth.ts index 330302a68..7b043223b 100644 --- a/libs/market-depth/src/lib/__generated__/MarketDepth.ts +++ b/libs/market-depth/src/lib/__generated__/MarketDepth.ts @@ -24,7 +24,7 @@ export interface MarketDepth_market_data { */ staticMidPrice: string; /** - * what state the market is in (auction, continuous etc) + * what state 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 ID of the associated mark price */ market: MarketDepth_market_data_market; } @@ -117,7 +117,7 @@ export interface MarketDepth_market { 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -133,9 +133,10 @@ export interface MarketDepth_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -150,7 +151,7 @@ export interface MarketDepth_market { export interface MarketDepth { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: MarketDepth_market | null; } diff --git a/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts b/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts index f38ac4ea9..456b6cc8c 100644 --- a/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts +++ b/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts @@ -24,7 +24,7 @@ export interface MarketDepthSubscription_marketDepthUpdate_market_data { */ staticMidPrice: string; /** - * what state the market is in (auction, continuous etc) + * what state the market is in (auction, continuous, etc) */ marketTradingMode: MarketTradingMode; /** @@ -44,7 +44,7 @@ export interface MarketDepthSubscription_marketDepthUpdate_market_data { */ bestStaticOfferPrice: string; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: MarketDepthSubscription_marketDepthUpdate_market_data_market; } @@ -56,9 +56,10 @@ export interface MarketDepthSubscription_marketDepthUpdate_market { */ id: string; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -102,7 +103,7 @@ export interface MarketDepthSubscription_marketDepthUpdate_buy { export interface MarketDepthSubscription_marketDepthUpdate { __typename: "MarketDepthUpdate"; /** - * Market id + * Market */ market: MarketDepthSubscription_marketDepthUpdate_market; /** diff --git a/libs/market-depth/src/lib/orderbook-data.ts b/libs/market-depth/src/lib/orderbook-data.ts index 8894e6a5a..fa515a464 100644 --- a/libs/market-depth/src/lib/orderbook-data.ts +++ b/libs/market-depth/src/lib/orderbook-data.ts @@ -424,8 +424,8 @@ export const generateMockData = ({ staticMidPrice: '', marketTradingMode: overlap > 0 - ? MarketTradingMode.BatchAuction - : MarketTradingMode.Continuous, + ? MarketTradingMode.TRADING_MODE_BATCH_AUCTION + : MarketTradingMode.TRADING_MODE_CONTINUOUS, bestStaticBidPrice: bestStaticBidPrice.toString(), bestStaticOfferPrice: bestStaticOfferPrice.toString(), indicativePrice: indicativePrice?.toString() ?? '', diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 7b9307ebf..4b0d9130e 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -330,7 +330,8 @@ export const Orderbook = ({ cumulativeAsk={data.cumulativeVol.ask} cumulativeRelativeAsk={data.cumulativeVol.relativeAsk} indicativeVolume={ - marketTradingMode !== MarketTradingMode.Continuous && + marketTradingMode !== + MarketTradingMode.TRADING_MODE_CONTINUOUS && indicativePrice === data.price ? indicativeVolume : undefined diff --git a/libs/market-list/src/lib/__generated__/MarketDataFields.ts b/libs/market-list/src/lib/__generated__/MarketDataFields.ts index 3cff0c510..44cdd10ac 100644 --- a/libs/market-list/src/lib/__generated__/MarketDataFields.ts +++ b/libs/market-list/src/lib/__generated__/MarketDataFields.ts @@ -28,7 +28,7 @@ export interface MarketDataFields_market { export interface MarketDataFields { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: MarketDataFields_market; /** @@ -40,7 +40,7 @@ export interface MarketDataFields { */ bestOfferPrice: string; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** diff --git a/libs/market-list/src/lib/__generated__/MarketDataSub.ts b/libs/market-list/src/lib/__generated__/MarketDataSub.ts index dcb66d351..c77181ea3 100644 --- a/libs/market-list/src/lib/__generated__/MarketDataSub.ts +++ b/libs/market-list/src/lib/__generated__/MarketDataSub.ts @@ -28,7 +28,7 @@ export interface MarketDataSub_marketData_market { export interface MarketDataSub_marketData { __typename: "MarketData"; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: MarketDataSub_marketData_market; /** @@ -40,7 +40,7 @@ export interface MarketDataSub_marketData { */ bestOfferPrice: string; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** diff --git a/libs/market-list/src/lib/__generated__/MarketList.ts b/libs/market-list/src/lib/__generated__/MarketList.ts index 7d50683c8..5f56d3975 100644 --- a/libs/market-list/src/lib/__generated__/MarketList.ts +++ b/libs/market-list/src/lib/__generated__/MarketList.ts @@ -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 ID of the associated mark price */ market: MarketList_markets_data_market; /** @@ -64,7 +64,7 @@ export interface MarketList_markets_data { */ bestOfferPrice: string; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** @@ -128,7 +128,7 @@ export interface MarketList_markets_tradableInstrument_instrument { export interface MarketList_markets_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: MarketList_markets_tradableInstrument_instrument; } @@ -177,7 +177,7 @@ export interface MarketList_markets { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -193,9 +193,10 @@ export interface MarketList_markets { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -215,7 +216,7 @@ export interface MarketList_markets { */ data: MarketList_markets_data | null; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: MarketList_markets_tradableInstrument; /** @@ -223,7 +224,7 @@ export interface MarketList_markets { */ marketTimestamps: MarketList_markets_marketTimestamps; /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by params + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters */ candles: (MarketList_markets_candles | null)[] | null; } diff --git a/libs/market-list/src/lib/components/asset-details-dialog/__generated__/AssetsConnection.ts b/libs/market-list/src/lib/components/asset-details-dialog/__generated__/AssetsConnection.ts index 04c123868..47a34d4c6 100644 --- a/libs/market-list/src/lib/components/asset-details-dialog/__generated__/AssetsConnection.ts +++ b/libs/market-list/src/lib/components/asset-details-dialog/__generated__/AssetsConnection.ts @@ -14,17 +14,17 @@ export interface AssetsConnection_assetsConnection_edges_node_source_BuiltinAsse export interface AssetsConnection_assetsConnection_edges_node_source_ERC20 { __typename: "ERC20"; /** - * The address of the erc20 contract + * The address of the ERC20 contract */ contractAddress: string; /** * The lifetime limits deposit per address - * Note: this is a temporary measure for restricted mainnet + * Note: this is a temporary measure for alpha mainnet */ lifetimeLimit: string; /** - * The maximum allowed per withdraw - * Note: this is a temporary measure for restricted mainnet + * The maximum allowed per withdrawal + * Note: this is a temporary measure for alpha mainnet */ withdrawThreshold: string; } @@ -34,7 +34,7 @@ export type AssetsConnection_assetsConnection_edges_node_source = AssetsConnecti export interface AssetsConnection_assetsConnection_edges_node { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -46,11 +46,7 @@ export interface AssetsConnection_assetsConnection_edges_node { */ symbol: string; /** - * The total supply of the market - */ - totalSupply: string; - /** - * The precision of the asset + * 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; /** @@ -58,7 +54,7 @@ export interface AssetsConnection_assetsConnection_edges_node { */ quantum: string; /** - * The origin source of the asset (e.g: an erc20 asset) + * The origin source of the asset (e.g: an ERC20 asset) */ source: AssetsConnection_assetsConnection_edges_node_source; } @@ -78,7 +74,7 @@ export interface AssetsConnection_assetsConnection { export interface AssetsConnection { /** - * The list of all assets in use in the vega network or the specified asset if id is provided + * The list of all assets in use in the Vega network or the specified asset if ID is provided */ assetsConnection: AssetsConnection_assetsConnection; } diff --git a/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.spec.tsx b/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.spec.tsx index 7086f44fc..574e65ccd 100644 --- a/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.spec.tsx +++ b/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.spec.tsx @@ -14,7 +14,6 @@ const mockedData = { id: 'XYZalpha', name: 'XYZ (α alpha)', symbol: 'XYZalpha', - totalSupply: '10000000000000000000000000000', decimals: 5, quantum: '1', source: { @@ -29,7 +28,6 @@ const mockedData = { id: 'XYZbeta', name: 'XYZ (β beta)', symbol: 'XYZbeta', - totalSupply: '1000000000', decimals: 5, quantum: '1', source: { @@ -44,7 +42,6 @@ const mockedData = { id: 'XYZdelta', name: 'XYZ (δ delta)', symbol: 'XYZdelta', - totalSupply: '1000000000', decimals: 5, quantum: '1', source: { @@ -59,7 +56,6 @@ const mockedData = { id: 'XYZepsilon', name: 'XYZ (ε epsilon)', symbol: 'XYZepsilon', - totalSupply: '1000000000', decimals: 5, quantum: '1', source: { @@ -74,7 +70,6 @@ const mockedData = { id: 'XYZgamma', name: 'XYZ (γ gamma)', symbol: 'XYZgamma', - totalSupply: '1000000000', decimals: 5, quantum: '1', source: { @@ -89,7 +84,6 @@ const mockedData = { id: '2282ffc06a557173d297739305cc69f6444cdbbb1089df7d9aef32bbfd735ba1', name: 'Tim Token (Vega)', symbol: 'TIM', - totalSupply: '1000000000000000000000000000', decimals: 18, quantum: '1', source: { @@ -107,7 +101,6 @@ const mockedData = { id: '449dbfb66e7a444c485b4fdc77ddc6bbf81abbf7c8e247ac299c25e9557b99cf', name: 'Taker Reward Token (Vega)', symbol: 'TAK', - totalSupply: '1000000000000000000000000000', decimals: 18, quantum: '1', source: { @@ -125,7 +118,6 @@ const mockedData = { id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', name: 'tBTC TEST', symbol: 'tBTC', - totalSupply: '21000000', decimals: 5, quantum: '1', source: { @@ -143,7 +135,6 @@ const mockedData = { id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', name: 'tDAI TEST', symbol: 'tDAI', - totalSupply: '21000000', decimals: 5, quantum: '1', source: { @@ -161,7 +152,6 @@ const mockedData = { id: '8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4', name: 'tEURO TEST', symbol: 'tEURO', - totalSupply: '21000000', decimals: 5, quantum: '1', source: { @@ -179,7 +169,6 @@ const mockedData = { id: '98032ba34576f8012de9b822e1da3ed4b6223a4f4e05f573002d441ffb4bf314', name: 'Liquidity Reward Token (Vega)', symbol: 'LIQ', - totalSupply: '1000000200000000000000000000', decimals: 18, quantum: '1', source: { @@ -197,7 +186,6 @@ const mockedData = { id: '993ed98f4f770d91a796faab1738551193ba45c62341d20597df70fea6704ede', name: 'tUSDC TEST', symbol: 'tUSDC', - totalSupply: '21000000', decimals: 5, quantum: '1', source: { @@ -215,7 +203,6 @@ const mockedData = { id: 'ba98cdeeec849a053e60cc03808e91e90d9d2e62425c76a590617b95ad41a066', name: 'Steve Token (Vega)', symbol: 'STE', - totalSupply: '1000000000000000000000000000', decimals: 18, quantum: '1', source: { @@ -233,7 +220,6 @@ const mockedData = { id: 'ce3fb1ab0717f0adbce019d7aef53aacdbadefe2d30ad1647b55f134d4072c90', name: 'Woz Token (Vega)', symbol: 'WOZ', - totalSupply: '1000000000000000000000000000', decimals: 18, quantum: '1', source: { @@ -251,7 +237,6 @@ const mockedData = { id: 'ebcd94151ae1f0d39a4bde3b21a9c7ae81a80ea4352fb075a92e07608d9c953d', name: 'Maker Reward Token (Vega)', symbol: 'MAK', - totalSupply: '1000000000000000000000000000', decimals: 18, quantum: '1', source: { @@ -269,7 +254,6 @@ const mockedData = { id: 'fc7fd956078fb1fc9db5c19b88f0874c4299b2a7639ad05a47a28c0aef291b55', name: 'Vega (testnet)', symbol: 'VEGA', - totalSupply: '64999723000000000000000000', decimals: 18, quantum: '1', source: { @@ -333,9 +317,6 @@ describe('AssetDetailsDialog', () => { expect((await screen.findByTestId('name_value')).textContent).toContain( name ); - expect( - (await screen.findByTestId('totalsupply_value')).textContent - ).toContain(totalSupply); } ); }); diff --git a/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.tsx b/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.tsx index 23042d31b..9702f5c39 100644 --- a/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.tsx +++ b/libs/market-list/src/lib/components/asset-details-dialog/asset-details-dialog.tsx @@ -1,5 +1,5 @@ import { gql, useQuery } from '@apollo/client'; -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/react-helpers'; import type { Asset } from '@vegaprotocol/react-helpers'; import { Button, @@ -50,7 +50,6 @@ export const ASSETS_CONNECTION_QUERY = gql` id name symbol - totalSupply decimals quantum source { @@ -111,12 +110,6 @@ export const AssetDetailsDialog = ({ value: asset.node.quantum, tooltip: t('The minimum economically meaningful amount in the asset'), }, - { - key: 'totalsupply', - label: t('Total supply'), - value: formatNumber(toBigNum(asset.node.totalSupply, 0)), - tooltip: t('Total circulating supply for the asset'), - }, { key: 'contractaddress', label: t('Contract address'), diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index 30de7b3f0..4aa2d12eb 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -84,9 +84,10 @@ export const MarketListTable = forwardRef((props, ref) => { if (!value) return value; const { market, trigger } = value; return market && - market.tradingMode === MarketTradingMode.MonitoringAuction && + market.tradingMode === + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && trigger && - trigger !== AuctionTrigger.Unspecified + trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED ? `${formatLabel(market.tradingMode)} - ${trigger.toLowerCase()}` : formatLabel(market?.tradingMode); }} diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index 228ef0711..83d720a88 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -20,7 +20,7 @@ export const MarketsContainer = () => { const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; const yTimestamp = new Date(yesterday * 1000).toISOString(); const variables = useMemo( - () => ({ interval: Interval.I1H, since: yTimestamp }), + () => ({ interval: Interval.INTERVAL_I1H, since: yTimestamp }), [yTimestamp] ); @@ -45,7 +45,7 @@ export const MarketsContainer = () => { const rowsThisBlock = dataRef.current ? dataRef.current .slice(startRow, endRow) - .filter((m) => m.data?.market.state !== MarketState.Rejected) + .filter((m) => m.data?.market.state !== MarketState.STATE_REJECTED) : []; const lastRow = dataRef.current?.length ?? -1; successCallback(rowsThisBlock, lastRow); diff --git a/libs/market-list/src/lib/components/select-market-columns.tsx b/libs/market-list/src/lib/components/select-market-columns.tsx index 43429c087..c3770c86a 100644 --- a/libs/market-list/src/lib/components/select-market-columns.tsx +++ b/libs/market-list/src/lib/components/select-market-columns.tsx @@ -294,9 +294,10 @@ export const columns = (market: any, onSelect: (id: string) => void) => { }, { value: - market.tradingMode === MarketTradingMode.MonitoringAuction && + market.tradingMode === + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && market.data?.trigger && - market.data.trigger !== AuctionTrigger.Unspecified + market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED ? `${formatLabel( market.tradingMode )} - ${market.data?.trigger.toLowerCase()}` @@ -453,9 +454,10 @@ export const columnsPositionMarkets = ( }, { value: - market.tradingMode === MarketTradingMode.MonitoringAuction && + market.tradingMode === + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && market.data?.trigger && - market.data.trigger !== AuctionTrigger.Unspecified + market.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED ? `${formatLabel( market.tradingMode )} - ${market.data?.trigger.toLowerCase()}` diff --git a/libs/market-list/src/lib/components/select-market.tsx b/libs/market-list/src/lib/components/select-market.tsx index 2aa27f816..106da8271 100644 --- a/libs/market-list/src/lib/components/select-market.tsx +++ b/libs/market-list/src/lib/components/select-market.tsx @@ -125,10 +125,11 @@ export const SelectMarketPopover = ({ const variables = useMemo(() => ({ partyId: keypair?.pub }), [keypair?.pub]); const { data } = useQuery(MARKET_LIST_QUERY, { - variables: { interval: Interval.I1H, since: yTimestamp }, + variables: { interval: Interval.INTERVAL_I1H, since: yTimestamp }, }); const { data: marketDataPositions } = useQuery(POSITION_QUERY, { variables, + skip: !keypair?.pub, }); const positionMarkets = useMemo( @@ -231,7 +232,7 @@ export const SelectMarketDialog = ({ }; const { data } = useQuery(MARKET_LIST_QUERY, { - variables: { interval: Interval.I1H, since: yTimestamp }, + variables: { interval: Interval.INTERVAL_I1H, since: yTimestamp }, }); return ( markets ?.filter( (m) => - m.state !== MarketState.Rejected && - m.tradingMode !== MarketTradingMode.NoTrading + m.state !== MarketState.STATE_REJECTED && + m.tradingMode !== MarketTradingMode.TRADING_MODE_NO_TRADING ) .map((m) => { return { diff --git a/libs/orders/src/lib/components/mocks/generate-orders.ts b/libs/orders/src/lib/components/mocks/generate-orders.ts index 47d3638f4..732cf4c00 100644 --- a/libs/orders/src/lib/components/mocks/generate-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-orders.ts @@ -30,12 +30,12 @@ export const generateOrder = ( }, }, size: '10', - type: OrderType.Market, - status: OrderStatus.Active, - side: Side.Buy, + type: OrderType.TYPE_MARKET, + status: OrderStatus.STATUS_ACTIVE, + side: Side.SIDE_BUY, remaining: '5', price: '', - timeInForce: OrderTimeInForce.IOC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_IOC, createdAt: new Date().toISOString(), updatedAt: null, expiresAt: null, @@ -46,17 +46,17 @@ export const generateOrder = ( export const limitOrder = generateOrder({ id: 'limit-order', - type: OrderType.Limit, - status: OrderStatus.Active, - timeInForce: OrderTimeInForce.GTT, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_ACTIVE, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTT, createdAt: new Date(2022, 3, 3).toISOString(), expiresAt: new Date(2022, 3, 5).toISOString(), }); export const marketOrder = generateOrder({ id: 'market-order', - type: OrderType.Market, - status: OrderStatus.Active, + type: OrderType.TYPE_MARKET, + status: OrderStatus.STATUS_ACTIVE, }); export const generateMockOrders = @@ -79,12 +79,12 @@ export const generateMockOrders = }, }, size: '10', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '20000000', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2020, 1, 1).toISOString(), }), generateOrder({ @@ -104,12 +104,12 @@ export const generateMockOrders = }, }, size: '1', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '100', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date().toISOString(), }), generateOrder({ @@ -129,12 +129,12 @@ export const generateMockOrders = }, }, size: '1', - type: OrderType.Limit, - status: OrderStatus.Filled, - side: Side.Buy, + type: OrderType.TYPE_LIMIT, + status: OrderStatus.STATUS_FILLED, + side: Side.SIDE_BUY, remaining: '0', price: '20000', - timeInForce: OrderTimeInForce.GTC, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, createdAt: new Date(2022, 5, 10).toISOString(), }), ]; diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts index 329ef0a82..664b1cc48 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts @@ -24,7 +24,7 @@ export interface OrderFields_market_tradableInstrument_instrument { export interface OrderFields_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: OrderFields_market_tradableInstrument_instrument; } @@ -41,7 +41,7 @@ export interface OrderFields_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -57,13 +57,14 @@ export interface OrderFields_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: OrderFields_market_tradableInstrument; } @@ -77,7 +78,7 @@ export interface OrderFields { /** * The market the order is trading on (probably stored internally as a hash of the market details) */ - market: OrderFields_market | null; + market: OrderFields_market; /** * Type the order type (defaults to PARTY) */ diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts index 904cf1fff..421f926b2 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts @@ -24,7 +24,7 @@ export interface OrderSub_orders_market_tradableInstrument_instrument { export interface OrderSub_orders_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: OrderSub_orders_market_tradableInstrument_instrument; } @@ -41,7 +41,7 @@ export interface OrderSub_orders_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -57,13 +57,14 @@ export interface OrderSub_orders_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: OrderSub_orders_market_tradableInstrument; } @@ -77,7 +78,7 @@ export interface OrderSub_orders { /** * The market the order is trading on (probably stored internally as a hash of the market details) */ - market: OrderSub_orders_market | null; + market: OrderSub_orders_market; /** * Type the order type (defaults to PARTY) */ diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts index 4812fbd20..78f1f1084 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts @@ -24,7 +24,7 @@ export interface Orders_party_ordersConnection_edges_node_market_tradableInstrum export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: Orders_party_ordersConnection_edges_node_market_tradableInstrument_instrument; } @@ -41,7 +41,7 @@ export interface Orders_party_ordersConnection_edges_node_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -57,13 +57,14 @@ export interface Orders_party_ordersConnection_edges_node_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: Orders_party_ordersConnection_edges_node_market_tradableInstrument; } @@ -77,7 +78,7 @@ export interface Orders_party_ordersConnection_edges_node { /** * The market the order is trading on (probably stored internally as a hash of the market details) */ - market: Orders_party_ordersConnection_edges_node_market | null; + market: Orders_party_ordersConnection_edges_node_market; /** * Type the order type (defaults to PARTY) */ @@ -164,7 +165,7 @@ export interface Orders_party { export interface Orders { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Orders_party | null; } diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx index 225431c73..fd18334bc 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx @@ -23,6 +23,7 @@ describe('OrderFeedback', () => { beforeEach(() => { props = { transaction: { + dialogOpen: false, status: VegaTxStatus.Complete, error: null, txHash: 'tx-hash', @@ -39,8 +40,8 @@ describe('OrderFeedback', () => { it('renders error reason', () => { const orderFields = { - status: OrderStatus.Rejected, - rejectionReason: OrderRejectionReason.OrderAmendFailure, + status: OrderStatus.STATUS_REJECTED, + rejectionReason: OrderRejectionReason.ORDER_ERROR_AMEND_FAILURE, }; const order = generateOrder(orderFields); render(); @@ -51,10 +52,10 @@ describe('OrderFeedback', () => { it('should render order details when order is placed successfully', () => { const order = generateOrder({ - type: OrderType.Limit, + type: OrderType.TYPE_LIMIT, price: '100', size: '200', - side: Side.Buy, + side: Side.SIDE_BUY, market: { decimalPlaces: 2, positionDecimalPlaces: 0, diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index 574064e97..2d551112b 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -30,7 +30,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => {

    {t(`Status`)}

    {t(`${order.status}`)}

    - {order.type === OrderType.Limit && order.market && ( + {order.type === OrderType.TYPE_LIMIT && order.market && (

    {t(`Price`)}

    @@ -42,12 +42,14 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => {

    {t(`Size`)}

    - {`${order.side === Side.Buy ? '+' : '-'} ${addDecimalsFormatNumber( + {`${ + order.side === Side.SIDE_BUY ? '+' : '-' + } ${addDecimalsFormatNumber( order.size, order.market?.positionDecimalPlaces ?? 0 )} @@ -85,11 +87,11 @@ const getRejectionReason = ( order: OrderEvent_busEvents_event_Order ): string | null => { switch (order.status) { - case OrderStatus.Stopped: + case OrderStatus.STATUS_STOPPED: return t( `Your ${order.timeInForce} order was not filled and it has been stopped` ); - case OrderStatus.Rejected: + case OrderStatus.STATUS_REJECTED: return order.rejectionReason && t(startCase(order.rejectionReason)); default: return null; diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index a22b5cd7a..b08262d3a 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -3,7 +3,7 @@ import { addDecimalsFormatNumber, toDecimal, } from '@vegaprotocol/react-helpers'; -import { OrderType } from '@vegaprotocol/types'; +import { OrderType, Side } from '@vegaprotocol/types'; import { FormGroup, Input, @@ -55,7 +55,7 @@ export const OrderEditDialog = ({

    {t(`${order.market.name}`)}

    )} - {order.type === OrderType.Limit && order.market && ( + {order.type === OrderType.TYPE_LIMIT && order.market && (

    {t(`Current price`)}

    @@ -67,12 +67,12 @@ export const OrderEditDialog = ({

    {t(`Remaining size`)}

    - {order.side === 'Buy' ? '+' : '-'} + {order.side === Side.SIDE_BUY ? '+' : '-'} {order.size}

    diff --git a/libs/orders/src/lib/components/order-list/order-list.spec.tsx b/libs/orders/src/lib/components/order-list/order-list.spec.tsx index 66b584f93..6a8a47d8a 100644 --- a/libs/orders/src/lib/components/order-list/order-list.spec.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.spec.tsx @@ -111,8 +111,9 @@ describe('OrderListTable', () => { it('should apply correct formatting for a rejected order', async () => { const rejectedOrder = { ...marketOrder, - status: OrderStatus.Rejected, - rejectionReason: OrderRejectionReason.InsufficientAssetBalance, + status: OrderStatus.STATUS_REJECTED, + rejectionReason: + OrderRejectionReason.ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE, }; await act(async () => { render(generateJsx([rejectedOrder])); diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 852e3e32a..c05f0cde1 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -1,4 +1,9 @@ -import { OrderTimeInForce, OrderStatus, Side } from '@vegaprotocol/types'; +import { + OrderTimeInForce, + OrderStatus, + Side, + OrderType, +} from '@vegaprotocol/types'; import { addDecimal, getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; import { AgGridDynamic as AgGrid, @@ -120,12 +125,12 @@ export const OrderListTable = forwardRef( data, }: { data: Orders_party_ordersConnection_edges_node; - }) => data?.side === Side.Buy, + }) => data?.side === Side.SIDE_BUY, 'text-vega-red-dark dark:text-vega-red': ({ data, }: { data: Orders_party_ordersConnection_edges_node; - }) => data?.side === Side.Sell, + }) => data?.side === Side.SIDE_SELL, }} valueFormatter={({ value, @@ -136,7 +141,11 @@ export const OrderListTable = forwardRef( if (value === undefined || !data || !data.market) { return undefined; } - const prefix = data ? (data.side === Side.Buy ? '+' : '-') : ''; + const prefix = data + ? data.side === Side.SIDE_BUY + ? '+' + : '-' + : ''; return ( prefix + addDecimal(value, data.market.positionDecimalPlaces) ); @@ -154,7 +163,7 @@ export const OrderListTable = forwardRef( if (value === undefined || !data || !data.market) { return undefined; } - if (value === OrderStatus.Rejected) { + if (value === OrderStatus.STATUS_REJECTED) { return `${value}: ${ data.rejectionReason && startCase(data.rejectionReason) }`; @@ -198,7 +207,7 @@ export const OrderListTable = forwardRef( value === undefined || !data || !data.market || - data.type === 'Market' + data.type === OrderType.TYPE_MARKET ) { return '-'; } @@ -216,7 +225,10 @@ export const OrderListTable = forwardRef( if (value === undefined || !data || !data.market) { return undefined; } - if (value === OrderTimeInForce.GTT && data.expiresAt) { + if ( + value === OrderTimeInForce.TIME_IN_FORCE_GTT && + data.expiresAt + ) { const expiry = getDateTimeFormat().format( new Date(data.expiresAt) ); @@ -292,11 +304,11 @@ export const OrderListTable = forwardRef( */ const isOrderActive = (status: OrderStatus) => { return ![ - OrderStatus.Cancelled, - OrderStatus.Rejected, - OrderStatus.Expired, - OrderStatus.Filled, - OrderStatus.Stopped, + OrderStatus.STATUS_CANCELLED, + OrderStatus.STATUS_REJECTED, + OrderStatus.STATUS_EXPIRED, + OrderStatus.STATUS_FILLED, + OrderStatus.STATUS_STOPPED, ].includes(status); }; @@ -306,21 +318,21 @@ const getEditDialogTitle = (status?: OrderStatus): string | undefined => { } switch (status) { - case OrderStatus.Active: + case OrderStatus.STATUS_ACTIVE: return t('Order updated'); - case OrderStatus.Filled: + case OrderStatus.STATUS_FILLED: return t('Order filled'); - case OrderStatus.PartiallyFilled: + case OrderStatus.STATUS_PARTIALLY_FILLED: return t('Order partially filled'); - case OrderStatus.Parked: + case OrderStatus.STATUS_PARKED: return t('Order parked'); - case OrderStatus.Stopped: + case OrderStatus.STATUS_STOPPED: return t('Order stopped'); - case OrderStatus.Expired: + case OrderStatus.STATUS_EXPIRED: return t('Order expired'); - case OrderStatus.Cancelled: + case OrderStatus.STATUS_CANCELLED: return t('Order cancelled'); - case OrderStatus.Rejected: + case OrderStatus.STATUS_REJECTED: return t('Order rejected'); default: return t('Order amendment failed'); @@ -333,7 +345,7 @@ const getCancelDialogIntent = (status?: OrderStatus): Intent | undefined => { } switch (status) { - case OrderStatus.Cancelled: + case OrderStatus.STATUS_CANCELLED: return Intent.Success; default: return Intent.Danger; @@ -346,7 +358,7 @@ const getCancelDialogTitle = (status?: OrderStatus): string | undefined => { } switch (status) { - case OrderStatus.Cancelled: + case OrderStatus.STATUS_CANCELLED: return t('Order cancelled'); default: return t('Order cancellation failed'); diff --git a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts index 807c70496..df959703d 100644 --- a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts +++ b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts @@ -25,7 +25,7 @@ export interface OrderEvent_busEvents_event_Order_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -41,9 +41,10 @@ export interface OrderEvent_busEvents_event_Order_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; } @@ -93,7 +94,7 @@ export interface OrderEvent_busEvents_event_Order { /** * The market the order is trading on (probably stored internally as a hash of the market details) */ - market: OrderEvent_busEvents_event_Order_market | null; + market: OrderEvent_busEvents_event_Order_market; } export type OrderEvent_busEvents_event = OrderEvent_busEvents_event_TimeUpdate | OrderEvent_busEvents_event_Order; @@ -101,7 +102,7 @@ export type OrderEvent_busEvents_event = OrderEvent_busEvents_event_TimeUpdate | export interface OrderEvent_busEvents { __typename: "BusEvent"; /** - * the type of event we're dealing with + * the type of event */ type: BusEventType; /** diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx index 7451a67c0..06eb2350b 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx @@ -3,7 +3,6 @@ import type { VegaKeyExtended, VegaWalletContextShape, } from '@vegaprotocol/wallet'; -import { VegaWalletOrderTimeInForce } from '@vegaprotocol/wallet'; import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet'; import type { ReactNode } from 'react'; import { useOrderEdit } from './use-order-edit'; @@ -138,8 +137,8 @@ describe('useOrderEdit', () => { orderId: order.id, // eslint-disable-next-line marketId: order.market!.id, - timeInForce: VegaWalletOrderTimeInForce[order.timeInForce], - price: { value: '123456789' }, // Decimal removed + timeInForce: order.timeInForce, + price: '123456789', // Decimal removed sizeDelta: 0, expiresAt: undefined, }, diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.tsx index 36d466e17..a5fed3015 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.tsx @@ -1,10 +1,6 @@ import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; import { useState, useCallback } from 'react'; -import { - useVegaTransaction, - useVegaWallet, - VegaWalletOrderTimeInForce, -} from '@vegaprotocol/wallet'; +import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; import type { OrderEvent_busEvents_event_Order } from './__generated__'; import * as Sentry from '@sentry/react'; import type { OrderFields } from '../components'; @@ -51,15 +47,11 @@ export const useOrderEdit = (order: OrderFields | null) => { orderAmendment: { orderId: order.id, marketId: order.market.id, - price: { - value: removeDecimal(args.price, order.market.decimalPlaces), - }, - timeInForce: VegaWalletOrderTimeInForce[order.timeInForce], + price: removeDecimal(args.price, order.market.decimalPlaces), + timeInForce: order.timeInForce, sizeDelta: 0, expiresAt: order.expiresAt - ? { - value: toNanoSeconds(new Date(order.expiresAt)), // Wallet expects timestamp in nanoseconds - } + ? toNanoSeconds(new Date(order.expiresAt)) // Wallet expects timestamp in nanoseconds : undefined, }, }); diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx index 0d2f28841..6892f8d7d 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx @@ -5,11 +5,12 @@ import type { } from '@vegaprotocol/wallet'; import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet'; import { - VegaWalletOrderSide, - VegaWalletOrderTimeInForce, - VegaWalletOrderType, -} from '@vegaprotocol/wallet'; -import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; + MarketState, + MarketTradingMode, + OrderTimeInForce, + OrderType, + Side, +} from '@vegaprotocol/types'; import type { ReactNode } from 'react'; import type { Order } from './use-order-submit'; import { useOrderSubmit } from './use-order-submit'; @@ -27,8 +28,8 @@ const defaultMarket = { id: 'market-id', decimalPlaces: 2, positionDecimalPlaces: 1, - tradingMode: MarketTradingMode.Continuous, - state: MarketState.Active, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + state: MarketState.STATE_ACTIVE, tradableInstrument: { __typename: 'TradableInstrument', instrument: { @@ -158,10 +159,10 @@ describe('useOrderSubmit', () => { }); const order = { - type: VegaWalletOrderType.Limit, + type: OrderType.TYPE_LIMIT, size: '10', - timeInForce: VegaWalletOrderTimeInForce.GTT, - side: VegaWalletOrderSide.Buy, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTT, + side: Side.SIDE_BUY, price: '1234567.89', expiration: new Date('2022-01-01'), }; @@ -173,11 +174,11 @@ describe('useOrderSubmit', () => { pubKey: keypair.pub, propagate: true, orderSubmission: { - type: VegaWalletOrderType.Limit, + type: OrderType.TYPE_LIMIT, marketId: defaultMarket.id, // Market provided from hook argument size: '100', // size adjusted based on positionDecimalPlaces - side: VegaWalletOrderSide.Buy, - timeInForce: VegaWalletOrderTimeInForce.GTT, + side: Side.SIDE_BUY, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTT, price: '123456789', // Decimal removed expiresAt: order.expiration ? toNanoSeconds(order.expiration) diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.ts b/libs/orders/src/lib/order-hooks/use-order-submit.ts index 68b0828da..b8c9a6b83 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.ts +++ b/libs/orders/src/lib/order-hooks/use-order-submit.ts @@ -1,10 +1,6 @@ import { useCallback, useState } from 'react'; import type { OrderEvent_busEvents_event_Order } from './__generated__'; -import type { - VegaWalletOrderTimeInForce, - VegaWalletOrderSide, -} from '@vegaprotocol/wallet'; -import { VegaWalletOrderType, useVegaWallet } from '@vegaprotocol/wallet'; +import { useVegaWallet } from '@vegaprotocol/wallet'; import { determineId, removeDecimal, @@ -13,12 +9,14 @@ import { import { useVegaTransaction } from '@vegaprotocol/wallet'; import * as Sentry from '@sentry/react'; import { useOrderEvent } from './use-order-event'; +import type { OrderTimeInForce, Side } from '@vegaprotocol/types'; +import { OrderType } from '@vegaprotocol/types'; export interface Order { - type: VegaWalletOrderType; + type: OrderType; size: string; - side: VegaWalletOrderSide; - timeInForce: VegaWalletOrderTimeInForce; + side: Side; + timeInForce: OrderTimeInForce; price?: string; expiration?: Date; } @@ -64,7 +62,7 @@ export const useOrderSubmit = (market: Market) => { orderSubmission: { marketId: market.id, price: - order.type === VegaWalletOrderType.Limit && order.price + order.type === OrderType.TYPE_LIMIT && order.price ? removeDecimal(order.price, market.decimalPlaces) : undefined, size: removeDecimal(order.size, market.positionDecimalPlaces), diff --git a/libs/orders/src/lib/order-hooks/use-order-validation.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-validation.spec.tsx index b97edc1c7..1f88b867e 100644 --- a/libs/orders/src/lib/order-hooks/use-order-validation.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-validation.spec.tsx @@ -1,14 +1,15 @@ import { renderHook } from '@testing-library/react'; -import { - VegaWalletOrderTimeInForce, - VegaWalletOrderType, - useVegaWallet, -} from '@vegaprotocol/wallet'; +import { useVegaWallet } from '@vegaprotocol/wallet'; import type { VegaWalletContextShape, VegaKeyExtended, } from '@vegaprotocol/wallet'; -import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; +import { + MarketState, + MarketTradingMode, + OrderTimeInForce, + OrderType, +} from '@vegaprotocol/types'; import type { ValidationProps } from './use-order-validation'; import { marketTranslations } from './use-order-validation'; import { useOrderValidation } from './use-order-validation'; @@ -21,8 +22,8 @@ const market = { id: 'market-id', decimalPlaces: 2, positionDecimalPlaces: 1, - tradingMode: MarketTradingMode.Continuous, - state: MarketState.Active, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + state: MarketState.STATE_ACTIVE, tradableInstrument: { __typename: 'TradableInstrument', instrument: { @@ -59,8 +60,8 @@ const defaultWalletContext = { const defaultOrder = { market, step: 0.1, - orderType: VegaWalletOrderType.Market, - orderTimeInForce: VegaWalletOrderTimeInForce.FOK, + orderType: OrderType.TYPE_MARKET, + orderTimeInForce: OrderTimeInForce.TIME_IN_FORCE_FOK, }; const ERROR = { @@ -110,11 +111,11 @@ describe('useOrderValidation', () => { it.each` state - ${MarketState.Settled} - ${MarketState.Rejected} - ${MarketState.TradingTerminated} - ${MarketState.Closed} - ${MarketState.Cancelled} + ${MarketState.STATE_SETTLED} + ${MarketState.STATE_REJECTED} + ${MarketState.STATE_TRADING_TERMINATED} + ${MarketState.STATE_CLOSED} + ${MarketState.STATE_CANCELLED} `( 'Returns an error message for market state when not accepting orders', ({ state }) => { @@ -130,8 +131,8 @@ describe('useOrderValidation', () => { it.each` state - ${MarketState.Pending} - ${MarketState.Proposed} + ${MarketState.STATE_PENDING} + ${MarketState.STATE_PROPOSED} `( 'Returns an error message for market state suspended or pending', ({ state }) => { @@ -139,7 +140,7 @@ describe('useOrderValidation', () => { market: { ...defaultOrder.market, state, - tradingMode: MarketTradingMode.BatchAuction, + tradingMode: MarketTradingMode.TRADING_MODE_BATCH_AUCTION, }, }); expect(result.current).toStrictEqual({ @@ -150,16 +151,16 @@ describe('useOrderValidation', () => { ); it.each` - tradingMode | errorMessage - ${MarketTradingMode.BatchAuction} | ${ERROR.MARKET_CONTINUOUS_LIMIT} - ${MarketTradingMode.MonitoringAuction} | ${ERROR.MARKET_CONTINUOUS_LIMIT} - ${MarketTradingMode.OpeningAuction} | ${ERROR.MARKET_CONTINUOUS_LIMIT} + tradingMode | errorMessage + ${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${ERROR.MARKET_CONTINUOUS_LIMIT} + ${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${ERROR.MARKET_CONTINUOUS_LIMIT} + ${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${ERROR.MARKET_CONTINUOUS_LIMIT} `( `Returns an error message when trying to submit a non-limit order for a "$tradingMode" market`, ({ tradingMode, errorMessage }) => { const { result } = setup({ market: { ...defaultOrder.market, tradingMode }, - orderType: VegaWalletOrderType.Market, + orderType: OrderType.TYPE_MARKET, }); expect(result.current).toStrictEqual({ isDisabled: true, @@ -169,22 +170,22 @@ describe('useOrderValidation', () => { ); it.each` - tradingMode | orderTimeInForce | errorMessage - ${MarketTradingMode.BatchAuction} | ${VegaWalletOrderTimeInForce.FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.MonitoringAuction} | ${VegaWalletOrderTimeInForce.FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.OpeningAuction} | ${VegaWalletOrderTimeInForce.FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.BatchAuction} | ${VegaWalletOrderTimeInForce.IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.MonitoringAuction} | ${VegaWalletOrderTimeInForce.IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.OpeningAuction} | ${VegaWalletOrderTimeInForce.IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.BatchAuction} | ${VegaWalletOrderTimeInForce.GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.MonitoringAuction} | ${VegaWalletOrderTimeInForce.GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} - ${MarketTradingMode.OpeningAuction} | ${VegaWalletOrderTimeInForce.GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} + tradingMode | orderTimeInForce | errorMessage + ${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_FOK} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_IOC} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_BATCH_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_MONITORING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} + ${MarketTradingMode.TRADING_MODE_OPENING_AUCTION} | ${OrderTimeInForce.TIME_IN_FORCE_GFN} | ${ERROR.MARKET_CONTINUOUS_TIF} `( `Returns an error message when submitting a limit order with a "$orderTimeInForce" value to a "$tradingMode" market`, ({ tradingMode, orderTimeInForce, errorMessage }) => { const { result } = setup({ market: { ...defaultOrder.market, tradingMode }, - orderType: VegaWalletOrderType.Limit, + orderType: OrderType.TYPE_LIMIT, orderTimeInForce, }); expect(result.current).toStrictEqual({ @@ -205,7 +206,7 @@ describe('useOrderValidation', () => { ({ fieldName, errorType, errorMessage }) => { const { result } = setup({ fieldErrors: { [fieldName]: { type: errorType } }, - orderType: VegaWalletOrderType.Limit, + orderType: OrderType.TYPE_LIMIT, }); expect(result.current).toStrictEqual({ isDisabled: true, diff --git a/libs/orders/src/lib/order-hooks/use-order-validation.tsx b/libs/orders/src/lib/order-hooks/use-order-validation.tsx index 83e45ff43..effbda66b 100644 --- a/libs/orders/src/lib/order-hooks/use-order-validation.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-validation.tsx @@ -1,12 +1,13 @@ import type { FieldErrors } from 'react-hook-form'; import { useMemo } from 'react'; import { t, toDecimal } from '@vegaprotocol/react-helpers'; +import { useVegaWallet } from '@vegaprotocol/wallet'; import { - useVegaWallet, - VegaWalletOrderTimeInForce as OrderTimeInForce, - VegaWalletOrderType as OrderType, -} from '@vegaprotocol/wallet'; -import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; + MarketState, + MarketTradingMode, + OrderTimeInForce, + OrderType, +} from '@vegaprotocol/types'; import { ERROR_SIZE_DECIMAL } from '../utils/validate-size'; import type { Order } from './use-order-submit'; @@ -24,7 +25,7 @@ export type ValidationProps = { export const marketTranslations = (marketState: MarketState) => { switch (marketState) { - case MarketState.TradingTerminated: + case MarketState.STATE_TRADING_TERMINATED: return t('terminated'); default: return t(marketState).toLowerCase(); @@ -54,11 +55,11 @@ export const useOrderValidation = ({ if ( [ - MarketState.Settled, - MarketState.Rejected, - MarketState.TradingTerminated, - MarketState.Cancelled, - MarketState.Closed, + MarketState.STATE_SETTLED, + MarketState.STATE_REJECTED, + MarketState.STATE_TRADING_TERMINATED, + MarketState.STATE_CANCELLED, + MarketState.STATE_CLOSED, ].includes(market.state) ) { return { @@ -71,7 +72,11 @@ export const useOrderValidation = ({ }; } - if ([MarketState.Proposed, MarketState.Pending].includes(market.state)) { + if ( + [MarketState.STATE_PROPOSED, MarketState.STATE_PENDING].includes( + market.state + ) + ) { return { isDisabled: false, message: t( @@ -84,12 +89,12 @@ export const useOrderValidation = ({ if ( [ - MarketTradingMode.BatchAuction, - MarketTradingMode.MonitoringAuction, - MarketTradingMode.OpeningAuction, + MarketTradingMode.TRADING_MODE_BATCH_AUCTION, + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + MarketTradingMode.TRADING_MODE_OPENING_AUCTION, ].includes(market.tradingMode) ) { - if (orderType !== OrderType.Limit) { + if (orderType !== OrderType.TYPE_LIMIT) { return { isDisabled: true, message: t( @@ -100,9 +105,9 @@ export const useOrderValidation = ({ if ( [ - OrderTimeInForce.FOK, - OrderTimeInForce.IOC, - OrderTimeInForce.GFN, + OrderTimeInForce.TIME_IN_FORCE_FOK, + OrderTimeInForce.TIME_IN_FORCE_IOC, + OrderTimeInForce.TIME_IN_FORCE_GFN, ].includes(orderTimeInForce) ) { return { @@ -130,7 +135,7 @@ export const useOrderValidation = ({ if ( fieldErrors?.price?.type === 'required' && - orderType !== OrderType.Market + orderType !== OrderType.TYPE_MARKET ) { return { isDisabled: true, @@ -138,7 +143,10 @@ export const useOrderValidation = ({ }; } - if (fieldErrors?.price?.type === 'min' && orderType !== OrderType.Market) { + if ( + fieldErrors?.price?.type === 'min' && + orderType !== OrderType.TYPE_MARKET + ) { return { isDisabled: true, message: t(`The price cannot be negative`), @@ -165,9 +173,9 @@ export const useOrderValidation = ({ if ( [ - MarketTradingMode.BatchAuction, - MarketTradingMode.MonitoringAuction, - MarketTradingMode.OpeningAuction, + MarketTradingMode.TRADING_MODE_BATCH_AUCTION, + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + MarketTradingMode.TRADING_MODE_OPENING_AUCTION, ].includes(market.tradingMode) ) { return { diff --git a/libs/orders/src/lib/utils/get-default-order.ts b/libs/orders/src/lib/utils/get-default-order.ts index c3229704b..775b955bb 100644 --- a/libs/orders/src/lib/utils/get-default-order.ts +++ b/libs/orders/src/lib/utils/get-default-order.ts @@ -1,14 +1,10 @@ -import { - VegaWalletOrderTimeInForce, - VegaWalletOrderType, - VegaWalletOrderSide, -} from '@vegaprotocol/wallet'; import { toDecimal } from '@vegaprotocol/react-helpers'; import type { Order, Market } from '../order-hooks'; +import { OrderTimeInForce, OrderType, Side } from '@vegaprotocol/types'; export const getDefaultOrder = (market: Market): Order => ({ - type: VegaWalletOrderType.Market, - side: VegaWalletOrderSide.Buy, - timeInForce: VegaWalletOrderTimeInForce.IOC, + type: OrderType.TYPE_MARKET, + side: Side.SIDE_BUY, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_IOC, size: String(toDecimal(market.positionDecimalPlaces)), }); diff --git a/libs/positions/src/lib/__generated__/PositionDetails.ts b/libs/positions/src/lib/__generated__/PositionDetails.ts index 24e60a35f..ea481e297 100644 --- a/libs/positions/src/lib/__generated__/PositionDetails.ts +++ b/libs/positions/src/lib/__generated__/PositionDetails.ts @@ -20,15 +20,15 @@ export interface PositionDetails_market_data_market { export interface PositionDetails_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** - * what state the market is in (auction, continuous etc) + * what state the market is in (auction, continuous, etc) */ marketTradingMode: MarketTradingMode; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: PositionDetails_market_data_market; } @@ -48,7 +48,7 @@ export interface PositionDetails_market_tradableInstrument_instrument { export interface PositionDetails_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: PositionDetails_market_tradableInstrument_instrument; } @@ -69,7 +69,7 @@ export interface PositionDetails_market { data: PositionDetails_market_data | null; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct - * number denominated in the currency of the Market. (uint64) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -85,13 +85,14 @@ export interface PositionDetails_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: PositionDetails_market_tradableInstrument; } diff --git a/libs/positions/src/lib/__generated__/PositionMetricsFields.ts b/libs/positions/src/lib/__generated__/PositionMetricsFields.ts index 24c0f1789..fd780da1e 100644 --- a/libs/positions/src/lib/__generated__/PositionMetricsFields.ts +++ b/libs/positions/src/lib/__generated__/PositionMetricsFields.ts @@ -20,7 +20,7 @@ export interface PositionMetricsFields_market_tradableInstrument_instrument { export interface PositionMetricsFields_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: PositionMetricsFields_market_tradableInstrument_instrument; } @@ -28,7 +28,7 @@ export interface PositionMetricsFields_market_tradableInstrument { export interface PositionMetricsFields_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; } @@ -45,7 +45,7 @@ export interface PositionMetricsFields_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -61,9 +61,10 @@ export interface PositionMetricsFields_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -71,7 +72,7 @@ export interface PositionMetricsFields_market { */ tradingMode: MarketTradingMode; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: PositionMetricsFields_market_tradableInstrument; /** diff --git a/libs/positions/src/lib/__generated__/PositionSubscribe.ts b/libs/positions/src/lib/__generated__/PositionSubscribe.ts index 190b7a168..ed106421e 100644 --- a/libs/positions/src/lib/__generated__/PositionSubscribe.ts +++ b/libs/positions/src/lib/__generated__/PositionSubscribe.ts @@ -20,15 +20,15 @@ export interface PositionSubscribe_positions_market_data_market { export interface PositionSubscribe_positions_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** - * what state the market is in (auction, continuous etc) + * what state the market is in (auction, continuous, etc) */ marketTradingMode: MarketTradingMode; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: PositionSubscribe_positions_market_data_market; } @@ -48,7 +48,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument_instrumen export interface PositionSubscribe_positions_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: PositionSubscribe_positions_market_tradableInstrument_instrument; } @@ -69,7 +69,7 @@ export interface PositionSubscribe_positions_market { data: PositionSubscribe_positions_market_data | null; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct - * number denominated in the currency of the Market. (uint64) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -85,13 +85,14 @@ export interface PositionSubscribe_positions_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: PositionSubscribe_positions_market_tradableInstrument; } diff --git a/libs/positions/src/lib/__generated__/Positions.ts b/libs/positions/src/lib/__generated__/Positions.ts index f5a7bac3d..2a4b695a7 100644 --- a/libs/positions/src/lib/__generated__/Positions.ts +++ b/libs/positions/src/lib/__generated__/Positions.ts @@ -20,15 +20,15 @@ export interface Positions_party_positions_market_data_market { export interface Positions_party_positions_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; /** - * what state the market is in (auction, continuous etc) + * what state the market is in (auction, continuous, etc) */ marketTradingMode: MarketTradingMode; /** - * market id of the associated mark price + * market ID of the associated mark price */ market: Positions_party_positions_market_data_market; } @@ -48,7 +48,7 @@ export interface Positions_party_positions_market_tradableInstrument_instrument export interface Positions_party_positions_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: Positions_party_positions_market_tradableInstrument_instrument; } @@ -69,7 +69,7 @@ export interface Positions_party_positions_market { data: Positions_party_positions_market_data | null; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct - * number denominated in the currency of the Market. (uint64) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -85,13 +85,14 @@ export interface Positions_party_positions_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: Positions_party_positions_market_tradableInstrument; } @@ -134,7 +135,7 @@ export interface Positions_party { export interface Positions { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Positions_party | null; } diff --git a/libs/positions/src/lib/__generated__/PositionsMetrics.ts b/libs/positions/src/lib/__generated__/PositionsMetrics.ts index 5b452face..fb7ba4c34 100644 --- a/libs/positions/src/lib/__generated__/PositionsMetrics.ts +++ b/libs/positions/src/lib/__generated__/PositionsMetrics.ts @@ -12,11 +12,11 @@ import { AccountType, MarketTradingMode } from "@vegaprotocol/types"; export interface PositionsMetrics_party_accounts_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** - * The precision of the asset + * 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; } @@ -72,15 +72,15 @@ export interface PositionsMetrics_party_marginsConnection_edges_node { */ market: PositionsMetrics_party_marginsConnection_edges_node_market; /** - * minimal margin for the position to be maintained in the network (unsigned int actually) + * minimal margin for the position to be maintained in the network (unsigned integer) */ maintenanceLevel: string; /** - * if the margin is between maintenance and search, the network will initiate a collateral search (unsigned int actually) + * if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer) */ searchLevel: string; /** - * this is the minimal margin required for a party to place a new order on the network (unsigned int actually) + * this is the minimum margin required for a party to place a new order on the network (unsigned integer) */ initialLevel: string; /** @@ -118,7 +118,7 @@ export interface PositionsMetrics_party_positionsConnection_edges_node_market_tr export interface PositionsMetrics_party_positionsConnection_edges_node_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: PositionsMetrics_party_positionsConnection_edges_node_market_tradableInstrument_instrument; } @@ -126,7 +126,7 @@ export interface PositionsMetrics_party_positionsConnection_edges_node_market_tr export interface PositionsMetrics_party_positionsConnection_edges_node_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; } @@ -143,7 +143,7 @@ export interface PositionsMetrics_party_positionsConnection_edges_node_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -159,9 +159,10 @@ export interface PositionsMetrics_party_positionsConnection_edges_node_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -169,7 +170,7 @@ export interface PositionsMetrics_party_positionsConnection_edges_node_market { */ tradingMode: MarketTradingMode; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: PositionsMetrics_party_positionsConnection_edges_node_market_tradableInstrument; /** @@ -230,7 +231,7 @@ export interface PositionsMetrics_party { */ accounts: PositionsMetrics_party_accounts[] | null; /** - * Margin level for a market + * Margin levels for a market */ marginsConnection: PositionsMetrics_party_marginsConnection; /** @@ -241,7 +242,7 @@ export interface PositionsMetrics_party { export interface PositionsMetrics { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: PositionsMetrics_party | null; } diff --git a/libs/positions/src/lib/__generated__/PositionsMetricsSubscription.ts b/libs/positions/src/lib/__generated__/PositionsMetricsSubscription.ts index e0ed50853..13bb2c5f7 100644 --- a/libs/positions/src/lib/__generated__/PositionsMetricsSubscription.ts +++ b/libs/positions/src/lib/__generated__/PositionsMetricsSubscription.ts @@ -20,7 +20,7 @@ export interface PositionsMetricsSubscription_positions_market_tradableInstrumen export interface PositionsMetricsSubscription_positions_market_tradableInstrument { __typename: "TradableInstrument"; /** - * An instance of or reference to a fully specified instrument. + * An instance of, or reference to, a fully specified instrument. */ instrument: PositionsMetricsSubscription_positions_market_tradableInstrument_instrument; } @@ -28,7 +28,7 @@ export interface PositionsMetricsSubscription_positions_market_tradableInstrumen export interface PositionsMetricsSubscription_positions_market_data { __typename: "MarketData"; /** - * the mark price (actually an unsigned int) + * the mark price (an unsigned integer) */ markPrice: string; } @@ -45,7 +45,7 @@ export interface PositionsMetricsSubscription_positions_market { name: 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -61,9 +61,10 @@ export interface PositionsMetricsSubscription_positions_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; /** @@ -71,7 +72,7 @@ export interface PositionsMetricsSubscription_positions_market { */ tradingMode: MarketTradingMode; /** - * An instance of or reference to a tradable instrument. + * An instance of, or reference to, a tradable instrument. */ tradableInstrument: PositionsMetricsSubscription_positions_market_tradableInstrument; /** diff --git a/libs/positions/src/lib/positions-metrics-data-provider.spec.ts b/libs/positions/src/lib/positions-metrics-data-provider.spec.ts index bd4aa4503..dbec5af0b 100644 --- a/libs/positions/src/lib/positions-metrics-data-provider.spec.ts +++ b/libs/positions/src/lib/positions-metrics-data-provider.spec.ts @@ -9,7 +9,7 @@ const data: PositionsMetrics = { accounts: [ { __typename: 'Account', - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, asset: { __typename: 'Asset', id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', @@ -20,7 +20,7 @@ const data: PositionsMetrics = { }, { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, asset: { __typename: 'Asset', id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', @@ -34,7 +34,7 @@ const data: PositionsMetrics = { }, { __typename: 'Account', - type: AccountType.Margin, + type: AccountType.ACCOUNT_TYPE_MARGIN, asset: { __typename: 'Asset', id: '6d9d35f657589e40ddfb448b7ad4a7463b66efb307527fedd2aa7df1bbd5ea61', @@ -105,7 +105,7 @@ const data: PositionsMetrics = { name: 'AAVEDAI Monthly (30 Jun 2022)', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', decimalPlaces: 5, - tradingMode: MarketTradingMode.MonitoringAuction, + tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, positionDecimalPlaces: 0, tradableInstrument: { __typename: 'TradableInstrument', @@ -135,7 +135,7 @@ const data: PositionsMetrics = { id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, - tradingMode: MarketTradingMode.Continuous, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, positionDecimalPlaces: 0, tradableInstrument: { __typename: 'TradableInstrument', @@ -179,7 +179,9 @@ describe('getMetrics', () => { '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8' ); expect(metrics[0].marketName).toEqual('AAVEDAI Monthly (30 Jun 2022)'); - expect(metrics[0].marketTradingMode).toEqual('MonitoringAuction'); + expect(metrics[0].marketTradingMode).toEqual( + 'TRADING_MODE_MONITORING_AUCTION' + ); expect(metrics[0].notional).toEqual('943177500'); expect(metrics[0].openVolume).toEqual('100'); expect(metrics[0].realisedPNL).toEqual('0'); @@ -202,7 +204,7 @@ describe('getMetrics', () => { '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e' ); expect(metrics[1].marketName).toEqual('UNIDAI Monthly (30 Jun 2022)'); - expect(metrics[1].marketTradingMode).toEqual('Continuous'); + expect(metrics[1].marketTradingMode).toEqual('TRADING_MODE_CONTINUOUS'); expect(metrics[1].notional).toEqual('86976200'); expect(metrics[1].openVolume).toEqual('-100'); expect(metrics[1].realisedPNL).toEqual('0'); diff --git a/libs/positions/src/lib/positions-metrics-data-provider.ts b/libs/positions/src/lib/positions-metrics-data-provider.ts index 53a5538a4..4948ef016 100644 --- a/libs/positions/src/lib/positions-metrics-data-provider.ts +++ b/libs/positions/src/lib/positions-metrics-data-provider.ts @@ -141,7 +141,7 @@ export const getMetrics = (data: PositionsMetrics_party | null): Position[] => { const generalAccount = data.accounts?.find( (account) => account.asset.id === marginAccount.asset.id && - account.type === AccountType.General + account.type === AccountType.ACCOUNT_TYPE_GENERAL ); const assetDecimals = marginAccount.asset.decimals; const { positionDecimalPlaces, decimalPlaces: marketDecimalPlaces } = diff --git a/libs/positions/src/lib/positions-table.spec.tsx b/libs/positions/src/lib/positions-table.spec.tsx index 7c315c5d6..95bd50807 100644 --- a/libs/positions/src/lib/positions-table.spec.tsx +++ b/libs/positions/src/lib/positions-table.spec.tsx @@ -17,7 +17,7 @@ const singleRow: Position = { liquidationPrice: '83', // 8.3 lowMarginLevel: false, marketId: 'string', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, markPrice: '123', // 12.3 notional: '12300', // 1230.0 openVolume: '100', // 100 @@ -103,7 +103,10 @@ it('displays mark price', async () => { result.rerender( ); diff --git a/libs/positions/src/lib/positions-table.stories.tsx b/libs/positions/src/lib/positions-table.stories.tsx index f8bd010e9..9656c5e5c 100644 --- a/libs/positions/src/lib/positions-table.stories.tsx +++ b/libs/positions/src/lib/positions-table.stories.tsx @@ -33,7 +33,7 @@ const longPosition: Position = { // marginSearch: '0', // marginInitial: '0', marketId: 'marketId1', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, markPrice: '1131894', notional: '46667989', openVolume: '4123', @@ -65,7 +65,7 @@ const shortPosition: Position = { // marginSearch: '0', // marginInitial: '0', marketId: 'marketId2', - marketTradingMode: MarketTradingMode.Continuous, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, markPrice: '24123', notional: '836344', openVolume: '-3467', diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 1fab3206f..23e78777a 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -179,7 +179,10 @@ export const PositionsTable = forwardRef((props, ref) => { if (!data) { return undefined; } - if (data.marketTradingMode === MarketTradingMode.OpeningAuction) { + if ( + data.marketTradingMode === + MarketTradingMode.TRADING_MODE_OPENING_AUCTION + ) { return '-'; } return addDecimalsFormatNumber( diff --git a/libs/trades/src/lib/__generated__/TradeFields.ts b/libs/trades/src/lib/__generated__/TradeFields.ts index e3eb24265..60678676c 100644 --- a/libs/trades/src/lib/__generated__/TradeFields.ts +++ b/libs/trades/src/lib/__generated__/TradeFields.ts @@ -15,7 +15,7 @@ export interface TradeFields_market { 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -31,9 +31,10 @@ export interface TradeFields_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; } diff --git a/libs/trades/src/lib/__generated__/Trades.ts b/libs/trades/src/lib/__generated__/Trades.ts index b20eb7243..f656ceca9 100644 --- a/libs/trades/src/lib/__generated__/Trades.ts +++ b/libs/trades/src/lib/__generated__/Trades.ts @@ -17,7 +17,7 @@ export interface Trades_market_tradesConnection_edges_node_market { 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -33,9 +33,10 @@ export interface Trades_market_tradesConnection_edges_node_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; } @@ -101,7 +102,7 @@ export interface Trades_market { export interface Trades { /** - * An instrument that is trading on the VEGA network + * An instrument that is trading on the Vega network */ market: Trades_market | null; } diff --git a/libs/trades/src/lib/__generated__/TradesSub.ts b/libs/trades/src/lib/__generated__/TradesSub.ts index 9b837772d..58d83cb89 100644 --- a/libs/trades/src/lib/__generated__/TradesSub.ts +++ b/libs/trades/src/lib/__generated__/TradesSub.ts @@ -15,7 +15,7 @@ export interface TradesSub_trades_market { 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) + * number denominated in the currency of the market. (uint64) * * Examples: * Currency Balance decimalPlaces Real Balance @@ -31,9 +31,10 @@ export interface TradesSub_trades_market { */ decimalPlaces: number; /** - * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * 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; } diff --git a/libs/types/project.json b/libs/types/project.json index 571da4a67..784781bc6 100644 --- a/libs/types/project.json +++ b/libs/types/project.json @@ -42,10 +42,7 @@ "generate": { "builder": "@nrwl/workspace:run-commands", "options": { - "commands": [ - "npx apollo client:codegen --config=libs/types/apollo.config.js --target=typescript --globalTypesFile=libs/types/src/__generated__/globalTypes.ts", - "node libs/types/fix-imports" - ], + "commands": ["node libs/types/fix-imports"], "parallel": false } } diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index edf55e031..cfc805369 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -8,34 +8,33 @@ //============================================================== /** - * The various account types we have (used by collateral) + * The various account types in Vega (used by collateral) */ export enum AccountType { - Bond = "Bond", - External = "External", - FeeInfrastructure = "FeeInfrastructure", - FeeLiquidity = "FeeLiquidity", - FeeMaker = "FeeMaker", - General = "General", - GlobalInsurance = "GlobalInsurance", - GlobalReward = "GlobalReward", - Insurance = "Insurance", - LockWithdraw = "LockWithdraw", - Margin = "Margin", - PendingTransfers = "PendingTransfers", - RewardLpReceivedFees = "RewardLpReceivedFees", - RewardMakerReceivedFees = "RewardMakerReceivedFees", - RewardMarketProposers = "RewardMarketProposers", - RewardTakerPaidFees = "RewardTakerPaidFees", - Settlement = "Settlement", + ACCOUNT_TYPE_BOND = "ACCOUNT_TYPE_BOND", + ACCOUNT_TYPE_EXTERNAL = "ACCOUNT_TYPE_EXTERNAL", + ACCOUNT_TYPE_FEES_INFRASTRUCTURE = "ACCOUNT_TYPE_FEES_INFRASTRUCTURE", + ACCOUNT_TYPE_FEES_LIQUIDITY = "ACCOUNT_TYPE_FEES_LIQUIDITY", + ACCOUNT_TYPE_FEES_MAKER = "ACCOUNT_TYPE_FEES_MAKER", + ACCOUNT_TYPE_GENERAL = "ACCOUNT_TYPE_GENERAL", + ACCOUNT_TYPE_GLOBAL_INSURANCE = "ACCOUNT_TYPE_GLOBAL_INSURANCE", + ACCOUNT_TYPE_GLOBAL_REWARD = "ACCOUNT_TYPE_GLOBAL_REWARD", + ACCOUNT_TYPE_INSURANCE = "ACCOUNT_TYPE_INSURANCE", + ACCOUNT_TYPE_MARGIN = "ACCOUNT_TYPE_MARGIN", + ACCOUNT_TYPE_PENDING_TRANSFERS = "ACCOUNT_TYPE_PENDING_TRANSFERS", + ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = "ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES", + ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = "ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES", + ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = "ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS", + ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = "ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES", + ACCOUNT_TYPE_SETTLEMENT = "ACCOUNT_TYPE_SETTLEMENT", } export enum AuctionTrigger { - Batch = "Batch", - Liquidity = "Liquidity", - Opening = "Opening", - Price = "Price", - Unspecified = "Unspecified", + AUCTION_TRIGGER_BATCH = "AUCTION_TRIGGER_BATCH", + AUCTION_TRIGGER_LIQUIDITY = "AUCTION_TRIGGER_LIQUIDITY", + AUCTION_TRIGGER_OPENING = "AUCTION_TRIGGER_OPENING", + AUCTION_TRIGGER_PRICE = "AUCTION_TRIGGER_PRICE", + AUCTION_TRIGGER_UNSPECIFIED = "AUCTION_TRIGGER_UNSPECIFIED", } export enum BusEventType { @@ -71,154 +70,153 @@ export enum BusEventType { * Comparator describes the type of comparison. */ export enum ConditionOperator { - OperatorEquals = "OperatorEquals", - OperatorGreaterThan = "OperatorGreaterThan", - OperatorGreaterThanOrEqual = "OperatorGreaterThanOrEqual", - OperatorLessThan = "OperatorLessThan", - OperatorLessThanOrEqual = "OperatorLessThanOrEqual", + OPERATOR_EQUALS = "OPERATOR_EQUALS", + OPERATOR_GREATER_THAN = "OPERATOR_GREATER_THAN", + OPERATOR_GREATER_THAN_OR_EQUAL = "OPERATOR_GREATER_THAN_OR_EQUAL", + OPERATOR_LESS_THAN = "OPERATOR_LESS_THAN", + OPERATOR_LESS_THAN_OR_EQUAL = "OPERATOR_LESS_THAN_OR_EQUAL", } /** * The status of a deposit */ export enum DepositStatus { - Cancelled = "Cancelled", - Finalized = "Finalized", - Open = "Open", + STATUS_CANCELLED = "STATUS_CANCELLED", + STATUS_FINALIZED = "STATUS_FINALIZED", + STATUS_OPEN = "STATUS_OPEN", } /** - * The interval for trade candles when subscribing via VEGA graphql, default is I15M + * The interval for trade candles when subscribing via Vega GraphQL, default is I15M */ export enum Interval { - I15M = "I15M", - I1D = "I1D", - I1H = "I1H", - I1M = "I1M", - I5M = "I5M", - I6H = "I6H", + INTERVAL_I15M = "INTERVAL_I15M", + INTERVAL_I1D = "INTERVAL_I1D", + INTERVAL_I1H = "INTERVAL_I1H", + INTERVAL_I1M = "INTERVAL_I1M", + INTERVAL_I5M = "INTERVAL_I5M", + INTERVAL_I6H = "INTERVAL_I6H", } /** * The current state of a market */ export enum MarketState { - Active = "Active", - Cancelled = "Cancelled", - Closed = "Closed", - Pending = "Pending", - Proposed = "Proposed", - Rejected = "Rejected", - Settled = "Settled", - Suspended = "Suspended", - TradingTerminated = "TradingTerminated", + STATE_ACTIVE = "STATE_ACTIVE", + STATE_CANCELLED = "STATE_CANCELLED", + STATE_CLOSED = "STATE_CLOSED", + STATE_PENDING = "STATE_PENDING", + STATE_PROPOSED = "STATE_PROPOSED", + STATE_REJECTED = "STATE_REJECTED", + STATE_SETTLED = "STATE_SETTLED", + STATE_SUSPENDED = "STATE_SUSPENDED", + STATE_TRADING_TERMINATED = "STATE_TRADING_TERMINATED", } /** - * What market trading mode are we in + * What market trading mode is the market in */ export enum MarketTradingMode { - BatchAuction = "BatchAuction", - Continuous = "Continuous", - MonitoringAuction = "MonitoringAuction", - NoTrading = "NoTrading", - OpeningAuction = "OpeningAuction", + TRADING_MODE_BATCH_AUCTION = "TRADING_MODE_BATCH_AUCTION", + TRADING_MODE_CONTINUOUS = "TRADING_MODE_CONTINUOUS", + TRADING_MODE_MONITORING_AUCTION = "TRADING_MODE_MONITORING_AUCTION", + TRADING_MODE_NO_TRADING = "TRADING_MODE_NO_TRADING", + TRADING_MODE_OPENING_AUCTION = "TRADING_MODE_OPENING_AUCTION", } export enum NodeStatus { - NonValidator = "NonValidator", - Validator = "Validator", + NODE_STATUS_NON_VALIDATOR = "NODE_STATUS_NON_VALIDATOR", + NODE_STATUS_VALIDATOR = "NODE_STATUS_VALIDATOR", } /** * Status describe the status of the oracle spec */ export enum OracleSpecStatus { - StatusActive = "StatusActive", - StatusUnused = "StatusUnused", + STATUS_ACTIVE = "STATUS_ACTIVE", + STATUS_DEACTIVATED = "STATUS_DEACTIVATED", } /** * Reason for the order being rejected by the core node */ export enum OrderRejectionReason { - AmendToGTTWithoutExpiryAt = "AmendToGTTWithoutExpiryAt", - CannotAmendFromGFAOrGFN = "CannotAmendFromGFAOrGFN", - CannotAmendPeggedOrderDetailsOnNonPeggedOrder = "CannotAmendPeggedOrderDetailsOnNonPeggedOrder", - CannotAmendToFOKOrIOC = "CannotAmendToFOKOrIOC", - CannotAmendToGFAOrGFN = "CannotAmendToGFAOrGFN", - EditNotAllowed = "EditNotAllowed", - ExpiryAtBeforeCreatedAt = "ExpiryAtBeforeCreatedAt", - FOKOrderDuringAuction = "FOKOrderDuringAuction", - GFAOrderDuringContinuousTrading = "GFAOrderDuringContinuousTrading", - GFNOrderDuringAuction = "GFNOrderDuringAuction", - GTCWithExpiryAtNotValid = "GTCWithExpiryAtNotValid", - IOCOrderDuringAuction = "IOCOrderDuringAuction", - InsufficientAssetBalance = "InsufficientAssetBalance", - InsufficientFundsToPayFees = "InsufficientFundsToPayFees", - InternalError = "InternalError", - InvalidExpirationTime = "InvalidExpirationTime", - InvalidMarketId = "InvalidMarketId", - InvalidMarketType = "InvalidMarketType", - InvalidOrderId = "InvalidOrderId", - InvalidOrderReference = "InvalidOrderReference", - InvalidPartyId = "InvalidPartyId", - InvalidPersistence = "InvalidPersistence", - InvalidRemainingSize = "InvalidRemainingSize", - InvalidSize = "InvalidSize", - InvalidTimeInForce = "InvalidTimeInForce", - InvalidType = "InvalidType", - MarginCheckFailed = "MarginCheckFailed", - MarketClosed = "MarketClosed", - MissingGeneralAccount = "MissingGeneralAccount", - NonPersistentOrderExceedsPriceBounds = "NonPersistentOrderExceedsPriceBounds", - OrderAmendFailure = "OrderAmendFailure", - OrderNotFound = "OrderNotFound", - OrderOutOfSequence = "OrderOutOfSequence", - OrderRemovalFailure = "OrderRemovalFailure", - PeggedOrderBuyCannotReferenceBestAskPrice = "PeggedOrderBuyCannotReferenceBestAskPrice", - PeggedOrderMustBeGTTOrGTC = "PeggedOrderMustBeGTTOrGTC", - PeggedOrderMustBeLimitOrder = "PeggedOrderMustBeLimitOrder", - PeggedOrderOffsetMustBeGreaterOrEqualToZero = "PeggedOrderOffsetMustBeGreaterOrEqualToZero", - PeggedOrderOffsetMustBeGreaterThanZero = "PeggedOrderOffsetMustBeGreaterThanZero", - PeggedOrderSellCannotReferenceBestBidPrice = "PeggedOrderSellCannotReferenceBestBidPrice", - PeggedOrderWithoutReferencePrice = "PeggedOrderWithoutReferencePrice", - SelfTrading = "SelfTrading", - TimeFailure = "TimeFailure", - UnableToAmendPeggedOrderPrice = "UnableToAmendPeggedOrderPrice", - UnableToRepricePeggedOrder = "UnableToRepricePeggedOrder", + ORDER_ERROR_AMEND_FAILURE = "ORDER_ERROR_AMEND_FAILURE", + ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = "ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE", + ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = "ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN", + ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = "ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER", + ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = "ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC", + ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = "ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN", + ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = "ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT", + ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = "ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT", + ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = "ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION", + ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = "ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION", + ORDER_ERROR_EDIT_NOT_ALLOWED = "ORDER_ERROR_EDIT_NOT_ALLOWED", + ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = "ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT", + ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = "ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING", + ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = "ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION", + ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = "ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE", + ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = "ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES", + ORDER_ERROR_INTERNAL_ERROR = "ORDER_ERROR_INTERNAL_ERROR", + ORDER_ERROR_INVALID_EXPIRATION_DATETIME = "ORDER_ERROR_INVALID_EXPIRATION_DATETIME", + ORDER_ERROR_INVALID_MARKET_ID = "ORDER_ERROR_INVALID_MARKET_ID", + ORDER_ERROR_INVALID_ORDER_ID = "ORDER_ERROR_INVALID_ORDER_ID", + ORDER_ERROR_INVALID_ORDER_REFERENCE = "ORDER_ERROR_INVALID_ORDER_REFERENCE", + ORDER_ERROR_INVALID_PARTY_ID = "ORDER_ERROR_INVALID_PARTY_ID", + ORDER_ERROR_INVALID_PERSISTENCE = "ORDER_ERROR_INVALID_PERSISTENCE", + ORDER_ERROR_INVALID_REMAINING_SIZE = "ORDER_ERROR_INVALID_REMAINING_SIZE", + ORDER_ERROR_INVALID_SIZE = "ORDER_ERROR_INVALID_SIZE", + ORDER_ERROR_INVALID_TIME_IN_FORCE = "ORDER_ERROR_INVALID_TIME_IN_FORCE", + ORDER_ERROR_INVALID_TYPE = "ORDER_ERROR_INVALID_TYPE", + ORDER_ERROR_MARGIN_CHECK_FAILED = "ORDER_ERROR_MARGIN_CHECK_FAILED", + ORDER_ERROR_MARKET_CLOSED = "ORDER_ERROR_MARKET_CLOSED", + ORDER_ERROR_MISSING_GENERAL_ACCOUNT = "ORDER_ERROR_MISSING_GENERAL_ACCOUNT", + ORDER_ERROR_MUST_BE_GTT_OR_GTC = "ORDER_ERROR_MUST_BE_GTT_OR_GTC", + ORDER_ERROR_MUST_BE_LIMIT_ORDER = "ORDER_ERROR_MUST_BE_LIMIT_ORDER", + ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = "ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS", + ORDER_ERROR_NOT_FOUND = "ORDER_ERROR_NOT_FOUND", + ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = "ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO", + ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = "ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO", + ORDER_ERROR_OUT_OF_SEQUENCE = "ORDER_ERROR_OUT_OF_SEQUENCE", + ORDER_ERROR_REMOVAL_FAILURE = "ORDER_ERROR_REMOVAL_FAILURE", + ORDER_ERROR_SELF_TRADING = "ORDER_ERROR_SELF_TRADING", + ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = "ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE", + ORDER_ERROR_TIME_FAILURE = "ORDER_ERROR_TIME_FAILURE", + ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = "ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER", + ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = "ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER", + ORDER_ERROR_WITHOUT_REFERENCE_PRICE = "ORDER_ERROR_WITHOUT_REFERENCE_PRICE", } /** * Valid order statuses, these determine several states for an order that cannot be expressed with other fields in Order. */ export enum OrderStatus { - Active = "Active", - Cancelled = "Cancelled", - Expired = "Expired", - Filled = "Filled", - Parked = "Parked", - PartiallyFilled = "PartiallyFilled", - Rejected = "Rejected", - Stopped = "Stopped", + STATUS_ACTIVE = "STATUS_ACTIVE", + STATUS_CANCELLED = "STATUS_CANCELLED", + STATUS_EXPIRED = "STATUS_EXPIRED", + STATUS_FILLED = "STATUS_FILLED", + STATUS_PARKED = "STATUS_PARKED", + STATUS_PARTIALLY_FILLED = "STATUS_PARTIALLY_FILLED", + STATUS_REJECTED = "STATUS_REJECTED", + STATUS_STOPPED = "STATUS_STOPPED", } /** * Valid order types, these determine what happens when an order is added to the book */ export enum OrderTimeInForce { - FOK = "FOK", - GFA = "GFA", - GFN = "GFN", - GTC = "GTC", - GTT = "GTT", - IOC = "IOC", + TIME_IN_FORCE_FOK = "TIME_IN_FORCE_FOK", + TIME_IN_FORCE_GFA = "TIME_IN_FORCE_GFA", + TIME_IN_FORCE_GFN = "TIME_IN_FORCE_GFN", + TIME_IN_FORCE_GTC = "TIME_IN_FORCE_GTC", + TIME_IN_FORCE_GTT = "TIME_IN_FORCE_GTT", + TIME_IN_FORCE_IOC = "TIME_IN_FORCE_IOC", } export enum OrderType { - Limit = "Limit", - Market = "Market", - Network = "Network", + TYPE_LIMIT = "TYPE_LIMIT", + TYPE_MARKET = "TYPE_MARKET", + TYPE_NETWORK = "TYPE_NETWORK", } /** @@ -226,55 +224,56 @@ export enum OrderType { * engine. */ export enum PropertyKeyType { - TypeBoolean = "TypeBoolean", - TypeDecimal = "TypeDecimal", - TypeEmpty = "TypeEmpty", - TypeInteger = "TypeInteger", - TypeString = "TypeString", - TypeTimestamp = "TypeTimestamp", + TYPE_BOOLEAN = "TYPE_BOOLEAN", + TYPE_DECIMAL = "TYPE_DECIMAL", + TYPE_EMPTY = "TYPE_EMPTY", + TYPE_INTEGER = "TYPE_INTEGER", + TYPE_STRING = "TYPE_STRING", + TYPE_TIMESTAMP = "TYPE_TIMESTAMP", } /** * Reason for the proposal being rejected by the core node */ export enum ProposalRejectionReason { - CloseTimeTooLate = "CloseTimeTooLate", - CloseTimeTooSoon = "CloseTimeTooSoon", - CouldNotInstantiateMarket = "CouldNotInstantiateMarket", - EnactTimeTooLate = "EnactTimeTooLate", - EnactTimeTooSoon = "EnactTimeTooSoon", - IncompatibleTimestamps = "IncompatibleTimestamps", - InsufficientEquityLikeShare = "InsufficientEquityLikeShare", - InsufficientTokens = "InsufficientTokens", - InvalidAsset = "InvalidAsset", - InvalidAssetDetails = "InvalidAssetDetails", - InvalidFeeAmount = "InvalidFeeAmount", - InvalidFutureMaturityTimestamp = "InvalidFutureMaturityTimestamp", - InvalidFutureProduct = "InvalidFutureProduct", - InvalidInstrumentSecurity = "InvalidInstrumentSecurity", - InvalidMarket = "InvalidMarket", - InvalidRiskParameter = "InvalidRiskParameter", - InvalidShape = "InvalidShape", - MajorityThresholdNotReached = "MajorityThresholdNotReached", - MarketMissingLiquidityCommitment = "MarketMissingLiquidityCommitment", - MissingBuiltinAssetField = "MissingBuiltinAssetField", - MissingCommitmentAmount = "MissingCommitmentAmount", - MissingERC20ContractAddress = "MissingERC20ContractAddress", - NetworkParameterInvalidKey = "NetworkParameterInvalidKey", - NetworkParameterInvalidValue = "NetworkParameterInvalidValue", - NetworkParameterValidationFailed = "NetworkParameterValidationFailed", - NoProduct = "NoProduct", - NoRiskParameters = "NoRiskParameters", - NoTradingMode = "NoTradingMode", - NodeValidationFailed = "NodeValidationFailed", - OpeningAuctionDurationTooLarge = "OpeningAuctionDurationTooLarge", - OpeningAuctionDurationTooSmall = "OpeningAuctionDurationTooSmall", - ParticipationThresholdNotReached = "ParticipationThresholdNotReached", - ProductMaturityIsPassed = "ProductMaturityIsPassed", - TooManyMarketDecimalPlaces = "TooManyMarketDecimalPlaces", - TooManyPriceMonitoringTriggers = "TooManyPriceMonitoringTriggers", - UnsupportedProduct = "UnsupportedProduct", - UnsupportedTradingMode = "UnsupportedTradingMode", + PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = "PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE", + PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = "PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON", + PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = "PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET", + PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = "PROPOSAL_ERROR_ENACT_TIME_TOO_LATE", + PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = "PROPOSAL_ERROR_ENACT_TIME_TOO_SOON", + PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = "PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS", + PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = "PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE", + PROPOSAL_ERROR_INSUFFICIENT_TOKENS = "PROPOSAL_ERROR_INSUFFICIENT_TOKENS", + PROPOSAL_ERROR_INVALID_ASSET = "PROPOSAL_ERROR_INVALID_ASSET", + PROPOSAL_ERROR_INVALID_ASSET_DETAILS = "PROPOSAL_ERROR_INVALID_ASSET_DETAILS", + PROPOSAL_ERROR_INVALID_FEE_AMOUNT = "PROPOSAL_ERROR_INVALID_FEE_AMOUNT", + PROPOSAL_ERROR_INVALID_FREEFORM = "PROPOSAL_ERROR_INVALID_FREEFORM", + PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = "PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT", + PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = "PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY", + PROPOSAL_ERROR_INVALID_MARKET = "PROPOSAL_ERROR_INVALID_MARKET", + PROPOSAL_ERROR_INVALID_RISK_PARAMETER = "PROPOSAL_ERROR_INVALID_RISK_PARAMETER", + PROPOSAL_ERROR_INVALID_SHAPE = "PROPOSAL_ERROR_INVALID_SHAPE", + PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = "PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED", + PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = "PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT", + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = "PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD", + PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = "PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT", + PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = "PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS", + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = "PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY", + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = "PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE", + PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = "PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED", + PROPOSAL_ERROR_NODE_VALIDATION_FAILED = "PROPOSAL_ERROR_NODE_VALIDATION_FAILED", + PROPOSAL_ERROR_NO_PRODUCT = "PROPOSAL_ERROR_NO_PRODUCT", + PROPOSAL_ERROR_NO_RISK_PARAMETERS = "PROPOSAL_ERROR_NO_RISK_PARAMETERS", + PROPOSAL_ERROR_NO_TRADING_MODE = "PROPOSAL_ERROR_NO_TRADING_MODE", + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = "PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE", + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = "PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL", + PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = "PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED", + PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = "PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES", + PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = "PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS", + PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = "PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE", + PROPOSAL_ERROR_UNKNOWN_TYPE = "PROPOSAL_ERROR_UNKNOWN_TYPE", + PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = "PROPOSAL_ERROR_UNSUPPORTED_PRODUCT", + PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = "PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE", } /** @@ -285,44 +284,50 @@ export enum ProposalRejectionReason { * Proposal can enter Failed state from any other state. */ export enum ProposalState { - Declined = "Declined", - Enacted = "Enacted", - Failed = "Failed", - Open = "Open", - Passed = "Passed", - Rejected = "Rejected", - WaitingForNodeVote = "WaitingForNodeVote", + STATE_DECLINED = "STATE_DECLINED", + STATE_ENACTED = "STATE_ENACTED", + STATE_FAILED = "STATE_FAILED", + STATE_OPEN = "STATE_OPEN", + STATE_PASSED = "STATE_PASSED", + STATE_REJECTED = "STATE_REJECTED", + STATE_WAITING_FOR_NODE_VOTE = "STATE_WAITING_FOR_NODE_VOTE", } /** * Whether the placer of an order is aiming to buy or sell on the market */ export enum Side { - Buy = "Buy", - Sell = "Sell", + SIDE_BUY = "SIDE_BUY", + SIDE_SELL = "SIDE_SELL", } /** * The status of the stake linking */ export enum StakeLinkingStatus { - Accepted = "Accepted", - Pending = "Pending", - Rejected = "Rejected", + STATUS_ACCEPTED = "STATUS_ACCEPTED", + STATUS_PENDING = "STATUS_PENDING", + STATUS_REJECTED = "STATUS_REJECTED", +} + +export enum ValidatorStatus { + VALIDATOR_NODE_STATUS_ERSATZ = "VALIDATOR_NODE_STATUS_ERSATZ", + VALIDATOR_NODE_STATUS_PENDING = "VALIDATOR_NODE_STATUS_PENDING", + VALIDATOR_NODE_STATUS_TENDERMINT = "VALIDATOR_NODE_STATUS_TENDERMINT", } export enum VoteValue { - No = "No", - Yes = "Yes", + VALUE_NO = "VALUE_NO", + VALUE_YES = "VALUE_YES", } /** * The status of a withdrawal */ export enum WithdrawalStatus { - Finalized = "Finalized", - Open = "Open", - Rejected = "Rejected", + STATUS_FINALIZED = "STATUS_FINALIZED", + STATUS_OPEN = "STATUS_OPEN", + STATUS_REJECTED = "STATUS_REJECTED", } /** diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts new file mode 100644 index 000000000..816b70055 --- /dev/null +++ b/libs/types/src/global-types-mappings.ts @@ -0,0 +1,277 @@ +export enum AccountTypeMapping { + ACCOUNT_TYPE_BOND = 'BOND', + ACCOUNT_TYPE_EXTERNAL = 'EXTERNAL', + ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'FEES_INFRASTRUCTURE', + ACCOUNT_TYPE_FEES_LIQUIDITY = 'FEES_LIQUIDITY', + ACCOUNT_TYPE_FEES_MAKER = 'FEES_MAKER', + ACCOUNT_TYPE_GENERAL = 'GENERAL', + ACCOUNT_TYPE_GLOBAL_INSURANCE = 'GLOBAL_INSURANCE', + ACCOUNT_TYPE_GLOBAL_REWARD = 'GLOBAL_REWARD', + ACCOUNT_TYPE_INSURANCE = 'INSURANCE', + ACCOUNT_TYPE_MARGIN = 'MARGIN', + ACCOUNT_TYPE_PENDING_TRANSFERS = 'PENDING_TRANSFERS', + ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'REWARD_LP_RECEIVED_FEES', + ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'REWARD_MAKER_RECEIVED_FEES', + ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'REWARD_MARKET_PROPOSERS', + ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'REWARD_TAKER_PAID_FEES', + ACCOUNT_TYPE_SETTLEMENT = 'SETTLEMENT', +} + +export enum AuctionTriggerMapping { + AUCTION_TRIGGER_BATCH = 'BATCH', + AUCTION_TRIGGER_LIQUIDITY = 'LIQUIDITY', + AUCTION_TRIGGER_OPENING = 'OPENING', + AUCTION_TRIGGER_PRICE = 'PRICE', + AUCTION_TRIGGER_UNSPECIFIED = 'UNSPECIFIED', +} + +/** + * Comparator describes the type of comparison. + */ +export enum ConditionOperatorMapping { + OPERATOR_EQUALS = 'EQUALS', + OPERATOR_GREATER_THAN = 'GREATER_THAN', + OPERATOR_GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL', + OPERATOR_LESS_THAN = 'LESS_THAN', + OPERATOR_LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL', +} + +/** + * The status of a deposit + */ +export enum DepositStatusMapping { + STATUS_CANCELLED = 'CANCELLED', + STATUS_FINALIZED = 'FINALIZED', + STATUS_OPEN = 'OPEN', +} + +/** + * The interval for trade candles when subscribing via Vega GraphQL, default is I15M + */ +export enum IntervalMapping { + INTERVAL_I15M = 'I15M', + INTERVAL_I1D = 'I1D', + INTERVAL_I1H = 'I1H', + INTERVAL_I1M = 'I1M', + INTERVAL_I5M = 'I5M', + INTERVAL_I6H = 'I6H', +} + +/** + * The current state of a market + */ +export enum MarketStateMapping { + STATE_ACTIVE = 'ACTIVE', + STATE_CANCELLED = 'CANCELLED', + STATE_CLOSED = 'CLOSED', + STATE_PENDING = 'PENDING', + STATE_PROPOSED = 'PROPOSED', + STATE_REJECTED = 'REJECTED', + STATE_SETTLED = 'SETTLED', + STATE_SUSPENDED = 'SUSPENDED', + STATE_TRADING_TERMINATED = 'TRADING_TERMINATED', +} + +/** + * What market trading mode is the market in + */ +export enum MarketTradingModeMapping { + TRADING_MODE_BATCH_AUCTION = 'Batch auction', + TRADING_MODE_CONTINUOUS = 'Continuous trading', + TRADING_MODE_MONITORING_AUCTION = 'Monitoring auction', + TRADING_MODE_NO_TRADING = 'No trading', + TRADING_MODE_OPENING_AUCTION = 'Opening auction', +} + +export enum NodeStatusMapping { + NODE_STATUS_NON_VALIDATOR = 'Non validator', + NODE_STATUS_VALIDATOR = 'Validator', +} + +/** + * Status describe the status of the oracle spec + */ +export enum OracleSpecStatusMapping { + STATUS_ACTIVE = 'Active', + STATUS_DEACTIVATED = 'Deactivated', +} + +/** + * Reason for the order being rejected by the core node + */ +export enum OrderRejectionReasonMapping { + ORDER_ERROR_AMEND_FAILURE = 'AMEND_FAILURE', + ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'BUY_CANNOT_REFERENCE_BEST_ASK_PRICE', + ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 'CANNOT_AMEND_FROM_GFA_OR_GFN', + ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 'CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER', + ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 'CANNOT_AMEND_TO_FOK_OR_IOC', + ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 'CANNOT_AMEND_TO_GFA_OR_GFN', + ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT', + ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'CANNOT_HAVE_GTC_AND_EXPIRYAT', + ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 'CANNOT_SEND_FOK_ORDER_DURING_AUCTION', + ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'CANNOT_SEND_IOC_ORDER_DURING_AUCTION', + ORDER_ERROR_EDIT_NOT_ALLOWED = 'EDIT_NOT_ALLOWED', + ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'EXPIRYAT_BEFORE_CREATEDAT', + ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'GFA_ORDER_DURING_CONTINUOUS_TRADING', + ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = 'GFN_ORDER_DURING_AN_AUCTION', + ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'INSUFFICIENT_ASSET_BALANCE', + ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'INSUFFICIENT_FUNDS_TO_PAY_FEES', + ORDER_ERROR_INTERNAL_ERROR = 'INTERNAL_ERROR', + ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'INVALID_EXPIRATION_DATETIME', + ORDER_ERROR_INVALID_MARKET_ID = 'INVALID_MARKET_ID', + ORDER_ERROR_INVALID_ORDER_ID = 'INVALID_ORDER_ID', + ORDER_ERROR_INVALID_ORDER_REFERENCE = 'INVALID_ORDER_REFERENCE', + ORDER_ERROR_INVALID_PARTY_ID = 'INVALID_PARTY_ID', + ORDER_ERROR_INVALID_PERSISTENCE = 'INVALID_PERSISTENCE', + ORDER_ERROR_INVALID_REMAINING_SIZE = 'INVALID_REMAINING_SIZE', + ORDER_ERROR_INVALID_SIZE = 'INVALID_SIZE', + ORDER_ERROR_INVALID_TIME_IN_FORCE = 'INVALID_TIME_IN_FORCE', + ORDER_ERROR_INVALID_TYPE = 'INVALID_TYPE', + ORDER_ERROR_MARGIN_CHECK_FAILED = 'MARGIN_CHECK_FAILED', + ORDER_ERROR_MARKET_CLOSED = 'MARKET_CLOSED', + ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'MISSING_GENERAL_ACCOUNT', + ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'MUST_BE_GTT_OR_GTC', + ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'MUST_BE_LIMIT_ORDER', + ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS', + ORDER_ERROR_NOT_FOUND = 'NOT_FOUND', + ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 'OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO', + ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'OFFSET_MUST_BE_GREATER_THAN_ZERO', + ORDER_ERROR_OUT_OF_SEQUENCE = 'OUT_OF_SEQUENCE', + ORDER_ERROR_REMOVAL_FAILURE = 'REMOVAL_FAILURE', + ORDER_ERROR_SELF_TRADING = 'SELF_TRADING', + ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'SELL_CANNOT_REFERENCE_BEST_BID_PRICE', + ORDER_ERROR_TIME_FAILURE = 'TIME_FAILURE', + ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 'UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER', + ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 'UNABLE_TO_REPRICE_PEGGED_ORDER', + ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'WITHOUT_REFERENCE_PRICE', +} + +/** + * Valid order statuses, these determine several states for an order that cannot be expressed with other fields in Order. + */ +export enum OrderStatusMapping { + STATUS_ACTIVE = 'Active', + STATUS_CANCELLED = 'Cancelled', + STATUS_EXPIRED = 'Expired', + STATUS_FILLED = 'Filled', + STATUS_PARKED = 'Parked', + STATUS_PARTIALLY_FILLED = 'PartiallyFilled', + STATUS_REJECTED = 'Rejected', + STATUS_STOPPED = 'Stopped', +} + +/** + * Valid order types, these determine what happens when an order is added to the book + */ +export enum OrderTimeInForceMapping { + TIME_IN_FORCE_FOK = 'Fill or Kill (FOK)', + TIME_IN_FORCE_GFA = 'Good for Auction (GFA)', + TIME_IN_FORCE_GFN = 'Good for Normal (GFN)', + TIME_IN_FORCE_GTC = `Good 'till Cancel (GTC)`, + TIME_IN_FORCE_GTT = `Good 'till Time (GTT)`, + TIME_IN_FORCE_IOC = 'Immediate or Cancel (IOC)', +} + +export enum OrderTypeMapping { + TYPE_LIMIT = 'Limit', + TYPE_MARKET = 'Market', + TYPE_NETWORK = 'Network', +} + +/** + * Reason for the proposal being rejected by the core node + */ +export enum ProposalRejectionReasonMapping { + PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'CLOSE_TIME_TOO_LATE', + PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'CLOSE_TIME_TOO_SOON', + PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'COULD_NOT_INSTANTIATE_MARKET', + PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 'ENACT_TIME_TOO_LATE', + PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'ENACT_TIME_TOO_SOON', + PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'INCOMPATIBLE_TIMESTAMPS', + PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'INSUFFICIENT_EQUITY_LIKE_SHARE', + PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'INSUFFICIENT_TOKENS', + PROPOSAL_ERROR_INVALID_ASSET = 'INVALID_ASSET', + PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'INVALID_ASSET_DETAILS', + PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'INVALID_FEE_AMOUNT', + PROPOSAL_ERROR_INVALID_FREEFORM = 'INVALID_FREEFORM', + PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'INVALID_FUTURE_PRODUCT', + PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'INVALID_INSTRUMENT_SECURITY', + PROPOSAL_ERROR_INVALID_MARKET = 'INVALID_MARKET', + PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'INVALID_RISK_PARAMETER', + PROPOSAL_ERROR_INVALID_SHAPE = 'INVALID_SHAPE', + PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'MAJORITY_THRESHOLD_NOT_REACHED', + PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'MARKET_MISSING_LIQUIDITY_COMMITMENT', + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'MISSING_BUILTIN_ASSET_FIELD', + PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'MISSING_COMMITMENT_AMOUNT', + PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'MISSING_ERC20_CONTRACT_ADDRESS', + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'NETWORK_PARAMETER_INVALID_KEY', + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'NETWORK_PARAMETER_INVALID_VALUE', + PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'NETWORK_PARAMETER_VALIDATION_FAILED', + PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'NODE_VALIDATION_FAILED', + PROPOSAL_ERROR_NO_PRODUCT = 'NO_PRODUCT', + PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'NO_RISK_PARAMETERS', + PROPOSAL_ERROR_NO_TRADING_MODE = 'NO_TRADING_MODE', + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 'OPENING_AUCTION_DURATION_TOO_LARGE', + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'OPENING_AUCTION_DURATION_TOO_SMALL', + PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'PARTICIPATION_THRESHOLD_NOT_REACHED', + PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 'TOO_MANY_MARKET_DECIMAL_PLACES', + PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'TOO_MANY_PRICE_MONITORING_TRIGGERS', + PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 'UNKNOWN_RISK_PARAMETER_TYPE', + PROPOSAL_ERROR_UNKNOWN_TYPE = 'UNKNOWN_TYPE', + PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'UNSUPPORTED_PRODUCT', + PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'UNSUPPORTED_TRADING_MODE', +} + +/** + * Various states a proposal can transition through: + * Open -> + * - Passed -> Enacted. + * - Rejected. + * Proposal can enter Failed state from any other state. + */ +export enum ProposalStateMapping { + STATE_DECLINED = 'Declined', + STATE_ENACTED = 'Enacted', + STATE_FAILED = 'Failed', + STATE_OPEN = 'Open', + STATE_PASSED = 'Passed', + STATE_REJECTED = 'Rejected', + STATE_WAITING_FOR_NODE_VOTE = 'Waiting for Node Vote', +} + +/** + * Whether the placer of an order is aiming to buy or sell on the market + */ +export enum SideMapping { + SIDE_BUY = 'Long', + SIDE_SELL = 'Short', +} + +/** + * The status of the stake linking + */ +export enum StakeLinkingStatusMapping { + STATUS_ACCEPTED = 'Accepted', + STATUS_PENDING = 'Pending', + STATUS_REJECTED = 'Rejected', +} + +export enum ValidatorStatusMapping { + VALIDATOR_NODE_STATUS_ERSATZ = 'ERSATZ', + VALIDATOR_NODE_STATUS_PENDING = 'PENDING', + VALIDATOR_NODE_STATUS_TENDERMINT = 'TENDERMINT', +} + +export enum VoteValueMapping { + VALUE_NO = 'No', + VALUE_YES = 'Yes', +} + +/** + * The status of a withdrawal + */ +export enum WithdrawalStatusMapping { + STATUS_FINALIZED = 'Finalized', + STATUS_OPEN = 'Open', + STATUS_REJECTED = 'Rejected', +} diff --git a/libs/types/src/index.ts b/libs/types/src/index.ts index a1cf99672..a0640b110 100644 --- a/libs/types/src/index.ts +++ b/libs/types/src/index.ts @@ -1,2 +1,3 @@ export * from './__generated__'; export * from './candle'; +export * from './global-types-mappings'; diff --git a/libs/wallet/src/wallet-types.ts b/libs/wallet/src/wallet-types.ts index e78460a72..3332fbc73 100644 --- a/libs/wallet/src/wallet-types.ts +++ b/libs/wallet/src/wallet-types.ts @@ -1,6 +1,12 @@ import type { z } from 'zod'; import type { GetKeysSchema, TransactionResponseSchema } from './connectors'; import type { IterableElement } from 'type-fest'; +import type { + OrderTimeInForce, + OrderType, + Side, + VoteValue, +} from '@vegaprotocol/types'; interface BaseTransaction { pubKey: string; @@ -26,9 +32,9 @@ export interface OrderSubmissionBody extends BaseTransaction { orderSubmission: { marketId: string; reference?: string; - type: VegaWalletOrderType; - side: VegaWalletOrderSide; - timeInForce: VegaWalletOrderTimeInForce; + type: OrderType; + side: Side; + timeInForce: OrderTimeInForce; size: string; price?: string; expiresAt?: string; @@ -47,22 +53,16 @@ export interface OrderAmendmentBody extends BaseTransaction { marketId: string; orderId: string; reference?: string; - timeInForce: VegaWalletOrderTimeInForce; + timeInForce: OrderTimeInForce; sizeDelta?: number; - // Note this is soon changing to price?: string - price?: { - value: string; - }; - // Note this is soon changing to expiresAt?: number - expiresAt?: { - value: string; - }; + price?: string; + expiresAt?: string; }; } export interface VoteSubmissionBody extends BaseTransaction { voteSubmission: { - value: VegaWalletVoteValue; + value: VoteValue; proposalId: string; }; } @@ -162,7 +162,6 @@ interface ProposalNewAssetTerms { changes: { name: string; symbol: string; - totalSupply: string; decimals: string; quantum: string; erc20: { @@ -244,30 +243,6 @@ export interface ProposalSubmissionBody extends BaseTransaction { proposalSubmission: ProposalSubmission; } -export enum VegaWalletVoteValue { - Yes = 'VALUE_YES', - No = 'VALUE_NO', -} - -export enum VegaWalletOrderType { - Market = 'TYPE_MARKET', - Limit = 'TYPE_LIMIT', -} - -export enum VegaWalletOrderSide { - Buy = 'SIDE_BUY', - Sell = 'SIDE_SELL', -} - -export enum VegaWalletOrderTimeInForce { - GTC = 'TIME_IN_FORCE_GTC', - GTT = 'TIME_IN_FORCE_GTT', - IOC = 'TIME_IN_FORCE_IOC', - FOK = 'TIME_IN_FORCE_FOK', - GFN = 'TIME_IN_FORCE_GFN', - GFA = 'TIME_IN_FORCE_GFA', -} - // Will make Transaction a union type as other transactions are added export type TransactionSubmission = | OrderSubmissionBody diff --git a/libs/withdraws/src/lib/__generated__/Erc20Approval.ts b/libs/withdraws/src/lib/__generated__/Erc20Approval.ts index 357cbaeb2..5f5343224 100644 --- a/libs/withdraws/src/lib/__generated__/Erc20Approval.ts +++ b/libs/withdraws/src/lib/__generated__/Erc20Approval.ts @@ -42,7 +42,7 @@ export interface Erc20Approval_erc20WithdrawalApproval { export interface Erc20Approval { /** - * find an erc20 withdrawal approval using its withdrawal id + * find an erc20 withdrawal approval using its withdrawal ID */ erc20WithdrawalApproval: Erc20Approval_erc20WithdrawalApproval | null; } diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts index 00b9bc3be..1e296daff 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts @@ -16,7 +16,7 @@ export interface WithdrawalEvent_busEvents_event_TimeUpdate { export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -24,7 +24,7 @@ export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { */ symbol: string; /** - * The precision of the asset + * 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; } @@ -40,7 +40,7 @@ export interface WithdrawalEvent_busEvents_event_Withdrawal_details { export interface WithdrawalEvent_busEvents_event_Withdrawal { __typename: "Withdrawal"; /** - * The Vega internal id of the withdrawal + * The Vega internal ID of the withdrawal */ id: string; /** @@ -60,7 +60,7 @@ export interface WithdrawalEvent_busEvents_event_Withdrawal { */ createdTimestamp: string; /** - * RFC3339Nano time at which the withdrawal was finalized + * RFC3339Nano time at which the withdrawal was finalised */ withdrawnTimestamp: string | null; /** diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts index 4f48582b8..49a87274f 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts @@ -12,7 +12,7 @@ import { WithdrawalStatus } from "@vegaprotocol/types"; export interface WithdrawalFields_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -20,7 +20,7 @@ export interface WithdrawalFields_asset { */ symbol: string; /** - * The precision of the asset + * 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; } @@ -36,7 +36,7 @@ export interface WithdrawalFields_details { export interface WithdrawalFields { __typename: "Withdrawal"; /** - * The Vega internal id of the withdrawal + * The Vega internal ID of the withdrawal */ id: string; /** @@ -56,7 +56,7 @@ export interface WithdrawalFields { */ createdTimestamp: string; /** - * RFC3339Nano time at which the withdrawal was finalized + * RFC3339Nano time at which the withdrawal was finalised */ withdrawnTimestamp: string | null; /** diff --git a/libs/withdraws/src/lib/__generated__/Withdrawals.ts b/libs/withdraws/src/lib/__generated__/Withdrawals.ts index 4f6350e25..6f437780d 100644 --- a/libs/withdraws/src/lib/__generated__/Withdrawals.ts +++ b/libs/withdraws/src/lib/__generated__/Withdrawals.ts @@ -12,7 +12,7 @@ import { WithdrawalStatus } from "@vegaprotocol/types"; export interface Withdrawals_party_withdrawals_asset { __typename: "Asset"; /** - * The id of the asset + * The ID of the asset */ id: string; /** @@ -20,7 +20,7 @@ export interface Withdrawals_party_withdrawals_asset { */ symbol: string; /** - * The precision of the asset + * 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; } @@ -36,7 +36,7 @@ export interface Withdrawals_party_withdrawals_details { export interface Withdrawals_party_withdrawals { __typename: "Withdrawal"; /** - * The Vega internal id of the withdrawal + * The Vega internal ID of the withdrawal */ id: string; /** @@ -56,7 +56,7 @@ export interface Withdrawals_party_withdrawals { */ createdTimestamp: string; /** - * RFC3339Nano time at which the withdrawal was finalized + * RFC3339Nano time at which the withdrawal was finalised */ withdrawnTimestamp: string | null; /** @@ -87,7 +87,7 @@ export interface Withdrawals_party { export interface Withdrawals { /** - * An entity that is trading on the VEGA network + * An entity that is trading on the Vega network */ party: Withdrawals_party | null; } diff --git a/libs/withdraws/src/lib/test-helpers.ts b/libs/withdraws/src/lib/test-helpers.ts index 28168f00a..d19a84a51 100644 --- a/libs/withdraws/src/lib/test-helpers.ts +++ b/libs/withdraws/src/lib/test-helpers.ts @@ -22,7 +22,7 @@ export const generateAsset = (override?: PartialDeep) => { export const generateAccount = (override?: PartialDeep) => { const defaultAccount: Account = { - type: AccountType.General, + type: AccountType.ACCOUNT_TYPE_GENERAL, balance: '100000', asset: { id: 'asset-id', @@ -39,7 +39,7 @@ export const generateWithdrawal = ( { __typename: 'Withdrawal', id: 'withdrawal-id', - status: WithdrawalStatus.Open, + status: WithdrawalStatus.STATUS_OPEN, amount: '100', asset: { __typename: 'Asset', diff --git a/libs/withdraws/src/lib/use-withdrawals.spec.tsx b/libs/withdraws/src/lib/use-withdrawals.spec.tsx index 53fc1c875..cc00b1fa8 100644 --- a/libs/withdraws/src/lib/use-withdrawals.spec.tsx +++ b/libs/withdraws/src/lib/use-withdrawals.spec.tsx @@ -14,11 +14,11 @@ describe('updateQuery', () => { it('Updates existing withdrawals', () => { const withdrawal = generateWithdrawal({ id: '1', - status: WithdrawalStatus.Open, + status: WithdrawalStatus.STATUS_OPEN, }); const withdrawalUpdate = generateWithdrawal({ id: '1', - status: WithdrawalStatus.Finalized, + status: WithdrawalStatus.STATUS_FINALIZED, }); const prev = mockQuery([withdrawal]); const incoming = mockSub([withdrawalUpdate]); @@ -70,14 +70,14 @@ describe('updateQuery', () => { it('Handles updates and inserts simultaneously', () => { const withdrawal1 = generateWithdrawal({ id: '1', - status: WithdrawalStatus.Open, + status: WithdrawalStatus.STATUS_OPEN, }); const withdrawal2 = generateWithdrawal({ id: '2', }); const withdrawalUpdate = generateWithdrawal({ id: '1', - status: WithdrawalStatus.Finalized, + status: WithdrawalStatus.STATUS_FINALIZED, }); const withdrawalNew = generateWithdrawal({ id: '3', diff --git a/libs/withdraws/src/lib/withdraw-manager.tsx b/libs/withdraws/src/lib/withdraw-manager.tsx index 7f13a7265..b39f6cbbd 100644 --- a/libs/withdraws/src/lib/withdraw-manager.tsx +++ b/libs/withdraws/src/lib/withdraw-manager.tsx @@ -38,7 +38,8 @@ export const WithdrawManager = ({ const account = useMemo(() => { return accounts.find( - (a) => a.type === AccountType.General && a.asset.id === asset?.id + (a) => + a.type === AccountType.ACCOUNT_TYPE_GENERAL && a.asset.id === asset?.id ); }, [asset, accounts]); diff --git a/libs/withdraws/src/lib/withdrawals-table.spec.tsx b/libs/withdraws/src/lib/withdrawals-table.spec.tsx index 88277e1c7..b2095fdf4 100644 --- a/libs/withdraws/src/lib/withdrawals-table.spec.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.spec.tsx @@ -70,7 +70,7 @@ describe('StatusCell', () => { }); it('Open', () => { - props.value = WithdrawalStatus.Finalized; + props.value = WithdrawalStatus.STATUS_FINALIZED; props.data.pendingOnForeignChain = false; props.data.txHash = null; render(); @@ -83,7 +83,7 @@ describe('StatusCell', () => { }); it('Pending', () => { - props.value = WithdrawalStatus.Finalized; + props.value = WithdrawalStatus.STATUS_FINALIZED; props.data.pendingOnForeignChain = true; props.data.txHash = '0x123'; render(); @@ -96,7 +96,7 @@ describe('StatusCell', () => { }); it('Finalized', () => { - props.value = WithdrawalStatus.Finalized; + props.value = WithdrawalStatus.STATUS_FINALIZED; props.data.pendingOnForeignChain = false; props.data.txHash = '0x123'; render(); @@ -109,11 +109,11 @@ describe('StatusCell', () => { }); it('Fallback', () => { - props.value = WithdrawalStatus.Rejected; + props.value = WithdrawalStatus.STATUS_REJECTED; props.data.pendingOnForeignChain = false; props.data.txHash = '0x123'; render(); - expect(screen.getByText('Rejected')).toBeInTheDocument(); + expect(screen.getByText('STATUS_REJECTED')).toBeInTheDocument(); }); }); diff --git a/libs/withdraws/src/lib/withdrawals-table.tsx b/libs/withdraws/src/lib/withdrawals-table.tsx index 8d34959b1..d4edf680a 100644 --- a/libs/withdraws/src/lib/withdrawals-table.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.tsx @@ -98,7 +98,7 @@ export const StatusCell = ({ ); } - if (value === WithdrawalStatus.Finalized) { + if (value === WithdrawalStatus.STATUS_FINALIZED) { return (
    {data.txHash ? ( diff --git a/scripts/get-tranches.js b/scripts/get-tranches.js index bf9615439..d8f1ea3c0 100644 --- a/scripts/get-tranches.js +++ b/scripts/get-tranches.js @@ -25,7 +25,7 @@ const CONFIG = [ startBlock: 11259488, }, { - env: 'stagnet2', + env: 'stagnet3', contract: '0x9F10cBeEf03A564Fb914c2010c0Cd55E9BB11406', provider: 'https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8', startBlock: 11790009,