jsonrpc

package
v0.0.0-...-b9e1d45 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeParseError     = -32700
	CodeInvalidRequest = -32600
	CodeMethodNotFound = -32601
	CodeInvalidParams  = -32602
	CodeInternalError  = -32603

	CodeServerErrorRangeStart = -32099
	CodeServerErrorRangeEnd   = -32000
)
View Source
const JSONRPCVersion = "2.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(networkAddr string) (client Client, err error)

func (*Client) CallRPC

func (c *Client) CallRPC(ctx context.Context, method string, params interface{}) (res Response, err error)

type Error

type Error struct {
	Name  string     `json:"name"`
	Cause ErrorCause `json:"cause"`

	// Legacy - do not rely on them
	Code    int             `json:"code"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

func (*Error) Error

func (err *Error) Error() string

type ErrorCause

type ErrorCause struct {
	Name string          `json:"name"`
	Info json.RawMessage `json:"info"`
	// contains filtered or unexported fields
}

func (ErrorCause) String

func (cause ErrorCause) String() string

func (*ErrorCause) UnmarshalJSON

func (cause *ErrorCause) UnmarshalJSON(b []byte) (err error)

type ErrorCauseMessage

type ErrorCauseMessage struct {
	ErrorMessage string `json:"error_message"`
}

type JSONRPC

type JSONRPC struct {
	JSONRPC string `json:"jsonrpc"`
	ID      string `json:"id"`
	Method  string `json:"method"`
}

type Request

type Request struct {
	JSONRPC
	Params interface{} `json:"params,omitempty"`
}

type Response

type Response struct {
	JSONRPC
	Error  *Error          `json:"error"`
	Result json.RawMessage `json:"result"`
}

Jump to

Keyboard shortcuts

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