x/upgrade: clean-up redundant struct (#6606)
Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
51df2f2033
commit
d0cabdeb88
|
@ -54,7 +54,7 @@ func GetAppliedHeightCmd(storeName string, cdc *codec.Codec) *cobra.Command {
|
||||||
clientCtx := client.NewContext().WithCodec(cdc).WithJSONMarshaler(cdc)
|
clientCtx := client.NewContext().WithCodec(cdc).WithJSONMarshaler(cdc)
|
||||||
|
|
||||||
name := args[0]
|
name := args[0]
|
||||||
params := types.NewQueryAppliedParams(name)
|
params := types.NewQueryAppliedPlanRequest(name)
|
||||||
bz, err := clientCtx.JSONMarshaler.MarshalJSON(params)
|
bz, err := clientCtx.JSONMarshaler.MarshalJSON(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -45,7 +45,7 @@ func getDonePlanHandler(clientCtx client.Context) func(http.ResponseWriter, *htt
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
|
|
||||||
params := types.NewQueryAppliedParams(name)
|
params := types.NewQueryAppliedPlanRequest(name)
|
||||||
bz, err := clientCtx.JSONMarshaler.MarshalJSON(params)
|
bz, err := clientCtx.JSONMarshaler.MarshalJSON(params)
|
||||||
if rest.CheckBadRequestError(w, err) {
|
if rest.CheckBadRequestError(w, err) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -43,7 +43,7 @@ func queryCurrent(ctx sdk.Context, _ abci.RequestQuery, k Keeper) ([]byte, error
|
||||||
}
|
}
|
||||||
|
|
||||||
func queryApplied(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) {
|
func queryApplied(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error) {
|
||||||
var params types.QueryAppliedParams
|
var params types.QueryAppliedPlanRequest
|
||||||
|
|
||||||
err := k.cdc.UnmarshalJSON(req.Data, ¶ms)
|
err := k.cdc.UnmarshalJSON(req.Data, ¶ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -15,14 +15,3 @@ func NewQueryCurrentPlanRequest() *QueryCurrentPlanRequest {
|
||||||
func NewQueryAppliedPlanRequest(name string) *QueryAppliedPlanRequest {
|
func NewQueryAppliedPlanRequest(name string) *QueryAppliedPlanRequest {
|
||||||
return &QueryAppliedPlanRequest{Name: name}
|
return &QueryAppliedPlanRequest{Name: name}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryAppliedParams is passed as data with QueryApplied
|
|
||||||
type QueryAppliedParams struct {
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewQueryAppliedParams creates a new instance to query
|
|
||||||
// if a named plan was applied
|
|
||||||
func NewQueryAppliedParams(name string) QueryAppliedParams {
|
|
||||||
return QueryAppliedParams{Name: name}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue