feat: add query groups in x/group (#14879)
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
This commit is contained in:
co-authored by
Likhita Polavarapu
parent
bdf4c76daf
commit
a2797c8cd4
@@ -34,6 +34,7 @@ func QueryCmd(name string) *cobra.Command {
|
||||
QueryVotesByVoterCmd(),
|
||||
QueryGroupsByMemberCmd(),
|
||||
QueryTallyResultCmd(),
|
||||
QueryGroupsCmd(),
|
||||
)
|
||||
|
||||
return queryCmd
|
||||
@@ -505,3 +506,37 @@ func QueryVotesByVoterCmd() *cobra.Command {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func QueryGroupsCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "groups",
|
||||
Short: "Query for groups present in the state",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pageReq, err := client.ReadPageRequest(cmd.Flags())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := group.NewQueryClient(clientCtx)
|
||||
|
||||
res, err := queryClient.Groups(cmd.Context(), &group.QueryGroupsRequest{
|
||||
Pagination: pageReq,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
flags.AddPaginationFlagsToCmd(cmd, "groups")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user