response

package
v0.90.0-pre Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NewError

func NewError(code int64, httpCode int, message string, data string, cause error) *Error

NewError is an Error constructor that takes Error contents from its parameters.

func NewInternalServerError

func NewInternalServerError(data string, cause error) *Error

NewInternalServerError creates a new error with code -32603.

func NewInvalidParamsError

func NewInvalidParamsError(data string, cause error) *Error

NewInvalidParamsError creates a new error with code -32602.

func NewInvalidRequestError

func NewInvalidRequestError(data string, cause error) *Error

NewInvalidRequestError creates a new error with code -32600.

func NewMethodNotFoundError

func NewMethodNotFoundError(data string, cause error) *Error

NewMethodNotFoundError creates a new error with code -32601.

func NewParseError

func NewParseError(data string, cause error) *Error

NewParseError creates a new error with code -32700.:%s

func NewRPCError

func NewRPCError(message string, data string, cause error) *Error

NewRPCError creates a new error with code -100

func NewSubmitError

func NewSubmitError(code int64, message string) *Error

NewSubmitError creates a new error with specified error code and error message

func (*Error) Error

func (e *Error) Error() string

Error implements the error 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 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

type HeaderAndError struct {
	Header
	Error *Error `json:"error,omitempty"`
}

HeaderAndError adds an Error (that can be empty) to the Header, it's used to construct type-specific responses.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL