Documentation ¶
Index ¶
- func ConfigFromViper(v *viper.Viper) *jsonrpchttp.Config
- func EthELAddrFlag(v *viper.Viper, f *pflag.FlagSet)
- func Flags(v *viper.Viper, f *pflag.FlagSet)
- func GetEthELAddr(v *viper.Viper) string
- type Client
- func (c *Client) BalanceAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *Client) BlockByHash(ctx context.Context, hash gethcommon.Hash) (*gethtypes.Block, error)
- func (c *Client) BlockByNumber(ctx context.Context, blockNumber *big.Int) (*gethtypes.Block, error)
- func (c *Client) BlockNumber(ctx context.Context) (uint64, error)
- func (c *Client) CallContract(ctx context.Context, msg geth.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *Client) CallContractAtHash(ctx context.Context, msg geth.CallMsg, blockHash gethcommon.Hash) ([]byte, error)
- func (c *Client) ChainID(ctx context.Context) (*big.Int, error)
- func (c *Client) CodeAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) ([]byte, error)
- func (c *Client) EstimateGas(ctx context.Context, msg geth.CallMsg) (uint64, error)
- func (c *Client) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*geth.FeeHistory, error)
- func (c *Client) FilterLogs(ctx context.Context, q geth.FilterQuery) ([]gethtypes.Log, error)
- func (c *Client) HeaderByHash(ctx context.Context, hash gethcommon.Hash) (*gethtypes.Header, error)
- func (c *Client) HeaderByNumber(ctx context.Context, blockNumber *big.Int) (*gethtypes.Header, error)
- func (c *Client) Logger() logrus.FieldLogger
- func (c *Client) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *Client) NonceAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) (uint64, error)
- func (c *Client) PeerCount(ctx context.Context) (uint64, error)
- func (c *Client) PendingBalanceAt(ctx context.Context, account gethcommon.Address) (*big.Int, error)
- func (c *Client) PendingCallContract(ctx context.Context, msg geth.CallMsg) ([]byte, error)
- func (c *Client) PendingCodeAt(ctx context.Context, account gethcommon.Address) ([]byte, error)
- func (c *Client) PendingNonceAt(ctx context.Context, account gethcommon.Address) (uint64, error)
- func (c *Client) PendingStorageAt(ctx context.Context, account gethcommon.Address, key gethcommon.Hash) ([]byte, error)
- func (c *Client) PendingTransactionCount(ctx context.Context) (uint, error)
- func (c *Client) SendTransaction(ctx context.Context, tx *gethtypes.Transaction) error
- func (c *Client) SetLogger(logger logrus.FieldLogger)
- func (c *Client) StorageAt(ctx context.Context, account gethcommon.Address, key gethcommon.Hash, ...) ([]byte, error)
- func (c *Client) SubscribeFilterLogs(ctx context.Context, _ geth.FilterQuery, _ chan<- gethtypes.Log) (geth.Subscription, error)
- func (c *Client) SubscribeNewHead(ctx context.Context, ch chan<- *gethtypes.Header) (geth.Subscription, error)
- func (c *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (c *Client) SyncProgress(ctx context.Context) (*geth.SyncProgress, error)
- func (c *Client) TransactionByHash(ctx context.Context, hash gethcommon.Hash) (tx *gethtypes.Transaction, isPending bool, err error)
- func (c *Client) TransactionCount(ctx context.Context, blockHash gethcommon.Hash) (uint, error)
- func (c *Client) TransactionInBlock(ctx context.Context, blockHash gethcommon.Hash, index uint) (*gethtypes.Transaction, error)
- func (c *Client) TransactionReceipt(ctx context.Context, txHash gethcommon.Hash) (*gethtypes.Receipt, error)
- func (c *Client) TransactionSender(ctx context.Context, tx *gethtypes.Transaction, block gethcommon.Hash, ...) (gethcommon.Address, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigFromViper ¶
func ConfigFromViper(v *viper.Viper) *jsonrpchttp.Config
func EthELAddrFlag ¶
EthELAddrFlag register flag for Eth1 node to connect to
func GetEthELAddr ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to interface with a JSON-RPC Ethereum 1.0 node
func New ¶
func New(cfg *jsonrpchttp.Config) (*Client, error)
NewFromAddress creates a new client connecting to an Ethereum node at addr
func (*Client) BlockByHash ¶
BlockByHash returns the given full block.
Note fetch of uncles blocks is not implemented yet.
func (*Client) BlockByNumber ¶
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
Note fetch of uncles blocks is not implemented yet.
func (*Client) BlockNumber ¶
BlockNumber returns current chain head number
func (*Client) CallContract ¶
func (c *Client) CallContract(ctx context.Context, msg geth.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract executes contract call The block number can be nil, in which case call is executed at the latest block.
func (*Client) CallContractAtHash ¶
func (c *Client) CallContractAtHash(ctx context.Context, msg geth.CallMsg, blockHash gethcommon.Hash) ([]byte, 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 (c *Client) CodeAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) ([]byte, 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 block.
func (*Client) EstimateGas ¶
EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the chain.
func (*Client) FeeHistory ¶
func (c *Client) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*geth.FeeHistory, error)
FeeHistory retrieves the fee market history.
func (*Client) FilterLogs ¶
FilterLogs executes a filter query.
func (*Client) HeaderByHash ¶
HeaderByNumber returns header of a given block hash
func (*Client) HeaderByNumber ¶
func (c *Client) HeaderByNumber(ctx context.Context, blockNumber *big.Int) (*gethtypes.Header, error)
HeaderByNumber returns header of a given block number
func (*Client) Logger ¶
func (c *Client) Logger() logrus.FieldLogger
func (*Client) NetworkID ¶
NetworkID returns the network ID (also known as the chain ID) for this chain.
func (*Client) NonceAt ¶
func (c *Client) NonceAt(ctx context.Context, account gethcommon.Address, blockNumber *big.Int) (uint64, error)
NonceAt returns the next nonce for the given account. The block number can be nil, in which case the code is taken from the latest block.
func (*Client) PeerCount ¶
PeerCount returns the number of p2p peers as reported by the net_peerCount method.
func (*Client) PendingBalanceAt ¶
func (c *Client) PendingBalanceAt(ctx context.Context, account gethcommon.Address) (*big.Int, error)
PendingBalanceAt returns the wei balance of the given account in the pending state.
func (*Client) PendingCallContract ¶
PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.
func (*Client) PendingCodeAt ¶
PendingCodeAt returns the contract code of the given account on pending state
func (*Client) PendingNonceAt ¶
PendingNonceAt returns the next nonce for the given account considering pending transaction.
func (*Client) PendingStorageAt ¶
func (c *Client) PendingStorageAt(ctx context.Context, account gethcommon.Address, key gethcommon.Hash) ([]byte, 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) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
func (*Client) SetLogger ¶
func (c *Client) SetLogger(logger logrus.FieldLogger)
func (*Client) StorageAt ¶
func (c *Client) StorageAt(ctx context.Context, account gethcommon.Address, key gethcommon.Hash, blockNumber *big.Int) ([]byte, 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) SubscribeFilterLogs ¶
func (c *Client) SubscribeFilterLogs(ctx context.Context, _ geth.FilterQuery, _ chan<- gethtypes.Log) (geth.Subscription, error)
SubscribeFilterLogs subscribes to the results of a streaming filter query.
func (*Client) SubscribeNewHead ¶
func (*Client) SuggestGasPrice ¶
SuggestGasPrice returns gas price for a transaction to be included in a miner block in a timely manner considering current network activity
func (*Client) SuggestGasTipCap ¶
SuggestGasPrice returns a gas tip cap after EIP-1559 for a transaction to be included in a miner block in a timely manner considering current network activity
func (*Client) SyncProgress ¶
func (*Client) TransactionByHash ¶
func (c *Client) TransactionByHash(ctx context.Context, hash gethcommon.Hash) (tx *gethtypes.Transaction, isPending bool, err error)
TransactionByHash returns the transaction with the given hash.
func (*Client) TransactionCount ¶
TransactionCount returns the total number of transactions in the given block.
func (*Client) TransactionInBlock ¶
func (c *Client) TransactionInBlock(ctx context.Context, blockHash gethcommon.Hash, index uint) (*gethtypes.Transaction, error)
TransactionInBlock returns a single transaction at index in the given block.
func (*Client) TransactionReceipt ¶
func (c *Client) TransactionReceipt(ctx context.Context, txHash gethcommon.Hash) (*gethtypes.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.
func (*Client) TransactionSender ¶
func (c *Client) TransactionSender(ctx context.Context, tx *gethtypes.Transaction, block gethcommon.Hash, index uint) (gethcommon.Address, error)
TransactionSender returns the sender address of the given transaction. The transaction must be known to the remote node and included in the blockchain at the given block and index. The sender is the one derived by the protocol at the time of inclusion.
There is a fast-path for transactions retrieved by TransactionByHash and TransactionInBlock. Getting their sender address can be done without an RPC interaction.