Documentation ¶
Index ¶
- type Client
- func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)
- func (ec *Client) BlockByHash(ctx context.Context, hash common.Hash) (block *types.Block, err error)
- func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)
- func (ec *Client) BlockNumber(ctx context.Context) (blockNumber uint64, err error)
- func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) (data []byte, err error)
- func (ec *Client) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) (data []byte, err error)
- func (ec *Client) ChainID(ctx context.Context) (chainId *big.Int, err error)
- func (ec *Client) Client() *rpc.Client
- func (ec *Client) Clients() []*ethclient.Client
- func (ec *Client) Close()
- func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) (data []byte, err error)
- func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (gas uint64, err error)
- func (ec *Client) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (history *ethereum.FeeHistory, err error)
- func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
- func (ec *Client) HeaderByHash(ctx context.Context, hash common.Hash) (header *types.Header, err error)
- func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (header *types.Header, err error)
- func (ec *Client) NetworkID(ctx context.Context) (ver *big.Int, err error)
- func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)
- func (ec *Client) PeerCount(ctx context.Context) (count uint64, err error)
- func (ec *Client) PendingBalanceAt(ctx context.Context, account common.Address) (balance *big.Int, err error)
- func (ec *Client) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) (data []byte, err error)
- func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) (data []byte, err error)
- func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (nonce uint64, err error)
- func (ec *Client) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) (data []byte, err error)
- func (ec *Client) PendingTransactionCount(ctx context.Context) (count uint, err error)
- func (ec *Client) RandClient() *ethclient.Client
- func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) (err error)
- func (ec *Client) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) (data []byte, err error)
- func (ec *Client) SuggestGasPrice(ctx context.Context) (gasPrice *big.Int, err error)
- func (ec *Client) SuggestGasTipCap(ctx context.Context) (gasTipCap *big.Int, err error)
- func (ec *Client) SyncProgress(ctx context.Context) (progress *ethereum.SyncProgress, err error)
- func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (ec *Client) TransactionCount(ctx context.Context, blockHash common.Hash) (count uint, err error)
- func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (tx *types.Transaction, err error)
- func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (receipt *types.Receipt, err error)
- func (ec *Client) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (sender common.Address, err error)
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
}
func DialContext ¶
DialContext connect all rawurls if all rpc error, an error will return
func DialOptions ¶ added in v0.0.2
func (*Client) BalanceAt ¶
func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)
BalanceAt returns the wei balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.
func (*Client) BlockByHash ¶
func (ec *Client) BlockByHash(ctx context.Context, hash common.Hash) (block *types.Block, err error)
BlockByHash returns the given full block.
Note that loading full blocks requires two requests. Use HeaderByHash if you don't need all transactions or uncle headers.
func (*Client) BlockByNumber ¶
func (ec *Client) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
Note that loading full blocks requires two requests. Use HeaderByNumber if you don't need all transactions or uncle headers.
func (*Client) BlockNumber ¶
BlockNumber returns the most recent block number the block number may **not increase**, because of multi rpc
func (*Client) CallContract ¶
func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) (data []byte, err error)
CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.
blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.
func (*Client) CallContractAtHash ¶
func (ec *Client) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) (data []byte, err error)
CallContractAtHash is almost the same as CallContract except that it selects the block by block hash instead of block height.
func (*Client) CodeAt ¶
func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) (data []byte, err error)
CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest known block.
func (*Client) EstimateGas ¶
EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.
func (*Client) FeeHistory ¶
func (ec *Client) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (history *ethereum.FeeHistory, err error)
FeeHistory retrieves the fee market history.
func (*Client) FilterLogs ¶
func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
FilterLogs executes a filter query.
func (*Client) HeaderByHash ¶
func (*Client) HeaderByNumber ¶
func (*Client) NonceAt ¶
func (ec *Client) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)
NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.
func (*Client) PendingBalanceAt ¶
func (ec *Client) PendingBalanceAt(ctx context.Context, account common.Address) (balance *big.Int, err error)
PendingBalanceAt returns the wei balance of the given account in the pending state.
func (*Client) PendingCallContract ¶
func (ec *Client) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) (data []byte, err error)
PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.
func (*Client) PendingCodeAt ¶
func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) (data []byte, err error)
PendingCodeAt returns the contract code of the given account in the pending state.
func (*Client) PendingNonceAt ¶
func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (nonce uint64, err error)
PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.
func (*Client) PendingStorageAt ¶
func (ec *Client) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) (data []byte, err error)
PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
func (*Client) PendingTransactionCount ¶
PendingTransactionCount returns the total number of transactions in the pending state.
func (*Client) RandClient ¶
func (*Client) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*Client) StorageAt ¶
func (ec *Client) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) (data []byte, err error)
StorageAt returns the value of key in the contract storage of the given account. The block number can be nil, in which case the value is taken from the latest known block.
func (*Client) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*Client) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to allow a timely execution of a transaction.