rpc

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 29 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildStdTxAndResponse

func BuildStdTxAndResponse(writer http.ResponseWriter, request *http.Request, cliCtx context.CLIContext, typ reflect.Type, fn func(req interface{}, from types.AccAddress, vars map[string]string) (txs.ITx, error))

func ParseEvents

func ParseEvents(rte []atypes.Event) ([]events, error)

func ParseURIPathAddress

func ParseURIPathAddress(request *http.Request, pathName string) (types.AccAddress, error)

func ParseURIPathValue

func ParseURIPathValue(request *http.Request, pathName string) (string, error)

func PostProcessResponseBare

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

func ServerCommand

func ServerCommand(cdc *amino.Codec, registerRoutesFn func(*RestServer)) *cobra.Command

func Write40XErrorResponse

func Write40XErrorResponse(w http.ResponseWriter, err error)

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, status int, err string)

func WriteGenStdTxResponse

func WriteGenStdTxResponse(writer http.ResponseWriter, cliCtx context.CLIContext, req BaseRequest, tx txs.ITx)

Types

type BaseRequest

type BaseRequest struct {
	From    string `json:"from"`
	ChainId string `json:"chain_id"`
	Nonce   int64  `json:"nonce"`
	MaxGas  int64  `json:"max_gas"`
	Height  int64  `json:"height"`
	Indent  bool   `json:"indent"`
	Mode    string `json:"mode"`
}

func NewBaseRequest

func NewBaseRequest(from, chainId string, nonce, maxGas, height int64, indent bool, mode string) BaseRequest

func ParseRequestForm

func ParseRequestForm(r *http.Request) (br BaseRequest, err error)

func (BaseRequest) Sanitize

func (br BaseRequest) Sanitize() BaseRequest

func (BaseRequest) Setup

func (BaseRequest) ValidateBasic

func (br BaseRequest) ValidateBasic() error

type BroadcastReq

type BroadcastReq struct {
	Tx   types.Tx `json:"tx"`
	Mode string   `json:"mode"`
}

type Config

type Config struct {
	MaxOpen      uint64
	ReadTimeOut  uint64
	WriteTimeOut uint64
}

type ErrorResponse

type ErrorResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

func NewErrorResponse

func NewErrorResponse(code int, err string) ErrorResponse

type Event added in v0.2.5

type Event struct {
	Type  string         `json:"type"`
	Pairs []EventKeyPair `json:"pairs"`
}

type EventKeyPair added in v0.2.5

type EventKeyPair struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type EventResult added in v0.2.5

type EventResult struct {
	BeginBlockEvents []Event `json:"begin_block_events"`
	TxEvents         []Event `json:"tx_events"`
	EndBlockEvents   []Event `json:"end_block_events"`
}

type RestServer

type RestServer struct {
	Mux    *mux.Router
	CliCtx context.CLIContext
	// contains filtered or unexported fields
}

func NewRestServer

func NewRestServer(cdc *amino.Codec) *RestServer

func (*RestServer) Start

func (rs *RestServer) Start(listenAddr string, config Config) (err error)

type TxGenerateResponse

type TxGenerateResponse struct {
	Code      int              `json:"code"`
	Tx        string           `json:"tx"`
	Signer    types.AccAddress `json:"signer"`
	PubKey    crypto.PubKey    `json:"pubkey"`
	Nonce     int64            `json:"nonce"`
	SignBytes string           `json:"sign_bytes"`
}

type TxResponse

type TxResponse struct {
	Height    int64    `json:"height"`
	TxHash    string   `json:"txhash"`
	Code      uint32   `json:"code"`
	Data      string   `json:"data,omitempty"`
	RawLog    string   `json:"raw_log,omitempty"`
	Info      string   `json:"info,omitempty"`
	GasWanted int64    `json:"gas_wanted,omitempty"`
	GasUsed   int64    `json:"gas_used,omitempty"`
	Codespace string   `json:"codespace,omitempty"`
	Tx        types.Tx `json:"tx,omitempty"`
	Timestamp string   `json:"timestamp,omitempty"`
	Events    []events `JSON:"event,omitempty"`
}

func NewResponseResultTx

func NewResponseResultTx(res *ctypes.ResultTx, tx types.Tx, timestamp string) TxResponse

type TxsSearchEvent

type TxsSearchEvent struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Op    string `json:"op"`
}

type TxsSearchItem

type TxsSearchItem struct {
	Hash    string `json:"hash"`
	Height  int64  `json:"height"`
	Index   uint32 `json:"index"`
	GasUsed int64  `json:"gas_used"`
}

type TxsSearchRequest

type TxsSearchRequest struct {
	Events []TxsSearchEvent `json:"events"`
	Proof  bool             `json:"proof"`
	Page   int              `json:"page"`
	Limit  int              `json:"limit"`
}

type TxsSearchResponse

type TxsSearchResponse struct {
	Txs        []TxsSearchItem `json:"txs"`
	TotalCount int             `json:"total_count"`
}

Jump to

Keyboard shortcuts

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