Documentation
¶
Index ¶
- Constants
- func AsyncOnlyArg(r *http.Request) bool
- func CalculateGas(queryFunc func(string, common.HexBytes) ([]byte, error), cdc *amino.Codec, ...) (estimate, adjusted int64, err error)
- func ConvertDecToRat(input sdk.Dec) irishubType.Rat
- func EnrichCtxWithGas(txCtx context.TxContext, cliCtx context.CLIContext, name string, ...) (context.TxContext, error)
- func ExRateFromStakeTokenToMainUnit(cliCtx context.CLIContext) irishubType.Rat
- func HasDryRunArg(r *http.Request) bool
- func HasGenerateOnlyArg(r *http.Request) bool
- func InitReqCliCtx(cliCtx context.CLIContext, r *http.Request) context.CLIContext
- func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool)
- func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool)
- func ParseUint64OrReturnBadRequest(w http.ResponseWriter, s string) (n uint64, ok bool)
- func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response interface{}, indent bool)
- func PrintUnsignedStdTx(txCtx context.TxContext, cliCtx context.CLIContext, msgs []sdk.Msg, ...) (err error)
- func ReadPostBody(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req interface{}) (err error)
- func SendOrPrintTx(txCtx context.TxContext, cliCtx context.CLIContext, msgs []sdk.Msg) error
- func SendOrReturnUnsignedTx(w http.ResponseWriter, cliCtx context.CLIContext, baseTx context.BaseTx, ...)
- func SignStdTx(txCtx context.TxContext, cliCtx context.CLIContext, name string, ...) (auth.StdTx, error)
- func WriteErrorResponse(w http.ResponseWriter, status int, err string)
- func WriteGenerateStdTxResponse(w http.ResponseWriter, txCtx context.TxContext, msgs []sdk.Msg)
- func WriteSimulationResponse(w http.ResponseWriter, gas int64)
Constants ¶
const (
Async = "async"
)
Variables ¶
This section is empty.
Functions ¶
func AsyncOnlyArg ¶
AsyncOnlyArg returns whether a URL's query "async" parameter
func CalculateGas ¶ added in v0.7.0
func CalculateGas(queryFunc func(string, common.HexBytes) ([]byte, error), cdc *amino.Codec, txBytes []byte, adjustment float64) (estimate, adjusted int64, err error)
CalculateGas simulates the execution of a transaction and returns both the estimate obtained by the query and the adjusted amount.
func ConvertDecToRat ¶ added in v0.7.0
func ConvertDecToRat(input sdk.Dec) irishubType.Rat
func EnrichCtxWithGas ¶ added in v0.7.0
func EnrichCtxWithGas(txCtx context.TxContext, cliCtx context.CLIContext, name string, msgs []sdk.Msg) (context.TxContext, error)
EnrichCtxWithGas calculates the gas estimate that would be consumed by the transaction and set the transaction's respective value accordingly.
func ExRateFromStakeTokenToMainUnit ¶ added in v0.7.0
func ExRateFromStakeTokenToMainUnit(cliCtx context.CLIContext) irishubType.Rat
func HasDryRunArg ¶ added in v0.7.0
HasDryRunArg returns true if the request's URL query contains the dry run argument and its value is set to "true".
func HasGenerateOnlyArg ¶ added in v0.7.0
HasGenerateOnlyArg returns whether a URL's query "generate-only" parameter is set to "true".
func InitReqCliCtx ¶ added in v0.7.0
func InitReqCliCtx(cliCtx context.CLIContext, r *http.Request) context.CLIContext
InitReqCliCtx
func ParseFloat64OrReturnBadRequest ¶ added in v0.7.0
func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool)
ParseFloat64OrReturnBadRequest converts s to a float64 value. It returns a default value, defaultIfEmpty, if the string is empty.
func ParseInt64OrReturnBadRequest ¶ added in v0.7.0
func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool)
ParseInt64OrReturnBadRequest converts s to a int64 value.
func ParseUint64OrReturnBadRequest ¶ added in v0.7.0
func ParseUint64OrReturnBadRequest(w http.ResponseWriter, s string) (n uint64, ok bool)
ParseUint64OrReturnBadRequest converts s to a uint64 value.
func PostProcessResponse ¶ added in v0.7.0
func PostProcessResponse(w http.ResponseWriter, cdc *codec.Codec, response interface{}, indent bool)
PostProcessResponse performs post process for rest response
func PrintUnsignedStdTx ¶
func PrintUnsignedStdTx(txCtx context.TxContext, cliCtx context.CLIContext, msgs []sdk.Msg, offline bool) (err error)
PrintUnsignedStdTx builds an unsigned StdTx and prints it to os.Stdout. Don't perform online validation or lookups if offline is true.
func ReadPostBody ¶
func ReadPostBody(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req interface{}) (err error)
ReadPostBody
func SendOrPrintTx ¶
SendOrPrintTx implements a utility function that facilitates sending a series of messages in a signed transaction given a TxContext and a QueryContext. It ensures that the account exists, has a proper number and sequence set. In addition, it builds and signs a transaction with the supplied messages. Finally, it broadcasts the signed transaction to a node. NOTE: Also see CompleteAndBroadcastTxREST.
func SendOrReturnUnsignedTx ¶
func SendOrReturnUnsignedTx(w http.ResponseWriter, cliCtx context.CLIContext, baseTx context.BaseTx, msgs []sdk.Msg)
SendOrReturnUnsignedTx implements a utility function that facilitates sending a series of messages in a signed transaction given a TxBuilder and a QueryContext. It ensures that the account exists, has a proper number and sequence set. In addition, it builds and signs a transaction with the supplied messages. Finally, it broadcasts the signed transaction to a node.
NOTE: Also see SendOrPrintTx. NOTE: Also see x/stake/client/rest/tx.go delegationsRequestHandlerFn.
func SignStdTx ¶ added in v0.7.0
func SignStdTx(txCtx context.TxContext, cliCtx context.CLIContext, name string, stdTx auth.StdTx, appendSig bool, offline bool) (auth.StdTx, error)
SignStdTx appends a signature to a StdTx and returns a copy of a it. If appendSig is false, it replaces the signatures already attached with the new signature. Don't perform online validation or lookups if offline is true.
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, status int, err string)
WriteErrorResponse prepares and writes a HTTP error given a status code and an error message.
func WriteGenerateStdTxResponse ¶
WriteGenerateStdTxResponse writes response for the generate_only mode.
func WriteSimulationResponse ¶ added in v0.7.0
func WriteSimulationResponse(w http.ResponseWriter, gas int64)
WriteSimulationResponse prepares and writes an HTTP response for transactions simulations.
Types ¶
This section is empty.