|
1 | | -import {Option, CommandRunner, SubCommand} from 'nest-commander'; |
2 | | - |
| 1 | +import { Option, CommandRunner, SubCommand } from 'nest-commander'; |
3 | 2 |
|
4 | 3 | @SubCommand({ |
5 | | - name: 'candidate', |
6 | | - arguments: '<public_key>', |
7 | | - argsDescription: {'public_key':'Public key'}, |
8 | | - description: 'Candidate returns candidate’s info by provided public key', |
| 4 | + name: 'candidate', |
| 5 | + arguments: '<public_key>', |
| 6 | + argsDescription: { public_key: 'Public key' }, |
| 7 | + description: 'Candidate returns candidate’s info by provided public key', |
9 | 8 | }) |
10 | 9 | export class CandidateCommand extends CommandRunner { |
| 10 | + async run( |
| 11 | + inputs: string[], |
| 12 | + options: { height?: number; not_show_stakes?: boolean }, |
| 13 | + ): Promise<void> { |
| 14 | + console.log('candidate'); |
| 15 | + console.log(`inputs: ${inputs[0]}`); |
| 16 | + console.log(`height: ${options.height}`); |
| 17 | + console.log(`not_show_stakes: ${options.not_show_stakes}`); |
| 18 | + return Promise.resolve(undefined); |
| 19 | + } |
11 | 20 |
|
12 | | - async run(inputs: string[], |
13 | | - options: { height?: number, not_show_stakes?: boolean}, |
14 | | - ): Promise<void> { |
15 | | - |
16 | | - console.log("candidate"); |
17 | | - console.log(`inputs: ${inputs[0]}`); |
18 | | - console.log(`height: ${options.height}`); |
19 | | - console.log(`not_show_stakes: ${options.not_show_stakes}`); |
20 | | - return Promise.resolve(undefined); |
21 | | - } |
22 | | - |
23 | | - @Option({ |
24 | | - flags: '--height [number]', |
25 | | - name: 'Height', |
26 | | - description: 'Blockchain state height for the current request. Optional, the last default state of the node is used', |
27 | | - }) |
28 | | - parseNumber(val: string): number { |
29 | | - return Number(val); |
30 | | - } |
31 | | - |
32 | | - @Option({ |
33 | | - flags: '--not_show_stakes [boolean]', |
34 | | - description: 'Do not display a list of steaks. Note: used_slots, uniq_users, min_stake will be filled', |
35 | | - defaultValue: true, |
36 | | - }) |
37 | | - parseBoolean(val: string): boolean { |
38 | | - return JSON.parse(val); |
39 | | - } |
| 21 | + @Option({ |
| 22 | + flags: '--height [number]', |
| 23 | + name: 'Height', |
| 24 | + description: |
| 25 | + 'Blockchain state height for the current request. Optional, the last default state of the node is used', |
| 26 | + }) |
| 27 | + parseNumber(val: string): number { |
| 28 | + return Number(val); |
| 29 | + } |
40 | 30 |
|
| 31 | + @Option({ |
| 32 | + flags: '--not_show_stakes [boolean]', |
| 33 | + description: |
| 34 | + 'Do not display a list of steaks. Note: used_slots, uniq_users, min_stake will be filled', |
| 35 | + defaultValue: true, |
| 36 | + }) |
| 37 | + parseBoolean(val: string): boolean { |
| 38 | + return JSON.parse(val); |
| 39 | + } |
41 | 40 | } |
0 commit comments