reduce module interdependancy, /client refactor (#4415)
* abstract staking BuildCreateValidatorMsg, genutil defines its own flags * client/ refactor * staking move keys from keeper to types
This commit is contained in:
committed by
Alessio Treglia
parent
91e75cb74a
commit
73e5ef7c13
@@ -0,0 +1,5 @@
|
||||
package rest
|
||||
|
||||
import "errors"
|
||||
|
||||
var errInvalidGasAdjustment = errors.New("invalid gas adjustment")
|
||||
+4
-4
@@ -4,8 +4,8 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@@ -21,12 +21,12 @@ import (
|
||||
func WriteGenerateStdTxResponse(w http.ResponseWriter, cdc *codec.Codec,
|
||||
cliCtx context.CLIContext, br rest.BaseReq, msgs []sdk.Msg) {
|
||||
|
||||
gasAdj, ok := rest.ParseFloat64OrReturnBadRequest(w, br.GasAdjustment, client.DefaultGasAdjustment)
|
||||
gasAdj, ok := rest.ParseFloat64OrReturnBadRequest(w, br.GasAdjustment, flags.DefaultGasAdjustment)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
simAndExec, gas, err := client.ParseGas(br.Gas)
|
||||
simAndExec, gas, err := flags.ParseGas(br.Gas)
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
@@ -39,7 +39,7 @@ func WriteGenerateStdTxResponse(w http.ResponseWriter, cdc *codec.Codec,
|
||||
|
||||
if br.Simulate || simAndExec {
|
||||
if gasAdj < 0 {
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, client.ErrInvalidGasAdjustment.Error())
|
||||
rest.WriteErrorResponse(w, http.StatusBadRequest, errInvalidGasAdjustment.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user