Skip to content

Commit

Permalink
Removed unavailable queries
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Jan 27, 2023
1 parent 0b2e7f6 commit 7ecd638
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 52 deletions.
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ func main() {
var (
config = hub.MakeEncodingConfig()
clientCtx = client.Context{}.
WithJSONMarshaler(config.Marshaler).
WithInterfaceRegistry(config.InterfaceRegistry).
WithTxConfig(config.TxConfig).
WithLegacyAmino(config.Amino).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(types.DefaultHomeDirectory)
WithCodec(config.Marshaler).
WithInterfaceRegistry(config.InterfaceRegistry).
WithTxConfig(config.TxConfig).
WithLegacyAmino(config.Amino).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(types.DefaultHomeDirectory)
)

if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil {
Expand Down
7 changes: 3 additions & 4 deletions x/session/client/cmd/flags.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package cmd

const (
flagAddress = "address"
flagRating = "rating"
flagStatus = "status"
flagSubscription = "subscription"
flagAddress = "address"
flagRating = "rating"
flagStatus = "status"
)
21 changes: 1 addition & 20 deletions x/session/client/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ func QuerySessions() *cobra.Command {
return err
}

subscription, err := cmd.Flags().GetUint64(flagSubscription)
if err != nil {
return err
}

bech32Address, err := cmd.Flags().GetString(flagAddress)
if err != nil {
return err
Expand All @@ -115,20 +110,7 @@ func QuerySessions() *cobra.Command {
qc = sessiontypes.NewQueryServiceClient(ctx)
)

if subscription != 0 {
result, err := qc.QuerySessionsForSubscription(
context.Background(),
sessiontypes.NewQuerySessionsForSubscriptionRequest(
subscription,
pagination,
),
)
if err != nil {
return err
}

items = append(items, types.NewSessionsFromRaw(result.Sessions)...)
} else if bech32Address != "" {
if bech32Address != "" {
address, err := sdk.AccAddressFromBech32(bech32Address)
if err != nil {
return err
Expand Down Expand Up @@ -190,7 +172,6 @@ func QuerySessions() *cobra.Command {
flags.AddPaginationFlagsToCmd(cmd, "sessions")

cmd.Flags().String(flagAddress, "", "filter with account address")
cmd.Flags().Uint64(flagSubscription, 0, "filter with subscription identity")
cmd.Flags().String(flagStatus, "Active", "filter with status (Active|Inactive)")

return cmd
Expand Down
1 change: 0 additions & 1 deletion x/subscription/client/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ package cmd

const (
flagAddress = "address"
flagPlan = "plan"
flagStatus = "status"
)
19 changes: 0 additions & 19 deletions x/subscription/client/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ func QuerySubscriptions() *cobra.Command {
return err
}

plan, err := cmd.Flags().GetUint64(flagPlan)
if err != nil {
return err
}

status, err := cmd.Flags().GetString(flagStatus)
if err != nil {
return err
Expand Down Expand Up @@ -149,19 +144,6 @@ func QuerySubscriptions() *cobra.Command {
return err
}

items = append(items, types.NewSubscriptionsFromRaw(result.Subscriptions)...)
} else if plan != 0 {
result, err := qsc.QuerySubscriptionsForPlan(
context.Background(),
subscriptiontypes.NewQuerySubscriptionsForPlanRequest(
plan,
pagination,
),
)
if err != nil {
return err
}

items = append(items, types.NewSubscriptionsFromRaw(result.Subscriptions)...)
} else {
result, err := qsc.QuerySubscriptions(
Expand Down Expand Up @@ -204,7 +186,6 @@ func QuerySubscriptions() *cobra.Command {
flags.AddPaginationFlagsToCmd(cmd, "subscriptions")

cmd.Flags().String(flagAddress, "", "filter with account address")
cmd.Flags().Uint64(flagPlan, 0, "filter with plan identity")
cmd.Flags().String(flagStatus, "Active", "filter with status (Active|Inactive)")

return cmd
Expand Down

0 comments on commit 7ecd638

Please sign in to comment.