2022-05-03 15:32:31 +00:00
|
|
|
## Trading
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
First copy the configuration of the application you are starting:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp .env.[environment] .env.local
|
|
|
|
```
|
|
|
|
|
|
|
|
Starting the app:
|
|
|
|
|
|
|
|
```bash
|
2023-07-11 09:41:54 +00:00
|
|
|
yarn nx serve trading
|
2022-05-03 15:32:31 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
|
|
|
Example configurations are provided here:
|
|
|
|
|
|
|
|
- [Mainnet](./.env.mainnet)
|
2023-07-04 16:20:40 +00:00
|
|
|
- [Mainnet-mirror](./.env.mainnet-mirror)
|
2022-05-23 09:56:11 +00:00
|
|
|
- [Devnet](./.env.devnet)
|
2022-05-03 15:32:31 +00:00
|
|
|
- [Testnet](./.env.testnet)
|
|
|
|
|
2022-07-06 15:53:35 +00:00
|
|
|
For convenience, you can boot the app injecting one of the configurations above by running:
|
|
|
|
|
|
|
|
```bash
|
2023-07-11 09:41:54 +00:00
|
|
|
yarn env-cmd -f .\apps\trading\.env.{env} yarn nx run trading:serve # e.g. stagnet1
|
2022-07-06 15:53:35 +00:00
|
|
|
```
|
|
|
|
|
2022-05-03 15:32:31 +00:00
|
|
|
There are a few different configuration options offered for this app:
|
|
|
|
|
2022-06-21 23:20:53 +00:00
|
|
|
The network configuration for the app
|
|
|
|
|
2022-05-03 15:32:31 +00:00
|
|
|
| **Flag** | **Purpose** |
|
|
|
|
| -------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
|
|
| `NX_VEGA_ENV` | The name of the currently connected vega environment |
|
2022-06-21 23:20:53 +00:00
|
|
|
| `NX_VEGA_CONFIG_URL` | The network configuration for the app |
|
2022-05-03 15:32:31 +00:00
|
|
|
| `NX_VEGA_URL` | The GraphQL query endpoint of a [Vega data node](https://github.com/vegaprotocol/networks#data-node) |
|
|
|
|
| `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
|
|
|
|
```
|