2018-10-30 07:18:03 +03:00
|
|
|
# Uniswap Frontend
|
2019-04-15 19:07:16 +03:00
|
|
|
|
|
|
|
[![Netlify Status](https://api.netlify.com/api/v1/badges/fa110555-b3c7-4eeb-b840-88a835009c62/deploy-status)](https://app.netlify.com/sites/uniswap/deploys)
|
2020-05-08 18:38:33 +03:00
|
|
|
[![Tests](https://github.com/Uniswap/uniswap-frontend/workflows/Tests/badge.svg?branch=v2)](https://github.com/Uniswap/uniswap-frontend/actions?query=workflow%3ATests)
|
2019-04-15 21:05:54 +03:00
|
|
|
[![Styled With Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/)
|
2019-04-15 19:07:16 +03:00
|
|
|
|
2020-05-08 20:51:47 +03:00
|
|
|
An open source interface for Uniswap -- a protocol for decentralized exchange of Ethereum tokens.
|
2018-01-18 22:15:59 +03:00
|
|
|
|
2020-05-07 21:36:26 +03:00
|
|
|
- Website: [uniswap.org](https://uniswap.org/)
|
|
|
|
- Docs: [uniswap.org/docs/](https://uniswap.org/docs/)
|
|
|
|
- Twitter: [@UniswapProtocol](https://twitter.com/UniswapProtocol)
|
|
|
|
- Reddit: [/r/Uniswap](https://www.reddit.com/r/Uniswap/)
|
|
|
|
- Email: [contact@uniswap.org](mailto:contact@uniswap.org)
|
2019-12-12 19:57:43 +03:00
|
|
|
- Discord: [Uniswap](https://discord.gg/Y7TF6QA)
|
2019-04-15 21:05:54 +03:00
|
|
|
- Whitepaper: [Link](https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig)
|
2019-12-12 19:57:43 +03:00
|
|
|
|
|
|
|
## Run Uniswap Locally
|
|
|
|
|
|
|
|
1. Download and unzip the `build.zip` file from the latest release in the [Releases tab](https://github.com/Uniswap/uniswap-frontend/releases/latest).
|
|
|
|
2. Serve the `build/` folder locally, and access the application via a browser.
|
|
|
|
|
2020-05-13 23:36:45 +03:00
|
|
|
For more information on running a local server see
|
|
|
|
[https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server).
|
|
|
|
|
|
|
|
This simple approach has one downside: refreshing the page will give a `404` because of how React handles client-side routing.
|
|
|
|
To fix this issue, consider running `serve -s` courtesy of the [serve](https://github.com/zeit/serve) package.
|
2019-12-12 19:57:43 +03:00
|
|
|
|
2019-12-12 22:02:59 +03:00
|
|
|
## Develop Uniswap Locally
|
2018-11-02 11:30:09 +03:00
|
|
|
|
2019-04-25 19:12:47 +03:00
|
|
|
### Install Dependencies
|
2018-11-02 11:30:09 +03:00
|
|
|
|
|
|
|
```bash
|
|
|
|
yarn
|
|
|
|
```
|
|
|
|
|
2020-05-13 23:36:45 +03:00
|
|
|
### Configure Environment (optional)
|
2019-04-15 21:05:54 +03:00
|
|
|
|
2020-05-08 19:05:52 +03:00
|
|
|
Copy `.env` to `.env.local` and change the appropriate variables.
|
2018-11-02 11:30:09 +03:00
|
|
|
|
2019-04-25 19:12:47 +03:00
|
|
|
### Run
|
2019-04-15 21:05:54 +03:00
|
|
|
|
2018-11-02 11:30:09 +03:00
|
|
|
```bash
|
2019-04-25 19:12:47 +03:00
|
|
|
yarn start
|
2018-11-02 11:30:09 +03:00
|
|
|
```
|
|
|
|
|
2020-05-13 23:36:45 +03:00
|
|
|
To have the frontend default to a different network, make a copy of `.env` named `.env.local`,
|
|
|
|
change `REACT_APP_NETWORK_ID` to `"{yourNetworkId}"`, and change `REACT_APP_NETWORK_URL` to e.g.
|
|
|
|
`"https://{yourNetwork}.infura.io/v3/{yourKey}"`.
|
|
|
|
|
|
|
|
Note that the front end only works properly on testnets where both
|
|
|
|
[Uniswap V2](https://uniswap.org/docs/v2/smart-contracts/factory/) and
|
|
|
|
[eth-scan](https://github.com/MyCryptoHQ/eth-scan) are deployed.
|
|
|
|
The frontend is not expected to work with local testnets.
|
|
|
|
|
|
|
|
### Deployment
|
2019-09-18 01:47:55 +03:00
|
|
|
|
2020-05-13 23:36:45 +03:00
|
|
|
As a single page application, all routes that do not match an asset must be redirect to `/index.html`.
|
|
|
|
See [create-react-app documentation.](https://create-react-app.dev/docs/deployment#notes-on-client-side-routing).
|
2019-04-25 19:12:47 +03:00
|
|
|
|
2019-04-15 21:05:54 +03:00
|
|
|
## Contributions
|
|
|
|
|
2020-05-08 19:05:52 +03:00
|
|
|
**Please open all pull requests against the `v2` branch.**
|
|
|
|
CI checks will run against all PRs.
|