Documentation ¶
Index ¶
- Constants
- Variables
- func NewDecodeParamError(errstr string) error
- func NewRpcErrorResponse(id interface{}, jsonrpcver string, errCode int, err error) *interface{}
- func NewRpcResponse(id interface{}, jsonrpcver string, reply interface{}, err error) *interface{}
- func NewValidationError(param string, msg string) error
- type DecodeParamError
- type ErrorObject
- type ErrorResponse
- type EthereumApi
- type InsufficientParamsError
- type InvalidTypeError
- type NotAvailableError
- type NotImplementedError
- type Request
- type Response
- type SuccessResponse
- type ValidationError
Constants ¶
View Source
const ( AdminApiName = "admin" EthApiName = "eth" DbApiName = "db" DebugApiName = "debug" MergedApiName = "merged" MinerApiName = "miner" NetApiName = "net" ShhApiName = "shh" TxPoolApiName = "txpool" PersonalApiName = "personal" Web3ApiName = "web3" JsonRpcVersion = "2.0" )
Variables ¶
View Source
var ( // All API's AllApis = strings.Join([]string{ AdminApiName, DbApiName, EthApiName, DebugApiName, MinerApiName, NetApiName, ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName, }, ",") )
Functions ¶
func NewDecodeParamError ¶
func NewRpcErrorResponse ¶
Create RPC error response, this allows for custom error codes
func NewRpcResponse ¶
Create RPC response
func NewValidationError ¶
Types ¶
type DecodeParamError ¶
type DecodeParamError struct {
// contains filtered or unexported fields
}
func (*DecodeParamError) Error ¶
func (e *DecodeParamError) Error() string
type ErrorObject ¶
RPC error response details
type ErrorResponse ¶
type ErrorResponse struct { Id interface{} `json:"id"` Jsonrpc string `json:"jsonrpc"` Error *ErrorObject `json:"error"` }
RPC error response
type EthereumApi ¶
type EthereumApi interface { // API identifier Name() string // API version ApiVersion() string // Execute the given request and returns the response or an error Execute(*Request) (interface{}, error) // List of supported RCP methods this API provides Methods() []string }
Ethereum RPC API interface
type InsufficientParamsError ¶
type InsufficientParamsError struct {
// contains filtered or unexported fields
}
func NewInsufficientParamsError ¶
func NewInsufficientParamsError(have int, want int) *InsufficientParamsError
func (*InsufficientParamsError) Error ¶
func (e *InsufficientParamsError) Error() string
type InvalidTypeError ¶
type InvalidTypeError struct {
// contains filtered or unexported fields
}
func NewInvalidTypeError ¶
func NewInvalidTypeError(method, msg string) *InvalidTypeError
func (*InvalidTypeError) Error ¶
func (e *InvalidTypeError) Error() string
type NotAvailableError ¶
func NewNotAvailableError ¶
func NewNotAvailableError(method string, reason string) *NotAvailableError
func (*NotAvailableError) Error ¶
func (e *NotAvailableError) Error() string
type NotImplementedError ¶
type NotImplementedError struct {
Method string
}
func NewNotImplementedError ¶
func NewNotImplementedError(method string) *NotImplementedError
func (*NotImplementedError) Error ¶
func (e *NotImplementedError) Error() string
type Request ¶
type Request struct { Id interface{} `json:"id"` Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params json.RawMessage `json:"params"` }
RPC request
type Response ¶
type Response struct { Id interface{} `json:"id"` Jsonrpc string `json:"jsonrpc"` }
RPC response
type SuccessResponse ¶
type SuccessResponse struct { Id interface{} `json:"id"` Jsonrpc string `json:"jsonrpc"` Result interface{} `json:"result"` }
RPC success response
type ValidationError ¶
type ValidationError struct { ParamName string // contains filtered or unexported fields }
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.