How to get near balance of an account using cli?

Viewed 385

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

1 Answers

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
Related