Go to file
2023-04-21 09:01:38 +08:00
.github/workflows v1.3.1 2023-02-27 21:56:14 +01:00
.vscode v1.0.0 2023-01-31 16:46:56 +01:00
public v1.2.1 2023-02-18 13:58:48 +01:00
src release v1.4.4 2023-04-21 09:01:38 +08:00
.dockerignore feat: introduce Dockerfile 2023-02-07 20:33:43 +01:00
.env v1.2.0 2023-02-07 17:52:13 +01:00
.env.example v1.3.0 2023-02-27 12:19:48 +01:00
.env.production Add ability to specify endpoints 2023-04-20 09:16:15 +02:00
.eslintrc.json v1.0.0 2023-01-31 16:46:56 +01:00
.gitignore env: use main translation branch 2023-02-27 12:23:55 +01:00
.npmrc v1.0.0 2023-01-31 16:46:56 +01:00
.prettierrc v1.0.0 2023-01-31 16:46:56 +01:00
Dockerfile Add ability to specify endpoints 2023-04-20 09:16:15 +02:00
entrypoint.sh Add ability to specify endpoints 2023-04-20 09:16:15 +02:00
jest.config.js v1.0.0 2023-01-31 16:46:56 +01:00
LICENSE v1.0.0 2023-01-31 16:46:56 +01:00
next-config.patch feat: introduce Dockerfile 2023-02-07 20:33:43 +01:00
next-env.d.ts v1.0.0 2023-01-31 16:46:56 +01:00
next.config.js v1.2.0 2023-02-07 17:52:13 +01:00
package.json release v1.4.4 2023-04-20 22:12:19 +08:00
README.md Update image from Docker Hub 2023-04-20 09:49:21 +02:00
tsconfig.json v1.0.0 2023-01-31 16:46:56 +01:00
yarn.lock release v1.4.2 2023-04-12 13:17:37 +02:00

Mars Protocol Osmosis Outpost Frontend

mars-banner-1200w

1. Web App

This project is a NextJS. React application.

The project utilises React hooks, functional components, Zustand for state management, and useQuery for general data fetching and management.

Typescript is added and utilised (but optional if you want to create .jsx or .tsx files).

SCSS with CSS modules (webpack allows importing css files into javascript, use the CSS module technique to avoid className clashes).

2. Deployment

Start web server

yarn && yarn dev

2.1 Custom node endpoints using non-Docker deployments

Copy .env.example to .env and modify the values to suit your needs.

2.2 Custom node endpoints using Docker

We allow the use of environment variables to be passed to the Docker container to specify custom endpoints for the app. The variables are:

Variable Description Default
NETWORK Flag for mainnet or testnet mainnet
URL_GQL The Hive GraphQL endpoint to use https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-hive-front/graphql
URL_REST The node REST endpoint to use https://lcd-osmosis.blockapsis.com
URL_RPC The node RPC endpoint to use https://rpc-osmosis.blockapsis.com

Sample Docker run command

This command will start the container in interactive mode with port 3000 bound to localhost and print logs to stdout.

docker run -it -p 3000:3000 \
      -e NETWORK=mainnet \
      -e URL_GQL=https://your-hive-endpoint.com \
      -e URL_REST=https://your-rest-endpoint.com \
      -e URL_RPC=https://your-rpc-endpoint.com marsprotocol/interface:latest

3. Text and translations

This repository makes use of a translation repository. This repository containes all of the translation key values that are used within the UI. The rationale is to have no hardcoded display string values in this repository.

4. Development practices

4.1 Imports

Local components are imported via index files, which can be automatically generated with yarn index. This command targets index.ts files with a specific pattern in order to automate component exports. This results in clean imports throughout the pages:

import { Button, Card, Title } from 'components/common'

or

import { Breakdown, RepayInput } from 'components/fields'

In order for this to work, components are place in a folder with UpperCamelCase with the respective Component.tsx file. The component cannot be exported at default, so rather export the const instead.

4.2 Data orchestration

Data is handled with a combination of container components, useQuery and Zustand. Container components are responsible for syncing the application state with the wallet-provider state. This fire of the required queries in useQuery, which are for many cases also stored in Zustand.

We aim to have as much as possible available in Zustand, to have one source of truth.

5. Contributing

We welcome and encourage contributions! Please create a pull request with as much information about the work you did and what your motivation/intention was.

6. License

Contents of this repository are open source under the Mars Protocol Web Application License Agreement.