Getting More Interesting: Orders with the Tools
In this tutorial lets deal with something a little more involved, creating and monitoring trades through two users with the Network Tools
Let’s try something a bit more fun. Now with users on our exchange, let's see how we can facilitate trades using the network tools.
Since this script will have a little more complexity to it, I am going to be splitting it into a few sections and files so we can see what is going on at each stage.
At the end, a complete script will be provided for enabling and monitoring trade between two users (you can skip to there if you don't want the guided tour).
The possibilities are endless in how you want to integrate the HollaEx Network into your own service, here I will be taking this general hardcoded approach for explanation's sake. The sky is the limit though in how you work with the Tools.
Our script will be even more simple than this I promise, I just like picture to break up text

Goals for this Script

For the sake of reference, these are the rough steps we will take in this tutorial.
Some of these steps are not required for facilitating a sell or buy order, but to show off some more of the feature of the network tools, as well as due to the fact I am running these commands on a test exchange and so a little setup is required.
The main commands we are using are also listed, alongside their step.
  1. 1.
    Interact with three accounts (Admin and two users)
    • Account A and B have been created with a similar script to the previous tutorial and given wallets we need for trades
  2. 2.
    Transfer from the Admin account XHT to user A, and USDT to user B
    • transerAsset
  3. 3.
    From account A create a sell order for 10 XHT and a buy order for Account B for 10 XHT
    • createOrder
  4. 4.
    Observe this order
    • getOrder
    • getOrders
  5. 5.
    See the values in our users' wallets now the trade has occurred
    • getUser
  6. 6.
    See our generated fees from the trade
    • getGeneratedFees
  7. 7.
    Settle these fees to the admin account
    • settleFees
Copy link