Documentation ¶
Index ¶
- type EthClientProxy
- func (p *EthClientProxy) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (p *EthClientProxy) BlockNumber(ctx context.Context) (uint64, error)
- func (p *EthClientProxy) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (p *EthClientProxy) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
- func (p *EthClientProxy) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
- func (p *EthClientProxy) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
- func (p *EthClientProxy) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (p *EthClientProxy) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (p *EthClientProxy) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (p *EthClientProxy) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (p *EthClientProxy) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (p *EthClientProxy) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (p *EthClientProxy) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (p *EthClientProxy) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (p *EthClientProxy) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (p *EthClientProxy) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (p *EthClientProxy) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EthClientProxy ¶
type EthClientProxy struct {
// contains filtered or unexported fields
}
This type wraps multiple ETH clients, providing natural fallback support if one of them fails.
func NewEth1ClientProxy ¶
func NewEth1ClientProxy(reconnectDelay time.Duration, urls ...string) *EthClientProxy
Creates a new Eth1ClientProxy instance based on the main and backup client URLs
func (*EthClientProxy) BalanceAt ¶
func (p *EthClientProxy) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, 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 (*EthClientProxy) BlockNumber ¶
func (p *EthClientProxy) BlockNumber(ctx context.Context) (uint64, error)
BlockNumber returns the most recent block number
func (*EthClientProxy) CallContract ¶
func (p *EthClientProxy) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract executes an Ethereum contract call with the specified data as the input.
func (*EthClientProxy) CodeAt ¶
func (p *EthClientProxy) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt returns the code of the given account. This is needed to differentiate between contract internal errors and the local chain being out of sync.
func (*EthClientProxy) EstimateGas ¶
func (p *EthClientProxy) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
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 (*EthClientProxy) FilterLogs ¶
func (p *EthClientProxy) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
FilterLogs executes a log filter operation, blocking during execution and returning all the results in one batch.
TODO(karalabe): Deprecate when the subscription one can return past data too.
func (*EthClientProxy) HeaderByNumber ¶
func (p *EthClientProxy) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*EthClientProxy) NonceAt ¶
func (p *EthClientProxy) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, 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 (*EthClientProxy) PendingCodeAt ¶
PendingCodeAt returns the code of the given account in the pending state.
func (*EthClientProxy) PendingNonceAt ¶
func (p *EthClientProxy) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
PendingNonceAt retrieves the current pending nonce associated with an account.
func (*EthClientProxy) SendTransaction ¶
func (p *EthClientProxy) SendTransaction(ctx context.Context, tx *types.Transaction) error
SendTransaction injects the transaction into the pending pool for execution.
func (*EthClientProxy) SubscribeFilterLogs ¶
func (p *EthClientProxy) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogs creates a background log filtering operation, returning a subscription immediately, which can be used to stream the found events.
func (*EthClientProxy) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*EthClientProxy) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested 1559 priority fee to allow a timely execution of a transaction.
func (*EthClientProxy) SyncProgress ¶
func (p *EthClientProxy) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.
func (*EthClientProxy) TransactionByHash ¶
func (p *EthClientProxy) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionByHash returns the transaction with the given hash.
func (*EthClientProxy) TransactionReceipt ¶
func (p *EthClientProxy) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.