Skip to content

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

7 watching

Forks

Repository files navigation

Generated by generator-ezetech

This is a monorepo for multiple clients:

  1. Dashboard user site — https://app.fio.net/
  2. Dashboard admin panel
  3. Wrap status page — the page where the user could check the status of wrap and unwrap actions — https://wrap.fio.net/
  4. FIO Id — the page where any user could get some public data for any FIO Handle — https://fio.id/
  5. FIO Wallet snap for testing and developing the Metamask snap — https://snaps.metamask.io/snap/npm/fioprotocol/fio-wallet-snap/

Requirements

  • Node v16.14.2
  • PostgreSQL database

Notices

If you want to update the edge-core-js — update the forked edge-currency-accountbased. You need to remove all unused providers to make the library as tiny as possible.

Initial setup

There are a couple of setups that should be done before the 1st app run:

a) Setup the account profiles for registering orders.

  • For Free Handles should be accounts with regaddress permission — 1st primary and 2nd fallback.
  • For Paid items should be accounts with active permission — 1st primary and 2nd fallback.
  • For metamask domain should be regaddress permission and this account should be the owner of the metamask private domain.

b) Setup the api urls. For more details use https://bpmonitor.fio.net/ site or switch on Dynamic Fetch on /api-urls.

c) Pre-setup default domains on admin Defaults — they will be shown on the FIO handles selection page.

Deploy process

If you use the current AWS flow — any push to the production main branch will trigger the build pipeline. How the flow should go develop => staging => main.

Warning! After deploy check the notification table and verify manually that it looks fine and there are no duplications or wrong emails. If all is good — go to admin Defaults and toggle Outbound Emails to OFF to run them back.

If you are deploying by yourself, follow this instruction:

  1. Run npm install --legacy-peer-deps.
  2. Run npm run client:build. It will generate static files. Host them somewhere.
  3. Run npm run admin:as:build for the admin panel. It will generate static files. Host them somewhere.
  4. Run the server npm run server:prod.
  5. Set up a couple of cron-jobs:
    • npm run scheduler — runs tasks that are set as a param in the command. If you need to change the tasks or add a new one, edit that command.
    • npm run scheduler:wallet-data — gets the data of the wallets that are registered via the dashboard.
    • npm run scheduler:orders — processes the orders.
    • npm run scheduler:wrap-status — gets the data for the wrap status page.

There are a couple of pages that could be deployed as well:

  1. If you need the Wrap status page client, run npm run landing-page-wrap-status:as:build.
  2. If you need the FIO Id page, run npm run landing-page-fio-id:as:build.

Client

Documentation: Create-React-App.

https://github.com/facebook/create-react-app

Run tests:
npm test

In case you can't run tests: brew install watchman

Server

Run server in dev mode

Create .env file from .env.example template:

Run docker-compose:

docker-compose up

Then run

npm run server:dev

Notice: Before start app in dev mode you need to run npm install

Run tests for server

npm test:api

Code styles

  • Imports in files should have the right order:

    • 3-d party libs
    • components
    • components form the same folder
    • constants
    • methods/utils/hooks
    • types
    • css
  • Default exports for pages and named exports is for other exports

  • If you see that something is not styled as it should be - change it.

Email templates

We change code for email templates here https://github.com/fioprotocol/fio-dashboard-tools Then we copy generated templates into dashboard app.

BitPay integration

If you want to use BitPay locally you need to have public access to your running application for webhook and payment BitPay site redirectUrl. How to easy handle this on your machine?

  1. Install nginx - https://www.nginx.com/ Useful links:
  • https://www.cyberciti.biz/faq/nginx-restart-ubuntu-linux-command/
  1. Install ngrok - https://ngrok.com/
  • You need to register there
  1. Configure nginx:
  • I have 5555 port, you could use any other port you want. Add this to you nginx.conf server part:
        # some default settings...
        
        listen       5555;
        server_name  localhost;

        location / {
            proxy_pass http://localhost:3000;
        }

        location /api/v1 {
            proxy_pass http://localhost:9006;
        }
    }
  1. Run nginx
  2. Run ngrok with command ngrok http 5555
  3. Ngrok will return a pubilc url address like https://564b-178-133-53-168.ngrok.io. Set it as API_BASE_URL and rerun server. Every time you run ngrok your public url address changes re-setup API_BASE_URL and rerun server. Enjoy!

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages