Skip to content

Commit

Permalink
feat: add missing market summary CLI query (#918)
Browse files Browse the repository at this point in the history
* fix: add missing market summary CLI query

* cl++
  • Loading branch information
toteki authored May 17, 2022
1 parent 66e253c commit b0f2dde
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions x/leverage/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
GetCmdQueryBorrowLimit(),
GetCmdQueryLiquidationLimit(),
GetCmdQueryLiquidationTargets(),
GetCmdQueryMarketSummary(),
)

return cmd
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b0f2dde

Please sign in to comment.