-
Notifications
You must be signed in to change notification settings - Fork 115
/
validate.ts
31 lines (27 loc) · 1.06 KB
/
validate.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
import StakingCommandBase from '../../base/StakingCommandBase'
import { flags } from '@oclif/command'
export default class StakingValidateCommand extends StakingCommandBase {
static description = 'Start validating. Takes the controller key.'
static flags = {
commission: flags.integer({
required: false,
description:
'Set a commission (0-100), which is deducted from all rewards before the remainder is split with nominator',
}),
controller: flags.string({
required: false,
description: 'The controller key you want to validate with.',
}),
}
async run(): Promise<void> {
let { commission, controller } = this.parse(StakingValidateCommand).flags
const validatorPrefs = await this.getValidatorPrefs(commission)
if (controller === undefined) {
controller = await this.getController()
} else {
await this.isController(controller)
}
// await this.checkElectionStatus()
await this.sendAndFollowNamedTx(await this.getDecodedPair(controller), 'staking', 'validate', [validatorPrefs])
}
}