Documentation ¶
Index ¶
- Variables
- func GetMethod(method string) (func() Executer, bool)
- func Register(name string, factory func() Executer)
- func SetConfig(config *config.Config)
- type Args
- type CreateTxRequest
- type DefaultError
- type Error
- type Executer
- type GetAccPubKeyRequest
- type GetChainRequest
- type GetPeersRequest
- type GetSnapShotRequest
- type GetTxListRequest
- type GetTxRequest
- type InsufficientDataEvent
- type LastSnapShotRequest
- type ListSnapShotRequest
- type LoadChainRequest
- type LoadChainResponse
- type OpenAccRequest
- type PingRequest
- type PostTxRequest
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrParseError returned if invalid JSON was received by the server. // An error occurred on the server while parsing the JSON text. ErrParseError = err(-32700, "Parse Error") /// ErrInvalidRequest returned if JSON sent is not a valid Request object. ErrInvalidRequest = err(-32600, "Invalid Request") // ErrMethodNotFound returned if method does not exist / is not available. ErrMethodNotFound = err(-32601, "Method not found") // ErrInvalidParams returned if received invalid method parameter(s). ErrInvalidParams = err(-32602, "Invalid method parameter(s)") // ErrInternalError returned if occurred internal JSON-RPC error. ErrInternalError = err(-32603, "Internal error") )
View Source
var (
ErrTxNotFound = err(0, rawdb.ErrTxNotFound.Error())
)
Functions ¶
Types ¶
type Args ¶
type Args []byte
Args is necessary at the stage of receiving json, because to determine the necessary parameters, you first need to know what method should be called.
func (*Args) UnmarshalJSON ¶
UnmarshalJSON allows you to put json "as is" in text form, then deserialize as soon as the method is known.
type CreateTxRequest ¶
type DefaultError ¶
func (*DefaultError) Code ¶
func (e *DefaultError) Code() int32
func (*DefaultError) Message ¶
func (e *DefaultError) Message() string
type Executer ¶
type Executer interface {
// contains filtered or unexported methods
}
Executer at its core the request object that consists of the necessary fields.
type GetAccPubKeyRequest ¶
type GetAccPubKeyRequest struct {
Secret string `json:"secret"`
}
type GetChainRequest ¶
type GetChainRequest struct {
Id string `json:"id"`
}
type GetPeersRequest ¶
type GetPeersRequest struct {
Limit int `json:"limit"`
}
type GetSnapShotRequest ¶
type GetTxListRequest ¶
type GetTxListRequest struct {
Limit int `json:"limit"`
}
type GetTxRequest ¶
type InsufficientDataEvent ¶
func (*InsufficientDataEvent) GetObject ¶
func (e *InsufficientDataEvent) GetObject(obj interface{}) error
type LastSnapShotRequest ¶
type LastSnapShotRequest struct{}
type ListSnapShotRequest ¶
type LoadChainRequest ¶
type LoadChainResponse ¶
type OpenAccRequest ¶
type OpenAccRequest struct {
PublicKey string `json:"publicKey"`
}
type PingRequest ¶
type PingRequest string
PingRequest is a small way to check if the node is responding.
type PostTxRequest ¶
type Request ¶
type Request struct { Id int32 `json:"id"` Method string `json:"method"` Params interface{} `json:"params,omitempty"` Peer *peer.Peer `json:"peer,omitempty"` }
Request is the basic structure for JSON RPC requests.
type Response ¶
type Response struct { Id int32 `json:"id"` Error Error `json:"error,omitempty"` Result interface{} `json:"result,omitempty"` Peer *peer.Peer `json:"peer,omitempty"` }
Response is the basic structure for JSON RPC responses.
func ExecuteRequest ¶
ExecuteRequest executes RPC request and returns a response if the method is not valid anyway, the response will return with the corresponding error.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.