Get CAPS balances
Prerequisites
How to get the total CAPS balance of an address
import { balanceToNumber, getTotalBalance } from "ternoa-js";
// Public address of the known account we want to use
const ADDRESS = "5Cf8PBw7QiRFNPBTnUoks9Hvkzn8av1qfcgMtSppJvjYcxp6";
const main = async () => {
try {
const totalBalanceBN = await getTotalBalance(ADDRESS);
const totalBalance = balanceToNumber(totalBalanceBN);
console.log(`The total balance of ${ADDRESS} is:`, totalBalance);
} catch (e) {
console.error(e);
}
};
main();How to get the transferrable CAPS balance of an address
How to subscribe to CAPS balance changes
Support
Last updated