jsonrpc

package
v0.0.0-...-031fc53 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "2.0"

Version is a JSONRPC version

Variables

This section is empty.

Functions

func MarshalRequest

func MarshalRequest(r Request) []byte

MarshalRequest JSONRPC request bytes from a Request struct

func MarshalRequestStringParams

func MarshalRequestStringParams(r RequestStringParams) []byte

MarshalRequestStringParams creates a JSONRPC request bytes from a RequestStringParams struct

func MarshalResponse

func MarshalResponse(r Response) []byte

MarshalResponse creates a JSONRPC response bytes from a Response struct

Types

type Request

type Request struct {
	JSONRPCVersion string      `json:"jsonrpc"`
	ID             int         `json:"id"`
	Method         string      `json:"method"`
	Params         interface{} `json:"params"`
}

Request specifies the JSONRPC gateway request

type RequestStringParams

type RequestStringParams struct {
	JSONRPCVersion string   `json:"jsonrpc"`
	ID             int      `json:"id"`
	Method         string   `json:"method"`
	Params         []string `json:"params"`
}

RequestStringParams specifies the JSONRPC gateway request

func UnmarshalRequest

func UnmarshalRequest(b []byte) (RequestStringParams, error)

UnmarshalRequest parses the JSONRPC request, and returns it as a Request struct

type Response

type Response struct {
	JSONRPCVersion string      `json:"jsonrpc"`
	ID             int         `json:"id"`
	Result         interface{} `json:"result"`
	Error          interface{} `json:"error"`
}

Response specifies the JSONRPC gateway response

func UnmarshalResponse

func UnmarshalResponse(b []byte) (Response, error)

UnmarshalResponse parses the JSONRPC request, and returns it as a Response struct

Jump to

Keyboard shortcuts

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