@@ -21,33 +21,37 @@ func GetQueryCmd() *cobra.Command {
21
21
}
22
22
23
23
queryCmd .AddCommand (
24
- GetQueryCmdKey (),
25
24
GetQueryCmdKeys (),
25
+ GetQueryCmdKey (),
26
26
GetQueryCmdRewards (),
27
27
GetQueryCmdReward (),
28
- GetQueryCmdLocks (),
29
28
GetQueryCmdLock (),
29
+ GetQueryCmdLocks (),
30
30
)
31
31
32
32
return queryCmd
33
33
}
34
34
35
- // GetQueryCmdKey implements the key query command.
36
- func GetQueryCmdKey () * cobra.Command {
35
+ // GetQueryCmdKeys implements the keys query command.
36
+ func GetQueryCmdKeys () * cobra.Command {
37
37
cmd := & cobra.Command {
38
- Use : "key [name] " ,
39
- Short : "shows information of the key " ,
40
- Args : cobra .ExactArgs ( 1 ) ,
38
+ Use : "keys " ,
39
+ Short : "shows all keys " ,
40
+ Args : cobra .NoArgs ,
41
41
RunE : func (cmd * cobra.Command , args []string ) error {
42
- clientCtx := client .GetClientContextFromCmd (cmd )
42
+ clientCtx , err := client .GetClientQueryContext (cmd )
43
+ if err != nil {
44
+ return err
45
+ }
46
+
43
47
queryClient := types .NewQueryClient (clientCtx )
44
48
45
- res , err := queryClient . Key (
46
- context . Background (),
47
- & types. QueryKeyRequest {
48
- Key : args [ 0 ],
49
- },
50
- )
49
+ pageReq , err := client . ReadPageRequest ( cmd . Flags ())
50
+ if err != nil {
51
+ return err
52
+ }
53
+
54
+ res , err := queryClient . Keys ( context . Background (), & types. QueryKeysRequest { Pagination : pageReq } )
51
55
if err != nil {
52
56
return err
53
57
}
@@ -56,27 +60,32 @@ func GetQueryCmdKey() *cobra.Command {
56
60
},
57
61
}
58
62
63
+ flags .AddPaginationFlagsToCmd (cmd , "keys" )
59
64
flags .AddQueryFlagsToCmd (cmd )
60
65
61
66
return cmd
62
67
}
63
68
64
- // GetQueryCmdKeys implements the keys query command.
65
- func GetQueryCmdKeys () * cobra.Command {
69
+ // GetQueryCmdKey implements the key query command.
70
+ func GetQueryCmdKey () * cobra.Command {
66
71
cmd := & cobra.Command {
67
- Use : "keys " ,
68
- Short : "shows all keys " ,
69
- Args : cobra .NoArgs ,
72
+ Use : "key [name] " ,
73
+ Short : "shows information of the key " ,
74
+ Args : cobra .ExactArgs ( 1 ) ,
70
75
RunE : func (cmd * cobra.Command , args []string ) error {
71
- clientCtx := client .GetClientContextFromCmd (cmd )
72
- queryClient := types .NewQueryClient (clientCtx )
73
-
74
- pageReq , err := client .ReadPageRequest (cmd .Flags ())
76
+ clientCtx , err := client .GetClientQueryContext (cmd )
75
77
if err != nil {
76
78
return err
77
79
}
78
80
79
- res , err := queryClient .Keys (context .Background (), & types.QueryKeysRequest {Pagination : pageReq })
81
+ queryClient := types .NewQueryClient (clientCtx )
82
+
83
+ res , err := queryClient .Key (
84
+ context .Background (),
85
+ & types.QueryKeyRequest {
86
+ Key : args [0 ],
87
+ },
88
+ )
80
89
if err != nil {
81
90
return err
82
91
}
@@ -85,7 +94,6 @@ func GetQueryCmdKeys() *cobra.Command {
85
94
},
86
95
}
87
96
88
- flags .AddPaginationFlagsToCmd (cmd , "keys" )
89
97
flags .AddQueryFlagsToCmd (cmd )
90
98
91
99
return cmd
@@ -98,11 +106,21 @@ func GetQueryCmdRewards() *cobra.Command {
98
106
Short : "shows all rewards of an address" ,
99
107
Args : cobra .ExactArgs (1 ),
100
108
RunE : func (cmd * cobra.Command , args []string ) error {
101
- clientCtx := client .GetClientContextFromCmd (cmd )
109
+ clientCtx , err := client .GetClientQueryContext (cmd )
110
+ if err != nil {
111
+ return err
112
+ }
113
+
102
114
queryClient := types .NewQueryClient (clientCtx )
103
115
116
+ pageReq , err := client .ReadPageRequest (cmd .Flags ())
117
+ if err != nil {
118
+ return err
119
+ }
120
+
104
121
res , err := queryClient .Rewards (context .Background (), & types.QueryRewardsRequest {
105
122
LockerAddress : args [0 ],
123
+ Pagination : pageReq ,
106
124
})
107
125
if err != nil {
108
126
return err
@@ -125,7 +143,11 @@ func GetQueryCmdReward() *cobra.Command {
125
143
Short : "shows the reward of an locker address for the key" ,
126
144
Args : cobra .ExactArgs (2 ),
127
145
RunE : func (cmd * cobra.Command , args []string ) error {
128
- clientCtx := client .GetClientContextFromCmd (cmd )
146
+ clientCtx , err := client .GetClientQueryContext (cmd )
147
+ if err != nil {
148
+ return err
149
+ }
150
+
129
151
queryClient := types .NewQueryClient (clientCtx )
130
152
131
153
res , err := queryClient .Reward (context .Background (), & types.QueryRewardRequest {
@@ -152,11 +174,21 @@ func GetQueryCmdLocks() *cobra.Command {
152
174
Short : "shows all locks of an locker address" ,
153
175
Args : cobra .ExactArgs (1 ),
154
176
RunE : func (cmd * cobra.Command , args []string ) error {
155
- clientCtx := client .GetClientContextFromCmd (cmd )
177
+ clientCtx , err := client .GetClientQueryContext (cmd )
178
+ if err != nil {
179
+ return err
180
+ }
181
+
156
182
queryClient := types .NewQueryClient (clientCtx )
157
183
184
+ pageReq , err := client .ReadPageRequest (cmd .Flags ())
185
+ if err != nil {
186
+ return err
187
+ }
188
+
158
189
res , err := queryClient .Locks (context .Background (), & types.QueryLocksRequest {
159
190
LockerAddress : args [0 ],
191
+ Pagination : pageReq ,
160
192
})
161
193
if err != nil {
162
194
return err
@@ -179,7 +211,11 @@ func GetQueryCmdLock() *cobra.Command {
179
211
Short : "shows the lock of an locker address for the key" ,
180
212
Args : cobra .ExactArgs (2 ),
181
213
RunE : func (cmd * cobra.Command , args []string ) error {
182
- clientCtx := client .GetClientContextFromCmd (cmd )
214
+ clientCtx , err := client .GetClientQueryContext (cmd )
215
+ if err != nil {
216
+ return err
217
+ }
218
+
183
219
queryClient := types .NewQueryClient (clientCtx )
184
220
185
221
res , err := queryClient .Lock (context .Background (), & types.QueryLockRequest {
0 commit comments