diff --git a/.prettierignore b/.prettierignore index 5967ba713..eb82b9e9f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,3 @@ /dist /coverage __generated__ -*.md diff --git a/README.md b/README.md index c427fcded..eddb7a35d 100644 --- a/README.md +++ b/README.md @@ -6,25 +6,53 @@ This repository is managed using [Nx](https://nx.dev). # 🔎 Applications in this repo -### [Block explorer](https://github.com/vegaprotocol/frontend-monorepo/tree/master/apps/explorer) +### [Block explorer](./apps/explorer) The Vega block explorer provides an interface that allows users to search for and see transactions, blocks, parties, assets, markets and more on the Vega chain. -### [Trading UI](https://github.com/vegaprotocol/frontend-monorepo/tree/master/apps/trading) +### [Trading UI](./apps/trading) The trading interface built based on a component toolkit. It will provide a way for participants to interact with markets and provide resources for others to build additional open-source user interfaces. +### [Token](./apps/token) + +The utlity dApp for interacting with the Vega token and using its' utility. This includes; delegation, nomination, governance and redemption of tokens. + +### [Explorer](./apps/explorer) + +The block explorer for the Vega network, showing details of raw chain states and the state of markets on the Vega network. + +### [Stats](./apps/stats) + +An application for the status of the Vega network. Showing block height and other network activity. + +### [Static](./apps/static) + +Hosting for static content being shared across apps, for example fonts. + # 🧱 Libraries in this repo -### [UI toolkit](https://github.com/vegaprotocol/frontend-monorepo/tree/master/libs/ui-toolkit) +### [UI toolkit](./libs/ui-toolkit) The UI toolkit contains a set of components used to build interfaces that can interact with the Vega protocol, and follow the design style of the project. It contains a storybook that can be served with `yarn nx run ui-toolkit:storybook`. -### [Tailwind CSS config](https://github.com/vegaprotocol/frontend-monorepo/tree/master/libs/tailwindcss-config) +### [Tailwind CSS config](./libs/tailwindcss-config) The Tailwind CSS config contains theme that align default config with Vega design system. +### [Cypress](./libs/cypress) + +For shared Cypress logic, commands and steps. + +### [Web3](./libs/web3) + +A ulitity library for connecting to the Ethereum network and interacting with Vega Web3 contracts. + +### [React Helpers](./libs/react-helpers) + +Generic react helpers that can be used across multilpe applications, along with other utilties. + # 💻 Develop ### Set up @@ -37,15 +65,21 @@ The repository includes a number of template .env files for different networks. Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. -Run `nx serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. +Run `nx serve my-app` for a dev server. Navigate to the port specified in `app//project.json`. The app will automatically reload if you change any of the source files. ### Running tests -Run `yarn nx run -e2e:e2e` to execute the e2e tests with [cypress](https://docs.cypress.io/). You can use the `--watch` flag to open the cypress tests UI in watch mode, see [cypress executor](https://nx.dev/packages/cypress/executors/cypress) for all CLI flags. +Run `yarn nx run -e2e:e2e` to execute the e2e tests with [cypress](https://docs.cypress.io/), or `nx affected:e2e` will execute just the end-to-end tests affected by a change. You can use the `--watch` flag to open the cypress tests UI in watch mode, see [cypress executor](https://nx.dev/packages/cypress/executors/cypress) for all CLI flags. Run `nx test my-app` to execute the unit tests with [Jest](https://jestjs.io), or `nx affected:test` to execute just unit tests affected by a change. You can also use `--watch` with these test to run jest in watch mode, see [Jest executor](https://nx.dev/packages/jest/executors/jest) for all CLI flags. -Similarly `nx e2e my-app` will execute the end-to-end tests with [Cypress](https://www.cypress.io)., and `nx affected:e2e` will execute just the end-to-end tests affected by a change. +### Formatting + +In CI linting, formatting and also run. These checks can be seen in the [CI workflow file](.github/workflows//test.yml). + +- To fix linting errors locally run `yarn nx lint --fix` +- To fix formatting errors local run `yarn nx format` +- For either command you may use `--all` to run across the entire repository ### Further help with Nx @@ -58,9 +92,9 @@ Visit the [Nx Documentation](https://nx.dev/getting-started/intro) to learn more Follow the following steps to start using a local network with the Vega Explorer: 1. Prepare vegacapsule. Follow the [Vegacapsule instructions](https://github.com/vegaprotocol/vegacapsule#quick-start) -1. Build the explorer frontend application -1. Start the explorer frontend application with the `.env.vegacapsule` env file -1. Go to [http://localhost:3000](http://localhost:3000) in your browser +2. Build the explorer frontend application +3. Start the explorer frontend application with the `.env.vegacapsule` env file +4. Go to [http://localhost:3000](http://localhost:3000) in your browser If you simply want to run Explorer locally, without using a local network: diff --git a/apps/explorer/.env.vegacapsule b/apps/explorer/.env.vegacapsule deleted file mode 100644 index bd411c699..000000000 --- a/apps/explorer/.env.vegacapsule +++ /dev/null @@ -1,7 +0,0 @@ -# App configuration variables -NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-explorer-api" -NX_TENDERMINT_URL = "http://localhost:26607/" -NX_TENDERMINT_WEBSOCKET_URL = "wss://localhost:26607/websocket" -NX_VEGA_URL = "http://localhost:3003/query" -NX_VEGA_ENV = 'CUSTOM' -NX_VEGA_REST = 'http://localhost:3029/rest' diff --git a/apps/explorer/README.md b/apps/explorer/README.md new file mode 100644 index 000000000..42963ce9d --- /dev/null +++ b/apps/explorer/README.md @@ -0,0 +1,71 @@ +## Explorer + +## Features + +- Transactions - Showing all transactions and decoded individual transactions +- Search - Search for block number or transaction hash +- Blocks - A list of the blocks on our chain and the transactions within each block +- Assets - List of all assets on the Vega chain +- Genesis - The initial Genesis configuration the network was started with +- Governance - Current and past governance proposals +- Markets - The markets currently open and expired on the Vega network +- Network Parameters - The current network parameters +- Parties - Searching for a specific party and the details for that party +- Validators - The validator information in Vega and Tendermint + +## Development + +First copy the configuration of the application you are starting: + +```bash +cp .env.[environment] .env.local +``` + +Starting the app: + +```bash +yarn nx serve explorer +``` + +### Configuration + +Example configurations are provided here: + +- [Mainnet](./.env.mainnet) +- [Testnet](./.env.testnet) +- [Capsule](./.env.capsule) +- [Testnet](./.env.testnet) +- [Stagnet1](./.env.stagnet1) +- [Stagnet2](./.env.stagnet2) + +There are a few different configuration options offered for this app: + +| **Flag** | **Purpose** | +| -------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `NX_CHAIN_EXPLORER_URL` | The URL of the chain explorer service for decoding transactions | +| `NX_TENDERMINT_URL` | The Tendermint REST URL for the Vega consesus engine | +| `NX_TENDERMINT_WEBSOCKET_URL` | The Tendermint Websocket URL for the Vega consensus engine | +| `NX_VEGA_URL` | The GraphQl query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) | +| `NX_VEGA_ENV` | The name of the currently connected vega environment | +| `NX_VEGA_REST` | The REST URL for the Vega Data Node | +| `NX_EXPLORER_ASSETS` | Enable the assets page for the explorer | +| `NX_EXPLORER_GENESIS` | Enable the genesis page for the explorer | +| `NX_EXPLORER_GOVERNANCE` | Enable the governance page for the explorer | +| `NX_EXPLORER_MARKETS` | Enable the markets page for the explorer | +| `NX_EXPLORER_NETWORK_PARAMETERS` | Enable the network parameters page for the explorer | +| `NX_EXPLORER_PARTIES` | Enable the parties page for the explorer | +| `NX_EXPLORER_VALIDATORS` | Enable the validators page for the explorer | + +## Testing + +To run the minimal set of unit tests, run the following: + +```bash +yarn nx test explorer +``` + +To run the UI automation tests with a mocked API, run: + +```bash +yarn nx run explorer-e2e:e2e +``` diff --git a/apps/static/README.md b/apps/static/README.md new file mode 100644 index 000000000..b3cc64ff1 --- /dev/null +++ b/apps/static/README.md @@ -0,0 +1,3 @@ +# Static + +A static CDN for Vega assets diff --git a/apps/stats/.env.mainnet b/apps/stats/.env.mainnet index 1d34ab55b..4d6e909bf 100644 --- a/apps/stats/.env.mainnet +++ b/apps/stats/.env.mainnet @@ -1 +1,3 @@ # App configuration variables. No overrides for default urls +NX_VEGA_ENV = 'MAINNET' +NX_VEGA_REST = 'https://api.token.vega.xyz/' diff --git a/apps/stats/.env.stagnet1 b/apps/stats/.env.stagnet1 index a9ec115d3..9caf9a482 100644 --- a/apps/stats/.env.stagnet1 +++ b/apps/stats/.env.stagnet1 @@ -1,3 +1,3 @@ # App configuration variables -NX_VEGA_ENV = 'STAGNET 1' +NX_VEGA_ENV = 'STAGNET1' NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest' diff --git a/apps/stats/.env.stagnet2 b/apps/stats/.env.stagnet2 index e19fe0891..dd46b7320 100644 --- a/apps/stats/.env.stagnet2 +++ b/apps/stats/.env.stagnet2 @@ -1,3 +1,3 @@ # App configuration variables -NX_VEGA_ENV = 'STAGNET 2' -NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest' +NX_VEGA_ENV = 'STAGNET2' +NX_VEGA_REST = 'https://n03.stagnet2.vega.xyz/datanode/rest' diff --git a/apps/token/README.md b/apps/token/README.md new file mode 100644 index 000000000..2be98295a --- /dev/null +++ b/apps/token/README.md @@ -0,0 +1,70 @@ +# The Vega token website + +**_Control panel for your VEGA tokens_** + +Screenshot 2021-12-11 at 06 32 51 + +## Features + +- View vesting progress +- Redeem VEGA tokens +- Stake VEGA tokens +- Withdraw tokens +- Vote on proposals + +# Development + +Starting the app: + +`yarn nx serve token` + +## Configuration + +There are a few different configuration options offered for this app: + +| **Flag** | **Purpose** | +| ------------------------------ | ---------------------------------------------------------------------------------------------------- | +| `NX_APP_SENTRY_DSN` | The sentry endpoint to report to. Should be off in dev but set in live. | +| `NX_APP_CHAIN` | The ETH chain for the app to work on. Should be mainnet for live, but ropsten for preview deploys. | +| `NX_APP_VEGA_URL` | The GraphQL query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) | +| `NX_APP_DEX_STAKING_DISABLED` | Disable the dex liquidity page an show a coming soon message | +| `NX_APP_FAIRGROUND` | Change styling to be themed as the fairground version of the website | +| `NX_APP_INFURA_ID` | Infura fallback for if the user does not have a web3 compatible browser | +| `NX_APP_HOSTED_WALLET_ENABLED` | If the hosted wallet is enabled or not. If so then allow users to login using the hosted wallet | +| `NX_APP_ENV` | Change network to connect to. When set to CUSTOM use CUSTOM\_\* vars for network parameters | +| `CUSTOM_URLS` | When NX_APP_ENV=CUSTOM use these Data Node REST URLs, optional if CUSTOM_URLS_WITH_GRAPHQL is used. | +| `CUSTOM_URLS_WITH_GRAPHQL` | When NX_APP_ENV=CUSTOM use these Data Node GraphQL URLs, optional if CUSTOM_URLS is used. | +| `CUSTOM_TOKEN_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega token address. | +| `CUSTOM_CLAIM_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega claim address. | +| `CUSTOM_LOCKED_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega locked address. | +| `CUSTOM_VESTING_ADDRESS` | When NX_APP_ENV=CUSTOM specify Vega vesting address. | +| `CUSTOM_STAKING_BRIDGE` | When NX_APP_ENV=CUSTOM specify Vega staking bridge address. | + +## Example configs: + +For example configurations, check out our [netlify.toml](./netlify.toml). + +## Testing + +To run the minimal set of unit tests, run the following: + +```bash +yarn nx test token +``` + +To run the UI automation tests with a mocked API, run: + +```bash +yarn nx run token-e2e:e2e +``` + +## See also + +- [vega-locked-erc20](https://github.com/vegaprotocol/vega-locked-erc20) - proxy contract that shows your current balance + of locked tokens +- [VEGA Tokens: Vesting Details](https://blog.vega.xyz/vega-tokens-vesting-details-890b00fc238e) - blog describing + the vesting process & key dates +- [Introducing the VEGA token](https://blog.vega.xyz/introducing-the-vega-token-40dac090b5c1) - blog about the VEGA + token +- [The VEGA Token Listing & LP Incentives](https://blog.vega.xyz/unlocking-vega-coinlist-pro-uniswap-sushiswap-b1414750e358) - blog about the token and site +- [vega.xyz](https://vega.xyz) - about Vega Protocol diff --git a/apps/trading/README.md b/apps/trading/README.md new file mode 100644 index 000000000..5d256bc19 --- /dev/null +++ b/apps/trading/README.md @@ -0,0 +1,49 @@ +## Trading + +## Development + +First copy the configuration of the application you are starting: + +```bash +cp .env.[environment] .env.local +``` + +Starting the app: + +```bash +yarn nx serve explorer +``` + +### Configuration + +Example configurations are provided here: + +- [Mainnet](./.env.mainnet) +- [Testnet](./.env.testnet) +- [Testnet](./.env.testnet) +- [Stagnet1](./.env.stagnet1) +- [Stagnet2](./.env.stagnet2) + +There are a few different configuration options offered for this app: + +| **Flag** | **Purpose** | +| -------------------------- | -------------------------------------------------------------------------------------------------------- | +| `NX_VEGA_ENV` | The name of the currently connected vega environment | +| `NX_VEGA_URL` | The GraphQL query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) | +| `NX_ETHEREUM_CHAIN_ID` | The ID of the Ethereum chain the currently connected Vega Network uses. E.g. Ropsten (3) for testnet | +| `NX_ETHEREUM_PROVIDER_URL` | The Ethereum Provider URL for getting data from the Ethereum network, for example Infura or a local node | +| `NX_ETHERSCAN_URL` | The Etherscan URL to link Ethereum transactions to | + +## Testing + +To run the minimal set of unit tests, run the following: + +```bash +yarn nx test trading +``` + +To run the UI automation tests with a mocked API, run: + +```bash +yarn nx run trading-e2e:e2e +```