Skip to main content
Version: 3.1.0

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_ETHEREUM_ADDRESS);
important

You can get the AVN_GATEWAY_URL here.

const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "gateway url of your chosen network";
const options = {
suri: "suri of your account",
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};

const ACCOUNT = "5DAgx...";
const TOKEN_ETHEREUM_ADDRESS = "0x7e5bb...";

async function main() {
await avnSdk.init();
const api = await avnSdk.apis();

let token_balance = await api.query.getTokenBalance(
ACCOUNT,
TOKEN_ETHEREUM_ADDRESS
);
console.log(token_balance);
}

(async () => {
await main();
})();