Skip to content

Commit

Permalink
Revert x/params
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Jul 16, 2020
1 parent d078b57 commit ac7790c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions x/params/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package cli

import (
"context"
"fmt"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
)

// NewQueryCmd returns a root CLI command handler for all x/params query commands.
Expand All @@ -21,9 +20,7 @@ func NewQueryCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(
NewQuerySubspaceParamsCmd(),
)
cmd.AddCommand(NewQuerySubspaceParamsCmd())

return cmd
}
Expand All @@ -41,16 +38,26 @@ func NewQuerySubspaceParamsCmd() *cobra.Command {
if err != nil {
return err
}
queryClient := proposal.NewQueryClient(clientCtx)

params := proposal.NewQueryParametersRequest(args[0], args[1])
params := types.NewQuerySubspaceParams(args[0], args[1])
route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams)

res, err := queryClient.Parameters(context.Background(), params)
bz, err := clientCtx.JSONMarshaler.MarshalJSON(params)
if err != nil {
return fmt.Errorf("failed to marshal params: %w", err)
}

bz, _, err = clientCtx.QueryWithData(route, bz)
if err != nil {
return err
}

var resp types.SubspaceParamsResponse
if err := clientCtx.JSONMarshaler.UnmarshalJSON(bz, &resp); err != nil {
return err
}

return clientCtx.PrintOutput(res.GetParams())
return clientCtx.PrintOutput(resp)
},
}

Expand Down

0 comments on commit ac7790c

Please sign in to comment.