func NewRPCErrorResponse(id string, code int, message string) RPCResponse {
	return RPCResponse(&RPCErrorResponse{
		Error:   &RPCError{code, message},
		Id:      id,
		JSONRPC: "2.0",
	})
}
NewRPCErrorResponse creates a new error-response object from the error code and message
package rpc
import (
	"encoding/json"
	"fmt"
)
const (
	RPCErrorServerError    = -32000
	RPCErrorInvalidRequest = -32600
	RPCErrorMethodNotFound = -32601
	RPCErrorInvalidParams  = -32602
	RPCErrorInternalError  = -32603
	RPCErrorParseError     = -32700
)
type (
	RPCRequest struct {
		JSONRPC string          `json:"jsonrpc"`
		Method  string          `json:"method"`
		Params  json.RawMessage `json:"params"`
		Id      string          `json:"id"`
	}
	RPCResponse interface {
		AssertIsRPCResponse() bool
	}
	RPCResultResponse struct {
		Result  interface{} `json:"result"`
		Id      string      `json:"id"`
		JSONRPC string      `json:"jsonrpc"`
	}
	RPCErrorResponse struct {
		Error   *RPCError `json:"error"`
		Id      string    `json:"id"`
		JSONRPC string    `json:"jsonrpc"`
	}
	RPCError struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	}
)
func (err RPCError) Error() string {
	return fmt.Sprintf("Error %v: %s", err.Code, err.Message)
}
func NewRPCRequest(id string, method string, params json.RawMessage) *RPCRequest {
	return &RPCRequest{
		JSONRPC: "2.0",
		Id:      id,
		Method:  method,
		Params:  params,
	}
}
func NewRPCResponse(id string, res interface{}) RPCResponse {
	return RPCResponse(&RPCResultResponse{
		Result:  res,
		Id:      id,
		JSONRPC: "2.0",
	})
}