jsonrpc

package
v0.0.0-...-8f649d9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PendingBlockNumber  = BlockNumber(-3)
	LatestBlockNumber   = BlockNumber(-2)
	EarliestBlockNumber = BlockNumber(-1)
)

Variables

This section is empty.

Functions

func Factory

func Factory(logger hclog.Logger, m interface{}, config map[string]interface{}) (api.API, error)

Factory is the factory method for the api backend

Types

type BlockNumber

type BlockNumber int64

type Dispatcher

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

Dispatcher handles jsonrpc requests

type ErrorObject

type ErrorObject struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

ErrorObject is a jsonrpc error

func (*ErrorObject) Error

func (e *ErrorObject) Error() string

Error implements error interface

type Eth

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

Eth is the eth jsonrpc endpoint

func (*Eth) BlockNumber

func (e *Eth) BlockNumber() (interface{}, error)

CurrentBlock returns current block number

func (*Eth) GetBalance

func (e *Eth) GetBalance(address string, number string) (interface{}, error)

CurrentBlock returns current block number

func (*Eth) GetBlockByHash

func (e *Eth) GetBlockByHash(hashStr string, full bool) (interface{}, error)

GetBlockByHash returns information about a block by hash

func (*Eth) GetBlockByNumber

func (e *Eth) GetBlockByNumber(blockNumber string, full bool) (interface{}, error)

GetBlockByNumber returns information about a block by block number

func (*Eth) GetCode

func (e *Eth) GetCode(address string, number string) (interface{}, error)

GetCode returns account code at given block number

func (*Eth) GetTransactionCount

func (e *Eth) GetTransactionCount(address string, number string) (interface{}, error)

GetTransactionCount returns account nonce

func (*Eth) GetTransactionReceipt

func (e *Eth) GetTransactionReceipt(hash string) (interface{}, error)

GetTransactionReceipt returns account nonce

func (*Eth) SendRawTransaction

func (e *Eth) SendRawTransaction(input string) (interface{}, error)

func (*Eth) SendTransaction

func (e *Eth) SendTransaction(params map[string]interface{}) (interface{}, error)

SendTransaction creates new message call transaction or a contract creation, if the data field contains code.

type HTTPServer

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

HTTPServer is an http server that serves jsonrpc requests

func (*HTTPServer) Close

func (h *HTTPServer) Close() error

Close implements the transport interface

type JSONRPC

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

JSONRPC is an API backend

func (*JSONRPC) Close

func (j *JSONRPC) Close() error

Close implements the API interface

type Net

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

Net is the net jsonrpc endpoint

func (*Net) Listening

func (n *Net) Listening() (interface{}, error)

Listening returns true if client is actively listening for network connections

func (*Net) PeerCount

func (n *Net) PeerCount() (interface{}, error)

PeerCount returns number of peers currently connected to the client

func (*Net) Version

func (n *Net) Version() (interface{}, error)

Version returns the current network id

type Request

type Request struct {
	ID     int             `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

Request is a jsonrpc request

type Response

type Response struct {
	ID     int             `json:"id"`
	Result json.RawMessage `json:"result"`
	Error  *ErrorObject    `json:"error,omitempty"`
}

Response is a jsonrpc response

type Server

type Server interface {
	// Close shutdowns the server and closes any open connection
	Close() error
}

Server is a communication interface for the server

type ServerConfig

type ServerConfig map[string]interface{}

ServerConfig is the configuration for each server

type ServerFactory

type ServerFactory func(d *Dispatcher, logger hclog.Logger, config ServerConfig) (Server, error)

ServerFactory is a factory method to create servers

type Web3

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

Web3 is the web3 jsonrpc endpoint

func (*Web3) ClientVersion

func (w *Web3) ClientVersion() (interface{}, error)

ClientVersion returns the current client version

func (*Web3) Sha3

func (w *Web3) Sha3(val string) (interface{}, error)

Sha3 returns Keccak-256 (not the standardized SHA3-256) of the given data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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