Get CAPS balances
CAPS is the Ternoa blockchain token. Transactions made on the Ternoa blockchain are carried out in CAPS. It is used in particular for the creation of NFTs, Encryption, and storage of data over time.
Prerequisites
Before getting started, make sure you have the following ready:
Create a Ternoa account with Alphanet CAPS
Install and set up your editor of choice (we will use Visual Studio Code [VSC] in this tutorial)
Install NodeJS v.14+ & NPM
How to get the total CAPS balance of an address
This example shows how to get the total CAPS balance of an address using getTotalBalance
. The total balance corresponds to the sum of the free balance and the reserve balance. The balanceToNumber
helper is used to format balances from a BN (big number) to a humanized value.
How to get the transferrable CAPS balance of an address
This example shows how to get the transferrable CAPS balance of an address using getTransferrableBalance
. The transferrable balance corresponds to the liquid balance of an account; we do not take into account the staked balance nor the balance locked on the governance. The balanceToNumber
helper is used to format balances from a BN (big number) to a humanized value.
How to subscribe to CAPS balance changes
This example shows how to retrieve balance updates.
Support
If you face any trouble, feel free to reach out to our community engineers in our Discord.
Last updated