Documentation
¶
Index ¶
- Constants
- func ForwardCall(request jsonrpc.RPCRequest) ([]byte, error)
- func InitResponseCache(c ResponseCache)
- func MarshalResponse(r *jsonrpc.RPCResponse) ([]byte, error)
- func MethodRequiresAccountID(method string) bool
- func NewErrorResponse(message string, code int) *jsonrpc.RPCResponse
- func NewRequest(method string, params ...interface{}) jsonrpc.RPCRequest
- func Proxy(r *jsonrpc.RPCRequest, accountID string) ([]byte, error)
- func RawCall(request jsonrpc.RPCRequest) (*jsonrpc.RPCResponse, error)
- func UnmarshalRequest(r []byte) (*jsonrpc.RPCRequest, error)
- type ResponseCache
Constants ¶
const ErrInternal int = -32603
ErrInternal is a general server error code
const ErrInvalidParams int = -32602
ErrInvalidParams signifies a client-supplied params error
const ErrMethodNotFound int = -32601
ErrMethodNotFound means the client-requested method cannot be found
const ErrProxy int = -32080
ErrProxy is for general errors that originate inside the proxy module
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 ¶
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 ¶
func NewErrorResponse ¶
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 ¶
func NewRequest(method string, params ...interface{}) jsonrpc.RPCRequest
func Proxy ¶
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 ¶
func RawCall(request jsonrpc.RPCRequest) (*jsonrpc.RPCResponse, error)
RawCall makes an arbitrary jsonrpc request to the SDK
func UnmarshalRequest ¶
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