proxy

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ErrInternal int = -32603

ErrInternal is a general server error code

View Source
const ErrInvalidParams int = -32602

ErrInvalidParams signifies a client-supplied params error

View Source
const ErrMethodNotFound int = -32601

ErrMethodNotFound means the client-requested method cannot be found

View Source
const ErrProxy int = -32080

ErrProxy is for general errors that originate inside the proxy module

View Source
const ErrProxyAuthFailed int = -32085

ErrProxyAuthFailed is when supplied auth_token / account_id is not present in the database

Variables

This section is empty.

Functions

func ForwardCall

func ForwardCall(request jsonrpc.RPCRequest) ([]byte, error)

ForwardCall passes a prepared jsonrpc request to the SDK and calls post-processors on the response.

func InitResponseCache

func InitResponseCache(c ResponseCache)

InitResponseCache initializes module-level responseCache variable

func MarshalResponse added in v0.6.1

func MarshalResponse(r *jsonrpc.RPCResponse) ([]byte, error)

MarshalResponse takes a raw json request body and serializes it into RPCRequest struct for further processing.

func MethodRequiresAccountID added in v0.6.1

func MethodRequiresAccountID(method string) bool

func NewErrorResponse added in v0.6.1

func NewErrorResponse(message string, code int) *jsonrpc.RPCResponse

NewErrorResponse is a shorthand for creating an RPCResponse instance with specified error message and code

func NewRequest added in v0.6.1

func NewRequest(method string, params ...interface{}) jsonrpc.RPCRequest

func Proxy added in v0.6.1

func Proxy(r *jsonrpc.RPCRequest, accountID string) ([]byte, error)

Proxy takes a parsed jsonrpc request, calls processors on it and passes it over to the daemon. If accountID is supplied, it's injected as a request param.

func RawCall added in v0.6.1

func RawCall(request jsonrpc.RPCRequest) (*jsonrpc.RPCResponse, error)

RawCall makes an arbitrary jsonrpc request to the SDK

func UnmarshalRequest added in v0.6.1

func UnmarshalRequest(r []byte) (*jsonrpc.RPCRequest, error)

UnmarshalRequest takes a raw json request body and serializes it into RPCRequest struct for further processing.

Types

type ResponseCache

type ResponseCache interface {
	Save(method string, params interface{}, r interface{})
	Retrieve(method string, params interface{}) interface{}
	Count() int
	// contains filtered or unexported methods
}

ResponseCache interface describes methods for SDK response cache saving and retrieval

Jump to

Keyboard shortcuts

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