rpchandler

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePaymentAddress

func CreatePaymentAddress(shardID byte) string

CreatePaymentAddress is a temp function that creates a payment address of a specific shard.

func ParseResponse

func ParseResponse(respondInBytes []byte, val interface{}) error

ParseResponse parses a JSON-RPC response to val.

Types

type JsonRequest

type JsonRequest struct {
	JsonRPC string      `json:"Jsonrpc"`
	Method  string      `json:"Method"`
	Params  interface{} `json:"Params"`
	Id      interface{} `json:"Id"`
}

JsonRequest represents a JSON-RPC request.

func CreateJsonRequest

func CreateJsonRequest(jsonRPC, method string, params []interface{}, id interface{}) *JsonRequest

CreateJsonRequest creates a new JsonRequest given the method and parameters.

type JsonResponse

type JsonResponse struct {
	Id      *interface{}    `json:"Id"`
	Result  json.RawMessage `json:"Result"`
	Error   *RPCError       `json:"Error"`
	Params  interface{}     `json:"Params"`
	Method  string          `json:"Method"`
	JsonRPC string          `json:"Jsonrpc"`
}

JsonResponse represents a JSON-RPC response.

func OldParseResponse deprecated

func OldParseResponse(respondInBytes []byte) (*JsonResponse, error)

OldParseResponse parses a raw JSON-RPC response into a JsonResponse.

Deprecated: use ParseResponse instead.

type RPCError

type RPCError struct {
	Code       int    `json:"Code,omitempty"`
	Message    string `json:"Message,omitempty"`
	StackTrace string `json:"StackTrace"`
	Err        error  `json:"Err"`
}

RPCError represents an error that is used as a part of a JSON-RPC JsonResponse object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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