From 48ee996f619e96a55934f3f4d6abdf2ae13aadde Mon Sep 17 00:00:00 2001 From: Robert Pirtle Date: Wed, 25 Oct 2023 11:36:18 -0700 Subject: [PATCH] feat(community): add CLI cmd for annualized-rewards (#1756) --- x/community/client/cli/query.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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) + }, + } +}