client

package
v0.0.0-...-54fe0b3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 8 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           string         `json:"number"`
	Hash             string         `json:"hash"`
	Parent           string         `json:"parentHash"`
	Nonce            string         `json:"nonce"`
	SHA3Uncles       string         `json:"sha3Uncles"`
	LogsBloom        string         `json:"logsBloom"`
	TransactionsRoot string         `json:"transactionsRoot"`
	StateRoot        string         `json:"stateRoot"`
	ReceiptsRoot     string         `json:"receiptsRoot"`
	Miner            string         `json:"miner"`
	Difficulty       string         `json:"difficulty"`
	TotalDifficulty  string         `json:"totalDifficulty"`
	ExtraData        string         `json:"extraData"`
	Size             string         `json:"size"`
	GasLimit         string         `json:"gasLimit"`
	GasUsed          string         `json:"gasUsed"`
	Timestamp        string         `json:"timestamp"`
	Transactions     []*Transaction `json:"transactions"`
	Uncles           []string       `json:"uncles"`
}

Block eth block object

type CallSite

type CallSite struct {
	From     string `json:"from,omitempty"`
	To       string `json:"to,omitempty"`
	Value    string `json:"value,omitempty"`
	GasPrice string `json:"gasPrice,omitempty"`
	Gas      string `json:"gas,omitempty"`
	Data     string `json:"data,omitempty"`
}

CallSite .

type Provider

type Provider interface {
	Nonce(ctx context.Context, address string) (uint64, error)
	GetBalance(ctx context.Context, address string) (*fixed.Number, error)
	BlockNumber(ctx context.Context) (uint64, error)
	Call(ctx context.Context, callsite *CallSite) (val string, err error)
	GetBlockByNumber(ctx context.Context, number uint64, full bool) (val *Block, err error)
	GetTransactionByHash(ctx context.Context, tx string) (val *Transaction, err error)
	SendRawTransaction(ctx context.Context, tx []byte) (val string, err error)
	GetTransactionReceipt(ctx context.Context, tx string) (val *TransactionReceipt, err error)
	GasPrice(ctx context.Context) (*fixed.Number, error)
	GetBlockTransactionCountByHash(ctx context.Context, blockHash string) (uint64, error)
	GetBlockTransactionCountByNumber(ctx context.Context, number uint64) (uint64, error)
	GetBlockByHash(ctx context.Context, blockHash string, full bool) (val *Block, err error)
}

Provider rpc provider

func HttpProvider

func HttpProvider(remote string, ops ...client.ClientOpt) (Provider, error)

HttpProvider create http jsonrpc provider

func NewJSONRPCProvider

func NewJSONRPCProvider(client jsonrpc.Client) (Provider, error)

func WebsocketProvider

func WebsocketProvider(remote string, ops ...client.ClientOpt) (Provider, error)

type Transaction

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

Transaction .

type TransactionReceipt

type TransactionReceipt struct {
	Hash              string        `json:"transactionHash"`
	BlockHash         string        `json:"blockHash"`
	BlockNumber       string        `json:"blockNumber"`
	TransactionIndex  string        `json:"transactionIndex"`
	CumulativeGasUsed string        `json:"cumulativeGasUsed"`
	GasUsed           string        `json:"gasUsed"`
	ContractAddress   string        `json:"contractAddress"`
	Logs              []interface{} `json:"logs"`
	LogsBloom         string        `json:"logsBloom"`
	Status            string        `json:"status"`
}

TransactionReceipt .

Jump to

Keyboard shortcuts

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