commercionetwork / almerico

Official Commercio.network explorer
https://mainnet.commercio.network/
MIT License
3 stars 1 forks source link
blockchain vuejs

Almerico

GitHub release GitHub repo size GitHub top language GitHub license

Almerico (tribute to Almerico from Schio) is the official Commercio.network explorer.

Install

In order to properly build the project, first you have to install all of its dependencies. To do so run:

npm install

Project setup

Development

In order to run this project as a developer with the hot reload option enabled, you have to:

  1. Create a file named .env.development.local inside the project root folder;
  2. Inside the .env.development.local file add the following data:

    VUE_APP_API_VERSION=VALUE (e.g., v1)
    VUE_APP_API_VERSION_COSMWASM=VALUE (e.g., v1)
    VUE_APP_ANCESTORS=VALUE (e.g., [{"lcd_ledger":"http://lcd.com",
    "lcd": "http://lcd.com", "ver": "0.12"}])
    VUE_APP_BACKEND=VALUE (e.g., http://backend.com)
    VUE_APP_BACKEND_WS=VALUE (e.g., ws://backend.com/websocket)
    VUE_APP_CONNECTIONS=VALUE (e.g., [{"id":"connection-10","chain_id":"osmo-test-5"}])
    VUE_APP_CONTRACT_DEX=VALUE (e.g., did:com:1yva23huwtu5f5tzm9vu3ce4h4y7x9j0q59wvse4t0lrzhhv68tzq5vps96)
    VUE_APP_FIRST_CONVERSION_RATE=VALUE (e.g., 1)
    VUE_APP_FIRST_HEIGHT=VALUE (e.g., 1234)
    VUE_APP_HAS_POOLS=VALUE (e.g., true)
    VUE_APP_LCD=VALUE (e.g., http://lcd.com)
    VUE_APP_MAIN_TITLE=VALUE (e.g., Testnet)
    VUE_APP_WASM_CW20_CODE_ID=VALUE (e.g., '7')
    VUE_APP_WASM_SWAP_CODE_ID=VALUE (e.g., '4')
    VUE_APP_WS=VALUE (e.g., ws://rpc.com/websocket)

Compiles and hot-reloads for development

To execute the explorer run:

npm run serve

This will start a local web server and publish a web page to http://localhost:8080

Production

Create a file named .env.production inside the project root folder and set the following data with your values:

VUE_APP_API_VERSION=VALUE (e.g., v1)
VUE_APP_API_VERSION_COSMWASM=VALUE (e.g., v1)
VUE_APP_ANCESTORS=VALUE (e.g., [{"lcd_ledger":"https://lcd.com",
"lcd": "https://lcd.com", "ver": "0.12"}])
VUE_APP_BACKEND=VALUE (e.g., https://backend.com)
VUE_APP_BACKEND_WS=VALUE (e.g., wss://backend.com/websocket)
VUE_APP_CONNECTIONS=VALUE (e.g., [{"id":"connection-8","chain_id":"osmosis-1"}])
VUE_APP_CONTRACT_DEX=VALUE (e.g., did:com:1yva23huwtu5f5tzm9vu3ce4h4y7x9j0q59wvse4t0lrzhhv68tzq5vps96)
VUE_APP_FIRST_CONVERSION_RATE=VALUE (e.g., 1)
VUE_APP_FIRST_HEIGHT=VALUE (e.g., 1)
VUE_APP_HAS_POOLS=VALUE (e.g., false)
VUE_APP_LCD=VALUE (e.g., https://lcd.com)
VUE_APP_MAIN_TITLE=VALUE (e.g., Mainnet)
VUE_APP_WASM_CW20_CODE_ID=VALUE (e.g., '1')
VUE_APP_WASM_SWAP_CODE_ID=VALUE (e.g., '2')
VUE_APP_WS=VALUE (e.g., wss://rpc.com/websocket)

Compiles and minifies for production

To build the project run:

npm run build

Run your unit tests

To test the code base run:

npm run test

Lints and fixes files

npm run lint

Docker

Build the Docker image

docker build -t almerico \
  --build-arg ANCESTORS_LIST=<Ancestors list> \
  --build-arg API_VERSION=<API version> \
  --build-arg API_VERSION_COSMWASM=<API version> \
  --build-arg BACKEND=<Backend url> \
  --build-arg BACKEND_WS=<Backend WebSocket URL> \
  --build-arg CONNECTIONS=<Connections list> \
  --build-arg CONTRACT_DEX=<DEX contract address> \
  --build-arg FIRST_CONVERSION_RATE=<First conversion rate> \
  --build-arg FIRST_HEIGHT=<First height> \
  --build-arg HAS_POOLS=<boolean> \
  --build-arg LCD_URL=<LCD URL> \
  --build-arg MAIN_TITLE=<App title> \
  --build-arg WASM_CW20_CODE_ID=<Wasm CW20 code_id> \
  --build-arg WASM_SWAP_CODE_ID=<Wasm SWAP code_id> \
  --build-arg WS_URL=<WebSocket URL> \
  .

Use the Docker image

docker run --name almerico --rm almerico

Customize the explorer

To customize the configuration edit the config.json file which is in the /src/config folder.

Customize the Vue.js CLI configuration

In order to properly customize the Vue.js CLI configuration please refer to the official configuration page.