| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | package cli | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 	"context" | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 	"strconv" | 
					
						
							| 
									
										
										
										
											2020-01-12 15:35:34 +00:00
										 |  |  | 	"strings" | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/spf13/cobra" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 	"github.com/cosmos/cosmos-sdk/client" | 
					
						
							| 
									
										
										
										
											2020-04-23 16:35:58 +00:00
										 |  |  | 	"github.com/cosmos/cosmos-sdk/client/flags" | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 	sdk "github.com/cosmos/cosmos-sdk/types" | 
					
						
							| 
									
										
										
										
											2020-01-16 15:20:12 +00:00
										 |  |  | 	"github.com/cosmos/cosmos-sdk/version" | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/kava-labs/kava/x/cdp/types" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | // Query CDP flags
 | 
					
						
							|  |  |  | const ( | 
					
						
							|  |  |  | 	flagCollateralType = "collateral-type" | 
					
						
							|  |  |  | 	flagOwner          = "owner" | 
					
						
							|  |  |  | 	flagID             = "id" | 
					
						
							|  |  |  | 	flagRatio          = "ratio" // returns CDPs under the given collateralization ratio threshold
 | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | // GetQueryCmd returns the cli query commands for this module
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func GetQueryCmd() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 	// Group nameservice queries under a subcommand
 | 
					
						
							|  |  |  | 	cdpQueryCmd := &cobra.Command{ | 
					
						
							|  |  |  | 		Use:   "cdp", | 
					
						
							|  |  |  | 		Short: "Querying commands for the cdp module", | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 	cmds := []*cobra.Command{ | 
					
						
							|  |  |  | 		QueryCdpCmd(), | 
					
						
							|  |  |  | 		QueryGetCdpsCmd(), | 
					
						
							|  |  |  | 		QueryCdpDepositsCmd(), | 
					
						
							|  |  |  | 		QueryParamsCmd(), | 
					
						
							|  |  |  | 		QueryGetAccounts(), | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for _, cmd := range cmds { | 
					
						
							|  |  |  | 		flags.AddQueryFlagsToCmd(cmd) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	cdpQueryCmd.AddCommand(cmds...) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	return cdpQueryCmd | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-12 15:35:34 +00:00
										 |  |  | // QueryCdpCmd returns the command handler for querying a particular cdp
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func QueryCdpCmd() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 	return &cobra.Command{ | 
					
						
							| 
									
										
										
										
											2020-08-21 19:42:46 +00:00
										 |  |  | 		Use:   "cdp [owner-addr] [collateral-type]", | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		Short: "get info about a cdp", | 
					
						
							| 
									
										
										
										
											2020-01-16 15:20:12 +00:00
										 |  |  | 		Long: strings.TrimSpace( | 
					
						
							|  |  |  | 			fmt.Sprintf(`Get a CDP by the owner address and the collateral name. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Example: | 
					
						
							| 
									
										
										
										
											2020-08-21 19:42:46 +00:00
										 |  |  | $ %s query %s cdp kava15qdefkmwswysgg4qxgqpqr35k3m49pkx2jdfnw atom-a | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | `, version.AppName, types.ModuleName)), | 
					
						
							| 
									
										
										
										
											2020-01-16 15:20:12 +00:00
										 |  |  | 		Args: cobra.ExactArgs(2), | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		RunE: func(cmd *cobra.Command, args []string) error { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			clientCtx, err := client.GetClientQueryContext(cmd) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			queryClient := types.NewQueryClient(clientCtx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			_, err = sdk.AccAddressFromBech32(args[0]) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			res, err := queryClient.Cdp(context.Background(), &types.QueryCdpRequest{ | 
					
						
							|  |  |  | 				Owner:          args[0], | 
					
						
							|  |  |  | 				CollateralType: args[1], | 
					
						
							|  |  |  | 			}) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			return clientCtx.PrintProto(res) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | // QueryGetCdpsCmd queries the cdps in the store
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func QueryGetCdpsCmd() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 	cmd := &cobra.Command{ | 
					
						
							|  |  |  | 		Use:   "cdps", | 
					
						
							|  |  |  | 		Short: "query cdps with optional filters", | 
					
						
							|  |  |  | 		Long: strings.TrimSpace(`Query for all paginated cdps that match optional filters: | 
					
						
							| 
									
										
										
										
											2020-01-16 15:20:12 +00:00
										 |  |  | Example: | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | $ kvcli q cdp cdps --collateral-type=bnb | 
					
						
							|  |  |  | $ kvcli q cdp cdps --owner=kava1hatdq32u5x4wnxrtv5wzjzmq49sxgjgsj0mffm | 
					
						
							|  |  |  | $ kvcli q cdp cdps --id=21 | 
					
						
							|  |  |  | $ kvcli q cdp cdps --ratio=2.75 | 
					
						
							|  |  |  | $ kvcli q cdp cdps --page=2 --limit=100 | 
					
						
							|  |  |  | `, | 
					
						
							|  |  |  | 		), | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		RunE: func(cmd *cobra.Command, args []string) error { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			strCollateralType, err := cmd.Flags().GetString(flagCollateralType) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			strOwner, err := cmd.Flags().GetString(flagOwner) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			strID, err := cmd.Flags().GetString(flagID) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			strRatio, err := cmd.Flags().GetString(flagRatio) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			pageReq, err := client.ReadPageRequest(cmd.Flags()) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			req := types.QueryCdpsRequest{ | 
					
						
							|  |  |  | 				Pagination: pageReq, | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if len(strCollateralType) != 0 { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 				req.CollateralType = strings.ToLower(strings.TrimSpace(strCollateralType)) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 			if len(strOwner) != 0 { | 
					
						
							|  |  |  | 				cdpOwner, err := sdk.AccAddressFromBech32(strings.ToLower(strings.TrimSpace(strOwner))) | 
					
						
							|  |  |  | 				if err != nil { | 
					
						
							|  |  |  | 					return fmt.Errorf("cannot parse address from cdp owner %s", strOwner) | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 				req.Owner = cdpOwner.String() | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 			if len(strID) != 0 { | 
					
						
							|  |  |  | 				cdpID, err := strconv.ParseUint(strID, 10, 64) | 
					
						
							|  |  |  | 				if err != nil { | 
					
						
							|  |  |  | 					return fmt.Errorf("cannot parse cdp ID %s", strID) | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 				req.ID = cdpID | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 			if len(strRatio) != 0 { | 
					
						
							|  |  |  | 				cdpRatio, err := sdk.NewDecFromStr(strRatio) | 
					
						
							|  |  |  | 				if err != nil { | 
					
						
							|  |  |  | 					return fmt.Errorf("cannot parse cdp ratio %s", strRatio) | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 				// ratio is also validated on server
 | 
					
						
							|  |  |  | 				req.Ratio = cdpRatio.String() | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			clientCtx, err := client.GetClientQueryContext(cmd) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			queryClient := types.NewQueryClient(clientCtx) | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			res, err := queryClient.Cdps(context.Background(), &req) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			return clientCtx.PrintProto(res) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	cmd.Flags().String(flagCollateralType, "", "(optional) filter by CDP collateral type") | 
					
						
							|  |  |  | 	cmd.Flags().String(flagOwner, "", "(optional) filter by CDP owner") | 
					
						
							|  |  |  | 	cmd.Flags().String(flagID, "", "(optional) filter by CDP ID") | 
					
						
							|  |  |  | 	cmd.Flags().String(flagRatio, "", "(optional) filter by CDP collateralization ratio threshold") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 	flags.AddPaginationFlagsToCmd(cmd, "cdps") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 	return cmd | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | // QueryCdpDepositsCmd returns the command handler for querying the deposits of a particular cdp
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func QueryCdpDepositsCmd() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 	return &cobra.Command{ | 
					
						
							| 
									
										
										
										
											2020-08-21 19:42:46 +00:00
										 |  |  | 		Use:   "deposits [owner-addr] [collateral-type]", | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 		Short: "get deposits for a cdp", | 
					
						
							|  |  |  | 		Long: strings.TrimSpace( | 
					
						
							|  |  |  | 			fmt.Sprintf(`Get the deposits of a CDP. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Example: | 
					
						
							| 
									
										
										
										
											2020-08-21 19:42:46 +00:00
										 |  |  | $ %s query %s deposits kava15qdefkmwswysgg4qxgqpqr35k3m49pkx2jdfnw atom-a | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | `, version.AppName, types.ModuleName)), | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 		Args: cobra.ExactArgs(2), | 
					
						
							|  |  |  | 		RunE: func(cmd *cobra.Command, args []string) error { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			clientCtx, err := client.GetClientQueryContext(cmd) | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			queryClient := types.NewQueryClient(clientCtx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			_, err = sdk.AccAddressFromBech32(args[0]) | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			res, err := queryClient.Deposits(context.Background(), &types.QueryDepositsRequest{ | 
					
						
							|  |  |  | 				Owner:          args[0], | 
					
						
							|  |  |  | 				CollateralType: args[1], | 
					
						
							|  |  |  | 			}) | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			return clientCtx.PrintProto(res) | 
					
						
							| 
									
										
										
										
											2020-01-28 20:08:17 +00:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-12 15:35:34 +00:00
										 |  |  | // QueryParamsCmd returns the command handler for cdp parameter querying
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func QueryParamsCmd() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 	return &cobra.Command{ | 
					
						
							|  |  |  | 		Use:   "params", | 
					
						
							|  |  |  | 		Short: "get the cdp module parameters", | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 		Long:  "get the current global cdp module parameters.", | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		Args:  cobra.NoArgs, | 
					
						
							|  |  |  | 		RunE: func(cmd *cobra.Command, args []string) error { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			clientCtx, err := client.GetClientQueryContext(cmd) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			queryClient := types.NewQueryClient(clientCtx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			return clientCtx.PrintProto(&res.Params) | 
					
						
							| 
									
										
										
										
											2019-11-25 19:46:02 +00:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | // QueryGetAccounts queries CDP module accounts
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | func QueryGetAccounts() *cobra.Command { | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 	return &cobra.Command{ | 
					
						
							|  |  |  | 		Use:   "accounts", | 
					
						
							| 
									
										
										
										
											2020-09-17 00:45:10 +00:00
										 |  |  | 		Short: "get module accounts", | 
					
						
							|  |  |  | 		Long:  "get cdp module account addresses", | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 		Args:  cobra.NoArgs, | 
					
						
							|  |  |  | 		RunE: func(cmd *cobra.Command, args []string) error { | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			clientCtx, err := client.GetClientQueryContext(cmd) | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 			queryClient := types.NewQueryClient(clientCtx) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			res, err := queryClient.Accounts(context.Background(), &types.QueryAccountsRequest{}) | 
					
						
							|  |  |  | 			if err != nil { | 
					
						
							|  |  |  | 				return err | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-01-08 00:39:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			return clientCtx.PrintProto(res) | 
					
						
							| 
									
										
										
										
											2020-06-19 19:30:10 +00:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |