-
Notifications
You must be signed in to change notification settings - Fork 44
/
query_global_virtual_group_families.go
51 lines (39 loc) · 1.17 KB
/
query_global_virtual_group_families.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
package cli
import (
"fmt"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/spf13/cobra"
"github.com/bnb-chain/greenfield/x/virtualgroup/types"
)
var _ = strconv.Itoa(0)
func CmdGlobalVirtualGroupFamilies() *cobra.Command {
cmd := &cobra.Command{
Use: "global-virtual-group-families [limit]",
Short: "query all global virtual groups families of the storage provider.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
limit, err := strconv.ParseInt(args[0], 10, 32)
if err != nil || limit <= 0 {
return fmt.Errorf("invalid limit %s", args[0])
}
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGlobalVirtualGroupFamiliesRequest{
Pagination: &query.PageRequest{Limit: uint64(limit)},
}
res, err := queryClient.GlobalVirtualGroupFamilies(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}