Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modify env #62

Merged
merged 11 commits into from
Apr 2, 2024
69 changes: 58 additions & 11 deletions .env template
Original file line number Diff line number Diff line change
@@ -1,20 +1,67 @@
# VITE_ATTESTOR_API_URLS_EXAMPLE: https://example/attestor-1,https://example/attestor-2,https://example/attestor-3
#### --------------------------- ####
# Environment Variables Template #
#### --------------------------- ####

# Regtest
# This file is a template for the environment variables that need to be set in the `.env` file.
# Copy the contents of this file into the different environments' `.env` files and fill in the values.

VITE_ETHEREUM_DEPLOYMENT_BRANCH=dev
VITE_ETHEREUM_DEPLOYMENT_VERSION=1
VITE_ENABLED_ETHEREUM_NETWORKS='11155111'
VITE_ATTESTOR_API_URLS=
VITE_BITCOIN_NETWORK=regtest
VITE_BITCOIN_EXPLORER_API_URL=https://devnet.dlc.link/electrs/tx/
VITE_BITCOIN_BLOCKCHAIN_API_URL=https://devnet.dlc.link/electrs
# Naming Conventions:
# - `.env.localhost`: For locally run attestors / regtest bitcoin. Use with `yarn localhost`.
# - `.env.devnet`: For deployed devnet attestors / regtest bitcoin. Use with `yarn devnet`.
# - `.env.testnet`: For deployed testnet attestors / testnet bitcoin. Use with `yarn testnet`.
# - `.env.mainnet`: For deployed mainnet attestors / mainnet bitcoin. Use with `yarn mainnet`.

# ------------------------------------
# Example Values for Missing Variables
# ------------------------------------

# Endpoints of the Attestor Group API
# VITE_ATTESTOR_API_URLS=https://example.com/attestor-1,https://example.com/attestor-2,https://example.com/attestor-3

# ----------------------------------------
# Locally Run Attestors / Regtest Bitcoin
# ----------------------------------------

# VITE_ETHEREUM_DEPLOYMENT_BRANCH=dev
# VITE_ETHEREUM_DEPLOYMENT_VERSION=1
# VITE_ENABLED_ETHEREUM_NETWORKS='11155111'
# VITE_ATTESTOR_API_URLS=
# VITE_BITCOIN_NETWORK=regtest
# VITE_BITCOIN_EXPLORER_API_URL=https://devnet.dlc.link/electrs
# VITE_BITCOIN_BLOCKCHAIN_API_URL=https://devnet.dlc.link/electrs

# -------------------------------------------
# Deployed Devnet Attestors / Regtest Bitcoin
# -------------------------------------------

# # Testnet
# VITE_ETHEREUM_DEPLOYMENT_BRANCH=dev
# VITE_ETHEREUM_DEPLOYMENT_VERSION=1
# VITE_ENABLED_ETHEREUM_NETWORKS='11155111'
# VITE_ATTESTOR_API_URLS=
# VITE_BITCOIN_NETWORK=regtest
# VITE_BITCOIN_EXPLORER_API_URL=https://devnet.dlc.link/electrs
# VITE_BITCOIN_BLOCKCHAIN_API_URL=https://devnet.dlc.link/electrs

# --------------------------------------------
# Deployed Testnet Attestors / Testnet Bitcoin
# --------------------------------------------

# VITE_ETHEREUM_DEPLOYMENT_BRANCH=testnet
# VITE_ETHEREUM_DEPLOYMENT_VERSION=1
# VITE_ENABLED_ETHEREUM_NETWORKS='11155111'
# VITE_ATTESTOR_API_URLS=
# VITE_BITCOIN_NETWORK=testnet
# VITE_BITCOIN_EXPLORER_API_URL=https://mempool.space/testnet/tx/
# VITE_BITCOIN_EXPLORER_API_URL=https://mempool.space/testnet
# VITE_BITCOIN_BLOCKCHAIN_API_URL=https://testnet.dlc.link/electrs

# --------------------------------------------
# Deployed Mainnet Attestors / Mainnet Bitcoin
# --------------------------------------------

# VITE_ETHEREUM_DEPLOYMENT_BRANCH=mainnet
# VITE_ETHEREUM_DEPLOYMENT_VERSION=1
# VITE_ENABLED_ETHEREUM_NETWORKS='11155111'
# VITE_ATTESTOR_API_URLS=
# VITE_BITCOIN_NETWORK=mainnet
# VITE_BITCOIN_EXPLORER_API_URL=https://mempool.space
# VITE_BITCOIN_BLOCKCHAIN_API_URL=https://mainnet.dlc.link/electrs
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ dist-ssr
/playwright/.cache/

# Environment variables
.env
.env.development
.env*
!.env.example
66 changes: 47 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
# React + TypeScript + Vite
# DLC.Link - dlcBTC Bridge

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
## Installation

Currently, two official plugins are available:
To install all the dependencies, run the following command:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
```bash
yarn install
```

or

```bash
npm install
```

## Setup Environment Variables

This application uses environment variables for configuration. These are stored in `.env` files. There are different `.env` files for different environments:

- `.env.localhost`: For locally run attestors / regtest bitcoin.
- `.env.devnet`: For deployed devnet attestors / regtest bitcoin.
- `.env.testnet`: For deployed testnet attestors / testnet bitcoin.
- `.env.mainnet`: For deployed mainnet attestors / mainnet bitcoin.

Copy the contents of the `.env` template file into the appropriate `.env` file for your environment and fill in the values. The template for the environment variables can be found in the `.env.template` file in the root directory of this project.

Please ensure that you replace the placeholders with your actual values.

## Expanding the ESLint configuration
## Running the Application

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
According to the environment you want to run the application in, you can run the following commands:

- Configure the top-level `parserOptions` property like this:
- For locally ran attestors / regtest bitcoin:

```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```bash
yarn localhost
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
# dlc-btc-website
- For deployed devnet attestors / regtest bitcoin:

```bash
yarn devnet
```

- For deployed testnet attestors / testnet bitcoin:

```bash
yarn testnet
```

- For deployed mainnet attestors / mainnet bitcoin:

```bash
yarn mainnet
```
Loading
Loading