rpc

package
v0.0.0-...-7db15e3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHeight

func CompareHeight(reply_height string, correct_height string) bool

Types

type AccountBalance

type AccountBalance struct {
	Balance []CoinBase `json:"balances"`
}

type CoinBase

type CoinBase struct {
	TokenId  string `json:"tokenId"`
	TokenStr string `json:"tokenStr"`
	Balance  string `json:"balance"`
}

type GetBlockReply

type GetBlockReply struct {
	Number       string     `json:"height"`
	Hash         string     `json:"hash"`
	Nonce        string     `json:"nonce"`
	Miner        string     `json:"miner"`
	Difficulty   string     `json:"difficulty"`
	GasLimit     string     `json:"gasLimit"`
	GasUsed      string     `json:"gasUsed"`
	Coinbase     []CoinBase `json:"coinbase"`
	Transactions []Tx       `json:"transactions"`
}

type GetBlockReplyPart

type GetBlockReplyPart struct {
	Number     string `json:"height"`
	Difficulty string `json:"difficulty"`
}

type GetRootBlockReply

type GetRootBlockReply struct {
	Number            string             `json:"height"`
	Hash              string             `json:"hash"`
	Nonce             string             `json:"nonce"`
	Miner             string             `json:"miner"`
	Difficulty        string             `json:"difficulty"`
	MinorBlockHeaders []MinorBlockHeader `json:"minorBlockHeaders"`
}

Get root block reply format

type JSONRpcResp

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

type MinorBlockHeader

type MinorBlockHeader struct {
	Height      string `json:"height"`
	Hash        string `json:"hash"`
	FullShardId string `json:"fullShardId"`
}

Get minor block header

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)

func (*RPCClient) GetBlockByHash

func (r *RPCClient) GetBlockByHash(shardId string, hash string) (*GetBlockReply, error)

func (*RPCClient) GetBlockByHeight

func (r *RPCClient) GetBlockByHeight(shardId string, height int64) (*GetBlockReply, error)

func (*RPCClient) GetCode

func (r *RPCClient) GetCode(login string) (string, error)

func (*RPCClient) GetLastestRootBlock

func (r *RPCClient) GetLastestRootBlock() (string, error)

Get the latest root block height

func (*RPCClient) GetPeerCount

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

func (*RPCClient) GetPendingBlock

func (r *RPCClient) GetPendingBlock(shardId string) (*GetBlockReplyPart, error)

func (*RPCClient) GetRootBlockByHeight

func (r *RPCClient) GetRootBlockByHeight(shardId string, height int64) (string, error)

Get the lastest root block information

func (*RPCClient) GetStorageAt

func (r *RPCClient) GetStorageAt(login string, key uint64) (string, error)

func (*RPCClient) GetTxReceipt

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

func (*RPCClient) GetWork

func (r *RPCClient) GetWork(shardId string) ([]string, error)

func (*RPCClient) GetWorkWithID

func (r *RPCClient) GetWorkWithID(shardId string, login string) ([]string, error)

func (*RPCClient) SendTransaction

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

func (*RPCClient) Sick

func (r *RPCClient) Sick() bool

func (*RPCClient) Sign

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

func (*RPCClient) SubmitBlock

func (r *RPCClient) SubmitBlock(shardId string, params []string) (bool, error)

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