feat: 0.54.0 (#949)

* chore: remove stagnet2, add stagnet3

* fix: types for transaction order submission (#932)

* test: add night runs again (#917)

Co-authored-by: Rado <rado@vegaprotocol.io>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Feat/893 anchor per network param (#907)

* feat: highlight network param targeted by anchor

* Feat/893: Highlighted key-value row colours

* Feat/893: Removed unneeded important bangs

Co-authored-by: sam-keen <samuel.kleinmann@gmail.com>

* Fix/687: Jump to block input should not allow negative block numbers or 0 (#918)

* Fix/687: Jump to block input should not allow negative block numbers

* Fix/687: Jump to block input should have a minimum of 1

* fix: text and theme icon colors (#920)

* Fix/eager connection (#923)

* fix: eager connect

* chore: add comment for eslint disable

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Task/Remove vegawallet service api client (#916)

* chore: remove generated vegawallet client code and implement in rest connector

* feat: add zod validation

* feat: handle specific auth/token delete case

* feat: make withdraw dialog match vega tx dialog

* fix: response stub to be right shape, add content type to requests

* chore: revert unrelated classname change

* feat: [console-lite] - fixes in order margin calcs (#891)

* feat: [console-lite] - fixes in order margin calcs

* feat: [console-lite] - fixes in order margin calcs - fix decimals

* feat: [console-lite] - fixes in order margin calcs - add unit tests

* feat: [console-lite] - fixes in order margin calcs - improve cals

* feat: [console-lite] - fixes in order margin calcs - improve cals

* feat: [console-lite] - fixes in order margin calcs - more improvements

Co-authored-by: maciek <maciek@vegaprotocol.io>

* fix: make check link unclickable while loading (#928)

* fix: make check link unclickable while loading

* fix: format

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix/904: Validators sorting (#913)

* fix(790): gap between orderbook headers and tabs (#929)

* feat: show correct reward type (#930)

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Task/remove vegawallet service (#926)

* feat: improve error handling

* chore: lint

* fix: cypress test incorrect assertion

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update tranches

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: order transaction types

Co-authored-by: Radosław Szpiech <szpiechrados@gmail.com>
Co-authored-by: Rado <rado@vegaprotocol.io>
Co-authored-by: mattrussell36 <mattrussell36@users.noreply.github.com>
Co-authored-by: Edd <edd@vega.xyz>
Co-authored-by: sam-keen <samuel.kleinmann@gmail.com>
Co-authored-by: Sam Keen <samuel@vegaprotocol.io>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: macqbat <kubat.maciek@gmail.com>
Co-authored-by: maciek <maciek@vegaprotocol.io>
Co-authored-by: asiaznik <artur.siaznik@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* test: fix test import

* chore: resolve bad merge files

* chore: begin enum changes

* test: fix the majority of the tests

* test: fix tests

* style: lint

* fix: update enums

* fix: adjusted tests to updated enums

* ci: bump capsule

* fix: temporarily skip failing staking tests

* ci: revert capsule changes

* test: fix tests for stats

* chore: merge few changes and api updates to stagnet3 updates branch (#1100)

* chore: merge few changes and api updates to stagnet3 updates branch

* chore: [console-lite] - fast fix in unit test

Co-authored-by: maciek <maciek@vegaprotocol.io>

* test: fix broken test

* chore: change to use the new nodes rather than load balancer

* style: formatting

* style: formatting

* chore: fix env file

* fix: don't assume GQL URL path

* fix: skip positions  query if there is no part

* fix: simple trading app test

Co-authored-by: botond <105208209+notbot00@users.noreply.github.com>
Co-authored-by: Radosław Szpiech <szpiechrados@gmail.com>
Co-authored-by: Rado <rado@vegaprotocol.io>
Co-authored-by: mattrussell36 <mattrussell36@users.noreply.github.com>
Co-authored-by: Edd <edd@vega.xyz>
Co-authored-by: sam-keen <samuel.kleinmann@gmail.com>
Co-authored-by: Sam Keen <samuel@vegaprotocol.io>
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: macqbat <kubat.maciek@gmail.com>
Co-authored-by: maciek <maciek@vegaprotocol.io>
Co-authored-by: asiaznik <artur.siaznik@gmail.com>
Co-authored-by: Joe <joe@vega.xyz>
Co-authored-by: m.ray <16125548+MadalinaRaicu@users.noreply.github.com>
This commit is contained in:
Dexter Edwards 2022-08-22 23:50:13 +01:00 committed by GitHub
parent 18100dfc83
commit c70a273e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
233 changed files with 1667 additions and 1564 deletions

View File

@ -7,5 +7,5 @@ __generated__
apps/static/src/assets/devnet-tranches.json apps/static/src/assets/devnet-tranches.json
apps/static/src/assets/mainnet-tranches.json apps/static/src/assets/mainnet-tranches.json
apps/static/src/assets/stagnet1-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 apps/static/src/assets/testnet-tranches.json

View File

@ -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`. In order to generate the schemas for your GraphQL queries, you can run `NX_VEGA_URL=[YOUR URL HERE] nx run types:generate`.
```bash ```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 yarn nx run types:generate
``` ```

View File

@ -1,10 +1,10 @@
# App configuration variables # App configuration variables
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query
NX_VEGA_ENV=STAGNET2 NX_VEGA_ENV=STAGNET3
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest
# App flags # App flags
NX_EXPLORER_ASSETS=1 NX_EXPLORER_ASSETS=1

View File

@ -1,10 +1,10 @@
# App configuration variables # App configuration variables
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api 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_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_ENV=TESTNET
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest NX_VEGA_REST=https://api.n11.testnet.vega.xyz
# App flags # App flags
NX_EXPLORER_ASSETS=1 NX_EXPLORER_ASSETS=1

View File

@ -21,8 +21,7 @@ context('Validator page', function () {
'have.text', 'have.text',
'Tendermint data' 'Tendermint data'
); );
cy.get('[data-testid="vega-header"]').should('have.text', 'Vega data'); cy.get('[data-testid="tendermint-data"]').should('not.be.empty');
cy.get('[data-testid="vega-data"]').should('not.be.empty');
} }
}); });
}); });

View File

@ -6,13 +6,13 @@ NX_VEGA_ENV=CUSTOM
NX_VEGA_REST=http://localhost:3029 NX_VEGA_REST=http://localhost:3029
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api 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://n01.stagnet3.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
NX_VEGA_URL=https://lb.testnet.vega.xyz/query NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_ENV=TESTNET NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' 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 NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
# App flags # App flags

View File

@ -1,10 +1,10 @@
# App configuration variables # App configuration variables
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
NX_TENDERMINT_URL=https://n03.stagnet2.vega.xyz/tm NX_TENDERMINT_URL=https://n01.stagnet3.vega.xyz/tm
NX_TENDERMINT_WEBSOCKET_URL=wss://n03.stagnet2.vega.xyz/tm/websocket NX_TENDERMINT_WEBSOCKET_URL=wss://n01.stagnet3.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query
NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}' NX_VEGA_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=STAGNET2 NX_VEGA_ENV=STAGNET3
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -1,10 +1,10 @@
# App configuration variables # App configuration variables
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api 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_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json 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_NETWORKS='{"TESTNET":"https://explorer.fairground.wtf","MAINNET":"https://explorer.vega.xyz"}'
NX_VEGA_ENV=TESTNET 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 NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -36,7 +36,7 @@ Example configurations are provided here:
- [Capsule](./.env.capsule) - [Capsule](./.env.capsule)
- [Testnet](./.env.testnet) - [Testnet](./.env.testnet)
- [Stagnet1](./.env.stagnet1) - [Stagnet1](./.env.stagnet1)
- [Stagnet2](./.env.stagnet2) - [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:

View File

@ -6,9 +6,8 @@ export function createClient(base?: string) {
if (!base) { if (!base) {
throw new Error('Base must be passed into createClient!'); throw new Error('Base must be passed into createClient!');
} }
const gqlPath = 'query'; const urlHTTP = new URL(base);
const urlHTTP = new URL(gqlPath, base); const urlWS = new URL(base);
const urlWS = new URL(gqlPath, base);
// Replace http with ws, preserving if its a secure connection eg. https => wss // Replace http with ws, preserving if its a secure connection eg. https => wss
urlWS.protocol = urlWS.protocol.replace('http', 'ws'); urlWS.protocol = urlWS.protocol.replace('http', 'ws');

View File

@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface AssetsQuery_assets_source_ERC20 { export interface AssetsQuery_assets_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -54,7 +54,7 @@ export interface AssetsQuery_assets_infrastructureFeeAccount {
export interface AssetsQuery_assets { export interface AssetsQuery_assets {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -66,11 +66,11 @@ export interface AssetsQuery_assets {
*/ */
symbol: string; 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; 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; source: AssetsQuery_assets_source;
/** /**
@ -81,7 +81,7 @@ export interface AssetsQuery_assets {
export interface AssetsQuery { 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; assets: AssetsQuery_assets[] | null;
} }

View File

@ -17,8 +17,8 @@ export interface ProposalsQuery_proposals_party {
id: string; id: string;
} }
export interface ProposalsQuery_proposals_terms_change_NewFreeform { export interface ProposalsQuery_proposals_terms_change_UpdateAsset {
__typename: "NewFreeform"; __typename: "UpdateAsset" | "NewFreeform";
} }
export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { 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 { export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -67,7 +67,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset {
*/ */
symbol: string; symbol: string;
/** /**
* the source of the new Asset * The source of the new asset
*/ */
source: ProposalsQuery_proposals_terms_change_NewAsset_source; 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; 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 { export interface ProposalsQuery_proposals_terms {
__typename: "ProposalTerms"; __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. * 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. * 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. * 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 { export interface ProposalsQuery_proposals_votes_yes {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: ProposalsQuery_proposals_votes_yes_votes[] | null; votes: ProposalsQuery_proposals_votes_yes_votes[] | null;
} }
@ -200,15 +201,15 @@ export interface ProposalsQuery_proposals_votes_no_votes {
export interface ProposalsQuery_proposals_votes_no { export interface ProposalsQuery_proposals_votes_no {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: ProposalsQuery_proposals_votes_no_votes[] | null; votes: ProposalsQuery_proposals_votes_no_votes[] | null;
} }
@ -228,11 +229,11 @@ export interface ProposalsQuery_proposals_votes {
export interface ProposalsQuery_proposals { export interface ProposalsQuery_proposals {
__typename: "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; id: string | null;
/** /**
* A UUID reference to aid tracking proposals on VEGA * A UUID reference to aid tracking proposals on Vega
*/ */
reference: string; reference: string;
/** /**
@ -263,7 +264,7 @@ export interface ProposalsQuery_proposals {
export interface ProposalsQuery { export interface ProposalsQuery {
/** /**
* All governance proposals in the VEGA network * All governance proposals in the Vega network
*/ */
proposals: ProposalsQuery_proposals[] | null; proposals: ProposalsQuery_proposals[] | null;
} }

View File

@ -52,7 +52,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett
export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset { export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -60,7 +60,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett
*/ */
name: string; 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; decimals: number;
/** /**
@ -108,11 +108,11 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk
*/ */
r: number; r: number;
/** /**
* sigma parameter * sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number
*/ */
sigma: number; sigma: number;
/** /**
* mu parameter * mu parameter, annualised growth rate of the underlying asset
*/ */
mu: number; mu: number;
} }
@ -120,15 +120,15 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk
export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel { export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel {
__typename: "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; 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; riskAversionParameter: number;
/** /**
* Params for the log normal risk model * Parameters for the log normal risk model
*/ */
params: MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params; params: MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params;
} }
@ -166,7 +166,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalin
*/ */
initialMargin: number; initialMargin: number;
/** /**
* The scaling factor that determines the overflow margin level * the scaling factor that determines the overflow margin level
*/ */
collateralRelease: number; collateralRelease: number;
} }
@ -182,7 +182,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator {
export interface MarketsQuery_markets_tradableInstrument { export interface MarketsQuery_markets_tradableInstrument {
__typename: "TradableInstrument"; __typename: "TradableInstrument";
/** /**
* An instance of or reference to a fully specified instrument. * An instance of, or reference to, a fully specified instrument.
*/ */
instrument: MarketsQuery_markets_tradableInstrument_instrument; instrument: MarketsQuery_markets_tradableInstrument_instrument;
/** /**
@ -219,7 +219,7 @@ export interface MarketsQuery_markets_priceMonitoringSettings_parameters_trigger
probability: number; probability: number;
/** /**
* Price monitoring auction extension duration in seconds should the price * 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) * probability level (> 0)
*/ */
auctionExtensionSecs: number; auctionExtensionSecs: number;
@ -239,10 +239,6 @@ export interface MarketsQuery_markets_priceMonitoringSettings {
* Specified a set of PriceMonitoringParameters to be use for price monitoring purposes * Specified a set of PriceMonitoringParameters to be use for price monitoring purposes
*/ */
parameters: MarketsQuery_markets_priceMonitoringSettings_parameters | null; 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 { export interface MarketsQuery_markets_liquidityMonitoringParameters_targetStakeParameters {
@ -272,7 +268,7 @@ export interface MarketsQuery_markets_liquidityMonitoringParameters {
export interface MarketsQuery_markets_proposal { export interface MarketsQuery_markets_proposal {
__typename: "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; id: string | null;
} }
@ -280,7 +276,7 @@ export interface MarketsQuery_markets_proposal {
export interface MarketsQuery_markets_accounts_asset { export interface MarketsQuery_markets_accounts_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -309,7 +305,7 @@ export interface MarketsQuery_markets_data_priceMonitoringBounds_trigger {
__typename: "PriceMonitoringTrigger"; __typename: "PriceMonitoringTrigger";
/** /**
* Price monitoring auction extension duration in seconds should the price * 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) * probability level (> 0)
*/ */
auctionExtensionSecs: number; auctionExtensionSecs: number;
@ -350,15 +346,15 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare_party {
export interface MarketsQuery_markets_data_liquidityProviderFeeShare { export interface MarketsQuery_markets_data_liquidityProviderFeeShare {
__typename: "LiquidityProviderFeeShare"; __typename: "LiquidityProviderFeeShare";
/** /**
* The liquidity provider party id * The liquidity provider party ID
*/ */
party: MarketsQuery_markets_data_liquidityProviderFeeShare_party; party: MarketsQuery_markets_data_liquidityProviderFeeShare_party;
/** /**
* The share own by this liquidity provider (float) * The share owned by this liquidity provider (float)
*/ */
equityLikeShare: string; 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; averageEntryValuation: string;
} }
@ -366,7 +362,7 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare {
export interface MarketsQuery_markets_data { export interface MarketsQuery_markets_data {
__typename: "MarketData"; __typename: "MarketData";
/** /**
* the mark price (actually an unsigned int) * the mark price (an unsigned integer)
*/ */
markPrice: string; markPrice: string;
/** /**
@ -450,7 +446,7 @@ export interface MarketsQuery_markets_data {
*/ */
suppliedStake: string | null; 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; priceMonitoringBounds: MarketsQuery_markets_data_priceMonitoringBounds[] | null;
/** /**
@ -478,12 +474,12 @@ export interface MarketsQuery_markets {
*/ */
fees: MarketsQuery_markets_fees; 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; tradableInstrument: MarketsQuery_markets_tradableInstrument;
/** /**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * 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: * Examples:
* Currency Balance decimalPlaces Real Balance * Currency Balance decimalPlaces Real Balance
@ -520,7 +516,7 @@ export interface MarketsQuery_markets {
*/ */
state: MarketState; state: MarketState;
/** /**
* The proposal which initiated this market * The proposal that initiated this market
*/ */
proposal: MarketsQuery_markets_proposal | null; proposal: MarketsQuery_markets_proposal | null;
/** /**

View File

@ -78,7 +78,6 @@ const MARKETS_QUERY = gql`
auctionExtensionSecs auctionExtensionSecs
} }
} }
updateFrequencySecs
} }
liquidityMonitoringParameters { liquidityMonitoringParameters {
triggeringRatio triggeringRatio

View File

@ -61,7 +61,7 @@ export interface OracleSpecs_oracleSpecs {
*/ */
status: OracleSpecStatus; status: OracleSpecStatus;
/** /**
* id is a hash generated from the OracleSpec data. * ID is a hash generated from the OracleSpec data.
*/ */
id: string; id: string;
/** /**

View File

@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface PartyAssetsQuery_party_delegations_node { export interface PartyAssetsQuery_party_delegations_node {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
name: string; name: string;
@ -49,7 +49,7 @@ export interface PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset {
export interface PartyAssetsQuery_party_accounts_asset_source_ERC20 { export interface PartyAssetsQuery_party_accounts_asset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -63,11 +63,11 @@ export interface PartyAssetsQuery_party_accounts_asset {
*/ */
name: string; name: string;
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; 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; decimals: number;
/** /**
@ -75,7 +75,7 @@ export interface PartyAssetsQuery_party_accounts_asset {
*/ */
symbol: string; 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; source: PartyAssetsQuery_party_accounts_asset_source;
} }
@ -115,7 +115,7 @@ export interface PartyAssetsQuery_party {
export interface PartyAssetsQuery { 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; party: PartyAssetsQuery_party | null;
} }

View File

@ -17,7 +17,7 @@ const PendingTxs = () => {
<RouteTitle data-testid="unconfirmed-transactions-header"> <RouteTitle data-testid="unconfirmed-transactions-header">
{t('Unconfirmed transactions')} {t('Unconfirmed transactions')}
</RouteTitle> </RouteTitle>
https://lb.testnet.vega.xyz/tm/unconfirmed_txs https://tm.n06.testnet.vega.xyz/tm/unconfirmed_txs
<br /> <br />
<div>{t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}</div> <div>{t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}</div>
<br /> <br />

View File

@ -28,33 +28,33 @@ export interface NodesQuery_nodes_epochData {
export interface NodesQuery_nodes { export interface NodesQuery_nodes {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
name: 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; infoUrl: string;
avatarUrl: string | null; avatarUrl: string | null;
/** /**
* Pubkey of the node operator * Public key of the node operator
*/ */
pubkey: string; pubkey: string;
/** /**
* Public key of Tendermint * Tendermint public key of the node
*/ */
tmPubkey: string; tmPubkey: string;
/** /**
* Ethereum public key of the node * Ethereum public key of the node
*/ */
ethereumAdddress: string; ethereumAddress: string;
/** /**
* Country code for the location of the node * Country code for the location of the node
*/ */
location: string; location: string;
/** /**
* The amount the node has put up themselves * The amount of stake the node has put up themselves
*/ */
stakedByOperator: string; stakedByOperator: string;
/** /**

View File

@ -18,7 +18,7 @@ const NODES_QUERY = gql`
avatarUrl avatarUrl
pubkey pubkey
tmPubkey tmPubkey
ethereumAdddress ethereumAddress
location location
stakedByOperator stakedByOperator
stakedByDelegates stakedByDelegates

View File

@ -21,7 +21,7 @@ NX_URL=$URL
NX_DEPLOY_URL=$DEPLOY_URL NX_DEPLOY_URL=$DEPLOY_URL
NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_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_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 NX_VEGA_WALLET_URL=http://localhost:1789/api/v1

View File

@ -3,7 +3,7 @@ import { connectVegaWallet } from '../support/connect-wallet';
describe('market selector', () => { describe('market selector', () => {
let markets; let markets;
before(() => { before(() => {
cy.intercept('POST', '/query', (req) => { cy.intercept('POST', '/graphql', (req) => {
const { body } = req; const { body } = req;
if (body.operationName === 'SimpleMarkets') { if (body.operationName === 'SimpleMarkets') {
req.alias = `gqlSimpleMarketsQuery`; req.alias = `gqlSimpleMarketsQuery`;

View File

@ -19,7 +19,7 @@ NX_DEPLOY_URL=$DEPLOY_URL
NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json" NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json"
NX_VEGA_ENV = 'TESTNET' 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_VEGA_WALLET_URL=http://localhost:1789/api/v1
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,9 +1,8 @@
# App configuration variables # App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet2-network.json NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query
NX_VEGA_ENV=STAGNET2 NX_VEGA_ENV=STAGNET3
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz NX_VEGA_EXPLORER_URL=https://staging2.explorer.vega.xyz

View File

@ -1,8 +1,8 @@
# App configuration variables # App configuration variables
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json 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_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_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -26,7 +26,7 @@ export interface MarketTags_market_tradableInstrument_instrument {
export interface MarketTags_market_tradableInstrument { export interface MarketTags_market_tradableInstrument {
__typename: "TradableInstrument"; __typename: "TradableInstrument";
/** /**
* An instance of or reference to a fully specified instrument. * An instance of, or reference to, a fully specified instrument.
*/ */
instrument: MarketTags_market_tradableInstrument_instrument; instrument: MarketTags_market_tradableInstrument_instrument;
} }
@ -34,14 +34,14 @@ export interface MarketTags_market_tradableInstrument {
export interface MarketTags_market { export interface MarketTags_market {
__typename: "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; tradableInstrument: MarketTags_market_tradableInstrument;
} }
export interface MarketTags { 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; market: MarketTags_market | null;
} }

View File

@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface PartyBalanceQuery_party_accounts_asset { export interface PartyBalanceQuery_party_accounts_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -24,7 +24,7 @@ export interface PartyBalanceQuery_party_accounts_asset {
*/ */
name: string; 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; decimals: number;
} }
@ -55,7 +55,7 @@ export interface PartyBalanceQuery_party {
export interface PartyBalanceQuery { 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; party: PartyBalanceQuery_party | null;
} }

View File

@ -18,7 +18,7 @@ const tDAI: PartyBalanceQuery_party_accounts_asset = {
const accounts: PartyBalanceQuery_party_accounts[] = [ const accounts: PartyBalanceQuery_party_accounts[] = [
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.General, type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '1000000', balance: '1000000',
asset: tDAI, asset: tDAI,
}, },

View File

@ -24,7 +24,7 @@ export const DealTicketBalance = ({
const settlementAccount = useSettlementAccount( const settlementAccount = useSettlementAccount(
settlementAssetId, settlementAssetId,
accounts, accounts,
AccountType.General AccountType.ACCOUNT_TYPE_GENERAL
); );
const formatedNumber = const formatedNumber =
settlementAccount?.balance && settlementAccount?.balance &&

View File

@ -9,7 +9,6 @@ import classNames from 'classnames';
import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket';
import type { Order } from '@vegaprotocol/orders'; import type { Order } from '@vegaprotocol/orders';
import { SIDE_NAMES } from './side-selector'; import { SIDE_NAMES } from './side-selector';
import { VegaWalletOrderSide } from '@vegaprotocol/wallet';
import SimpleMarketExpires from '../simple-market-list/simple-market-expires'; import SimpleMarketExpires from '../simple-market-list/simple-market-expires';
import { gql, useQuery } from '@apollo/client'; import { gql, useQuery } from '@apollo/client';
import type { import type {
@ -17,6 +16,7 @@ import type {
MarketTagsVariables, MarketTagsVariables,
} from './__generated__/MarketTags'; } from './__generated__/MarketTags';
import { DealTicketEstimates } from './deal-ticket-estimates'; import { DealTicketEstimates } from './deal-ticket-estimates';
import { Side } from '@vegaprotocol/types';
export const MARKET_TAGS_QUERY = gql` export const MARKET_TAGS_QUERY = gql`
query MarketTags($marketId: ID!) { query MarketTags($marketId: ID!) {
@ -71,10 +71,9 @@ export default ({
<div <div
className={classNames( className={classNames(
{ {
'buyButton dark:buyButtonDark': 'buyButton dark:buyButtonDark': order.side === Side.SIDE_BUY,
order.side === VegaWalletOrderSide.Buy,
'sellButton dark:sellButtonDark': 'sellButton dark:sellButtonDark':
order.side === VegaWalletOrderSide.Sell, order.side === Side.SIDE_SELL,
}, },
'px-8 py-4 inline text-ui-small' 'px-8 py-4 inline text-ui-small'
)} )}

View File

@ -1,17 +1,17 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { FormGroup, Button } from '@vegaprotocol/ui-toolkit'; import { FormGroup, Button } from '@vegaprotocol/ui-toolkit';
import { VegaWalletOrderSide } from '@vegaprotocol/wallet';
import { t } from '@vegaprotocol/react-helpers'; import { t } from '@vegaprotocol/react-helpers';
import { Side } from '@vegaprotocol/types';
interface SideSelectorProps { interface SideSelectorProps {
value: VegaWalletOrderSide; value: Side;
onSelect: (side: VegaWalletOrderSide) => void; onSelect: (side: Side) => void;
} }
export const SIDE_NAMES: Record<VegaWalletOrderSide, string> = { export const SIDE_NAMES: Record<Side, string> = {
[VegaWalletOrderSide.Buy]: t('Long'), [Side.SIDE_BUY]: t('Long'),
[VegaWalletOrderSide.Sell]: t('Short'), [Side.SIDE_SELL]: t('Short'),
}; };
export default ({ value, onSelect }: SideSelectorProps) => { export default ({ value, onSelect }: SideSelectorProps) => {
@ -31,9 +31,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
className={classNames( className={classNames(
'py-8', 'py-8',
'buyButton hover:buyButton dark:buyButtonDark dark:hover:buyButtonDark', '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')} {t('Long')}
</Button> </Button>
@ -43,9 +43,9 @@ export default ({ value, onSelect }: SideSelectorProps) => {
className={classNames( className={classNames(
'py-8', 'py-8',
'sellButton hover:sellButton dark:sellButtonDark dark:hover:sellButtonDark', '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')} {t('Short')}
</Button> </Button>

View File

@ -24,7 +24,7 @@ export interface SimpleMarketDataFields_market {
export interface SimpleMarketDataFields { export interface SimpleMarketDataFields {
__typename: "MarketData"; __typename: "MarketData";
/** /**
* market id of the associated mark price * market ID of the associated mark price
*/ */
market: SimpleMarketDataFields_market; market: SimpleMarketDataFields_market;
} }

View File

@ -24,7 +24,7 @@ export interface SimpleMarketDataSub_marketData_market {
export interface SimpleMarketDataSub_marketData { export interface SimpleMarketDataSub_marketData {
__typename: "MarketData"; __typename: "MarketData";
/** /**
* market id of the associated mark price * market ID of the associated mark price
*/ */
market: SimpleMarketDataSub_marketData_market; market: SimpleMarketDataSub_marketData_market;
} }

View File

@ -24,7 +24,7 @@ export interface SimpleMarkets_markets_data_market {
export interface SimpleMarkets_markets_data { export interface SimpleMarkets_markets_data {
__typename: "MarketData"; __typename: "MarketData";
/** /**
* market id of the associated mark price * market ID of the associated mark price
*/ */
market: SimpleMarkets_markets_data_market; market: SimpleMarkets_markets_data_market;
} }
@ -76,7 +76,7 @@ export interface SimpleMarkets_markets_tradableInstrument_instrument {
export interface SimpleMarkets_markets_tradableInstrument { export interface SimpleMarkets_markets_tradableInstrument {
__typename: "TradableInstrument"; __typename: "TradableInstrument";
/** /**
* An instance of or reference to a fully specified instrument. * An instance of, or reference to, a fully specified instrument.
*/ */
instrument: SimpleMarkets_markets_tradableInstrument_instrument; instrument: SimpleMarkets_markets_tradableInstrument_instrument;
} }
@ -108,11 +108,11 @@ export interface SimpleMarkets_markets {
*/ */
data: SimpleMarkets_markets_data | null; 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; 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; candles: (SimpleMarkets_markets_candles | null)[] | null;
} }

View File

@ -45,7 +45,7 @@ export const MARKETS_QUERY = gql`
} }
} }
} }
candles(interval: I1H, since: $CandleSince) { candles(interval: INTERVAL_I1H, since: $CandleSince) {
open open
close close
} }
@ -64,7 +64,7 @@ const MARKET_DATA_SUB = gql`
export const CANDLE_SUB = gql` export const CANDLE_SUB = gql`
subscription CandleLive($marketId: ID!) { subscription CandleLive($marketId: ID!) {
candles(marketId: $marketId, interval: I1H) { candles(marketId: $marketId, interval: INTERVAL_I1H) {
close close
} }
} }

View File

@ -10,7 +10,6 @@ import {
import { MockedProvider } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing';
import type { MockedResponse } from '@apollo/client/testing'; import type { MockedResponse } from '@apollo/client/testing';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import { MarketState } from '@vegaprotocol/types';
import SimpleMarketList from './simple-market-list'; import SimpleMarketList from './simple-market-list';
import { MARKETS_QUERY } from './data-provider'; import { MARKETS_QUERY } from './data-provider';
import type { import type {
@ -68,7 +67,7 @@ describe('SimpleMarketList', () => {
id: '1', id: '1',
data: { data: {
market: { market: {
state: MarketState.Active, state: 'Active',
}, },
}, },
tradableInstrument: { tradableInstrument: {
@ -88,7 +87,7 @@ describe('SimpleMarketList', () => {
id: '2', id: '2',
data: { data: {
market: { market: {
state: MarketState.Active, state: 'Active',
}, },
}, },
tradableInstrument: { tradableInstrument: {
@ -131,6 +130,7 @@ describe('SimpleMarketList', () => {
document.querySelector('.ag-center-cols-container') document.querySelector('.ag-center-cols-container')
).toBeInTheDocument(); ).toBeInTheDocument();
}); });
screen.debug();
await waitFor(() => { await waitFor(() => {
const container = document.querySelector('.ag-center-cols-container'); const container = document.querySelector('.ag-center-cols-container');
expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2); expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2);

View File

@ -79,7 +79,7 @@ const SimpleMarketToolbar = ({ data }: Props) => {
data-testid="market-products-menu" data-testid="market-products-menu"
aria-label={t('Product type')} aria-label={t('Product type')}
> >
<li key="all" className="md:mr-16 whitespace-nowrap"> <li key="all-markets" className="md:mr-16 whitespace-nowrap">
<Link <Link
to={`/markets${ to={`/markets${
params.state && params.state !== 'Active' params.state && params.state !== 'Active'

View File

@ -10,7 +10,7 @@
export interface MarketMarkPrice_market_data { export interface MarketMarkPrice_market_data {
__typename: "MarketData"; __typename: "MarketData";
/** /**
* the mark price (actually an unsigned int) * the mark price (an unsigned integer)
*/ */
markPrice: string; markPrice: string;
} }
@ -19,7 +19,7 @@ export interface MarketMarkPrice_market {
__typename: "Market"; __typename: "Market";
/** /**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * 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: * Examples:
* Currency Balance decimalPlaces Real Balance * Currency Balance decimalPlaces Real Balance
@ -42,7 +42,7 @@ export interface MarketMarkPrice_market {
export interface MarketMarkPrice { export interface MarketMarkPrice {
/** /**
* An instrument that is trading on the VEGA network * An instrument that is trading on the Vega network
*/ */
market: MarketMarkPrice_market | null; market: MarketMarkPrice_market | null;
} }

View File

@ -12,11 +12,11 @@ import { AccountType } from "@vegaprotocol/types";
export interface PartyMarketData_party_accounts_asset { export interface PartyMarketData_party_accounts_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; 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; decimals: number;
} }
@ -64,15 +64,15 @@ export interface PartyMarketData_party_marginsConnection_edges_node {
*/ */
market: PartyMarketData_party_marginsConnection_edges_node_market; market: PartyMarketData_party_marginsConnection_edges_node_market;
/** /**
* 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; initialLevel: string;
/** /**
* 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; 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; searchLevel: string;
} }
@ -101,14 +101,14 @@ export interface PartyMarketData_party {
*/ */
accounts: PartyMarketData_party_accounts[] | null; accounts: PartyMarketData_party_accounts[] | null;
/** /**
* Margin level for a market * Margin levels for a market
*/ */
marginsConnection: PartyMarketData_party_marginsConnection; marginsConnection: PartyMarketData_party_marginsConnection;
} }
export interface PartyMarketData { export interface PartyMarketData {
/** /**
* An entity that is trading on the VEGA network * An entity that is trading on the Vega network
*/ */
party: PartyMarketData_party | null; party: PartyMarketData_party | null;
} }

View File

@ -12,15 +12,15 @@ import { Side, OrderTimeInForce, OrderType } from "@vegaprotocol/types";
export interface EstimateOrder_estimateOrder_fee { export interface EstimateOrder_estimateOrder_fee {
__typename: "TradeFee"; __typename: "TradeFee";
/** /**
* The maker fee, aggressive party to the other party (the one who had an order in the book) * The maker fee, paid by the aggressive party to the other party (the one who had an order in the book)
*/ */
makerFee: string; 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; 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; liquidityFee: string;
} }
@ -28,7 +28,7 @@ export interface EstimateOrder_estimateOrder_fee {
export interface EstimateOrder_estimateOrder_marginLevels { export interface EstimateOrder_estimateOrder_marginLevels {
__typename: "MarginLevels"; __typename: "MarginLevels";
/** /**
* 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; initialLevel: string;
} }

View File

@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface MarketPositions_party_accounts_asset { export interface MarketPositions_party_accounts_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* 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; decimals: number;
} }
@ -96,7 +96,7 @@ export interface MarketPositions_party {
export interface MarketPositions { export interface MarketPositions {
/** /**
* An entity that is trading on the VEGA network * An entity that is trading on the Vega network
*/ */
party: MarketPositions_party | null; party: MarketPositions_party | null;
} }

View File

@ -1,14 +1,14 @@
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import useMaximumPositionSize from './use-maximum-position-size'; import useMaximumPositionSize from './use-maximum-position-size';
import type { PartyBalanceQuery_party_accounts } from '../components/deal-ticket/__generated__/PartyBalanceQuery'; import type { PartyBalanceQuery_party_accounts } from '../components/deal-ticket/__generated__/PartyBalanceQuery';
import { AccountType } from '@vegaprotocol/types'; import {
AccountType,
OrderTimeInForce,
OrderType,
Side,
} from '@vegaprotocol/types';
import type { PositionMargin } from './use-market-positions'; import type { PositionMargin } from './use-market-positions';
import { BigNumber } from 'bignumber.js'; import { BigNumber } from 'bignumber.js';
import {
VegaWalletOrderSide,
VegaWalletOrderTimeInForce,
VegaWalletOrderType,
} from '@vegaprotocol/wallet';
const defaultMockMarketPositions = { const defaultMockMarketPositions = {
openVolume: new BigNumber(1), openVolume: new BigNumber(1),
@ -19,7 +19,7 @@ let mockMarketPositions: PositionMargin | null = defaultMockMarketPositions;
const mockAccount: PartyBalanceQuery_party_accounts = { const mockAccount: PartyBalanceQuery_party_accounts = {
__typename: 'Account', __typename: 'Account',
type: AccountType.General, type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '200000', balance: '200000',
asset: { asset: {
__typename: 'Asset', __typename: 'Asset',
@ -31,10 +31,10 @@ const mockAccount: PartyBalanceQuery_party_accounts = {
}; };
const mockOrder = { const mockOrder = {
type: VegaWalletOrderType.Market, type: OrderType.TYPE_MARKET,
size: '1', size: '1',
side: VegaWalletOrderSide.Buy, side: Side.SIDE_BUY,
timeInForce: VegaWalletOrderTimeInForce.IOC, timeInForce: OrderTimeInForce.TIME_IN_FORCE_IOC,
}; };
jest.mock('./use-settlement-account', () => { jest.mock('./use-settlement-account', () => {
@ -81,7 +81,7 @@ describe('useMaximumPositionSize Hook', () => {
it('should return correct size when open positions and opposite side', () => { it('should return correct size when open positions and opposite side', () => {
const price = '50'; const price = '50';
mockOrder.side = VegaWalletOrderSide.Sell; mockOrder.side = Side.SIDE_SELL;
mockMarketPositions = defaultMockMarketPositions; mockMarketPositions = defaultMockMarketPositions;
const expected = 4001; const expected = 4001;
const { result } = renderHook(() => const { result } = renderHook(() =>

View File

@ -2,8 +2,7 @@ import useMarketPositions from './use-market-positions';
import type { Order } from '@vegaprotocol/orders'; import type { Order } from '@vegaprotocol/orders';
import type { PartyBalanceQuery_party_accounts } from '../components/deal-ticket/__generated__/PartyBalanceQuery'; import type { PartyBalanceQuery_party_accounts } from '../components/deal-ticket/__generated__/PartyBalanceQuery';
import { useSettlementAccount } from './use-settlement-account'; import { useSettlementAccount } from './use-settlement-account';
import { AccountType } from '@vegaprotocol/types'; import { AccountType, Side } from '@vegaprotocol/types';
import { VegaWalletOrderSide } from '@vegaprotocol/wallet';
import { BigNumber } from 'bignumber.js'; import { BigNumber } from 'bignumber.js';
interface Props { interface Props {
@ -29,7 +28,7 @@ export default ({
const settlementAccount = useSettlementAccount( const settlementAccount = useSettlementAccount(
settlementAssetId, settlementAssetId,
accounts, accounts,
AccountType.General AccountType.ACCOUNT_TYPE_GENERAL
); );
const marketPositions = useMarketPositions({ marketId: marketId, partyId }); const marketPositions = useMarketPositions({ marketId: marketId, partyId });
@ -48,10 +47,8 @@ export default ({
} }
const isSameSide = const isSameSide =
(marketPositions.openVolume.isPositive() && (marketPositions.openVolume.isPositive() && order.side === Side.SIDE_BUY) ||
order.side === VegaWalletOrderSide.Buy) || (marketPositions.openVolume.isNegative() && order.side === Side.SIDE_SELL);
(marketPositions.openVolume.isNegative() &&
order.side === VegaWalletOrderSide.Sell);
const adjustedForVolume = new BigNumber(size)[isSameSide ? 'minus' : 'plus']( const adjustedForVolume = new BigNumber(size)[isSameSide ? 'minus' : 'plus'](
marketPositions.openVolume marketPositions.openVolume

View File

@ -3,7 +3,7 @@ import type { Order } from '@vegaprotocol/orders';
import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket';
import type { PartyBalanceQuery } from '../components/deal-ticket/__generated__/PartyBalanceQuery'; import type { PartyBalanceQuery } from '../components/deal-ticket/__generated__/PartyBalanceQuery';
import { useSettlementAccount } from './use-settlement-account'; 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 { addDecimal, formatNumber } from '@vegaprotocol/react-helpers';
import { gql, useQuery } from '@apollo/client'; import { gql, useQuery } from '@apollo/client';
import useMarketPositions from './use-market-positions'; import useMarketPositions from './use-market-positions';
@ -12,6 +12,7 @@ import type {
PartyMarketData, PartyMarketData,
PartyMarketDataVariables, PartyMarketDataVariables,
} from './__generated__/PartyMarketData'; } from './__generated__/PartyMarketData';
import { Side } from '@vegaprotocol/types';
const CLOSEOUT_PRICE_QUERY = gql` const CLOSEOUT_PRICE_QUERY = gql`
query PartyMarketData($partyId: ID!) { query PartyMarketData($partyId: ID!) {
@ -96,7 +97,7 @@ const useOrderCloseOut = ({ order, market, partyData }: Props): string => {
marketPositions?.openVolume.toNumber() || 0, marketPositions?.openVolume.toNumber() || 0,
market.positionDecimalPlaces market.positionDecimalPlaces
) )
)[order.side === VegaWalletOrderSide.Buy ? 'plus' : 'minus'](order.size); )[order.side === Side.SIDE_BUY ? 'plus' : 'minus'](order.size);
const markPrice = new BigNumber( const markPrice = new BigNumber(
addDecimal( addDecimal(
markPriceData?.market?.data?.markPrice || 0, markPriceData?.market?.data?.markPrice || 0,

View File

@ -7,12 +7,7 @@ import type {
EstimateOrder_estimateOrder_fee, EstimateOrder_estimateOrder_fee,
} from './__generated__/estimateOrder'; } from './__generated__/estimateOrder';
import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket'; import type { DealTicketQuery_market } from '@vegaprotocol/deal-ticket';
import { OrderTimeInForce, OrderType, Side } from '@vegaprotocol/types'; import { Side } from '@vegaprotocol/types';
import {
VegaWalletOrderSide,
VegaWalletOrderTimeInForce,
VegaWalletOrderType,
} from '@vegaprotocol/wallet';
import { addDecimal, removeDecimal } from '@vegaprotocol/react-helpers'; import { addDecimal, removeDecimal } from '@vegaprotocol/react-helpers';
import useMarketPositions from './use-market-positions'; import useMarketPositions from './use-market-positions';
import useMarketData from './use-market-data'; import useMarketData from './use-market-data';
@ -56,20 +51,6 @@ interface Props {
partyId: string; partyId: string;
} }
const times: Record<VegaWalletOrderTimeInForce, OrderTimeInForce> = {
[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, OrderType> = {
[VegaWalletOrderType.Market]: OrderType.Market,
[VegaWalletOrderType.Limit]: OrderType.Limit,
};
const addFees = (feeObj: EstimateOrder_estimateOrder_fee) => { const addFees = (feeObj: EstimateOrder_estimateOrder_fee) => {
return new BigNumber(feeObj.makerFee) return new BigNumber(feeObj.makerFee)
.plus(feeObj.liquidityFee) .plus(feeObj.liquidityFee)
@ -99,14 +80,14 @@ const useOrderMargin = ({
BigNumber.maximum( BigNumber.maximum(
0, 0,
new BigNumber(marketPositions?.openVolume || 0)[ new BigNumber(marketPositions?.openVolume || 0)[
order.side === VegaWalletOrderSide.Buy ? 'plus' : 'minus' order.side === Side.SIDE_BUY ? 'plus' : 'minus'
](order.size) ](order.size)
).toString(), ).toString(),
market.positionDecimalPlaces market.positionDecimalPlaces
), ),
side: order.side === VegaWalletOrderSide.Buy ? Side.Buy : Side.Sell, side: order.side === Side.SIDE_BUY ? Side.SIDE_BUY : Side.SIDE_SELL,
timeInForce: times[order.timeInForce], timeInForce: order.timeInForce,
type: types[order.type], type: order.type,
}, },
skip: skip:
!partyId || !partyId ||

View File

@ -8,7 +8,7 @@ describe('useSettlementAccount Hook', () => {
const accounts: PartyBalanceQuery_party_accounts[] = [ const accounts: PartyBalanceQuery_party_accounts[] = [
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.General, type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '2000000000000000000000', balance: '2000000000000000000000',
asset: { asset: {
__typename: 'Asset', __typename: 'Asset',
@ -20,7 +20,7 @@ describe('useSettlementAccount Hook', () => {
}, },
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.General, type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '1000000000', balance: '1000000000',
asset: { asset: {
__typename: 'Asset', __typename: 'Asset',
@ -32,7 +32,7 @@ describe('useSettlementAccount Hook', () => {
}, },
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.General, type: AccountType.ACCOUNT_TYPE_GENERAL,
balance: '5000000000000000000', balance: '5000000000000000000',
asset: { asset: {
__typename: 'Asset', __typename: 'Asset',
@ -44,7 +44,7 @@ describe('useSettlementAccount Hook', () => {
}, },
{ {
__typename: 'Account', __typename: 'Account',
type: AccountType.Margin, type: AccountType.ACCOUNT_TYPE_MARGIN,
balance: '5000000000000000000', balance: '5000000000000000000',
asset: { asset: {
__typename: 'Asset', __typename: 'Asset',
@ -67,7 +67,7 @@ describe('useSettlementAccount Hook', () => {
expect(resultDai.current?.asset).toEqual(accounts[1].asset); expect(resultDai.current?.asset).toEqual(accounts[1].asset);
const { result: resultVega } = renderHook(() => const { result: resultVega } = renderHook(() =>
useSettlementAccount(vega, accounts, AccountType.Margin) useSettlementAccount(vega, accounts, AccountType.ACCOUNT_TYPE_MARGIN)
); );
expect(resultVega.current?.balance).toBe(accounts[3].balance); expect(resultVega.current?.balance).toBe(accounts[3].balance);

View File

@ -15,9 +15,8 @@ export function createClient(base?: string) {
if (!base) { if (!base) {
throw new Error('Base must be passed into createClient!'); throw new Error('Base must be passed into createClient!');
} }
const gqlPath = 'query'; const urlHTTP = new URL(base);
const urlHTTP = new URL(gqlPath, base); const urlWS = new URL(base);
const urlWS = new URL(gqlPath, base);
// Replace http with ws, preserving if its a secure connection eg. https => wss // Replace http with ws, preserving if its a secure connection eg. https => wss
urlWS.protocol = urlWS.protocol.replace('http', 'ws'); urlWS.protocol = urlWS.protocol.replace('http', 'ws');

View File

@ -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": []
}
]

View File

@ -1,3 +1,3 @@
{ {
"hosts": ["https://n03.stagnet2.vega.xyz/query"] "hosts": ["https://n01.stagnet3.vega.xyz/query"]
} }

View File

@ -0,0 +1 @@
[]

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
CYPRESS_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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
CYPRESS_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

View File

@ -1,3 +0,0 @@
# App configuration variables
NX_VEGA_REST=https://n01.stagnet2.vega.xyz/datanode/rest;
NX_VEGA_ENV=STAGNET2;

3
apps/stats/.env.stagnet3 Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_REST=https://n01.stagnet3.vega.xyz/datanode/rest;
NX_VEGA_ENV=STAGNET3;

View File

@ -1,3 +1,3 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_REST=https://lb.testnet.vega.xyz/datanode/rest NX_VEGA_REST=https://api.n11.testnet.vega.xyz

View File

@ -3,7 +3,7 @@ NX_VEGA_ENV=TESTNET
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545 NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_FAIRGROUND=false 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_URL=http://localhost:3028/query
NX_VEGA_REST=http://localhost:3029 NX_VEGA_REST=http://localhost:3029

View File

@ -1,5 +1,5 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=STAGNET2 NX_VEGA_ENV=STAGNET3
NX_VEGA_URL=https://n03.stagnet2.vega.xyz/query NX_VEGA_URL=https://n01.stagnet3.vega.xyz/query
NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -1,5 +1,5 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET 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_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io

View File

@ -124,7 +124,7 @@ context('Staking Page - verify elements on page', function () {
}); });
// 1002-STKE-050 // 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 () { before('connect wallets and click on validator', function () {
cy.vega_wallet_import(); cy.vega_wallet_import();
cy.vega_wallet_connect(); cy.vega_wallet_connect();

View File

@ -1,10 +1,10 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json NX_VEGA_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_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io 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_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='{"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 NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -3,7 +3,7 @@ NX_VEGA_ENV=DEVNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
NX_VEGA_URL=https://n04.d.vega.xyz/query NX_VEGA_URL=https://n04.d.vega.xyz/query
NX_VEGA_REST=https://n04.d.vega.xyz/datanode/rest 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_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -2,7 +2,7 @@
NX_VEGA_ENV=MAINNET NX_VEGA_ENV=MAINNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
NX_VEGA_URL=https://api.token.vega.xyz/query 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_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://etherscan.io NX_ETHERSCAN_URL=https://etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -2,7 +2,7 @@
NX_VEGA_ENV=STAGNET NX_VEGA_ENV=STAGNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
NX_VEGA_URL=https://n03.s.vega.xyz/query 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_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions

View File

@ -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

19
apps/token/.env.stagnet3 Normal file
View File

@ -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

View File

@ -1,9 +1,9 @@
# App configuration variables # App configuration variables
NX_VEGA_ENV=TESTNET NX_VEGA_ENV=TESTNET
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json NX_VEGA_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='{"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_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_ETHERSCAN_URL=https://ropsten.etherscan.io
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions 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

View File

@ -28,7 +28,7 @@ Example configurations are provided here:
- [Devnet](./.env.devnet) - [Devnet](./.env.devnet)
- [Testnet](./.env.testnet) - [Testnet](./.env.testnet)
- [Stagnet1](./.env.stagnet1) - [Stagnet1](./.env.stagnet1)
- [Stagnet2](./.env.stagnet2) - [Stagnet3](./.env.stagnet3)
For convenience, you can boot the app injecting one of the configurations above by running: For convenience, you can boot the app injecting one of the configurations above by running:

View File

@ -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
//==============================================================

View File

@ -20,7 +20,7 @@ export interface Delegations_epoch {
export interface Delegations_party_delegations_node { export interface Delegations_party_delegations_node {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
name: string; name: string;
@ -59,7 +59,7 @@ export interface Delegations_party_accounts_asset_source_BuiltinAsset {
export interface Delegations_party_accounts_asset_source_ERC20 { export interface Delegations_party_accounts_asset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -73,11 +73,11 @@ export interface Delegations_party_accounts_asset {
*/ */
name: string; name: string;
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; 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; decimals: number;
/** /**
@ -85,7 +85,7 @@ export interface Delegations_party_accounts_asset {
*/ */
symbol: string; 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; source: Delegations_party_accounts_asset_source;
} }
@ -125,11 +125,11 @@ export interface Delegations_party {
export interface Delegations { 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; 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; party: Delegations_party | null;
} }

View File

@ -5,7 +5,6 @@ import uniq from 'lodash/uniq';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { AccountType } from '../../__generated__/globalTypes';
import noIcon from '../../images/token-no-icon.png'; import noIcon from '../../images/token-no-icon.png';
import vegaBlack from '../../images/vega_black.png'; import vegaBlack from '../../images/vega_black.png';
import { BigNumber } from '../../lib/bignumber'; import { BigNumber } from '../../lib/bignumber';
@ -19,6 +18,7 @@ import type {
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { useContracts } from '../../contexts/contracts/contracts-context'; import { useContracts } from '../../contexts/contracts/contracts-context';
import { isAssetTypeERC20 } from '@vegaprotocol/react-helpers'; import { isAssetTypeERC20 } from '@vegaprotocol/react-helpers';
import { AccountType } from '@vegaprotocol/types';
const DELEGATIONS_QUERY = gql` const DELEGATIONS_QUERY = gql`
query Delegations($partyId: ID!) { query Delegations($partyId: ID!) {
@ -115,7 +115,7 @@ export const usePollForDelegations = () => {
const accounts = res.data.party?.accounts || []; const accounts = res.data.party?.accounts || [];
setAccounts( setAccounts(
accounts accounts
.filter((a) => a.type === AccountType.General) .filter((a) => a.type === AccountType.ACCOUNT_TYPE_GENERAL)
.map((a) => { .map((a) => {
const isVega = const isVega =
isAssetTypeERC20(a.asset) && isAssetTypeERC20(a.asset) &&

View File

@ -32,7 +32,7 @@ export const ContractAddresses: {
claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env 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 claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error
lockedAddress: '0x0', // TODO not deployed to this env lockedAddress: '0x0', // TODO not deployed to this env
}, },

View File

@ -10,7 +10,7 @@ const TRANCHES_URLS: { [N in Networks]: string } = {
MAINNET: 'https://static.vega.xyz/assets/mainnet-tranches.json', MAINNET: 'https://static.vega.xyz/assets/mainnet-tranches.json',
TESTNET: 'https://static.vega.xyz/assets/testnet-tranches.json', TESTNET: 'https://static.vega.xyz/assets/testnet-tranches.json',
STAGNET: 'https://static.vega.xyz/assets/stagnet1-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', DEVNET: 'https://static.vega.xyz/assets/devnet-tranches.json',
CUSTOM: 'https://static.vega.xyz/assets/testnet-tranches.json', CUSTOM: 'https://static.vega.xyz/assets/testnet-tranches.json',
}; };

View File

@ -5,9 +5,8 @@ export function getDataNodeUrl() {
if (!base) { if (!base) {
throw new Error('Environment variable NX_VEGA_URL must be set'); throw new Error('Environment variable NX_VEGA_URL must be set');
} }
const gqlPath = 'query'; const urlHTTP = new URL(base);
const urlHTTP = new URL(gqlPath, base); const urlWS = new URL(base);
const urlWS = new URL(gqlPath, base);
// Replace http with ws, preserving if its a secure connection eg. https => wss // Replace http with ws, preserving if its a secure connection eg. https => wss
urlWS.protocol = urlWS.protocol.replace('http', 'ws'); urlWS.protocol = urlWS.protocol.replace('http', 'ws');

View File

@ -17,8 +17,8 @@ export interface ProposalFields_party {
id: string; id: string;
} }
export interface ProposalFields_terms_change_NewFreeform { export interface ProposalFields_terms_change_UpdateAsset {
__typename: "NewFreeform"; __typename: "UpdateAsset" | "NewFreeform";
} }
export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct_settlementAsset { 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 { export interface ProposalFields_terms_change_NewMarket {
__typename: "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; decimalPlaces: number;
/** /**
@ -85,7 +85,7 @@ export interface ProposalFields_terms_change_NewAsset_source_BuiltinAsset {
export interface ProposalFields_terms_change_NewAsset_source_ERC20 { export interface ProposalFields_terms_change_NewAsset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -103,7 +103,7 @@ export interface ProposalFields_terms_change_NewAsset {
*/ */
symbol: string; symbol: string;
/** /**
* the source of the new Asset * The source of the new asset
*/ */
source: ProposalFields_terms_change_NewAsset_source; source: ProposalFields_terms_change_NewAsset_source;
} }
@ -125,7 +125,7 @@ export interface ProposalFields_terms_change_UpdateNetworkParameter {
networkParameter: ProposalFields_terms_change_UpdateNetworkParameter_networkParameter; 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 { export interface ProposalFields_terms {
__typename: "ProposalTerms"; __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. * 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. * 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. * 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 { export interface ProposalFields_votes_yes {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: ProposalFields_votes_yes_votes[] | null; votes: ProposalFields_votes_yes_votes[] | null;
} }
@ -236,15 +237,15 @@ export interface ProposalFields_votes_no_votes {
export interface ProposalFields_votes_no { export interface ProposalFields_votes_no {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: ProposalFields_votes_no_votes[] | null; votes: ProposalFields_votes_no_votes[] | null;
} }
@ -264,11 +265,11 @@ export interface ProposalFields_votes {
export interface ProposalFields { export interface ProposalFields {
__typename: "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; id: string | null;
/** /**
* A UUID reference to aid tracking proposals on VEGA * A UUID reference to aid tracking proposals on Vega
*/ */
reference: string; reference: string;
/** /**

View File

@ -1,4 +1,4 @@
import { ProposalState } from '../../../../__generated__/globalTypes'; import { ProposalState } from '@vegaprotocol/types';
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
export const CurrentProposalState = ({ export const CurrentProposalState = ({
@ -10,14 +10,14 @@ export const CurrentProposalState = ({
let className = 'text-white'; let className = 'text-white';
if ( if (
state === ProposalState.Declined || state === ProposalState.STATE_DECLINED ||
state === ProposalState.Failed || state === ProposalState.STATE_FAILED ||
state === ProposalState.Rejected state === ProposalState.STATE_REJECTED
) { ) {
className = 'text-danger'; className = 'text-danger';
} else if ( } else if (
state === ProposalState.Enacted || state === ProposalState.STATE_ENACTED ||
state === ProposalState.Passed state === ProposalState.STATE_PASSED
) { ) {
className = 'text-white'; className = 'text-white';
} }

View File

@ -2,7 +2,7 @@ import React from 'react';
import { formatDistanceToNow } from 'date-fns'; import { formatDistanceToNow } from 'date-fns';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ProposalState } from '../../../../__generated__/globalTypes'; import { ProposalState } from '@vegaprotocol/types';
import { useVoteInformation } from '../../hooks'; import { useVoteInformation } from '../../hooks';
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
@ -29,12 +29,13 @@ export const CurrentProposalStatus = ({
{ addSuffix: true } { addSuffix: true }
); );
const daysEnactedAgo = formatDistanceToNow( const daysEnactedAgo =
new Date(proposal.terms.enactmentDatetime), proposal.terms.enactmentDatetime &&
{ addSuffix: true } formatDistanceToNow(new Date(proposal.terms.enactmentDatetime), {
); addSuffix: true,
});
if (proposal.state === ProposalState.Open) { if (proposal.state === ProposalState.STATE_OPEN) {
if (willPass) { if (willPass) {
return ( return (
<> <>
@ -53,9 +54,9 @@ export const CurrentProposalStatus = ({
} }
if ( if (
proposal.state === ProposalState.Failed || proposal.state === ProposalState.STATE_FAILED ||
proposal.state === ProposalState.Declined || proposal.state === ProposalState.STATE_DECLINED ||
proposal.state === ProposalState.Rejected proposal.state === ProposalState.STATE_REJECTED
) { ) {
if (!participationMet) { if (!participationMet) {
return ( return (
@ -86,8 +87,8 @@ export const CurrentProposalStatus = ({
); );
} }
if ( if (
proposal.state === ProposalState.Enacted || proposal.state === ProposalState.STATE_ENACTED ||
proposal.state === ProposalState.Passed proposal.state === ProposalState.STATE_PASSED
) { ) {
return ( return (
<> <>
@ -95,7 +96,7 @@ export const CurrentProposalStatus = ({
<StatusPass>&nbsp;{proposal.state}</StatusPass> <StatusPass>&nbsp;{proposal.state}</StatusPass>
<span> <span>
&nbsp; &nbsp;
{proposal.state === ProposalState.Enacted {proposal.state === ProposalState.STATE_ENACTED
? daysEnactedAgo ? daysEnactedAgo
: daysClosedAgo} : daysClosedAgo}
. .
@ -104,7 +105,7 @@ export const CurrentProposalStatus = ({
); );
} }
if (proposal.state === ProposalState.WaitingForNodeVote) { if (proposal.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE) {
return ( return (
<span>{t('subjectToFurtherActions', { daysAgo: daysClosedAgo })}</span> <span>{t('subjectToFurtherActions', { daysAgo: daysClosedAgo })}</span>
); );

View File

@ -1,10 +1,7 @@
import { render, screen } from '@testing-library/react'; import { render, screen } from '@testing-library/react';
import { ProposalRejectionReason, ProposalState } from '@vegaprotocol/types';
import { format } from 'date-fns'; import { format } from 'date-fns';
import {
ProposalRejectionReason,
ProposalState,
} from '../../../../__generated__/globalTypes';
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
import { generateProposal } from '../../test-helpers/generate-proposals'; import { generateProposal } from '../../test-helpers/generate-proposals';
import { ProposalChangeTable } from './proposal-change-table'; 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(proposal.id as string)).toBeInTheDocument();
expect(screen.getByText('State')).toBeInTheDocument(); expect(screen.getByText('State')).toBeInTheDocument();
expect(screen.getByText('Open')).toBeInTheDocument(); expect(screen.getByText('STATE_OPEN')).toBeInTheDocument();
expect(screen.getByText('Closes on')).toBeInTheDocument(); expect(screen.getByText('Closes on')).toBeInTheDocument();
expect( expect(
@ -34,7 +31,10 @@ it('Renders all data for table', () => {
expect(screen.getByText('Proposed enactment')).toBeInTheDocument(); expect(screen.getByText('Proposed enactment')).toBeInTheDocument();
expect( expect(
screen.getByText( screen.getByText(
format(new Date(proposal.terms.enactmentDatetime), DATE_FORMAT_DETAILED) format(
new Date(proposal.terms.enactmentDatetime || 0),
DATE_FORMAT_DETAILED
)
) )
).toBeInTheDocument(); ).toBeInTheDocument();
@ -54,12 +54,12 @@ it('Renders all data for table', () => {
it('Changes data based on if data is in future or past', () => { it('Changes data based on if data is in future or past', () => {
const proposal = generateProposal({ const proposal = generateProposal({
state: ProposalState.Enacted, state: ProposalState.STATE_ENACTED,
}); });
render(<ProposalChangeTable proposal={proposal} />); render(<ProposalChangeTable proposal={proposal} />);
expect(screen.getByText('State')).toBeInTheDocument(); expect(screen.getByText('State')).toBeInTheDocument();
expect(screen.getByText('Enacted')).toBeInTheDocument(); expect(screen.getByText('STATE_ENACTED')).toBeInTheDocument();
expect(screen.getByText('Closed on')).toBeInTheDocument(); expect(screen.getByText('Closed on')).toBeInTheDocument();
expect( 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('Enacted on')).toBeInTheDocument();
expect( expect(
screen.getByText( screen.getByText(
format(new Date(proposal.terms.enactmentDatetime), DATE_FORMAT_DETAILED) format(
new Date(proposal.terms.enactmentDatetime || 0),
DATE_FORMAT_DETAILED
)
) )
).toBeInTheDocument(); ).toBeInTheDocument();
}); });
@ -80,7 +83,7 @@ it('Renders error details and rejection reason if present', () => {
const errorDetails = 'Error message'; const errorDetails = 'Error message';
const proposal = generateProposal({ const proposal = generateProposal({
errorDetails, errorDetails,
rejectionReason: ProposalRejectionReason.CloseTimeTooLate, rejectionReason: ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE,
}); });
render(<ProposalChangeTable proposal={proposal} />); render(<ProposalChangeTable proposal={proposal} />);
expect(screen.getByText('Error details')).toBeInTheDocument(); 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('Rejection reason')).toBeInTheDocument();
expect( expect(
screen.getByText(ProposalRejectionReason.CloseTimeTooLate) screen.getByText(ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE)
).toBeInTheDocument(); ).toBeInTheDocument();
}); });

View File

@ -32,10 +32,10 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
{format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)} {format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)}
</KeyValueTableRow> </KeyValueTableRow>
<KeyValueTableRow> <KeyValueTableRow>
{isFuture(new Date(terms.enactmentDatetime)) {isFuture(new Date(terms.enactmentDatetime || 0))
? t('proposedEnactment') ? t('proposedEnactment')
: t('enactedOn')} : t('enactedOn')}
{format(new Date(terms.enactmentDatetime), DATE_FORMAT_DETAILED)} {format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)}
</KeyValueTableRow> </KeyValueTableRow>
<KeyValueTableRow> <KeyValueTableRow>
{t('proposedBy')} {t('proposedBy')}

View File

@ -56,7 +56,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Enacted, state: ProposalState.STATE_ENACTED,
terms: { terms: {
enactmentDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(),
}, },
@ -73,7 +73,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Passed, state: ProposalState.STATE_PASSED,
terms: { terms: {
closingDatetime: lastWeek.toString(), closingDatetime: lastWeek.toString(),
enactmentDatetime: nextWeek.toString(), enactmentDatetime: nextWeek.toString(),
@ -91,7 +91,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.WaitingForNodeVote, state: ProposalState.STATE_WAITING_FOR_NODE_VOTE,
terms: { terms: {
enactmentDatetime: nextWeek.toString(), enactmentDatetime: nextWeek.toString(),
}, },
@ -110,7 +110,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
terms: { terms: {
closingDatetime: fiveMinutes.toString(), closingDatetime: fiveMinutes.toString(),
}, },
@ -127,7 +127,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
terms: { terms: {
closingDatetime: fiveHours.toString(), closingDatetime: fiveHours.toString(),
}, },
@ -144,7 +144,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
terms: { terms: {
closingDatetime: fiveDays.toString(), closingDatetime: fiveDays.toString(),
}, },
@ -161,14 +161,14 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
votes: { votes: {
__typename: 'ProposalVotes', __typename: 'ProposalVotes',
yes: { yes: {
votes: [ votes: [
{ {
__typename: 'Vote', __typename: 'Vote',
value: VoteValue.Yes, value: VoteValue.VALUE_YES,
datetime: lastWeek.toString(), datetime: lastWeek.toString(),
party: { party: {
__typename: 'Party', __typename: 'Party',
@ -199,14 +199,14 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
votes: { votes: {
__typename: 'ProposalVotes', __typename: 'ProposalVotes',
no: { no: {
votes: [ votes: [
{ {
__typename: 'Vote', __typename: 'Vote',
value: VoteValue.No, value: VoteValue.VALUE_NO,
datetime: lastWeek.toString(), datetime: lastWeek.toString(),
party: { party: {
__typename: 'Party', __typename: 'Party',
@ -237,7 +237,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
terms: { terms: {
enactmentDatetime: nextWeek.toString(), enactmentDatetime: nextWeek.toString(),
}, },
@ -258,7 +258,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
terms: { terms: {
enactmentDatetime: nextWeek.toString(), enactmentDatetime: nextWeek.toString(),
}, },
@ -279,7 +279,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
votes: { votes: {
__typename: 'ProposalVotes', __typename: 'ProposalVotes',
yes: generateYesVotes(3000, 1000000000000000000), yes: generateYesVotes(3000, 1000000000000000000),
@ -299,7 +299,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
votes: { votes: {
__typename: 'ProposalVotes', __typename: 'ProposalVotes',
yes: generateYesVotes(0), yes: generateYesVotes(0),
@ -319,7 +319,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Declined, state: ProposalState.STATE_DECLINED,
terms: { terms: {
enactmentDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(),
}, },
@ -340,7 +340,7 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Declined, state: ProposalState.STATE_DECLINED,
terms: { terms: {
enactmentDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(),
}, },
@ -361,17 +361,18 @@ describe('Proposals list item details', () => {
render( render(
renderComponent( renderComponent(
generateProposal({ generateProposal({
state: ProposalState.Rejected, state: ProposalState.STATE_REJECTED,
terms: { terms: {
enactmentDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(),
}, },
rejectionReason: ProposalRejectionReason.InvalidFutureProduct, rejectionReason:
ProposalRejectionReason.PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT,
}) })
) )
); );
expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected'); expect(screen.getByTestId('proposal-status')).toHaveTextContent('Rejected');
expect(screen.getByTestId('vote-status')).toHaveTextContent( expect(screen.getByTestId('vote-status')).toHaveTextContent(
'Invalid future product' 'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT'
); );
}); });
}); });

View File

@ -10,9 +10,9 @@ import {
import { format, formatDistanceToNowStrict } from 'date-fns'; import { format, formatDistanceToNowStrict } from 'date-fns';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
import { ProposalState } from '../../../../__generated__/globalTypes';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import type { Proposals_proposals } from '../../proposals/__generated__/Proposals';
import { ProposalState } from '@vegaprotocol/types';
const MajorityNotReached = () => { const MajorityNotReached = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -52,13 +52,13 @@ export const ProposalsListItemDetails = ({
let voteStatus: ReactNode; let voteStatus: ReactNode;
switch (state) { switch (state) {
case ProposalState.Enacted: { case ProposalState.STATE_ENACTED: {
proposalStatus = ( proposalStatus = (
<> <>
{t('voteState_Enacted')} <Icon name={'tick'} /> {t('voteState_Enacted')} <Icon name={'tick'} />
</> </>
); );
voteDetails = ( voteDetails = proposal.terms.enactmentDatetime && (
<> <>
{format( {format(
new Date(proposal.terms.enactmentDatetime), new Date(proposal.terms.enactmentDatetime),
@ -68,7 +68,7 @@ export const ProposalsListItemDetails = ({
); );
break; break;
} }
case ProposalState.Passed: { case ProposalState.STATE_PASSED: {
proposalStatus = ( proposalStatus = (
<> <>
{t('voteState_Passed')} <Icon name={'tick'} /> {t('voteState_Passed')} <Icon name={'tick'} />
@ -77,15 +77,16 @@ export const ProposalsListItemDetails = ({
voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && ( voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && (
<> <>
{t('toEnactOn')}{' '} {t('toEnactOn')}{' '}
{format( {proposal.terms.enactmentDatetime &&
new Date(proposal.terms.enactmentDatetime), format(
DATE_FORMAT_DETAILED new Date(proposal.terms.enactmentDatetime),
)} DATE_FORMAT_DETAILED
)}
</> </>
); );
break; break;
} }
case ProposalState.WaitingForNodeVote: { case ProposalState.STATE_WAITING_FOR_NODE_VOTE: {
proposalStatus = ( proposalStatus = (
<> <>
{t('voteState_WaitingForNodeVote')} <Icon name={'time'} /> {t('voteState_WaitingForNodeVote')} <Icon name={'time'} />
@ -94,15 +95,16 @@ export const ProposalsListItemDetails = ({
voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && ( voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && (
<> <>
{t('toEnactOn')}{' '} {t('toEnactOn')}{' '}
{format( {proposal.terms.enactmentDatetime &&
new Date(proposal.terms.enactmentDatetime), format(
DATE_FORMAT_DETAILED new Date(proposal.terms.enactmentDatetime),
)} DATE_FORMAT_DETAILED
)}
</> </>
); );
break; break;
} }
case ProposalState.Open: { case ProposalState.STATE_OPEN: {
proposalStatus = ( proposalStatus = (
<> <>
{t('voteState_Open')} <Icon name={'hand'} /> {t('voteState_Open')} <Icon name={'hand'} />
@ -140,7 +142,7 @@ export const ProposalsListItemDetails = ({
)); ));
break; break;
} }
case ProposalState.Declined: { case ProposalState.STATE_DECLINED: {
proposalStatus = ( proposalStatus = (
<> <>
{t('voteState_Declined')} <Icon name={'cross'} /> {t('voteState_Declined')} <Icon name={'cross'} />
@ -151,7 +153,7 @@ export const ProposalsListItemDetails = ({
(!majorityMet && <MajorityNotReached />); (!majorityMet && <MajorityNotReached />);
break; break;
} }
case ProposalState.Rejected: { case ProposalState.STATE_REJECTED: {
proposalStatus = ( proposalStatus = (
<> <>
<StatusFail>{t('voteState_Rejected')}</StatusFail>{' '} <StatusFail>{t('voteState_Rejected')}</StatusFail>{' '}

View File

@ -18,7 +18,7 @@ import type { Proposals_proposals } from '../../proposals/__generated__/Proposal
const openProposalClosesNextMonth = generateProposal({ const openProposalClosesNextMonth = generateProposal({
id: 'proposal1', id: 'proposal1',
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
party: { party: {
id: 'zxcv', id: 'zxcv',
}, },
@ -30,7 +30,7 @@ const openProposalClosesNextMonth = generateProposal({
const openProposalClosesNextWeek = generateProposal({ const openProposalClosesNextWeek = generateProposal({
id: 'proposal2', id: 'proposal2',
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
party: { party: {
id: 'bvcx', id: 'bvcx',
}, },
@ -42,7 +42,7 @@ const openProposalClosesNextWeek = generateProposal({
const enactedProposalClosedLastWeek = generateProposal({ const enactedProposalClosedLastWeek = generateProposal({
id: 'proposal3', id: 'proposal3',
state: ProposalState.Enacted, state: ProposalState.STATE_ENACTED,
terms: { terms: {
closingDatetime: lastWeek.toString(), closingDatetime: lastWeek.toString(),
enactmentDatetime: lastWeek.toString(), enactmentDatetime: lastWeek.toString(),
@ -51,7 +51,7 @@ const enactedProposalClosedLastWeek = generateProposal({
const rejectedProposalClosedLastMonth = generateProposal({ const rejectedProposalClosedLastMonth = generateProposal({
id: 'proposal4', id: 'proposal4',
state: ProposalState.Rejected, state: ProposalState.STATE_REJECTED,
terms: { terms: {
closingDatetime: lastMonth.toString(), closingDatetime: lastMonth.toString(),
enactmentDatetime: lastMonth.toString(), enactmentDatetime: lastMonth.toString(),
@ -60,7 +60,7 @@ const rejectedProposalClosedLastMonth = generateProposal({
const failedProposal = generateProposal({ const failedProposal = generateProposal({
id: 'proposal5', id: 'proposal5',
state: ProposalState.Failed, state: ProposalState.STATE_FAILED,
}); });
const renderComponent = (proposals: Proposals_proposals[]) => ( const renderComponent = (proposals: Proposals_proposals[]) => (

View File

@ -8,6 +8,7 @@ import type { Proposals_proposals } from '../../proposals/__generated__/Proposal
import Routes from '../../../routes'; import Routes from '../../../routes';
import { Button } from '@vegaprotocol/ui-toolkit'; import { Button } from '@vegaprotocol/ui-toolkit';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { ProposalState } from '@vegaprotocol/types';
interface ProposalsListProps { interface ProposalsListProps {
proposals: Proposals_proposals[]; proposals: Proposals_proposals[];
@ -23,7 +24,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
const [filterString, setFilterString] = useState(''); const [filterString, setFilterString] = useState('');
const failedProposalsCulled = proposals.filter( const failedProposalsCulled = proposals.filter(
({ state }) => state !== 'Failed' ({ state }) => state !== ProposalState.STATE_FAILED
); );
const sortedProposals = failedProposalsCulled.reduce( const sortedProposals = failedProposalsCulled.reduce(

View File

@ -30,7 +30,7 @@ export interface VoteButtons_party {
export interface VoteButtons { 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; party: VoteButtons_party | null;
} }

View File

@ -1,8 +1,8 @@
import { captureException, captureMessage } from '@sentry/minimal'; import { captureException, captureMessage } from '@sentry/minimal';
import * as React from 'react'; import * as React from 'react';
import { VoteValue } from '../../../../__generated__/globalTypes'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { useVegaWallet, VegaWalletVoteValue } from '@vegaprotocol/wallet'; import { VoteValue } from '@vegaprotocol/types';
export type Vote = { export type Vote = {
value: VoteValue; value: VoteValue;
@ -64,7 +64,7 @@ export function useUserVote(
setVoteState(VoteState.NotCast); setVoteState(VoteState.NotCast);
} else { } else {
setVoteState( setVoteState(
userVote.value === VoteValue.Yes ? VoteState.Yes : VoteState.No userVote.value === VoteValue.VALUE_YES ? VoteState.Yes : VoteState.No
); );
} }
}, [userVote]); }, [userVote]);
@ -100,7 +100,7 @@ export function useUserVote(
pubKey: keypair.pub, pubKey: keypair.pub,
propagate: true, propagate: true,
voteSubmission: { voteSubmission: {
value: VegaWalletVoteValue[value], value: value,
proposalId, proposalId,
}, },
}; };

View File

@ -3,8 +3,6 @@ import { format } from 'date-fns';
import * as React from 'react'; import * as React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ProposalState } from '../../../../__generated__/globalTypes';
import { VoteValue } from '../../../../__generated__/globalTypes';
import { import {
AppStateActionType, AppStateActionType,
useAppState, useAppState,
@ -18,6 +16,7 @@ import type {
import { VoteState } from './use-user-vote'; import { VoteState } from './use-user-vote';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { Button } from '@vegaprotocol/ui-toolkit'; import { Button } from '@vegaprotocol/ui-toolkit';
import { ProposalState, VoteValue } from '@vegaprotocol/types';
interface VoteButtonsContainerProps { interface VoteButtonsContainerProps {
voteState: VoteState | null; voteState: VoteState | null;
@ -78,7 +77,7 @@ export const VoteButtons = ({
const [changeVote, setChangeVote] = React.useState(false); const [changeVote, setChangeVote] = React.useState(false);
const cantVoteUI = React.useMemo(() => { const cantVoteUI = React.useMemo(() => {
if (proposalState !== ProposalState.Open) { if (proposalState !== ProposalState.STATE_OPEN) {
return t('youDidNotVote'); return t('youDidNotVote');
} }
@ -146,7 +145,7 @@ export const VoteButtons = ({
{voteDatetime ? ( {voteDatetime ? (
<span>{format(voteDatetime, DATE_FORMAT_LONG)}. </span> <span>{format(voteDatetime, DATE_FORMAT_LONG)}. </span>
) : null} ) : null}
{proposalState === ProposalState.Open ? ( {proposalState === ProposalState.STATE_OPEN ? (
<Button <Button
variant="inline-link" variant="inline-link"
onClick={() => { onClick={() => {
@ -166,10 +165,13 @@ export const VoteButtons = ({
return ( return (
<div className="flex gap-4"> <div className="flex gap-4">
<Button onClick={() => submitVote(VoteValue.Yes)} className="flex-1"> <Button
onClick={() => submitVote(VoteValue.VALUE_YES)}
className="flex-1"
>
{t('voteFor')} {t('voteFor')}
</Button> </Button>
<Button onClick={() => submitVote(VoteValue.No)} className="flex-1"> <Button onClick={() => submitVote(VoteValue.VALUE_NO)} className="flex-1">
{t('voteAgainst')} {t('voteAgainst')}
</Button> </Button>
</div> </div>

View File

@ -1,7 +1,6 @@
import { formatDistanceToNow } from 'date-fns'; import { formatDistanceToNow } from 'date-fns';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { ProposalState } from '../../../../__generated__/globalTypes';
import { formatNumber } from '../../../../lib/format-number'; import { formatNumber } from '../../../../lib/format-number';
import { ConnectToVega } from '../../../staking/connect-to-vega'; import { ConnectToVega } from '../../../staking/connect-to-vega';
import { useVoteInformation } from '../../hooks'; import { useVoteInformation } from '../../hooks';
@ -11,6 +10,7 @@ import { useUserVote } from './use-user-vote';
import { VoteButtonsContainer } from './vote-buttons'; import { VoteButtonsContainer } from './vote-buttons';
import { VoteProgress } from './vote-progress'; import { VoteProgress } from './vote-progress';
import { useVegaWallet } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet';
import { ProposalState } from '@vegaprotocol/types';
interface VoteDetailsProps { interface VoteDetailsProps {
proposal: Proposal_proposal; proposal: Proposal_proposal;
@ -50,7 +50,7 @@ export const VoteDetails = ({ proposal }: VoteDetailsProps) => {
<CurrentProposalStatus proposal={proposal} /> <CurrentProposalStatus proposal={proposal} />
</span> </span>
{'. '} {'. '}
{proposal.state === ProposalState.Open ? daysLeft : null} {proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}
</p> </p>
<table className="w-full font-normal mb-12"> <table className="w-full font-normal mb-12">
<thead> <thead>

View File

@ -17,8 +17,8 @@ export interface Proposal_proposal_party {
id: string; id: string;
} }
export interface Proposal_proposal_terms_change_NewFreeform { export interface Proposal_proposal_terms_change_UpdateAsset {
__typename: "NewFreeform"; __typename: "UpdateAsset" | "NewFreeform";
} }
export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_settlementAsset { 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 { export interface Proposal_proposal_terms_change_NewMarket {
__typename: "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; decimalPlaces: number;
/** /**
@ -85,7 +85,7 @@ export interface Proposal_proposal_terms_change_NewAsset_source_BuiltinAsset {
export interface Proposal_proposal_terms_change_NewAsset_source_ERC20 { export interface Proposal_proposal_terms_change_NewAsset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -103,7 +103,7 @@ export interface Proposal_proposal_terms_change_NewAsset {
*/ */
symbol: string; symbol: string;
/** /**
* the source of the new Asset * The source of the new asset
*/ */
source: Proposal_proposal_terms_change_NewAsset_source; 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; 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 { export interface Proposal_proposal_terms {
__typename: "ProposalTerms"; __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. * 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. * 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. * 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 { export interface Proposal_proposal_votes_yes {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: Proposal_proposal_votes_yes_votes[] | null; votes: Proposal_proposal_votes_yes_votes[] | null;
} }
@ -236,15 +237,15 @@ export interface Proposal_proposal_votes_no_votes {
export interface Proposal_proposal_votes_no { export interface Proposal_proposal_votes_no {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: Proposal_proposal_votes_no_votes[] | null; votes: Proposal_proposal_votes_no_votes[] | null;
} }
@ -264,11 +265,11 @@ export interface Proposal_proposal_votes {
export interface Proposal_proposal { export interface Proposal_proposal {
__typename: "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; id: string | null;
/** /**
* A UUID reference to aid tracking proposals on VEGA * A UUID reference to aid tracking proposals on Vega
*/ */
reference: string; reference: string;
/** /**
@ -303,7 +304,7 @@ export interface Proposal_proposal {
export interface 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; proposal: Proposal_proposal;
} }

View File

@ -17,8 +17,8 @@ export interface Proposals_proposals_party {
id: string; id: string;
} }
export interface Proposals_proposals_terms_change_NewFreeform { export interface Proposals_proposals_terms_change_UpdateAsset {
__typename: "NewFreeform"; __typename: "UpdateAsset" | "NewFreeform";
} }
export interface Proposals_proposals_terms_change_NewMarket_instrument_futureProduct_settlementAsset { 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 { export interface Proposals_proposals_terms_change_NewMarket {
__typename: "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; decimalPlaces: number;
/** /**
@ -85,7 +85,7 @@ export interface Proposals_proposals_terms_change_NewAsset_source_BuiltinAsset {
export interface Proposals_proposals_terms_change_NewAsset_source_ERC20 { export interface Proposals_proposals_terms_change_NewAsset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -103,7 +103,7 @@ export interface Proposals_proposals_terms_change_NewAsset {
*/ */
symbol: string; symbol: string;
/** /**
* the source of the new Asset * The source of the new asset
*/ */
source: Proposals_proposals_terms_change_NewAsset_source; 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; 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 { export interface Proposals_proposals_terms {
__typename: "ProposalTerms"; __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. * 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. * 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. * 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 { export interface Proposals_proposals_votes_yes {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: Proposals_proposals_votes_yes_votes[] | null; votes: Proposals_proposals_votes_yes_votes[] | null;
} }
@ -236,15 +237,15 @@ export interface Proposals_proposals_votes_no_votes {
export interface Proposals_proposals_votes_no { export interface Proposals_proposals_votes_no {
__typename: "ProposalVoteSide"; __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; totalTokens: string;
/** /**
* Total number of votes casted for this side * Total number of votes cast for this side
*/ */
totalNumber: string; totalNumber: string;
/** /**
* All votes casted for this side * All votes cast for this side
*/ */
votes: Proposals_proposals_votes_no_votes[] | null; votes: Proposals_proposals_votes_no_votes[] | null;
} }
@ -264,11 +265,11 @@ export interface Proposals_proposals_votes {
export interface Proposals_proposals { export interface Proposals_proposals {
__typename: "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; id: string | null;
/** /**
* A UUID reference to aid tracking proposals on VEGA * A UUID reference to aid tracking proposals on Vega
*/ */
reference: string; reference: string;
/** /**
@ -303,7 +304,7 @@ export interface Proposals_proposals {
export interface Proposals { export interface Proposals {
/** /**
* All governance proposals in the VEGA network * All governance proposals in the Vega network
*/ */
proposals: Proposals_proposals[] | null; proposals: Proposals_proposals[] | null;
} }

View File

@ -1,8 +1,8 @@
import { ProposalState, VoteValue } from '@vegaprotocol/types';
import * as faker from 'faker'; import * as faker from 'faker';
import isArray from 'lodash/isArray'; import isArray from 'lodash/isArray';
import mergeWith from 'lodash/mergeWith'; import mergeWith from 'lodash/mergeWith';
import { ProposalState, VoteValue } from '../../../__generated__/globalTypes';
import type { DeepPartial } from '../../../lib/type-helpers'; import type { DeepPartial } from '../../../lib/type-helpers';
import type { import type {
ProposalFields, ProposalFields,
@ -17,7 +17,7 @@ export function generateProposal(
__typename: 'Proposal', __typename: 'Proposal',
id: faker.datatype.uuid(), id: faker.datatype.uuid(),
reference: 'ref' + faker.datatype.uuid(), reference: 'ref' + faker.datatype.uuid(),
state: ProposalState.Open, state: ProposalState.STATE_OPEN,
datetime: faker.date.past().toISOString(), datetime: faker.date.past().toISOString(),
rejectionReason: null, rejectionReason: null,
errorDetails: null, errorDetails: null,
@ -29,14 +29,14 @@ export function generateProposal(
__typename: 'ProposalTerms', __typename: 'ProposalTerms',
closingDatetime: closingDatetime:
!override.state || // defaults to Open !override.state || // defaults to Open
override.state === ProposalState.Open || override.state === ProposalState.STATE_OPEN ||
override.state === ProposalState.WaitingForNodeVote override.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE
? faker.date.soon().toISOString() ? faker.date.soon().toISOString()
: faker.date.past().toISOString(), : faker.date.past().toISOString(),
enactmentDatetime: enactmentDatetime:
!override.state || // defaults to Open !override.state || // defaults to Open
override.state === ProposalState.Open || override.state === ProposalState.STATE_OPEN ||
override.state === ProposalState.WaitingForNodeVote override.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE
? faker.date.future().toISOString() ? faker.date.future().toISOString()
: faker.date.past().toISOString(), : faker.date.past().toISOString(),
change: { change: {
@ -80,7 +80,7 @@ export const generateYesVotes = (
votes: Array.from(Array(numberOfVotes)).map(() => { votes: Array.from(Array(numberOfVotes)).map(() => {
return { return {
__typename: 'Vote', __typename: 'Vote',
value: VoteValue.Yes, value: VoteValue.VALUE_YES,
party: { party: {
id: faker.datatype.uuid(), id: faker.datatype.uuid(),
__typename: 'Party', __typename: 'Party',
@ -115,7 +115,7 @@ export const generateNoVotes = (
votes: Array.from(Array(numberOfVotes)).map(() => { votes: Array.from(Array(numberOfVotes)).map(() => {
return { return {
__typename: 'Vote', __typename: 'Vote',
value: VoteValue.No, value: VoteValue.VALUE_NO,
party: { party: {
id: faker.datatype.uuid(), id: faker.datatype.uuid(),
__typename: 'Party', __typename: 'Party',

View File

@ -12,7 +12,7 @@ import { AccountType } from "@vegaprotocol/types";
export interface Rewards_party_rewardDetails_asset { export interface Rewards_party_rewardDetails_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -24,7 +24,7 @@ export interface Rewards_party_rewardDetails_asset {
export interface Rewards_party_rewardDetails_rewards_asset { export interface Rewards_party_rewardDetails_rewards_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
} }
@ -144,18 +144,18 @@ export interface Rewards_epoch {
*/ */
id: string; id: string;
/** /**
* Timestamps for start/end etc * Timestamps for start and end of epochs
*/ */
timestamps: Rewards_epoch_timestamps; timestamps: Rewards_epoch_timestamps;
} }
export interface Rewards { 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; 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; epoch: Rewards_epoch;
} }

View File

@ -3,6 +3,8 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ValidatorStatus } from "@vegaprotocol/types";
// ==================================================== // ====================================================
// GraphQL query operation: Nodes // GraphQL query operation: Nodes
// ==================================================== // ====================================================
@ -22,25 +24,25 @@ export interface Nodes_nodes_rankingScore {
*/ */
performanceScore: string; performanceScore: string;
/** /**
* The tendermint voting power of the validator (uint32) * The Tendermint voting power of the validator (uint32)
*/ */
votingPower: string; votingPower: string;
/** /**
* The current validation status of the validator * The current validation status of the validator
*/ */
status: string; status: ValidatorStatus;
} }
export interface Nodes_nodes { export interface Nodes_nodes {
__typename: "Node"; __typename: "Node";
avatarUrl: string | null; avatarUrl: string | null;
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
name: string; name: string;
/** /**
* Pubkey of the node operator * Public key of the node operator
*/ */
pubkey: string; pubkey: string;
/** /**

View File

@ -10,7 +10,7 @@
export interface PartyDelegations_party_delegations_node { export interface PartyDelegations_party_delegations_node {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
} }
@ -51,11 +51,11 @@ export interface PartyDelegations_epoch {
export interface PartyDelegations { 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; 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; epoch: PartyDelegations_epoch;
} }

View File

@ -21,7 +21,7 @@ export interface Staking_party_stake {
export interface Staking_party_delegations_node { export interface Staking_party_delegations_node {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
} }
@ -79,7 +79,7 @@ export interface Staking_epoch {
*/ */
id: string; id: string;
/** /**
* Timestamps for start/end etc * Timestamps for start and end of epochs
*/ */
timestamps: Staking_epoch_timestamps; timestamps: Staking_epoch_timestamps;
} }
@ -115,7 +115,7 @@ export interface Staking_nodes_rankingScore {
*/ */
performanceScore: string; performanceScore: string;
/** /**
* The tendermint voting power of the validator (uint32) * The Tendermint voting power of the validator (uint32)
*/ */
votingPower: string; votingPower: string;
} }
@ -123,16 +123,16 @@ export interface Staking_nodes_rankingScore {
export interface Staking_nodes { export interface Staking_nodes {
__typename: "Node"; __typename: "Node";
/** /**
* The node url eg n01.vega.xyz * The node URL eg n01.vega.xyz
*/ */
id: string; id: string;
name: string; name: string;
/** /**
* Pubkey of the node operator * Public key of the node operator
*/ */
pubkey: string; 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; infoUrl: string;
/** /**
@ -142,9 +142,9 @@ export interface Staking_nodes {
/** /**
* Ethereum public key of the node * 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; stakedByOperator: string;
/** /**
@ -198,11 +198,11 @@ export interface Staking_nodeData {
export interface Staking { 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; 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; epoch: Staking_epoch;
/** /**

View File

@ -44,7 +44,7 @@ export interface PartyStakeLinkings_party {
export interface PartyStakeLinkings { 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; party: PartyStakeLinkings_party | null;
} }

View File

@ -2,7 +2,6 @@ import { gql, useApolloClient } from '@apollo/client';
import * as Sentry from '@sentry/react'; import * as Sentry from '@sentry/react';
import React from 'react'; import React from 'react';
import { StakeLinkingStatus } from '../../../__generated__/globalTypes';
import { StakingMethod } from '../../../components/staking-method-radio'; import { StakingMethod } from '../../../components/staking-method-radio';
import { useContracts } from '../../../contexts/contracts/contracts-context'; import { useContracts } from '../../../contexts/contracts/contracts-context';
import { TxState } from '../../../hooks/transaction-reducer'; import { TxState } from '../../../hooks/transaction-reducer';
@ -16,6 +15,7 @@ import type {
} from './__generated__/PartyStakeLinkings'; } from './__generated__/PartyStakeLinkings';
import { useAppState } from '../../../contexts/app-state/app-state-context'; import { useAppState } from '../../../contexts/app-state/app-state-context';
import { removeDecimal } from '@vegaprotocol/react-helpers'; import { removeDecimal } from '@vegaprotocol/react-helpers';
import { StakeLinkingStatus } from '@vegaprotocol/types';
export const useAddStake = ( export const useAddStake = (
address: string, address: string,
@ -99,7 +99,7 @@ export const usePollForStakeLinking = (
.query<PartyStakeLinkings, PartyStakeLinkingsVariables>({ .query<PartyStakeLinkings, PartyStakeLinkingsVariables>({
query: PARTY_STAKE_LINKINGS, query: PARTY_STAKE_LINKINGS,
variables: { partyId }, 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 // the result is not stored in the cache
fetchPolicy: 'no-cache', fetchPolicy: 'no-cache',
}) })
@ -110,7 +110,8 @@ export const usePollForStakeLinking = (
const matchingLinking = linkings?.find((l) => { const matchingLinking = linkings?.find((l) => {
return ( return (
l.txHash === txHash && l.status === StakeLinkingStatus.Accepted l.txHash === txHash &&
l.status === StakeLinkingStatus.STATUS_ACCEPTED
); );
}); });

View File

@ -38,7 +38,7 @@ export const STAKING_QUERY = gql`
pubkey pubkey
infoUrl infoUrl
location location
ethereumAdddress ethereumAddress
stakedByOperator stakedByOperator
stakedByDelegates stakedByDelegates
stakedTotal stakedTotal

View File

@ -72,10 +72,10 @@ export const ValidatorTable = ({
<span> <span>
<Link <Link
title={t('View on Etherscan (opens in a new tab)')} title={t('View on Etherscan (opens in a new tab)')}
href={`${ETHERSCAN_URL}/address/${node.ethereumAdddress}`} href={`${ETHERSCAN_URL}/address/${node.ethereumAddress}`}
target="_blank" target="_blank"
> >
{node.ethereumAdddress} {node.ethereumAddress}
</Link> </Link>
</span> </span>
</KeyValueTableRow> </KeyValueTableRow>

View File

@ -16,7 +16,7 @@ export interface WithdrawPage_party_accounts_asset_source_BuiltinAsset {
export interface WithdrawPage_party_accounts_asset_source_ERC20 { export interface WithdrawPage_party_accounts_asset_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -26,7 +26,7 @@ export type WithdrawPage_party_accounts_asset_source = WithdrawPage_party_accoun
export interface WithdrawPage_party_accounts_asset { export interface WithdrawPage_party_accounts_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -38,11 +38,11 @@ export interface WithdrawPage_party_accounts_asset {
*/ */
symbol: string; 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; 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; source: WithdrawPage_party_accounts_asset_source;
} }
@ -67,7 +67,7 @@ export interface WithdrawPage_party_accounts {
export interface WithdrawPage_party_withdrawals_asset { export interface WithdrawPage_party_withdrawals_asset {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -75,7 +75,7 @@ export interface WithdrawPage_party_withdrawals_asset {
*/ */
symbol: string; 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; decimals: number;
} }
@ -91,7 +91,7 @@ export interface WithdrawPage_party_withdrawals_details {
export interface WithdrawPage_party_withdrawals { export interface WithdrawPage_party_withdrawals {
__typename: "Withdrawal"; __typename: "Withdrawal";
/** /**
* The Vega internal id of the withdrawal * The Vega internal ID of the withdrawal
*/ */
id: string; id: string;
/** /**
@ -111,7 +111,7 @@ export interface WithdrawPage_party_withdrawals {
*/ */
createdTimestamp: string; createdTimestamp: string;
/** /**
* RFC3339Nano time at which the withdrawal was finalized * RFC3339Nano time at which the withdrawal was finalised
*/ */
withdrawnTimestamp: string | null; withdrawnTimestamp: string | null;
/** /**
@ -147,7 +147,7 @@ export interface WithdrawPage_assets_source_BuiltinAsset {
export interface WithdrawPage_assets_source_ERC20 { export interface WithdrawPage_assets_source_ERC20 {
__typename: "ERC20"; __typename: "ERC20";
/** /**
* The address of the erc20 contract * The address of the ERC20 contract
*/ */
contractAddress: string; contractAddress: string;
} }
@ -157,7 +157,7 @@ export type WithdrawPage_assets_source = WithdrawPage_assets_source_BuiltinAsset
export interface WithdrawPage_assets { export interface WithdrawPage_assets {
__typename: "Asset"; __typename: "Asset";
/** /**
* The id of the asset * The ID of the asset
*/ */
id: string; id: string;
/** /**
@ -169,22 +169,22 @@ export interface WithdrawPage_assets {
*/ */
name: string; 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; 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; source: WithdrawPage_assets_source;
} }
export interface WithdrawPage { 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; 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; assets: WithdrawPage_assets[] | null;
} }

View File

@ -4,7 +4,6 @@ import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { AccountType } from '../../__generated__/globalTypes';
import { Heading } from '../../components/heading'; import { Heading } from '../../components/heading';
import { SplashLoader } from '../../components/splash-loader'; import { SplashLoader } from '../../components/splash-loader';
import { VegaWalletContainer } from '../../components/vega-wallet-container'; import { VegaWalletContainer } from '../../components/vega-wallet-container';
@ -15,6 +14,7 @@ import type {
WithdrawPageVariables, WithdrawPageVariables,
} from './__generated__/WithdrawPage'; } from './__generated__/WithdrawPage';
import { WithdrawManager } from '@vegaprotocol/withdraws'; import { WithdrawManager } from '@vegaprotocol/withdraws';
import { AccountType } from '@vegaprotocol/types';
const Withdraw = () => { const Withdraw = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -105,7 +105,9 @@ export const WithdrawContainer = ({ currVegaKey }: WithdrawContainerProps) => {
const accounts = React.useMemo(() => { const accounts = React.useMemo(() => {
if (!data?.party?.accounts) return []; if (!data?.party?.accounts) return [];
// You can only withdraw from general accounts // 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]); }, [data]);
// Note there is a small period where the withdrawal might have a tx hash but is technically // Note there is a small period where the withdrawal might have a tx hash but is technically

Some files were not shown because too many files have changed in this diff Show More