6

Is it possible to get near balance of an account using near cli.?

Amiya Behera
  • 2,210
  • 19
  • 32

1 Answers1

8

Running:

near state <account.near>

should do the trick:

Account account.near
{
  amount: 'XXXXXX',
  locked: '0',
  code_hash: 'XXXX',
  storage_usage: XX,
  storage_paid_at: 0,
  block_height: XXX,
  block_hash: 'XXXX',
  formattedAmount: 'XXXX'
}

or even:

near state account.near |  sed -n "s/.*formattedAmount: '\([^\\]*\).*'/\1/p"

if you just need the formattedAmount:

XYZ.39429240342
chefsale
  • 326
  • 1
  • 7