Fetch all information for an account
On-chain name of method: system_account
Parameters
parameter | type | optional | description |
---|---|---|---|
addresss | SS58 | true | The account address to fetch information for |
Returns
nonce
: Current nonce of the account on Avail DAconsumers
: The number of other modules that currently depend on this account's existence. The account cannot be reaped until this is zeroproviders
: The number of other modules that allow this account to exist. The account may not be reaped until this is zero.sufficients
: The number of modules that allow this account to exist for their own purposes only. The account may not be reaped until this is zero.free
: Amount of Transferrable AVAIL tokens with the accountreserved
: Amount of AVAIL tokens that are not bonded, but also not yet freely availablefrozen
: Amount of AVAIL tokens currently staked by the accountflags
: Some extra information about the account
NONCE
-
Every account on Avail DA starts with a nonce value of
0
. This number represents the number of transactions executed on Avail DA by that particular account. -
Every successive transaction will have a nonce value that is incremented by
1
from the previous transaction. -
To extend this a bit further, the sum of all non-zero nonces on Avail DA will be equal to the total number of transactions executed on Avail DA.
Minimal example (Fetch account information for a single account)
- Inside
your-file-name.ts
, add the following code:
avail-deno
import { SDK } from "https://raw.githubusercontent.com/availproject/avail/main/avail-deno/src/sdk.ts";
const providerEndpoint = "wss://turing-rpc.avail.so/ws";
const sdk = await SDK.New(providerEndpoint);
const key = "5DDY2yzh8uCysYFAiRSTeQVwtZSKNF49CkQkyPH852xvrYKk";
const value = await sdk.api.query.system.account(key);
console.log(value.toHuman());
Deno.exit();
- Run the code using:
deno run --allow-net your-file-name.ts
Sample Response:
{
nonce: "26",
consumers: "2",
providers: "1",
sufficients: "0",
data: {
free: "3,809,329,880,703,171,553,761",
reserved: "2,100,000,000,000,000,000",
frozen: "1,008,370,553,028,965,837,506",
flags: "170,141,183,460,469,231,731,687,303,715,884,105,728"
}
}