diff --git a/x/community/client/cli/query.go b/x/community/client/cli/query.go index 26a8f8c3..527aceb6 100644 --- a/x/community/client/cli/query.go +++ b/x/community/client/cli/query.go @@ -24,6 +24,7 @@ func GetQueryCmd() *cobra.Command { commands := []*cobra.Command{ getCmdQueryParams(), getCmdQueryBalance(), + getCmdQueryAnnualizedRewards(), } for _, cmd := range commands { @@ -81,3 +82,26 @@ func getCmdQueryBalance() *cobra.Command { }, } } + +// getCmdQueryAnnualizedRewards implements a command to return the current annualized rewards. +func getCmdQueryAnnualizedRewards() *cobra.Command { + return &cobra.Command{ + Use: "annualized-rewards", + Short: "Query a current calculation of annualized rewards for the chain.", + Args: cobra.NoArgs, + 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.AnnualizedRewards(cmd.Context(), &types.QueryAnnualizedRewardsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } +}