rpc

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARSE_ERROR      = -32700
	INVALID_REQUEST  = -32600
	METHOD_NOT_FOUND = -32601
	INVALID_PARAMS   = -32602
	INTERNAL_ERROR   = -32603
)

JSON-RPC 2.0 error codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	EncodeBytes(interface{}) ([]byte, error)
	Encode(interface{}, io.Writer) error
	DecodeBytes(interface{}, []byte) error
	DecodeBytesPtr(interface{}, []byte) error
	Decode(interface{}, io.Reader) error
}

Used for rpc request and response data.

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError MUST be included in the Response object if an error occured

type RPCErrorResponse added in v0.16.0

type RPCErrorResponse struct {
	Error   *RPCError `json:"error"`
	Id      string    `json:"id"`
	JSONRPC string    `json:"jsonrpc"`
}

RPCErrorResponse MUST NOT contain the result member if an error occured

func (*RPCErrorResponse) AssertIsRPCResponse added in v0.16.0

func (rpcErrorResponse *RPCErrorResponse) AssertIsRPCResponse() bool

AssertIsRPCResponse implements a marker method for RPCErrorResponse to implement the interface RPCResponse

type RPCRequest

type RPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
	Id      string          `json:"id"`
}

Request and Response objects. Id is a string. Error data not used. Refer to JSON-RPC specification http://www.jsonrpc.org/specification

type RPCResponse

type RPCResponse interface {
	AssertIsRPCResponse() bool
}

RPCResponse MUST follow the JSON-RPC specification for Response object reference: http://www.jsonrpc.org/specification#response_object

func NewRPCErrorResponse

func NewRPCErrorResponse(id string, code int, message string) RPCResponse

NewRPCErrorResponse creates a new error-response object from the error code and message

func NewRPCResponse

func NewRPCResponse(id string, res interface{}) RPCResponse

NewRPCResponse creates a new response object from a result

type RPCResultResponse added in v0.16.0

type RPCResultResponse struct {
	Result  interface{} `json:"result"`
	Id      string      `json:"id"`
	JSONRPC string      `json:"jsonrpc"`
}

RPCResultResponse MUST NOT contain the error member if no error occurred

func (*RPCResultResponse) AssertIsRPCResponse added in v0.16.0

func (rpcResultResponse *RPCResultResponse) AssertIsRPCResponse() bool

AssertIsRPCResponse implements a marker method for RPCResultResponse to implement the interface RPCResponse

Directories

Path Synopsis
tendermint
v0

Jump to

Keyboard shortcuts

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