auction query fixes (#354)

This commit is contained in:
Ruaridh 2020-02-01 15:49:36 +00:00 committed by GitHub
parent cd754a25d9
commit 183acfef62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,13 +46,13 @@ func queryAuctionHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
} }
// Query // Query
res, height, err := cliCtx.QueryWithData("custom/gov/proposal", bz) res, height, err := cliCtx.QueryWithData(fmt.Sprintf("/custom/%s/%s", types.ModuleName, types.QueryGetAuction), bz)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return return
} }
var auction types.Auction var auction types.Auction
err = cliCtx.Codec.UnmarshalJSON(res, auction) err = cliCtx.Codec.UnmarshalJSON(res, &auction)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return return
@ -74,7 +74,7 @@ func queryAuctionsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return return
} }
// Get all auctions // Get all auctions
res, height, err := cliCtx.QueryWithData(fmt.Sprintf("/custom/auction/%s", types.QueryGetAuctions), nil) res, height, err := cliCtx.QueryWithData(fmt.Sprintf("/custom/%s/%s", types.ModuleName, types.QueryGetAuctions), nil)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) rest.WriteErrorResponse(w, http.StatusNotFound, err.Error())
return return
@ -83,7 +83,7 @@ func queryAuctionsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
cliCtx = cliCtx.WithHeight(height) cliCtx = cliCtx.WithHeight(height)
var auctions types.Auctions var auctions types.Auctions
err = cliCtx.Codec.UnmarshalJSON(res, auctions) err = cliCtx.Codec.UnmarshalJSON(res, &auctions)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) rest.WriteErrorResponse(w, http.StatusNotFound, err.Error())
return return
@ -106,7 +106,7 @@ func getParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return return
} }
// Get the params // Get the params
res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/auction/%s", types.QueryGetParams), nil) res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.ModuleName, types.QueryGetParams), nil)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return return