API reference
Fetch all information for an account

Fetch all information for an account

On-chain name of method: system_account

Parameters

parametertypeoptionaldescription
addresssSS58trueThe account address to fetch information for

Returns

  • nonce: Current nonce of the account on Avail DA
  • consumers: The number of other modules that currently depend on this account's existence. The account cannot be reaped until this is zero
  • providers: 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 account
  • reserved: Amount of AVAIL tokens that are not bonded, but also not yet freely available
  • frozen: Amount of AVAIL tokens currently staked by the account
  • flags: 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)

  1. You will need to set up the dev enviornment required to run this example. For instructions, check out our docs here.

  2. 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.

  1. 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()
  1. Run the code using:
ts-node your-file-name.ts