rpc

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number           int
	Hash             string
	ParentHash       string
	Nonce            string
	Sha3Uncles       string
	LogsBloom        string
	TransactionsRoot string
	StateRoot        string
	Miner            string
	Difficulty       big.Int
	TotalDifficulty  big.Int
	ExtraData        string
	Size             int
	GasLimit         int
	GasUsed          int
	Timestamp        int
	Transactions     []Transaction
	Uncles           []string
}

Block - block object

type EthError

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

EthError - ethereum error

func (EthError) Error

func (err EthError) Error() string

type EthRPCClient

type EthRPCClient struct {
	Debug bool
	// contains filtered or unexported fields
}

EthRPC - Ethereum rpc client

func NewEthRPCClient

func NewEthRPCClient(url string, options ...func(rpc *EthRPCClient)) *EthRPCClient

NewEthRPC create new rpc client with given url

func (*EthRPCClient) Call

func (rpc *EthRPCClient) Call(method string, params ...interface{}) (json.RawMessage, error)

Call returns raw response of method call

func (*EthRPCClient) EthGetBlockByHash

func (rpc *EthRPCClient) EthGetBlockByHash(hash string, withTransactions bool) (*Block, error)

EthGetBlockByHash returns information about a block by hash.

func (*EthRPCClient) EthGetBlockByNumber

func (rpc *EthRPCClient) EthGetBlockByNumber(number int, withTransactions bool) (*Block, error)

EthGetBlockByNumber returns information about a block by block number.

func (*EthRPCClient) EthGetTransactionByBlockHashAndIndex

func (rpc *EthRPCClient) EthGetTransactionByBlockHashAndIndex(blockHash string, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.

func (*EthRPCClient) EthGetTransactionByBlockNumberAndIndex

func (rpc *EthRPCClient) EthGetTransactionByBlockNumberAndIndex(blockNumber, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.

func (*EthRPCClient) EthGetTransactionByHash

func (rpc *EthRPCClient) EthGetTransactionByHash(hash string) (*Transaction, error)

EthGetTransactionByHash returns the information about a transaction requested by transaction hash.

func (*EthRPCClient) EthGetTransactionReceipt added in v0.5.2

func (rpc *EthRPCClient) EthGetTransactionReceipt(hash string) (*Transaction, error)

func (*EthRPCClient) EthSyncing

func (rpc *EthRPCClient) EthSyncing() (*Syncing, error)

EthSyncing returns an object with data about the sync status or false.

func (*EthRPCClient) Web3ClientVersion

func (rpc *EthRPCClient) Web3ClientVersion() (string, error)

Web3ClientVersion returns the current client version.

func (*EthRPCClient) Web3Sha3

func (rpc *EthRPCClient) Web3Sha3(data []byte) (string, error)

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

type JsonBlockWithTransactions

type JsonBlockWithTransactions struct {
	Number           hexInt            `json:"number"`
	Hash             string            `json:"hash"`
	ParentHash       string            `json:"parentHash"`
	Nonce            string            `json:"nonce"`
	Sha3Uncles       string            `json:"sha3Uncles"`
	LogsBloom        string            `json:"logsBloom"`
	TransactionsRoot string            `json:"transactionsRoot"`
	StateRoot        string            `json:"stateRoot"`
	Miner            string            `json:"miner"`
	Difficulty       hexBig            `json:"difficulty"`
	TotalDifficulty  hexBig            `json:"totalDifficulty"`
	ExtraData        string            `json:"extraData"`
	Size             hexInt            `json:"size"`
	GasLimit         hexInt            `json:"gasLimit"`
	GasUsed          hexInt            `json:"gasUsed"`
	Timestamp        hexInt            `json:"timestamp"`
	Transactions     []JsonTransaction `json:"transactions"`
	Uncles           []string          `json:"uncles"`
}

JsonBlockWithTransactions - Block with Transaction json object

type JsonBlockWithoutTransactions

type JsonBlockWithoutTransactions struct {
	Number           hexInt   `json:"number"`
	Hash             string   `json:"hash"`
	ParentHash       string   `json:"parentHash"`
	Nonce            string   `json:"nonce"`
	Sha3Uncles       string   `json:"sha3Uncles"`
	LogsBloom        string   `json:"logsBloom"`
	TransactionsRoot string   `json:"transactionsRoot"`
	StateRoot        string   `json:"stateRoot"`
	Miner            string   `json:"miner"`
	Difficulty       hexBig   `json:"difficulty"`
	TotalDifficulty  hexBig   `json:"totalDifficulty"`
	ExtraData        string   `json:"extraData"`
	Size             hexInt   `json:"size"`
	GasLimit         hexInt   `json:"gasLimit"`
	GasUsed          hexInt   `json:"gasUsed"`
	Timestamp        hexInt   `json:"timestamp"`
	Transactions     []string `json:"transactions"`
	Uncles           []string `json:"uncles"`
}

JsonBlockWithoutTransactions - Block without Transaction json object

type JsonSyncing

type JsonSyncing struct {
	IsSyncing     bool   `json:"-"`
	StartingBlock hexInt `json:"startingBlock"`
	CurrentBlock  hexInt `json:"currentBlock"`
	HighestBlock  hexInt `json:"highestBlock"`
}

JsonSyncing - Syncing json object

type JsonTransaction

type JsonTransaction struct {
	Hash             string  `json:"hash"`
	Nonce            hexInt  `json:"nonce"`
	BlockHash        string  `json:"blockHash"`
	BlockNumber      *hexInt `json:"blockNumber"`
	TransactionIndex *hexInt `json:"transactionIndex"`
	From             string  `json:"from"`
	To               string  `json:"to"`
	Value            hexBig  `json:"value"`
	Gas              hexInt  `json:"gas"`
	GasPrice         hexBig  `json:"gasPrice"`
	Input            string  `json:"input"`
}

JsonTransaction - Transaction json object

type ProxyBlock

type ProxyBlock interface {
	// contains filtered or unexported methods
}

ProxyBlock - proxy to block object

type Syncing

type Syncing struct {
	IsSyncing     bool
	StartingBlock int
	CurrentBlock  int
	HighestBlock  int
}

Syncing - object with syncing data info

func (*Syncing) UnmarshalJSON

func (s *Syncing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Transaction

type Transaction struct {
	Hash             string
	Nonce            int
	BlockHash        string
	BlockNumber      *int
	TransactionIndex *int
	From             string
	To               string
	Value            big.Int
	Gas              int
	GasPrice         big.Int
	Input            string
}

Transaction - transaction object

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type TrxInput

type TrxInput struct {
	From     string
	To       string
	Gas      int
	GasPrice *big.Int
	Value    *big.Int
	Data     string
	Nonce    int
}

TrxInput - input transaction object

func (TrxInput) MarshalJSON

func (t TrxInput) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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