Documentation
¶
Index ¶
- type JsonRpcRequest
- type JsonRpcResponse
- func Error(id any, code int, msg string) *JsonRpcResponse
- func ErrorInvalidParams(id any, msg string) *JsonRpcResponse
- func ErrorInvalidRequest(id any, msg string) *JsonRpcResponse
- func ErrorMethodNotFound(id any, msg string) *JsonRpcResponse
- func ErrorServerError(id any, msg string) *JsonRpcResponse
- func NewJsonRpcResponse(id any, result any, err *JsonRpcResponseError) *JsonRpcResponse
- type JsonRpcResponseError
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonRpcRequest ¶
type JsonRpcRequest struct {
Id any `json:"id"`
JSONRpc string `json:"jsonrpc,omitempty"`
Method string `json:"method"`
Params interface{} `json:"params,omitempty"`
}
func MustUnmarshalJsonRpcRequest ¶
func MustUnmarshalJsonRpcRequest(data []byte) *JsonRpcRequest
type JsonRpcResponse ¶
type JsonRpcResponse struct {
Id any `json:"id"`
JSONRpc string `json:"jsonrpc,omitempty"`
Error *JsonRpcResponseError `json:"error,omitempty"`
Result interface{} `json:"result,omitempty"`
}
func ErrorInvalidParams ¶
func ErrorInvalidParams(id any, msg string) *JsonRpcResponse
func ErrorInvalidRequest ¶
func ErrorInvalidRequest(id any, msg string) *JsonRpcResponse
func ErrorMethodNotFound ¶
func ErrorMethodNotFound(id any, msg string) *JsonRpcResponse
func ErrorServerError ¶
func ErrorServerError(id any, msg string) *JsonRpcResponse
func NewJsonRpcResponse ¶
func NewJsonRpcResponse(id any, result any, err *JsonRpcResponseError) *JsonRpcResponse
func (*JsonRpcResponse) Marshal ¶
func (r *JsonRpcResponse) Marshal() []byte
type JsonRpcResponseError ¶
type JsonRpcResponseError struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}
func NewJsonRpcResponseError ¶
func NewJsonRpcResponseError(code int, message string, data any) *JsonRpcResponseError
type Session ¶
type Session struct {
RequestCtx any
Method string
Path string
Chain string
Request *JsonRpcRequest
RawRequest []byte
Cfg config.Config
Tries int
NodeName string
IsWriteRpcMethod bool
// contains filtered or unexported fields
}
func (*Session) IsMaxRetriesExceeded ¶
func (*Session) NewJsonRpcError ¶
func (s *Session) NewJsonRpcError(err error) *JsonRpcResponse
Click to show internal directories.
Click to hide internal directories.