Documentation ¶
Index ¶
- Variables
- type Error
- func NewError(code int64, httpCode int, message string, data string, cause error) *Error
- func NewInternalServerError(data string, cause error) *Error
- func NewInvalidParamsError(data string, cause error) *Error
- func NewInvalidRequestError(data string, cause error) *Error
- func NewMethodNotFoundError(data string, cause error) *Error
- func NewParseError(data string, cause error) *Error
- func NewRPCError(message string, data string, cause error) *Error
- func NewSubmitError(code int64, message string) *Error
- type EventID
- type GetRawTx
- type GetTxOut
- type Header
- type HeaderAndError
- type Notification
- type Raw
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidParams represents a generic 'invalid parameters' error. ErrInvalidParams = NewInvalidParamsError("", nil) // ErrAlreadyExists represents SubmitError with code -501 ErrAlreadyExists = NewSubmitError(-501, "Block or transaction already exists and cannot be sent repeatedly.") // ErrOutOfMemory represents SubmitError with code -502 ErrOutOfMemory = NewSubmitError(-502, "The memory pool is full and no more transactions can be sent.") // ErrUnableToVerify represents SubmitError with code -503 ErrUnableToVerify = NewSubmitError(-503, "The block cannot be validated.") // ErrValidationFailed represents SubmitError with code -504 ErrValidationFailed = NewSubmitError(-504, "Block or transaction validation failed.") // ErrPolicyFail represents SubmitError with code -505 ErrPolicyFail = NewSubmitError(-505, "One of the Policy filters failed.") // ErrUnknown represents SubmitError with code -500 ErrUnknown = NewSubmitError(-500, "Unknown error.") )
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Code int64 `json:"code"` HTTPCode int `json:"-"` Cause error `json:"-"` Message string `json:"message"` Data string `json:"data,omitempty"` }
Error object for outputting JSON-RPC 2.0 errors.
func NewInternalServerError ¶
NewInternalServerError creates a new error with code -32603.
func NewInvalidParamsError ¶
NewInvalidParamsError creates a new error with code -32602.
func NewInvalidRequestError ¶
NewInvalidRequestError creates a new error with code -32600.
func NewMethodNotFoundError ¶
NewMethodNotFoundError creates a new error with code -32601.
func NewParseError ¶
NewParseError creates a new error with code -32700.:%s
func NewRPCError ¶
NewRPCError creates a new error with code -100
func NewSubmitError ¶
NewSubmitError creates a new error with specified error code and error message
type EventID ¶ added in v0.75.0
type EventID byte
EventID represents an event type happening on the chain.
const ( // InvalidEventID is an invalid event id that is the default value of // EventID. It's only used as an initial value similar to nil. InvalidEventID EventID = iota // BlockEventID is a `block_added` event. BlockEventID // TransactionEventID corresponds to `transaction_added` event. TransactionEventID // NotificationEventID represents `notification_from_execution` events. NotificationEventID // ExecutionEventID is used for `transaction_executed` events. ExecutionEventID // MissedEventID notifies user of missed events. MissedEventID EventID = 255 )
func GetEventIDFromString ¶ added in v0.75.0
GetEventIDFromString converts input string into an EventID if it's possible.
func (EventID) MarshalJSON ¶ added in v0.75.0
MarshalJSON implements json.Marshaler interface.
func (*EventID) UnmarshalJSON ¶ added in v0.75.0
UnmarshalJSON implements json.Unmarshaler interface.
type GetRawTx ¶
type GetRawTx struct { HeaderAndError Result *result.TransactionOutputRaw `json:"result"` }
GetRawTx represents verbose output of `getrawtransaction` RPC call.
type GetTxOut ¶
type GetTxOut struct { HeaderAndError Result *result.TransactionOutput }
GetTxOut represents result of `gettxout` RPC call.
type Header ¶
type Header struct { ID json.RawMessage `json:"id"` JSONRPC string `json:"jsonrpc"` }
Header is a generic JSON-RPC 2.0 response header (ID and JSON-RPC version).
type HeaderAndError ¶
HeaderAndError adds an Error (that can be empty) to the Header, it's used to construct type-specific responses.
type Notification ¶ added in v0.75.0
type Notification struct { JSONRPC string `json:"jsonrpc"` Event EventID `json:"method"` Payload []interface{} `json:"params"` }
Notification is a type used to represent wire format of events, they're special in that they look like requests but they don't have IDs and their "method" is actually an event name.
type Raw ¶
type Raw struct { HeaderAndError Result json.RawMessage `json:"result,omitempty"` }
Raw represents a standard raw JSON-RPC 2.0 response: http://www.jsonrpc.org/specification#response_object.