diff --git a/x/mint/client/rest/query.go b/x/mint/client/rest/query.go deleted file mode 100644 index bf1f5a59..00000000 --- a/x/mint/client/rest/query.go +++ /dev/null @@ -1,62 +0,0 @@ -package rest - -import ( - "fmt" - "net/http" - - "github.com/Nolus-Protocol/nolus-core/x/mint/types" - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/types/rest" -) - -func registerQueryRoutes(clientCtx client.Context, r *mux.Router) { - r.HandleFunc( - "/minting/parameters", - queryParamsHandlerFn(clientCtx), - ).Methods("GET") - - r.HandleFunc( - "/minting/state", - queryMintStateHandlerFn(clientCtx), - ).Methods("GET") -} - -func queryParamsHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParameters) - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - res, height, err := clientCtx.QueryWithData(route, nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} - -func queryMintStateHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryInflation) - - clientCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, clientCtx, r) - if !ok { - return - } - - res, height, err := clientCtx.QueryWithData(route, nil) - if rest.CheckInternalServerError(w, err) { - return - } - - clientCtx = clientCtx.WithHeight(height) - rest.PostProcessResponse(w, clientCtx, res) - } -} diff --git a/x/mint/client/rest/rest.go b/x/mint/client/rest/rest.go deleted file mode 100644 index 2ed28d41..00000000 --- a/x/mint/client/rest/rest.go +++ /dev/null @@ -1,14 +0,0 @@ -package rest - -import ( - "github.com/gorilla/mux" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/rest" -) - -// RegisterRoutes registers minting module REST handlers on the provided router. -func RegisterRoutes(clientCtx client.Context, rtr *mux.Router) { - r := rest.WithHTTPDeprecationHeaders(rtr) - registerQueryRoutes(clientCtx, r) -} diff --git a/x/mint/module.go b/x/mint/module.go index ce5789e8..689a1f02 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -6,8 +6,6 @@ import ( "fmt" "math/rand" - "github.com/Nolus-Protocol/nolus-core/x/mint/client/rest" - "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -67,7 +65,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterRESTRoutes registers the REST routes for the mint module. func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { - rest.RegisterRoutes(clientCtx, rtr) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the mint module.