How to query NEAR node block height by near-cli? I didn't find it on https://docs.near.org/docs/tools/near-cli
Asked
Active
Viewed 132 times
1 Answers
0
You can use near repl
which launches interactive Node.js shell with NEAR connection available to use. The repl's initial context contains nearAPI
, near
and account
(source: near-cli --help
)
shell:
$> near repl
> let response = await near.connection.provider.block({finality: "final"})
> response
the response will give you a bunch of info, height among other things. Or you can go with
> response.header.height
and you'll get only the value of the height
field

Cheslab
- 1,896
- 2
- 17
- 27