Implementing a staking pool listing dashboard
In this section, we will create a staking pool listing dashboard, as shown in Figure 10.2:
Figure 10.2 – The UI for the staking pool listing dashboard
Figure 10.2 shows a dashboard that lists all the staking pools with the staking terms of each pool. The accordion component of each staking pool can be expanded for the user to interact with the staking pool. At the top of the page, there is a check box to hide the expired pools. There is also a button at the bottom of the page for users to create new staking pools.
Retrieve staking pools
The first process needed to build the staking pool listing dashboard is to retrieve all the staking pools. We have learned from Chapter 9, Building Smart Contracts for Staking and Farming that there is a getAllStakingPools
function in the StakingPoolManager
smart contract. We can use this function to retrieve all the addresses of the staking pools. We can also access...