Run Dev Mode

Dev mode is for development purposes to allow easier debugging and testing. If you have built your exchange using CLI commands running on your machine, you need to stop and start the process fresh with the following instructions.

Clone the HollaEx Kit Github repo: https://github.com/hollaex/hollaex-kit

git clone https://github.com/hollaex/hollaex-kit.git

HollaEx Kit /web is the front-end project built in ReactJS that connects to the HollaEx Kit server which is accessible in the /server folder.

Server

In order to start the server in dev mode you need to run the following:

You need to download a new Kit in order to follow the guide. Following the guide below with the existing Kit exchange could cause unexpected issues. Please make sure to proceed with a new fresh HollaEx Kit.

Before you proceed, please set up a new exchange on the HollaEx Dashboard. Please visit dash.hollaex.com for the mainnet connection or dash.testnet.hollaex.com for the testnet connection.

You need to get 2 things here.

Please save them somewhere safe. You'll need those very soon.

If you have your own custom HollaEx Network, you should set the following value in the env file, and go through the exchange creation flow above on your own network.

  • NETWORK_URL=https://<YOUR_CUSTOM_HOLLAEX_NETWORK_API_URL>

  1. Enter the HollaEx Kit folder with cd hollaex-kit/

  2. cd server/

  3. make a new env file mv tools/hollaex-kit.env.local.example tools/hollaex-kit.env.local

    1. Open the new tools/hollaex-kit.env.local file with a text editor/ IDE.

    2. Fill up API_KEY, API_SECRET, and ACTIVATION_CODE values you got from the HollaEx Dashboard.

      1. API_KEY and API_SECRET are for the exchange keys.

      2. ACTIVATION_CODE is for the activation code.

  4. Run docker-compose up to start the server.

  5. Once docker is all set, open a new terminal window, and check the status of the containers with docker ps . There should be 4 containers for nginx redis postgresql and the kit server

  6. Go inside the Docker container, by running docker exec -it server_hollaex-kit-server_1 /bin/bash

  7. Once you are successfully inside the docker container you should run the following commands:

    • Run database migrations: sequelize db:migrate

    • Run database seed: sequelize db:seed:all

    • Run database triggers: node tools/dbs/runTriggers.js

    • Run activation to activate the exchange: node tools/dbs/setActivationCode.js

  8. On the terminal that you ran docker-compose up, press ctrl + c to stop the process, then run docker-compose up again to apply the new settings.

Checking Dev Mode is working

One thing we can do to see dev mode in action is run the pre-existing 'hello-exchange' plugin. This will have been downloaded as part of the cloning process above and can be found at:

hollaex-kit/plugins/src/plugins/hello-exchange

Whilst docker-compose up is running in one terminal, in another terminal, enter the hollaex-kit_server docker container with:

docker exec -it server_hollaex-kit-server_1 /bin/bash (just as in step 7 above).

Once in the container run:

node plugins/dev.js --plugin=hello-exchange

Give it a little time (until 'info: HELLO-EXCHANGE PLUGIN initializing...' is printed) and from your browser access:

http://localhost:10013/plugins/hello-exchange/info

You should see the output in the image below.

Editing a File While in Dev Mode

Now let's edit the hello-exchange plugin, access the following file (I will be in my IDE):

hollaex-kit/plugins/src/plugins/hello-exchange/server/script.js

Edit the returned JSON object highlighted in the image above. Here the message has been altered from retrieving values from the config file, and elsewhere, to the string "Something new!"

Now go back to the terminal where we built the plugin (where the node command was run) and stop the process, and rerun it (node plugins/dev.js --plugin=hello-exchange). Refresh the localhost browser page, and we will see that a new message is now displayed.

From this very quick example, you can see the benefit of dev mode, rather than needing to completely rebuild the codebase, we have been able to quickly make a change, rebuild it in seconds and see that change reflected.

Accessing Dev Mode After Initial Setup

Once you have completed all the above, and either come out of dev mode or rebooted your machine, fortunately, to get back into dev mode the only command required to run is docker-compose up in the /server directory. Easy peasy.

Web

/web folder in HollaEx Kit is a ReactJS project that contains all the front-end code.

Use node.js v14 for the best compatibility since some latest version of node.js might fail to run.

To run it locally in development mode, you need to run: npm start which installs all the dependencies and starts the browser on http://localhost:3000 .

Changes are applied and updated live on the site.

By default, it connects to the default HollaEx Kit which is HollaEx Sandbox https://api.sandbox.hollaex.com

You can change this value in /web/src/config/index.js

Change DEVELOPMENT_ENDPOINT to your custom HollaEx Kit server API.

Last updated