Officia01d0fd10f8da4338f009e55526954a9d0a13f38al frontend app for the Balancer protocol (v2)
To setup the development environment first clone the repo:
git clone https://github.com/balancer/frontend-v2.git && cd frontend-v2
Install dependencies:
npm install
Start the app:
npm run dev
The app should be live at http://localhost:8080
Run unit tests:
npm run test:unit
Run unit tests in watch mode:
npm run test:unit:watch
Run unit tests with coverage:
npm run test:unit:coverage
Run unit tests with only lcov coverage (useful when doing exploratory testing):
npm run test:unit:silent:coverage
Run build:
npm run build
Preview build:
npm run preview
Run build in watch mode:
npm run build:watch
This mode is useful when you need to reproduce/fix bugs/issues in a production-like environment.
If you'd rather spin up the app in a docker container, first install dependencies to you local folder:
docker-compose build
docker-compose run --rm web npm i
and start the app:
docker-compose up
The app should be live at http://localhost:8080
If you are on Apple Silicon, try this:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
As we believe in decentralization at all layers, we've made it easy to host your own Balancer Frontend.
We've created a production ready docker image runs a pre-built version of Balancer Frontend-v2 using nginx. You'll need your own Infura, Alchemy, and Blocknative API keys in order to fetch data and execute transactions.
Here's an example of how to run the container. This can also be found in scripts/run-docker.sh.
docker run \
-e INFURA_PROJECT_ID= \ # Required
-e ALCHEMY_KEY= \ # Required
-e BLOCKNATIVE_DAPP_ID= \ # Required
balancerfi/frontend-v2
To override RPC network config set in src/lib/config
, you can use the following environment variables:
VITE_RPC_URL_<networkId>=XXX
The frontend can easily be deployed to any static host. Use the buttons below to spin up an instance. You will be prompted to provide your Infura Project ID, Alchemy Key, and Blocknative Dapp ID as these are required for the frontend to work correctly.
This app is powered by vite, which:
Both tools above rely on native ES modules but our app also depends on libraries like ethers.js which use Node.js built-in modules (like Buffer, stream or crypto) that require browser polyfills. Thats why our vite.config.ts
uses node-pollyfills
and rollup-plugin-polyfill-node.
We use some Vite plugins to improve the Vue developer experience.
Auto imports components located in src/components/_global
so that they are available from every other component in the application (and from vitest).
(It also auto generates a d.ts file for the auto imported components).
Analyze and visualize the bundle dependencies:
npm run build:analyze