/
get.ts
39 lines (33 loc) · 1.09 KB
/
get.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {flags} from '@oclif/command'
// import cli from 'cli-ux'
// import chalk from 'chalk'
import {RpcCommand} from '../../lib/rpc-command'
// import {formatBalance} from '../../lib/formatting'
import type {BlockchainState, Validator} from '../../lib/server-types'
export default class ValidatorGet extends RpcCommand {
static description = 'Show information for a validator'
static args = [{
name: 'validator_address',
description: 'Address of validator to show information for',
required: true,
}]
static flags = {
...RpcCommand.flags,
plain: flags.boolean({
description: 'Display plain command output',
}),
}
async run() {
const {args, flags} = this.parse(ValidatorGet)
const {data: validator, metadata} = await this.call<BlockchainState<Validator>>(
ValidatorGet,
'getValidatorByAddress',
[args.validator_address],
)
// if (flags.plain) {
console.dir(validator, {depth: Infinity, maxArrayLength: Infinity}) // eslint-disable-line no-console
// return
// }
this.showMetadataIfRequested(metadata, flags)
}
}