rest

package
v1.6.56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPage  = 1
	DefaultLimit = 30 // should be consistent with tendermint/tendermint/rpc/collactor/pipe.go:19

	DefaultSimulateGas = 200000
)

Variables

This section is empty.

Functions

func CheckHeightAndProve

func CheckHeightAndProve(w http.ResponseWriter, height, prove string, codespace sdk.CodespaceType) (isValid bool)

func GetNecessaryParams

func GetNecessaryParams(cliCtx context.Context, request *http.Request, cdc *codec.Codec, broadcast bool) (key string, from sdk.AccAddress, nonce, gas uint64, err error)

func MiddleHandler

func MiddleHandler(ctx context.Context, f func(clictx context.Context, w http.ResponseWriter, r *http.Request), codeSpace sdk.CodespaceType) http.HandlerFunc

func ParseHTTPArgsWithLimit

func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, page, limit int, err error)

ParseHTTPArgsWithLimit parses the request's URL and returns a slice containing all arguments pairs. It separates page and limit used for pagination where a default limit can be provided.

func ParseQueryHeightOrReturnBadRequest

func ParseQueryHeightOrReturnBadRequest(w http.ResponseWriter, cliCtx context.Context, r *http.Request, heightStr string) (context.Context, bool, error)

func PostProcessResponseBare

func PostProcessResponseBare(w http.ResponseWriter, ctx context.Context, body interface{})

func WriteErrorRes

func WriteErrorRes(w http.ResponseWriter, err string)

Types

type QueryRes

type QueryRes struct {
	Value  interface{}   `json:"value"`
	Height int64         `json:"height,omitempty"`
	Proof  *merkle.Proof `json:"proof,omitempty"`
}

func BuildQueryRes

func BuildQueryRes(height string, isProve bool, value interface{}, proof *merkle.Proof) QueryRes

type Response

type Response struct {
	Ret     int64           `json:"ret"`
	Data    json.RawMessage `json:"data"`
	Message string          `json:"message"`
}

func NewErrorRes

func NewErrorRes(err string) Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL