ethws

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Retry time.Duration
	WSUrl string
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type EthereumWS

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

func New

func New(conf Config) *EthereumWS

create new ethereum websocket

func (*EthereumWS) SendRequest

func (ws *EthereumWS) SendRequest(r Request) (<-chan Response, error)

send an request to ethereum network

func (*EthereumWS) State

func (ws *EthereumWS) State()

start state machine

type Request

type Request struct {
	ID      int64         `json:"id"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	JsonRPC string        `json:"jsonrpc"`
}

func (*Request) Marshal

func (r *Request) Marshal() ([]byte, error)

type Response

type Response struct {
	JsonRPC  string      `json:"jsonrpc"`
	RPCError *Error      `json:"error,omitempty"`
	Result   interface{} `json:"result"`
	ID       int64       `json:"id"`
	// contains filtered or unexported fields
}

func (*Response) Error

func (r *Response) Error() error

type State

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

type StateObject

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

Jump to

Keyboard shortcuts

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