httpconn

package
v0.0.0-...-58829ec Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoResult = errors.New("no result in JSON-RPC response")
)

Functions

This section is empty.

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	Status     string
	Body       []byte
}

func (HTTPError) Error

func (err HTTPError) Error() string

type HttpConn

type HttpConn struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(rpcUrl string) *HttpConn

func DialWithClient

func DialWithClient(rpcUrl string, c *http.Client) *HttpConn

func (*HttpConn) CallContext

func (h *HttpConn) CallContext(ctx context.Context, result interface{}, op Operation) error

CallContext performs a JSON-RPC call with the given arguments. If the context is canceled before the call has successfully returned, CallContext returns immediately.

The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.

type Operation

type Operation struct {
	Method string
	Params []interface{}
}

Jump to

Keyboard shortcuts

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