Documentation
¶
Index ¶
- type ETHClient
- type ETHClientWithMaxConcurrentCalls
- func (c *ETHClientWithMaxConcurrentCalls) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (c *ETHClientWithMaxConcurrentCalls) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *ETHClientWithMaxConcurrentCalls) BlockNumber(ctx context.Context) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
- func (c *ETHClientWithMaxConcurrentCalls) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) ChainID(ctx context.Context) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) Client() (_ *rpc.Client)
- func (c *ETHClientWithMaxConcurrentCalls) Close()
- func (c *ETHClientWithMaxConcurrentCalls) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*ethereum.FeeHistory, error)
- func (c *ETHClientWithMaxConcurrentCalls) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (c *ETHClientWithMaxConcurrentCalls) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (c *ETHClientWithMaxConcurrentCalls) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (c *ETHClientWithMaxConcurrentCalls) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) NonceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) PeerCount(ctx context.Context) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) PendingTransactionCount(ctx context.Context) (uint, error)
- func (c *ETHClientWithMaxConcurrentCalls) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *ETHClientWithMaxConcurrentCalls) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) StorageAtHash(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (c *ETHClientWithMaxConcurrentCalls) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (c *ETHClientWithMaxConcurrentCalls) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (c *ETHClientWithMaxConcurrentCalls) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (c *ETHClientWithMaxConcurrentCalls) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (c *ETHClientWithMaxConcurrentCalls) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (c *ETHClientWithMaxConcurrentCalls) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (c *ETHClientWithMaxConcurrentCalls) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (c *ETHClientWithMaxConcurrentCalls) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (c *ETHClientWithMaxConcurrentCalls) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
- type TestETHClient
- func (m *TestETHClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (m *TestETHClient) BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error)
- func (m *TestETHClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (m *TestETHClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (m *TestETHClient) BlockNumber(ctx context.Context) (uint64, error)
- func (m *TestETHClient) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
- func (m *TestETHClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (m *TestETHClient) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
- func (m *TestETHClient) ChainID(ctx context.Context) (*big.Int, error)
- func (m *TestETHClient) Client() *rpc.Client
- func (m *TestETHClient) Close()
- func (m *TestETHClient) CloseCalled() bool
- func (m *TestETHClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (m *TestETHClient) CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
- func (m *TestETHClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (m *TestETHClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*ethereum.FeeHistory, error)
- func (m *TestETHClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (m *TestETHClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (m *TestETHClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (m *TestETHClient) NetworkID(ctx context.Context) (*big.Int, error)
- func (m *TestETHClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (m *TestETHClient) NonceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (uint64, error)
- func (m *TestETHClient) PeerCount(ctx context.Context) (uint64, error)
- func (m *TestETHClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (m *TestETHClient) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
- func (m *TestETHClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (m *TestETHClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (m *TestETHClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (m *TestETHClient) PendingTransactionCount(ctx context.Context) (uint, error)
- func (m *TestETHClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (m *TestETHClient) SetBalanceAtHandler(...)
- func (m *TestETHClient) SetBalanceAtHashHandler(...)
- func (m *TestETHClient) SetBlockByHashHandler(f func(ctx context.Context, hash common.Hash) (*types.Block, error))
- func (m *TestETHClient) SetBlockByNumberHandler(f func(ctx context.Context, number *big.Int) (*types.Block, error))
- func (m *TestETHClient) SetBlockNumberHandler(f func(ctx context.Context) (uint64, error))
- func (m *TestETHClient) SetBlockReceiptsHandler(...)
- func (m *TestETHClient) SetCallContractAtHashHandler(...)
- func (m *TestETHClient) SetCallContractHandler(...)
- func (m *TestETHClient) SetChainIDHandler(f func(ctx context.Context) (*big.Int, error))
- func (m *TestETHClient) SetClientHandler(f func() *rpc.Client)
- func (m *TestETHClient) SetCodeAtHandler(...)
- func (m *TestETHClient) SetCodeAtHashHandler(...)
- func (m *TestETHClient) SetEstimateGasHandler(f func(ctx context.Context, msg ethereum.CallMsg) (uint64, error))
- func (m *TestETHClient) SetFeeHistoryHandler(...)
- func (m *TestETHClient) SetFilterLogsHandler(f func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error))
- func (m *TestETHClient) SetHeaderByHashHandler(f func(ctx context.Context, hash common.Hash) (*types.Header, error))
- func (m *TestETHClient) SetHeaderByNumberHandler(f func(ctx context.Context, number *big.Int) (*types.Header, error))
- func (m *TestETHClient) SetNetworkIDHandler(f func(ctx context.Context) (*big.Int, error))
- func (m *TestETHClient) SetNonceAtHandler(...)
- func (m *TestETHClient) SetNonceAtHashHandler(...)
- func (m *TestETHClient) SetPeerCountHandler(f func(ctx context.Context) (uint64, error))
- func (m *TestETHClient) SetPendingBalanceAtHandler(f func(ctx context.Context, account common.Address) (*big.Int, error))
- func (m *TestETHClient) SetPendingCallContractHandler(f func(ctx context.Context, msg ethereum.CallMsg) ([]byte, error))
- func (m *TestETHClient) SetPendingCodeAtHandler(f func(ctx context.Context, account common.Address) ([]byte, error))
- func (m *TestETHClient) SetPendingNonceAtHandler(f func(ctx context.Context, account common.Address) (uint64, error))
- func (m *TestETHClient) SetPendingStorageAtHandler(...)
- func (m *TestETHClient) SetPendingTransactionCountHandler(f func(ctx context.Context) (uint, error))
- func (m *TestETHClient) SetSendTransactionHandler(f func(ctx context.Context, tx *types.Transaction) error)
- func (m *TestETHClient) SetStorageAtHandler(...)
- func (m *TestETHClient) SetStorageAtHashHandler(...)
- func (m *TestETHClient) SetSubscribeFilterLogsHandler(...)
- func (m *TestETHClient) SetSubscribeNewHeadHandler(...)
- func (m *TestETHClient) SetSuggestGasPriceHandler(f func(ctx context.Context) (*big.Int, error))
- func (m *TestETHClient) SetSuggestGasTipCapHandler(f func(ctx context.Context) (*big.Int, error))
- func (m *TestETHClient) SetSyncProgressHandler(f func(ctx context.Context) (*ethereum.SyncProgress, error))
- func (m *TestETHClient) SetTransactionByHashHandler(...)
- func (m *TestETHClient) SetTransactionCountHandler(f func(ctx context.Context, blockHash common.Hash) (uint, error))
- func (m *TestETHClient) SetTransactionInBlockHandler(...)
- func (m *TestETHClient) SetTransactionReceiptHandler(f func(ctx context.Context, txHash common.Hash) (*types.Receipt, error))
- func (m *TestETHClient) SetTransactionSenderHandler(...)
- func (m *TestETHClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (m *TestETHClient) StorageAtHash(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (m *TestETHClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (m *TestETHClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (m *TestETHClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (m *TestETHClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (m *TestETHClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (m *TestETHClient) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (m *TestETHClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (m *TestETHClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (m *TestETHClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (m *TestETHClient) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
- type TestSubscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ETHClient ¶
type ETHClient interface {
// Close closes the underlying RPC connection.
Close()
// Client gets the underlying RPC client.
Client() *rpc.Client
// ChainID retrieves the current chain ID for transaction replay protection.
ChainID(ctx context.Context) (*big.Int, error)
// BlockByHash returns the given full block.
BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
// BlockByNumber returns a block from the current canonical chain. If number is nil, the
// latest known block is returned.
BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
// BlockNumber returns the most recent block number.
BlockNumber(ctx context.Context) (uint64, error)
// PeerCount returns the number of p2p peers.
PeerCount(ctx context.Context) (uint64, error)
// BlockReceipts returns the receipts of a given block number or hash.
BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
// HeaderByHash returns the block header with the given hash.
HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
// HeaderByNumber returns a block header from the current canonical chain. If number is
// nil, the latest known header is returned.
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
// TransactionByHash returns the transaction with the given hash.
TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
// TransactionSender returns the sender address of the given transaction.
TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
// TransactionCount returns the total number of transactions in the given block.
TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
// TransactionInBlock returns a single transaction at index in the given block.
TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
// TransactionReceipt returns the receipt of a transaction by transaction hash.
TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
// SyncProgress retrieves the current progress of the sync algorithm.
SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
// SubscribeNewHead subscribes to notifications about the current blockchain head.
SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
// NetworkID returns the network ID.
NetworkID(ctx context.Context) (*big.Int, error)
// BalanceAt returns the wei balance of the given account at a specific block number.
BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
// BalanceAtHash returns the wei balance of the given account at a specific block hash.
BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error)
// StorageAt returns the value of key in the contract storage of the given account at a specific block number.
StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
// StorageAtHash returns the value of key in the contract storage of the given account at a specific block hash.
StorageAtHash(ctx context.Context, account common.Address, key common.Hash, blockHash common.Hash) ([]byte, error)
// CodeAt returns the contract code of the given account at a specific block number.
CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
// CodeAtHash returns the contract code of the given account at a specific block hash.
CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
// NonceAt returns the account nonce of the given account at a specific block number.
NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
// NonceAtHash returns the account nonce of the given account at a specific block hash.
NonceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (uint64, error)
// FilterLogs executes a filter query.
FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
// SubscribeFilterLogs subscribes to the results of a streaming filter query.
SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
// PendingBalanceAt returns the wei balance of the given account in the pending state.
PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
// PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
// PendingCodeAt returns the contract code of the given account in the pending state.
PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
// PendingNonceAt returns the account nonce of the given account in the pending state.
PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
// PendingTransactionCount returns the total number of transactions in the pending state.
PendingTransactionCount(ctx context.Context) (uint, error)
// CallContract executes a message call transaction at a specific block number.
CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
// CallContractAtHash executes a message call transaction at a specific block hash.
CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
// PendingCallContract executes a message call transaction using the pending state.
PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
// SuggestGasPrice retrieves the currently suggested gas price.
SuggestGasPrice(ctx context.Context) (*big.Int, error)
// SuggestGasTipCap retrieves the currently suggested gas tip cap.
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
// FeeHistory retrieves the fee market history.
FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
// EstimateGas tries to estimate the gas needed to execute a specific transaction.
EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
// SendTransaction injects a signed transaction into the pending pool.
SendTransaction(ctx context.Context, tx *types.Transaction) error
}
ETHClient defines the methods exposed by an Ethereum RPC client. This interface abstracts the concrete implementation (*ethclient.Client) allowing for easier testing and dependency injection.
type ETHClientWithMaxConcurrentCalls ¶
type ETHClientWithMaxConcurrentCalls struct {
// contains filtered or unexported fields
}
func NewETHClientWithMaxConcurrentCalls ¶
func NewETHClientWithMaxConcurrentCalls(client ETHClient, max int) (*ETHClientWithMaxConcurrentCalls, error)
func (*ETHClientWithMaxConcurrentCalls) BalanceAt ¶
func (c *ETHClientWithMaxConcurrentCalls) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt returns the wei balance of the given account at a specific block number.
func (*ETHClientWithMaxConcurrentCalls) BalanceAtHash ¶
func (c *ETHClientWithMaxConcurrentCalls) BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error)
BalanceAtHash returns the wei balance of the given account at a specific block hash.
func (*ETHClientWithMaxConcurrentCalls) BlockByHash ¶
func (c *ETHClientWithMaxConcurrentCalls) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
BlockByHash returns the given full block.
func (*ETHClientWithMaxConcurrentCalls) BlockByNumber ¶
func (c *ETHClientWithMaxConcurrentCalls) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
func (*ETHClientWithMaxConcurrentCalls) BlockNumber ¶
func (c *ETHClientWithMaxConcurrentCalls) BlockNumber(ctx context.Context) (uint64, error)
BlockNumber returns the most recent block number.
func (*ETHClientWithMaxConcurrentCalls) BlockReceipts ¶
func (c *ETHClientWithMaxConcurrentCalls) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
BlockReceipts returns the receipts of a given block number or hash.
func (*ETHClientWithMaxConcurrentCalls) CallContract ¶
func (c *ETHClientWithMaxConcurrentCalls) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract is the most called and the slowest method it is the most important to limit the number of concurrent calls
func (*ETHClientWithMaxConcurrentCalls) CallContractAtHash ¶
func (c *ETHClientWithMaxConcurrentCalls) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
CallContractAtHash executes a message call transaction at a specific block hash.
func (*ETHClientWithMaxConcurrentCalls) ChainID ¶
ChainID retrieves the current chain ID for transaction replay protection.
func (*ETHClientWithMaxConcurrentCalls) Client ¶
func (c *ETHClientWithMaxConcurrentCalls) Client() (_ *rpc.Client)
Client gets the underlying RPC client.
func (*ETHClientWithMaxConcurrentCalls) Close ¶
func (c *ETHClientWithMaxConcurrentCalls) Close()
Close closes the underlying RPC connection.
func (*ETHClientWithMaxConcurrentCalls) CodeAt ¶
func (c *ETHClientWithMaxConcurrentCalls) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt returns the contract code of the given account at a specific block number.
func (*ETHClientWithMaxConcurrentCalls) CodeAtHash ¶
func (c *ETHClientWithMaxConcurrentCalls) CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
CodeAtHash returns the contract code of the given account at a specific block hash.
func (*ETHClientWithMaxConcurrentCalls) EstimateGas ¶
func (c *ETHClientWithMaxConcurrentCalls) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
EstimateGas tries to estimate the gas needed to execute a specific transaction.
func (*ETHClientWithMaxConcurrentCalls) FeeHistory ¶
func (c *ETHClientWithMaxConcurrentCalls) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
FeeHistory retrieves the fee market history.
func (*ETHClientWithMaxConcurrentCalls) FilterLogs ¶
func (c *ETHClientWithMaxConcurrentCalls) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
FilterLogs executes a filter query.
func (*ETHClientWithMaxConcurrentCalls) HeaderByHash ¶
func (c *ETHClientWithMaxConcurrentCalls) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
HeaderByHash returns the block header with the given hash.
func (*ETHClientWithMaxConcurrentCalls) HeaderByNumber ¶
func (c *ETHClientWithMaxConcurrentCalls) 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 (*ETHClientWithMaxConcurrentCalls) NonceAt ¶
func (c *ETHClientWithMaxConcurrentCalls) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt returns the account nonce of the given account at a specific block number.
func (*ETHClientWithMaxConcurrentCalls) NonceAtHash ¶
func (c *ETHClientWithMaxConcurrentCalls) NonceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (uint64, error)
NonceAtHash returns the account nonce of the given account at a specific block hash.
func (*ETHClientWithMaxConcurrentCalls) PeerCount ¶
func (c *ETHClientWithMaxConcurrentCalls) PeerCount(ctx context.Context) (uint64, error)
PeerCount returns the number of p2p peers.
func (*ETHClientWithMaxConcurrentCalls) PendingBalanceAt ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
PendingBalanceAt returns the wei balance of the given account in the pending state.
func (*ETHClientWithMaxConcurrentCalls) PendingCallContract ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
PendingCallContract executes a message call transaction using the pending state.
func (*ETHClientWithMaxConcurrentCalls) PendingCodeAt ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
PendingCodeAt returns the contract code of the given account in the pending state.
func (*ETHClientWithMaxConcurrentCalls) PendingNonceAt ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
PendingNonceAt returns the account nonce of the given account in the pending state.
func (*ETHClientWithMaxConcurrentCalls) PendingStorageAt ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
func (*ETHClientWithMaxConcurrentCalls) PendingTransactionCount ¶
func (c *ETHClientWithMaxConcurrentCalls) PendingTransactionCount(ctx context.Context) (uint, error)
PendingTransactionCount returns the total number of transactions in the pending state.
func (*ETHClientWithMaxConcurrentCalls) SendTransaction ¶
func (c *ETHClientWithMaxConcurrentCalls) SendTransaction(ctx context.Context, tx *types.Transaction) error
SendTransaction injects a signed transaction into the pending pool.
func (*ETHClientWithMaxConcurrentCalls) StorageAt ¶
func (c *ETHClientWithMaxConcurrentCalls) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
StorageAt returns the value of key in the contract storage of the given account at a specific block number.
func (*ETHClientWithMaxConcurrentCalls) StorageAtHash ¶
func (c *ETHClientWithMaxConcurrentCalls) StorageAtHash(ctx context.Context, account common.Address, key common.Hash, blockHash common.Hash) ([]byte, error)
StorageAtHash returns the value of key in the contract storage of the given account at a specific block hash.
func (*ETHClientWithMaxConcurrentCalls) SubscribeFilterLogs ¶
func (c *ETHClientWithMaxConcurrentCalls) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogs subscribes to the results of a streaming filter query.
func (*ETHClientWithMaxConcurrentCalls) SubscribeNewHead ¶
func (c *ETHClientWithMaxConcurrentCalls) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
SubscribeNewHead subscribes to notifications about the current blockchain head.
func (*ETHClientWithMaxConcurrentCalls) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price.
func (*ETHClientWithMaxConcurrentCalls) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested gas tip cap.
func (*ETHClientWithMaxConcurrentCalls) SyncProgress ¶
func (c *ETHClientWithMaxConcurrentCalls) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
SyncProgress retrieves the current progress of the sync algorithm.
func (*ETHClientWithMaxConcurrentCalls) TransactionByHash ¶
func (c *ETHClientWithMaxConcurrentCalls) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionByHash returns the transaction with the given hash.
func (*ETHClientWithMaxConcurrentCalls) TransactionCount ¶
func (c *ETHClientWithMaxConcurrentCalls) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
TransactionCount returns the total number of transactions in the given block.
func (*ETHClientWithMaxConcurrentCalls) TransactionInBlock ¶
func (c *ETHClientWithMaxConcurrentCalls) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
TransactionInBlock returns a single transaction at index in the given block.
func (*ETHClientWithMaxConcurrentCalls) TransactionReceipt ¶
func (c *ETHClientWithMaxConcurrentCalls) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt returns the receipt of a transaction by transaction hash.
func (*ETHClientWithMaxConcurrentCalls) TransactionSender ¶
func (c *ETHClientWithMaxConcurrentCalls) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
TransactionSender returns the sender address of the given transaction.
type TestETHClient ¶
type TestETHClient struct {
// CloseFunc func() // Close doesn't return, simple tracking might be better if needed
ClientFunc func() *rpc.Client
// Blockchain Access Handlers
ChainIDFunc func(ctx context.Context) (*big.Int, error)
BlockByHashFunc func(ctx context.Context, hash common.Hash) (*types.Block, error)
BlockByNumberFunc func(ctx context.Context, number *big.Int) (*types.Block, error)
BlockNumberFunc func(ctx context.Context) (uint64, error)
PeerCountFunc func(ctx context.Context) (uint64, error)
BlockReceiptsFunc func(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
HeaderByHashFunc func(ctx context.Context, hash common.Hash) (*types.Header, error)
HeaderByNumberFunc func(ctx context.Context, number *big.Int) (*types.Header, error)
TransactionByHashFunc func(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionSenderFunc func(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
TransactionCountFunc func(ctx context.Context, blockHash common.Hash) (uint, error)
TransactionInBlockFunc func(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
TransactionReceiptFunc func(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
SyncProgressFunc func(ctx context.Context) (*ethereum.SyncProgress, error)
SubscribeNewHeadFunc func(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
// State Access Handlers
NetworkIDFunc func(ctx context.Context) (*big.Int, error)
BalanceAtFunc func(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAtHashFunc func(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error)
StorageAtFunc func(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
StorageAtHashFunc func(ctx context.Context, account common.Address, key common.Hash, blockHash common.Hash) ([]byte, error)
CodeAtFunc func(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAtHashFunc func(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
NonceAtFunc func(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAtHashFunc func(ctx context.Context, account common.Address, blockHash common.Hash) (uint64, error)
// Filters Handlers
FilterLogsFunc func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
SubscribeFilterLogsFunc func(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
// Pending State Handlers
PendingBalanceAtFunc func(ctx context.Context, account common.Address) (*big.Int, error)
PendingStorageAtFunc func(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
PendingCodeAtFunc func(ctx context.Context, account common.Address) ([]byte, error)
PendingNonceAtFunc func(ctx context.Context, account common.Address) (uint64, error)
PendingTransactionCountFunc func(ctx context.Context) (uint, error)
// Contract Calling Handlers
CallContractFunc func(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContractAtHashFunc func(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
PendingCallContractFunc func(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
SuggestGasPriceFunc func(ctx context.Context) (*big.Int, error)
SuggestGasTipCapFunc func(ctx context.Context) (*big.Int, error)
FeeHistoryFunc func(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
EstimateGasFunc func(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
SendTransactionFunc func(ctx context.Context, tx *types.Transaction) error
// contains filtered or unexported fields
}
TestETHClient provides a mock implementation of the ETHClient interface. It defaults to returning nil/zero values but allows registering custom handler functions for specific methods using Set...Handler methods.
func NewTestETHClient ¶
func NewTestETHClient() *TestETHClient
NewTestETHClient creates a new TestETHClient mock instance.
func (*TestETHClient) BalanceAtHash ¶
func (*TestETHClient) BlockByHash ¶
func (*TestETHClient) BlockByNumber ¶
func (*TestETHClient) BlockNumber ¶
func (m *TestETHClient) BlockNumber(ctx context.Context) (uint64, error)
func (*TestETHClient) BlockReceipts ¶
func (m *TestETHClient) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
func (*TestETHClient) CallContract ¶
func (*TestETHClient) CallContractAtHash ¶
func (*TestETHClient) Client ¶
func (m *TestETHClient) Client() *rpc.Client
func (*TestETHClient) Close ¶
func (m *TestETHClient) Close()
func (*TestETHClient) CloseCalled ¶
func (m *TestETHClient) CloseCalled() bool
CloseCalled returns true if Close() was invoked.
func (*TestETHClient) CodeAtHash ¶
func (*TestETHClient) EstimateGas ¶
func (*TestETHClient) FeeHistory ¶
func (m *TestETHClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
func (*TestETHClient) FilterLogs ¶
func (m *TestETHClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
func (*TestETHClient) HeaderByHash ¶
func (*TestETHClient) HeaderByNumber ¶
func (*TestETHClient) NonceAtHash ¶
func (*TestETHClient) PeerCount ¶
func (m *TestETHClient) PeerCount(ctx context.Context) (uint64, error)
func (*TestETHClient) PendingBalanceAt ¶
func (*TestETHClient) PendingCallContract ¶
func (*TestETHClient) PendingCodeAt ¶
func (*TestETHClient) PendingNonceAt ¶
func (*TestETHClient) PendingStorageAt ¶
func (*TestETHClient) PendingTransactionCount ¶
func (m *TestETHClient) PendingTransactionCount(ctx context.Context) (uint, error)
func (*TestETHClient) SendTransaction ¶
func (m *TestETHClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
func (*TestETHClient) SetBalanceAtHandler ¶
func (*TestETHClient) SetBalanceAtHashHandler ¶
func (*TestETHClient) SetBlockByHashHandler ¶
func (*TestETHClient) SetBlockByNumberHandler ¶
func (*TestETHClient) SetBlockNumberHandler ¶
func (m *TestETHClient) SetBlockNumberHandler(f func(ctx context.Context) (uint64, error))
func (*TestETHClient) SetBlockReceiptsHandler ¶
func (m *TestETHClient) SetBlockReceiptsHandler(f func(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error))
func (*TestETHClient) SetCallContractAtHashHandler ¶
func (*TestETHClient) SetCallContractHandler ¶
func (*TestETHClient) SetChainIDHandler ¶
func (*TestETHClient) SetClientHandler ¶
func (m *TestETHClient) SetClientHandler(f func() *rpc.Client)
func (*TestETHClient) SetCodeAtHandler ¶
func (*TestETHClient) SetCodeAtHashHandler ¶
func (*TestETHClient) SetEstimateGasHandler ¶
func (*TestETHClient) SetFeeHistoryHandler ¶
func (m *TestETHClient) SetFeeHistoryHandler(f func(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error))
func (*TestETHClient) SetFilterLogsHandler ¶
func (m *TestETHClient) SetFilterLogsHandler(f func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error))
func (*TestETHClient) SetHeaderByHashHandler ¶
func (*TestETHClient) SetHeaderByNumberHandler ¶
func (*TestETHClient) SetNetworkIDHandler ¶
func (*TestETHClient) SetNonceAtHandler ¶
func (*TestETHClient) SetNonceAtHashHandler ¶
func (*TestETHClient) SetPeerCountHandler ¶
func (m *TestETHClient) SetPeerCountHandler(f func(ctx context.Context) (uint64, error))
func (*TestETHClient) SetPendingBalanceAtHandler ¶
func (*TestETHClient) SetPendingCallContractHandler ¶
func (*TestETHClient) SetPendingCodeAtHandler ¶
func (*TestETHClient) SetPendingNonceAtHandler ¶
func (*TestETHClient) SetPendingStorageAtHandler ¶
func (*TestETHClient) SetPendingTransactionCountHandler ¶
func (m *TestETHClient) SetPendingTransactionCountHandler(f func(ctx context.Context) (uint, error))
func (*TestETHClient) SetSendTransactionHandler ¶
func (m *TestETHClient) SetSendTransactionHandler(f func(ctx context.Context, tx *types.Transaction) error)
func (*TestETHClient) SetStorageAtHandler ¶
func (*TestETHClient) SetStorageAtHashHandler ¶
func (*TestETHClient) SetSubscribeFilterLogsHandler ¶
func (m *TestETHClient) SetSubscribeFilterLogsHandler(f func(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error))
func (*TestETHClient) SetSubscribeNewHeadHandler ¶
func (m *TestETHClient) SetSubscribeNewHeadHandler(f func(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error))
func (*TestETHClient) SetSuggestGasPriceHandler ¶
func (*TestETHClient) SetSuggestGasTipCapHandler ¶
func (*TestETHClient) SetSyncProgressHandler ¶
func (m *TestETHClient) SetSyncProgressHandler(f func(ctx context.Context) (*ethereum.SyncProgress, error))
func (*TestETHClient) SetTransactionByHashHandler ¶
func (m *TestETHClient) SetTransactionByHashHandler(f func(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error))
func (*TestETHClient) SetTransactionCountHandler ¶
func (*TestETHClient) SetTransactionInBlockHandler ¶
func (m *TestETHClient) SetTransactionInBlockHandler(f func(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error))
func (*TestETHClient) SetTransactionReceiptHandler ¶
func (*TestETHClient) SetTransactionSenderHandler ¶
func (*TestETHClient) StorageAtHash ¶
func (*TestETHClient) SubscribeFilterLogs ¶
func (m *TestETHClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
func (*TestETHClient) SubscribeNewHead ¶
func (m *TestETHClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
func (*TestETHClient) SuggestGasPrice ¶
func (*TestETHClient) SuggestGasTipCap ¶
func (*TestETHClient) SyncProgress ¶
func (m *TestETHClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
func (*TestETHClient) TransactionByHash ¶
func (m *TestETHClient) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
func (*TestETHClient) TransactionCount ¶
func (*TestETHClient) TransactionInBlock ¶
func (m *TestETHClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
func (*TestETHClient) TransactionReceipt ¶
func (*TestETHClient) TransactionSender ¶
type TestSubscription ¶
type TestSubscription struct {
// contains filtered or unexported fields
}
func NewTestSubscription ¶
func NewTestSubscription(unsubscribe func(), err func() <-chan error) *TestSubscription
func (*TestSubscription) Err ¶
func (s *TestSubscription) Err() <-chan error
func (*TestSubscription) Unsubscribe ¶
func (s *TestSubscription) Unsubscribe()