Documentation ¶
Index ¶
- type EventSubscriber
- type RPCError
- type RPCErrorCode
- type RPCRequest
- type RPCResponse
- func NewRPCErrorResponse(id string, code RPCErrorCode, data string) RPCResponse
- func NewRPCSuccessResponse(id string, res interface{}) RPCResponse
- func RPCInternalError(id string, err error) RPCResponse
- func RPCInvalidParamsError(id string, err error) RPCResponse
- func RPCInvalidRequestError(id string, err error) RPCResponse
- func RPCMethodNotFoundError(id string) RPCResponse
- func RPCParseError(id string, err error) RPCResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSubscriber ¶
type EventSubscriber interface { Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, out chan<- interface{}) error Unsubscribe(ctx context.Context, subscriber string, query tmpubsub.Query) error UnsubscribeAll(ctx context.Context, subscriber string) error }
EventSubscriber mirros tendermint/tendermint/types.EventBusSubscriber
type RPCError ¶
type RPCError struct { Code RPCErrorCode `json:"code"` Message string `json:"message"` Data json.RawMessage `json:"data,omitempty"` }
func (*RPCError) HTTPStatusCode ¶
func (*RPCError) IsServerError ¶ added in v0.34.4
type RPCErrorCode ¶
type RPCErrorCode int
From JSONRPC 2.0 spec
const ( RPCErrorCodeParseError RPCErrorCode = -32700 RPCErrorCodeInvalidRequest RPCErrorCode = -32600 RPCErrorCodeMethodNotFound RPCErrorCode = -32601 RPCErrorCodeInvalidParams RPCErrorCode = -32602 RPCErrorCodeInternalError RPCErrorCode = -32603 // Available for custom server-defined errors RPCErrorCodeServerErrorStart RPCErrorCode = -32000 RPCErrorCodeServerErrorEnd RPCErrorCode = -32099 )
func (RPCErrorCode) Error ¶
func (code RPCErrorCode) Error() string
func (RPCErrorCode) HTTPStatusCode ¶
func (code RPCErrorCode) HTTPStatusCode() int
func (RPCErrorCode) IsServerError ¶ added in v0.34.4
func (code RPCErrorCode) IsServerError() bool
func (RPCErrorCode) String ¶
func (code RPCErrorCode) String() string
type RPCRequest ¶
type RPCRequest struct { JSONRPC string `json:"jsonrpc"` ID string `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` // must be map[string]interface{} or []interface{} }
func NewRPCRequest ¶
func NewRPCRequest(id string, method string, params json.RawMessage) RPCRequest
func NewRequest ¶ added in v0.34.4
func NewRequest(id string, method string, params interface{}) (RPCRequest, error)
func (RPCRequest) String ¶
func (req RPCRequest) String() string
type RPCResponse ¶
type RPCResponse struct { JSONRPC string `json:"jsonrpc"` ID string `json:"id"` Result json.RawMessage `json:"result,omitempty"` Error *RPCError `json:"error,omitempty"` }
func NewRPCErrorResponse ¶
func NewRPCErrorResponse(id string, code RPCErrorCode, data string) RPCResponse
func NewRPCSuccessResponse ¶
func NewRPCSuccessResponse(id string, res interface{}) RPCResponse
func RPCInternalError ¶
func RPCInternalError(id string, err error) RPCResponse
func RPCInvalidParamsError ¶
func RPCInvalidParamsError(id string, err error) RPCResponse
func RPCInvalidRequestError ¶
func RPCInvalidRequestError(id string, err error) RPCResponse
func RPCMethodNotFoundError ¶
func RPCMethodNotFoundError(id string) RPCResponse
func RPCParseError ¶
func RPCParseError(id string, err error) RPCResponse
func (RPCResponse) String ¶
func (resp RPCResponse) String() string
Click to show internal directories.
Click to hide internal directories.