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)
-
You will need to set up the dev enviornment required to run this example. For instructions, check out our docs here.
-
If you're sending an extrinsic (i.e conducting a transaction) you will need to replace the demo seed phrase with your own seed phrase. The rest of the code should work as is.
- Inside
your-file-name.ts
, add the following code:
avail-js
import { SDK } from "avail-js-sdk"
const main = async () => {
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())
process.exit()
}
main()
- Run the code using:
ts-node your-file-name.ts