Get the account balance of any ERC20 or ERC777 token on the Aventus Network
Returns the balance of a specific token for a given AvN account
await api.query.getTokenBalance(account, token_address);
Example
const AvnApi = require("avn-api");
const GATEWAY = "<endpoint_url>"; //Replace the endpoint_url with the url received from Aventus.
const api = new AvnApi(GATEWAY);
const account = "5DAgx...";
const token_address = "0x7e5bb...";
async function main() {
await api.init();
// Returns the account token balance.
await api.query.getTokenBalance(account, token_address);
console.log();
// "30"
}
(async () => {
await main();
})();
Expected Output
5100000000000000000000