Fix list contracts by code id

This commit is contained in:
Ethan Frey 2020-02-10 12:44:09 +01:00
parent e4be8f1e58
commit 7c6c31de74
1 changed files with 6 additions and 1 deletions

View File

@ -77,7 +77,12 @@ func queryCodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
func listContractsByCodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { func listContractsByCodeHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, keeper.QueryListContractByCode) codeID, err := strconv.ParseUint(mux.Vars(r)["codeID"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
route := fmt.Sprintf("custom/%s/%s/%d", types.QuerierRoute, keeper.QueryListContractByCode, codeID)
res, _, err := cliCtx.Query(route) res, _, err := cliCtx.Query(route)
if err != nil { if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())