feat(community): add CLI cmd for annualized-rewards (#1756)

This commit is contained in:
Robert Pirtle 2023-10-25 11:36:18 -07:00 committed by GitHub
parent adbd70f71c
commit 48ee996f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
},
}
}