@@ -139,6 +139,11 @@ func getData(cliCtx context.CLIContext) http.HandlerFunc {
139139 // parse inputs and prepare request
140140 vars := mux .Vars (r )
141141
142+ cliCtx , ok := rest .ParseQueryHeightOrReturnBadRequest (w , cliCtx , r )
143+ if ! ok {
144+ return
145+ }
146+
142147 address , err := helpers .ParseSdkAddressParam (accountAddrName , vars [accountAddrName ], helpers .ParamTypeRestPath )
143148 if err != nil {
144149 rest .WriteErrorResponse (w , http .StatusBadRequest , "failed to parse request" )
@@ -155,19 +160,24 @@ func getData(cliCtx context.CLIContext) http.HandlerFunc {
155160 Address : common_vm .Bech32ToLibra (address ),
156161 Path : path ,
157162 })
163+
158164 if err != nil {
159165 rest .WriteErrorResponse (w , http .StatusInternalServerError , err .Error ())
160166 return
161167 }
162168
163169 // send request and process response
164- res , _ , err := cliCtx .QueryWithData (fmt .Sprintf ("custom/%s/%s" , types .ModuleName , types .QueryValue ), bz )
170+ res , height , err := cliCtx .QueryWithData (fmt .Sprintf ("custom/%s/%s" , types .ModuleName , types .QueryValue ), bz )
165171 if err != nil {
166172 rest .WriteErrorResponse (w , http .StatusInternalServerError , err .Error ())
167173 return
168174 }
169175 resp := types.ValueResp {Value : hex .EncodeToString (res )}
170176
177+ if cliCtx .Height == 0 {
178+ cliCtx = context .NewCLIContext ().WithCodec (cliCtx .Codec ).WithHeight (height )
179+ }
180+
171181 rest .PostProcessResponse (w , cliCtx , resp )
172182 }
173183}
0 commit comments