diff --git a/CHANGELOG.md b/CHANGELOG.md index 45d8f7a390..9d9bceba92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +- [918](https://github.com/umee-network/umee/pull/918) Add MarketSummary query to CLI + ## [v2.0.2](https://github.com/umee-network/umee/releases/tag/v2.0.2) - 2022-05-13 ### Features diff --git a/x/leverage/client/cli/query.go b/x/leverage/client/cli/query.go index 6f9c166603..bb609328bd 100644 --- a/x/leverage/client/cli/query.go +++ b/x/leverage/client/cli/query.go @@ -44,6 +44,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { GetCmdQueryBorrowLimit(), GetCmdQueryLiquidationLimit(), GetCmdQueryLiquidationTargets(), + GetCmdQueryMarketSummary(), ) return cmd @@ -660,6 +661,39 @@ func GetCmdQueryLiquidationLimit() *cobra.Command { return cmd } +// GetCmdQueryMarketSummary returns a CLI command handler to query for the +// Market Summary of a specific token. +func GetCmdQueryMarketSummary() *cobra.Command { + cmd := &cobra.Command{ + Use: "market-summary [denom]", + Args: cobra.ExactArgs(1), + Short: "Query for the market summary of a specified denomination", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryMarketSummaryRequest{ + Denom: args[0], + } + + resp, err := queryClient.MarketSummary(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + // GetCmdQueryLiquidationTargets returns a CLI command handler to query for // all eligible liquidation targets func GetCmdQueryLiquidationTargets() *cobra.Command {