Simple Wallet Example
In this example we will see how a front-end specific plugin is created, which will display an additional wallet page
Last updated
In this example we will see how a front-end specific plugin is created, which will display an additional wallet page
Last updated
In this start-to-finish example, we will add a page that
From the HollaEx root directory, in your terminal, access the plugins folder with:
Run the following command within this plugins directory to initialize the plugin with the name my-simple-wallet:
From your file explorer find the view.json file (located at plugins/src/plugins/my-simple-wallet/views/view/view.json) and update the path value to:
From your file explorer find the view.json file (located at plugins/src/plugins/my-simple-wallet/assets/strings.json) and update the path value to:
Back to the terminal and run the following command on the plugins directory to start the development mode:
In the browser, navigate to localhost:3000
in the address bar on our exchange's sidebar we will see a newly added Simple Wallet tab on the sidebar, and opening this we will see a plain page with the name of the plugin.
First, we will get the required information from the kit and supply it to the Form.js component using the coins
, balance
, and router
values from context:
The final Form.js code is included at the bottom of this page
Now we can access coins
, balance
, and router
values in the form props.
Now we can use this data and add a table to the simple wallet page that displays different assets with the corresponding user balance for each asset. We will also provide two buttons to navigate to the deposit and withdrawal page.
Replace the following code (which created the plain page we saw in the last image)
in the Form.js component with the following table component:
Back in the browser, on refresh we will see the above code reflected on the Simple Wallet page as a simple table with a header as below by refreshing the page.
Import the Button component from the "hollaex-web-lib”
To add content to the table by mapping the coins
object and displaying information for each row. The router
and balance
objects are used for displaying user balance and navigating to other pages respectively.
The Final Form.js Code is found in the expandable box below:
With this final Form.js you should be able to see the completed simple wallet plugin page