Documentation ¶
Index ¶
- Variables
- type APIServer
- func (s *APIServer) AddGETPath(path string, con echo.HandlerFunc) error
- func (s *APIServer) HandleJRPC(req *JRPCRequest) interface{}
- func (s *APIServer) JRPC(SubName string) (*JRPCSub, error)
- func (s *APIServer) Name() string
- func (s *APIServer) OnBlockConnected(b *types.Block, loader types.Loader)
- func (s *APIServer) OnLoadChain(loader types.Loader) error
- func (s *APIServer) OnTransactionFail(height uint32, txs []*types.Transaction, err []error)
- func (s *APIServer) OnTransactionInPoolExpired(txs []*types.Transaction)
- func (s *APIServer) Run(BindAddress string) error
- type Argument
- func (arg *Argument) Array(index int) ([]interface{}, error)
- func (arg *Argument) Float32(index int) (float32, error)
- func (arg *Argument) Float64(index int) (float64, error)
- func (arg *Argument) Int(index int) (int, error)
- func (arg *Argument) Len() int
- func (arg *Argument) Map(index int) (map[string]interface{}, error)
- func (arg *Argument) String(index int) (string, error)
- func (arg *Argument) Uint16(index int) (uint16, error)
- func (arg *Argument) Uint32(index int) (uint32, error)
- func (arg *Argument) Uint64(index int) (uint64, error)
- func (arg *Argument) Uint8(index int) (uint8, error)
- type Handler
- type INode
- type JRPCRequest
- type JRPCResponse
- type JRPCResponseWithError
- type JRPCSub
- type ReqData
- type RevertError
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidArgument = errors.New("invalid argument") ErrInvalidArgumentIndex = errors.New("invalid argument index") ErrInvalidArgumentType = errors.New("invalid argument type") ErrInvalidMethod = errors.New("invalid method") ErrExistSubName = errors.New("exist sub name") )
errors
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct { types.ServiceBase sync.Mutex // contains filtered or unexported fields }
APIServer provides json rpc and web service for the chain
func (*APIServer) AddGETPath ¶
func (s *APIServer) AddGETPath(path string, con echo.HandlerFunc) error
add link to apiserver
func (*APIServer) HandleJRPC ¶
func (s *APIServer) HandleJRPC(req *JRPCRequest) interface{}
func (*APIServer) OnBlockConnected ¶
OnBlockConnected called when a block is connected to the chain
func (*APIServer) OnLoadChain ¶
OnLoadChain called when the chain loaded
func (*APIServer) OnTransactionFail ¶
func (s *APIServer) OnTransactionFail(height uint32, txs []*types.Transaction, err []error)
OnTransactionFail called when the tx fail
func (*APIServer) OnTransactionInPoolExpired ¶
func (s *APIServer) OnTransactionInPoolExpired(txs []*types.Transaction)
OnTransactionInPoolExpired called when the tx expired
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
Argument parses rpc arguments
type JRPCRequest ¶
type JRPCRequest struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Method string `json:"method"` Params []interface{} `json:"params"` }
JRPCRequest is a jrpc request
type JRPCResponse ¶
type JRPCResponse struct { ID interface{} `json:"id"` JSONRPC string `json:"jsonrpc"` Result interface{} `json:"result"` }
JRPCResponse is a jrpc response
type JRPCResponseWithError ¶
type JRPCResponseWithError struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Result interface{} `json:"result,omitempty"` Error interface{} `json:"error,omitempty"` }
JRPCResponse is a jrpc response
type RevertError ¶
type RevertError struct {
// contains filtered or unexported fields
}
revertError is an API error that encompassas an EVM revertal with JSON error code and a binary data blob.
func NewRevertError ¶
func NewRevertError(result *core.ExecutionResult) *RevertError
func (*RevertError) ErrorCode ¶
func (e *RevertError) ErrorCode() int
ErrorCode returns the JSON error code for a revertal. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
func (*RevertError) ErrorData ¶
func (e *RevertError) ErrorData() interface{}
ErrorData returns the hex encoded revert reason.