Skip to content

Commit

Permalink
fix(mint): added missing cli query for current inflation (#366)
Browse files Browse the repository at this point in the history
Co-authored-by: danwt <[email protected]>
  • Loading branch information
mtsitrin and danwt authored Apr 8, 2024
1 parent bfd0943 commit 6ecadd8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions x/mint/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func GetQueryCmd() *cobra.Command {

mintingQueryCmd.AddCommand(
GetCmdQueryParams(),
GetCmdQueryInflation(),
)

return mintingQueryCmd
Expand Down Expand Up @@ -56,3 +57,32 @@ func GetCmdQueryParams() *cobra.Command {

return cmd
}

// GetCmdQueryInflation implements a command to return the current minting
// parameters.
func GetCmdQueryInflation() *cobra.Command {
cmd := &cobra.Command{
Use: "inflation",
Short: "Query the current inflation rate",
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)

req := &types.QueryInflationRequest{}
res, err := queryClient.Inflation(context.Background(), req)
if err != nil {
return err
}

return clientCtx.PrintObjectLegacy(res.CurrentInflationRate)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

0 comments on commit 6ecadd8

Please sign in to comment.