ethclient

package
v0.0.0-...-b78b3a4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

包ethclient为以太坊RPC API提供客户端。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

客户端为以太坊RPC API定义类型化包装器。

func Dial

func Dial(rawurl string) (*Client, error)

拨号将客户机连接到给定的URL。

func DialContext

func DialContext(ctx context.Context, rawurl string) (*Client, error)

func NewClient

func NewClient(c *rpc.Client) *Client

newclient创建使用给定RPC客户端的客户端。

func (*Client) BalanceAt

func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

balanceat返回给定帐户的wei余额。 块编号可以为零,在这种情况下,余额取自最新的已知块。

func (*Client) BlockByHash

func (ec *Client) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

blockbyhash返回给定的完整块。

请注意,加载完整块需要两个请求。使用headerbyhash 如果不需要所有事务或叔叔头。

func (*Client) BlockByNumber

func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

BlockByNumber返回当前规范链中的块。如果数字为零,则 返回最新的已知块。

请注意,加载完整块需要两个请求。使用HeaderByNumber 如果不需要所有事务或叔叔头。

func (*Client) CallContract

func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

CallContract执行消息调用事务,该事务直接在VM中执行 但从未开发到区块链中。

BlockNumber选择运行调用的块高度。可以是零,其中 如果代码取自最新的已知块。注意这个状态从很老 块可能不可用。

func (*Client) Close

func (ec *Client) Close()

func (*Client) CodeAt

func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

codeat返回给定帐户的合同代码。 块编号可以为零,在这种情况下,代码取自最新的已知块。

func (*Client) EstimateGas

func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

EstimateGas试图根据 后端区块链的当前挂起状态。不能保证这是 矿工可能增加或移除的其他交易的实际气体限制要求, 但它应为设定合理违约提供依据。

func (*Client) FilterLogs

func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

filterlogs执行筛选器查询。

func (*Client) HeaderByHash

func (ec *Client) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash返回具有给定哈希的块头。

func (*Client) HeaderByNumber

func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber返回当前规范链的块头。如果数字是 nil,返回最新的已知头。

func (*Client) NetworkID

func (ec *Client) NetworkID(ctx context.Context) (*big.Int, error)

network id返回此链的网络ID(也称为链ID)。

func (*Client) NonceAt

func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

nonceat返回给定帐户的nonce帐户。 块编号可以为零,在这种情况下,nonce是从最新的已知块中获取的。

func (*Client) PendingBalanceAt

func (ec *Client) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

PendingBalanceAt返回处于挂起状态的给定帐户的wei余额。

func (*Client) PendingCallContract

func (ec *Client) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

PendingCallContract使用EVM执行消息调用事务。 合同调用所看到的状态是挂起状态。

func (*Client) PendingCodeAt

func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

PendingCodeAt返回处于挂起状态的给定帐户的合同代码。

func (*Client) PendingNonceAt

func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

pendingnonceat返回处于挂起状态的给定帐户的帐户nonce。 这是应该用于下一个事务的nonce。

func (*Client) PendingStorageAt

func (ec *Client) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

PendingStorageAt返回处于挂起状态的给定帐户的合同存储中密钥的值。

func (*Client) PendingTransactionCount

func (ec *Client) PendingTransactionCount(ctx context.Context) (uint, error)

PendingtransactionCount返回处于挂起状态的事务总数。

func (*Client) SendTransaction

func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) error

sendTransaction将签名的事务注入挂起池以执行。

如果事务是合同创建,请使用TransactionReceipt方法获取 挖掘交易记录后的合同地址。

func (*Client) StorageAt

func (ec *Client) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

storageat返回给定帐户的合同存储中密钥的值。 块编号可以为零,在这种情况下,值取自最新的已知块。

func (*Client) SubscribeFilterLogs

func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

subscribeFilterLogs订阅流式筛选查询的结果。

func (*Client) SubscribeNewHead

func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

订阅订阅当前区块链头的通知 在给定的频道上。

func (*Client) SuggestGasPrice

func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)

SuggestGasprice检索当前建议的天然气价格,以便及时 交易的执行。

func (*Client) SyncProgress

func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

SyncProgress检索同步算法的当前进度。如果有 当前没有运行同步,它返回零。

func (*Client) TransactionByHash

func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)

TransactionByHash返回具有给定哈希的事务。

func (*Client) TransactionCount

func (ec *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

TransactionCount返回给定块中的事务总数。

func (*Client) TransactionInBlock

func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

TransactionBlock返回给定块中索引处的单个事务。

func (*Client) TransactionReceipt

func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

TransactionReceipt按事务哈希返回事务的接收。 请注意,收据不可用于待处理的交易。

func (*Client) TransactionSender

func (ec *Client) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)

TransactionSender返回给定事务的发件人地址。交易 必须为远程节点所知,并包含在给定块的区块链中,并且 索引。发送方是包含时协议派生的发送方。

TransactionByHash和 事务处理块。获取他们的发送者地址可以在没有RPC交互的情况下完成。

Jump to

Keyboard shortcuts

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