-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
query.go
748 lines (617 loc) · 19 KB
/
query.go
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
package cli
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
// GetQueryCmd returns the cli query commands for this module
func GetQueryCmd() *cobra.Command {
stakingQueryCmd := &cobra.Command{
Use: types.ModuleName,
Short: "Querying commands for the staking module",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
stakingQueryCmd.AddCommand(
GetCmdQueryDelegation(),
GetCmdQueryDelegations(),
GetCmdQueryUnbondingDelegation(),
GetCmdQueryUnbondingDelegations(),
GetCmdQueryRedelegation(),
GetCmdQueryRedelegations(),
GetCmdQueryValidator(),
GetCmdQueryValidators(),
GetCmdQueryValidatorDelegations(),
GetCmdQueryValidatorUnbondingDelegations(),
GetCmdQueryValidatorRedelegations(),
GetCmdQueryHistoricalInfo(),
GetCmdQueryParams(),
GetCmdQueryPool(),
)
return stakingQueryCmd
}
// GetCmdQueryValidator implements the validator query command.
func GetCmdQueryValidator() *cobra.Command {
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "validator [validator-addr]",
Short: "Query a validator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query details about an individual validator.
Example:
$ %s query staking validator %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
addr, err := sdk.ValAddressFromBech32(args[0])
if err != nil {
return err
}
params := &types.QueryValidatorRequest{ValidatorAddr: addr.String()}
res, err := queryClient.Validator(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Validator)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryValidators implements the query all validators command.
func GetCmdQueryValidators() *cobra.Command {
cmd := &cobra.Command{
Use: "validators",
Short: "Query for all validators",
Args: cobra.NoArgs,
Long: strings.TrimSpace(
fmt.Sprintf(`Query details about all validators on a network.
Example:
$ %s query staking validators
`,
version.AppName,
),
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
result, err := queryClient.Validators(context.Background(), &types.QueryValidatorsRequest{
// Leaving status empty on purpose to query all validators.
Pagination: pageReq,
})
if err != nil {
return err
}
return clientCtx.PrintProto(result)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "validators")
return cmd
}
// GetCmdQueryValidatorUnbondingDelegations implements the query all unbonding delegatations from a validator command.
func GetCmdQueryValidatorUnbondingDelegations() *cobra.Command {
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "unbonding-delegations-from [validator-addr]",
Short: "Query all unbonding delegatations from a validator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query delegations that are unbonding _from_ a validator.
Example:
$ %s query staking unbonding-delegations-from %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
valAddr, err := sdk.ValAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryValidatorUnbondingDelegationsRequest{
ValidatorAddr: valAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.ValidatorUnbondingDelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "unbonding delegations")
return cmd
}
// GetCmdQueryValidatorRedelegations implements the query all redelegatations
// from a validator command.
func GetCmdQueryValidatorRedelegations() *cobra.Command {
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "redelegations-from [validator-addr]",
Short: "Query all outgoing redelegatations from a validator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query delegations that are redelegating _from_ a validator.
Example:
$ %s query staking redelegations-from %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
valSrcAddr, err := sdk.ValAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryRedelegationsRequest{
SrcValidatorAddr: valSrcAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.Redelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "validator redelegations")
return cmd
}
// GetCmdQueryDelegation the query delegation command.
func GetCmdQueryDelegation() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "delegation [delegator-addr] [validator-addr]",
Short: "Query a delegation based on address and validator address",
Long: strings.TrimSpace(
fmt.Sprintf(`Query delegations for an individual delegator on an individual validator.
Example:
$ %s query staking delegation %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixAccAddr, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
delAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
valAddr, err := sdk.ValAddressFromBech32(args[1])
if err != nil {
return err
}
params := &types.QueryDelegationRequest{
DelegatorAddr: delAddr.String(),
ValidatorAddr: valAddr.String(),
}
res, err := queryClient.Delegation(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res.DelegationResponse)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryDelegations implements the command to query all the delegations
// made from one delegator.
func GetCmdQueryDelegations() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
cmd := &cobra.Command{
Use: "delegations [delegator-addr]",
Short: "Query all delegations made by one delegator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query delegations for an individual delegator on all validators.
Example:
$ %s query staking delegations %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`,
version.AppName, bech32PrefixAccAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
delAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryDelegatorDelegationsRequest{
DelegatorAddr: delAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.DelegatorDelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "delegations")
return cmd
}
// GetCmdQueryValidatorDelegations implements the command to query all the
// delegations to a specific validator.
func GetCmdQueryValidatorDelegations() *cobra.Command {
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "delegations-to [validator-addr]",
Short: "Query all delegations made to one validator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query delegations on an individual validator.
Example:
$ %s query staking delegations-to %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
valAddr, err := sdk.ValAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryValidatorDelegationsRequest{
ValidatorAddr: valAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.ValidatorDelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "validator delegations")
return cmd
}
// GetCmdQueryUnbondingDelegation implements the command to query a single
// unbonding-delegation record.
func GetCmdQueryUnbondingDelegation() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "unbonding-delegation [delegator-addr] [validator-addr]",
Short: "Query an unbonding-delegation record based on delegator and validator address",
Long: strings.TrimSpace(
fmt.Sprintf(`Query unbonding delegations for an individual delegator on an individual validator.
Example:
$ %s query staking unbonding-delegation %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixAccAddr, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
valAddr, err := sdk.ValAddressFromBech32(args[1])
if err != nil {
return err
}
delAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
params := &types.QueryUnbondingDelegationRequest{
DelegatorAddr: delAddr.String(),
ValidatorAddr: valAddr.String(),
}
res, err := queryClient.UnbondingDelegation(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Unbond)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryUnbondingDelegations implements the command to query all the
// unbonding-delegation records for a delegator.
func GetCmdQueryUnbondingDelegations() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
cmd := &cobra.Command{
Use: "unbonding-delegations [delegator-addr]",
Short: "Query all unbonding-delegations records for one delegator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query unbonding delegations for an individual delegator.
Example:
$ %s query staking unbonding-delegations %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`,
version.AppName, bech32PrefixAccAddr,
),
),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
delegatorAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryDelegatorUnbondingDelegationsRequest{
DelegatorAddr: delegatorAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.DelegatorUnbondingDelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "unbonding delegations")
return cmd
}
// GetCmdQueryRedelegation implements the command to query a single
// redelegation record.
func GetCmdQueryRedelegation() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
bech32PrefixValAddr := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
cmd := &cobra.Command{
Use: "redelegation [delegator-addr] [src-validator-addr] [dst-validator-addr]",
Short: "Query a redelegation record based on delegator and a source and destination validator address",
Long: strings.TrimSpace(
fmt.Sprintf(`Query a redelegation record for an individual delegator between a source and destination validator.
Example:
$ %s query staking redelegation %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p %s1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm %s1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj
`,
version.AppName, bech32PrefixAccAddr, bech32PrefixValAddr, bech32PrefixValAddr,
),
),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
delAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
valSrcAddr, err := sdk.ValAddressFromBech32(args[1])
if err != nil {
return err
}
valDstAddr, err := sdk.ValAddressFromBech32(args[2])
if err != nil {
return err
}
params := &types.QueryRedelegationsRequest{
DelegatorAddr: delAddr.String(),
DstValidatorAddr: valDstAddr.String(),
SrcValidatorAddr: valSrcAddr.String(),
}
res, err := queryClient.Redelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryRedelegations implements the command to query all the
// redelegation records for a delegator.
func GetCmdQueryRedelegations() *cobra.Command {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
cmd := &cobra.Command{
Use: "redelegations [delegator-addr]",
Args: cobra.ExactArgs(1),
Short: "Query all redelegations records for one delegator",
Long: strings.TrimSpace(
fmt.Sprintf(`Query all redelegation records for an individual delegator.
Example:
$ %s query staking redelegation %s1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p
`,
version.AppName, bech32PrefixAccAddr,
),
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
delAddr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
pageReq, err := client.ReadPageRequest(cmd.Flags())
if err != nil {
return err
}
params := &types.QueryRedelegationsRequest{
DelegatorAddr: delAddr.String(),
Pagination: pageReq,
}
res, err := queryClient.Redelegations(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
flags.AddPaginationFlagsToCmd(cmd, "delegator redelegations")
return cmd
}
// GetCmdQueryHistoricalInfo implements the historical info query command
func GetCmdQueryHistoricalInfo() *cobra.Command {
cmd := &cobra.Command{
Use: "historical-info [height]",
Args: cobra.ExactArgs(1),
Short: "Query historical info at given height",
Long: strings.TrimSpace(
fmt.Sprintf(`Query historical info at given height.
Example:
$ %s query staking historical-info 5
`,
version.AppName,
),
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
height, err := strconv.ParseInt(args[0], 10, 64)
if err != nil || height < 0 {
return fmt.Errorf("height argument provided must be a non-negative-integer: %v", err)
}
params := &types.QueryHistoricalInfoRequest{Height: height}
res, err := queryClient.HistoricalInfo(context.Background(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res.Hist)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryPool implements the pool query command.
func GetCmdQueryPool() *cobra.Command {
cmd := &cobra.Command{
Use: "pool",
Args: cobra.NoArgs,
Short: "Query the current staking pool values",
Long: strings.TrimSpace(
fmt.Sprintf(`Query values for amounts stored in the staking pool.
Example:
$ %s query staking pool
`,
version.AppName,
),
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Pool(context.Background(), &types.QueryPoolRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Pool)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
// GetCmdQueryParams implements the params query command.
func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Args: cobra.NoArgs,
Short: "Query the current staking parameters information",
Long: strings.TrimSpace(
fmt.Sprintf(`Query values set as staking parameters.
Example:
$ %s query staking params
`,
version.AppName,
),
),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Params)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}