Get Account Info
Returns a breakdown of the current AVT utilisation in a given AvN account including the Staking balance.
await api.query.getAccountInfo(avn_account)
important
You can get the AVN_GATEWAY_URL here.
Expected Results
- totalBalance - string integer value representing the account's total AVT balance.
- freeBalance - string integer value representing the portion of the total that is freely usable (not staked or locked).
- stakedBalance - string integer value representing the portion that is staked and currently earning rewards.
- unlockedBalance - string integer value representing the portion that is unstaked and unlocked and can be converted to free balance.
- unstakedBalance - string integer value representing the portion that is unstaked but still currently locked.
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<node_url>";
const options = {
suri: "<account_suri>",
};
const API = new AVN_API(AVN_GATEWAY_URL, options);
async function main() {
await api.init();
// Replace "acct" with the Aventus address or public key
const result = await api.query.getAccountInfo(acct)
console.log(result);
}
(async () => {
await main();
})();
totalBalance: "10000000000000000",
freeBalance: "5000000000000000",
stakedBalance: "2000000000000000",
unlockedBalance: "1000000000000000",
unstakedBalance: "2000000000000000"
REQUEST
POST <https://AVN_GATEWAY_URL/query>
HEADERS
Content-Type: application/json Authorization': bearer <awtToken>
REQUEST PARAMS
- accountId [required] - a string representing the public key or SS58 address of the account to check.
JSON-RPC Example
curl https://AVN_GATEWAY_URL/query \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"getAccountInfo", "params":{"accountId":"5GL...bDB9MH"}, "id":1}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"totalBalance": "10000000000000000",
"freeBalance": "5000000000000000",
"stakedBalance": "2000000000000000",
"unlockedBalance": "1000000000000000",
"unstakedBalance": "2000000000000000"
}
}