rpc

package
v0.0.4-0...-930291b Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	Number string `json:"height"`
	Hash   string `json:"id"`
	PoWSol PoWSol `json:"powSolutions"`
}

type CandidateResp

type CandidateResp struct {
	Msg    string   `json:"msg"`
	Target *big.Int `json:"b"`
	PK     string   `json:"pk"`
}

type GetBlockReply

type GetBlockReply struct {
	Number     string `json:"number"`
	Hash       string `json:"hash"`
	Nonce      string `json:"nonce"`
	Miner      string `json:"miner"`
	Difficulty string `json:"difficulty"`

	Transactions []Tx `json:"transactions"`
	// https://github.com/ethereum/EIPs/issues/95
	SealFields []string `json:"sealFields"`
}

type GetBlockReplyPart

type GetBlockReplyPart struct {
	Number string `json:"number"`
	Target string `json:"difficulty"`
}

type JSONRpcResp

type JSONRpcResp struct {
	Id     *json.RawMessage       `json:"id"`
	Result *json.RawMessage       `json:"result"`
	Error  map[string]interface{} `json:"error"`
}

type PoWSol

type PoWSol struct {
	PublicKey string `json:"pk"`
	W         string `json:"w"`
	N         string `json:"n"`
	D         string `json:"d"`
}

type RPCClient

type RPCClient struct {
	sync.RWMutex
	Url  string
	Name string
	// contains filtered or unexported fields
}

func NewRPCClient

func NewRPCClient(name, url, timeout string) *RPCClient

func (*RPCClient) Check

func (r *RPCClient) Check() bool

func (*RPCClient) GetBalance

func (r *RPCClient) GetBalance(address string) (*big.Int, error)

TODO: payer

func (*RPCClient) GetBlockByHeight

func (r *RPCClient) GetBlockByHeight(height int64) (*BlockHeader, error)

DONE: in unlocker

func (*RPCClient) GetInfo

func (r *RPCClient) GetInfo() map[string]interface{}

func (*RPCClient) GetPeerCount

func (r *RPCClient) GetPeerCount() (int64, error)

TODO: in payer

func (*RPCClient) GetPendingBlock

func (r *RPCClient) GetPendingBlock() (*BlockHeader, error)

TODO: in unlocker = get current block/height

func (*RPCClient) GetTxReceipt

func (r *RPCClient) GetTxReceipt(hash string) (*TxReceipt, error)

TODO: in payer

func (*RPCClient) GetWork

func (r *RPCClient) GetWork() (*CandidateResp, error)

func (*RPCClient) SendTransaction

func (r *RPCClient) SendTransaction(from, to, gas, gasPrice, value string, autoGas bool) (string, error)

TODO: in payer

func (*RPCClient) Sick

func (r *RPCClient) Sick() bool

func (*RPCClient) Sign

func (r *RPCClient) Sign(from string, s string) (string, error)

TODO: in payer

func (*RPCClient) SubmitSolution

func (r *RPCClient) SubmitSolution(params *SolutionReq) (bool, error)

type SolutionReq

type SolutionReq struct {
	PK   string     `json:"pk"`
	W    string     `json:"w"`
	N    string     `json:"n"`
	Hash *big.Float `json:"d"`
}

type Tx

type Tx struct {
	Gas      string `json:"gas"`
	GasPrice string `json:"gasPrice"`
	Hash     string `json:"hash"`
}

type TxReceipt

type TxReceipt struct {
	TxHash    string `json:"transactionHash"`
	GasUsed   string `json:"gasUsed"`
	BlockHash string `json:"blockHash"`
	Status    string `json:"status"`
}

func (*TxReceipt) Confirmed

func (r *TxReceipt) Confirmed() bool

func (*TxReceipt) Successful

func (r *TxReceipt) Successful() bool

Use with previous method

Jump to

Keyboard shortcuts

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