Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultQueryCtx(ctxs ...context.Context) (ctx context.Context, cancel context.CancelFunc)
- func ExtractRevertReasonFromRPCError(err error) (string, error)
- func NewClientWithNodes(logger logger.Logger, primaryNodes []Node, sendOnlyNodes []SendOnlyNode, ...) (*client, error)
- func ToBlockNumArg(number *big.Int) string
- type BatchSender
- type CallArgs
- type Client
- type ClientErrors
- type JsonError
- type Node
- type NodeConfig
- type NodeState
- type NullClient
- func (nc *NullClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (nc *NullClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (nc *NullClient) BatchCallContextAll(ctx context.Context, b []rpc.BatchElem) error
- func (nc *NullClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (nc *NullClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (nc *NullClient) Call(result interface{}, method string, args ...interface{}) error
- func (nc *NullClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (nc *NullClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (nc *NullClient) ChainID() *big.Int
- func (nc *NullClient) Close()
- func (nc *NullClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (nc *NullClient) Dial(context.Context) error
- func (nc *NullClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
- func (nc *NullClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (nc *NullClient) GetERC20Balance(address common.Address, contractAddress common.Address) (*big.Int, error)
- func (nc *NullClient) GetEthBalance(context.Context, common.Address, *big.Int) (*assets.Eth, error)
- func (nc *NullClient) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error)
- func (nc *NullClient) HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error)
- func (nc *NullClient) HeaderByNumber(ctx context.Context, n *big.Int) (*types.Header, error)
- func (nc *NullClient) NodeStates() map[int32]string
- func (nc *NullClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (nc *NullClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (nc *NullClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (nc *NullClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (nc *NullClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (nc *NullClient) SubscribeNewHead(ctx context.Context, ch chan<- *evmtypes.Head) (ethereum.Subscription, error)
- func (nc *NullClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (nc *NullClient) SuggestGasTipCap(ctx context.Context) (tipCap *big.Int, err error)
- func (nc *NullClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type Pool
- func (p *Pool) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (p *Pool) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (p *Pool) BatchCallContextAll(ctx context.Context, b []rpc.BatchElem) error
- func (p *Pool) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (p *Pool) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (p *Pool) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (p *Pool) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (p *Pool) ChainID() *big.Int
- func (p *Pool) Close()
- func (p *Pool) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (p *Pool) Dial(ctx context.Context) error
- func (p *Pool) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
- func (p *Pool) EthSubscribe(ctx context.Context, channel chan<- *evmtypes.Head, args ...interface{}) (ethereum.Subscription, error)
- func (p *Pool) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (p *Pool) HeaderByNumber(ctx context.Context, n *big.Int) (*types.Header, error)
- func (p *Pool) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (p *Pool) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (p *Pool) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (p *Pool) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (p *Pool) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (p *Pool) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (p *Pool) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (p *Pool) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type SendError
- func (s *SendError) CauseStr() string
- func (s *SendError) Error() string
- func (s *SendError) Fatal() bool
- func (s *SendError) IsFeeTooHigh() bool
- func (s *SendError) IsFeeTooLow() bool
- func (s *SendError) IsInsufficientEth() bool
- func (s *SendError) IsNonceTooLowError() bool
- func (s *SendError) IsReplacementUnderpriced() bool
- func (s *SendError) IsTemporarilyUnderpriced() bool
- func (s *SendError) IsTerminallyUnderpriced() bool
- func (s *SendError) IsTooExpensive() bool
- func (s *SendError) IsTransactionAlreadyInMempool() bool
- func (s *SendError) IsTransactionAlreadyMined() bool
- type SendOnlyNode
- type SimulatedBackendClient
- func (c *SimulatedBackendClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *SimulatedBackendClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *SimulatedBackendClient) BatchCallContextAll(ctx context.Context, b []rpc.BatchElem) error
- func (c *SimulatedBackendClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (c *SimulatedBackendClient) BlockByNumber(ctx context.Context, n *big.Int) (*types.Block, error)
- func (c *SimulatedBackendClient) Call(result interface{}, method string, args ...interface{}) error
- func (c *SimulatedBackendClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *SimulatedBackendClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *SimulatedBackendClient) ChainID() *big.Int
- func (c *SimulatedBackendClient) Close()
- func (c *SimulatedBackendClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *SimulatedBackendClient) Dial(context.Context) error
- func (c *SimulatedBackendClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
- func (c *SimulatedBackendClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
- func (c *SimulatedBackendClient) GetERC20Balance(address common.Address, contractAddress common.Address) (balance *big.Int, err error)
- func (c *SimulatedBackendClient) GetEthBalance(ctx context.Context, account common.Address, blockNumber *big.Int) (*assets.Eth, error)
- func (c *SimulatedBackendClient) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error)
- func (c *SimulatedBackendClient) HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error)
- func (c *SimulatedBackendClient) HeaderByNumber(ctx context.Context, n *big.Int) (*types.Header, error)
- func (c *SimulatedBackendClient) NodeStates() map[int32]string
- func (c *SimulatedBackendClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (c *SimulatedBackendClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *SimulatedBackendClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *SimulatedBackendClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *SimulatedBackendClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, channel chan<- types.Log) (ethereum.Subscription, error)
- func (c *SimulatedBackendClient) SubscribeNewHead(ctx context.Context, channel chan<- *evmtypes.Head) (ethereum.Subscription, error)
- func (c *SimulatedBackendClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *SimulatedBackendClient) SuggestGasTipCap(ctx context.Context) (tipCap *big.Int, err error)
- func (c *SimulatedBackendClient) TransactionReceipt(ctx context.Context, receipt common.Hash) (*types.Receipt, error)
- type Subscription
- type TxSender
Constants ¶
const ( NonceTooLow = iota ReplacementTransactionUnderpriced LimitReached TransactionAlreadyInMempool TerminallyUnderpriced InsufficientEth TooExpensive FeeTooLow FeeTooHigh TransactionAlreadyMined Fatal )
const ( // NodeStateUndialed is the first state of a virgin node NodeStateUndialed = NodeState(iota) // NodeStateDialed is after a node has successfully dialed but before it has verified the correct chain ID NodeStateDialed // NodeStateInvalidChainID is after chain ID verification failed NodeStateInvalidChainID // NodeStateAlive is a healthy node after chain ID verification succeeded NodeStateAlive // NodeStateUnreachable is a node that cannot be dialed or has disconnected NodeStateUnreachable // NodeStateOutOfSync is a node that is accepting connections but exceeded // the failure threshold without sending any new heads. It will be // disconnected, then put into a revive loop and re-awakened after redial // if a new head arrives NodeStateOutOfSync // NodeStateClosed is after the connection has been closed and the node is at the end of its lifecycle NodeStateClosed )
const NullClientChainID = 0
NullClientChainID the ChainID that nullclient will return 0 is never used as a real chain ID so makes sense as a dummy value here
Variables ¶
var ( // PromEVMPoolRPCNodeStates reports current RPC node state PromEVMPoolRPCNodeStates = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "evm_pool_rpc_node_states", Help: "The number of RPC nodes currently in the given state for the given chain", }, []string{"evmChainID", "state"}) )
Functions ¶
func DefaultQueryCtx ¶
DefaultQueryCtx returns a context with a sensible sanity limit timeout for queries to the eth node This is a sanity limit to try to work around poorly behaved remote WS endpoints that fail to send us data that we requested NO QUERY should ever take longer than this
func ExtractRevertReasonFromRPCError ¶
ExtractRevertReasonFromRPCError attempts to extract the revert reason from the response of an RPC eth_call that reverted by parsing the message from the "data" field ex: kovan (parity) { "error": { "code" : -32015, "data": "Reverted 0xABC123...", "message": "VM execution error." } } // revert reason always omitted rinkeby / ropsten (geth) { "error": { "code": 3, "data": "0x0xABC123...", "message": "execution reverted: hello world" } } // revert reason included in message
func NewClientWithNodes ¶
func NewClientWithNodes(logger logger.Logger, primaryNodes []Node, sendOnlyNodes []SendOnlyNode, chainID *big.Int) (*client, error)
NewClientWithNodes instantiates a client from a list of nodes Currently only supports one primary
func ToBlockNumArg ¶
Types ¶
type BatchSender ¶ added in v1.4.0
type CallArgs ¶
CallArgs represents the data used to call the balance method of a contract. "To" is the address of the ERC contract. "Data" is the message sent to the contract.
type Client ¶
type Client interface { Dial(ctx context.Context) error Close() ChainID() *big.Int // NodeStates returns a map of node ID->node state // It might be nil or empty, e.g. for mock clients etc NodeStates() map[int32]string GetERC20Balance(address common.Address, contractAddress common.Address) (*big.Int, error) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error) GetEthBalance(ctx context.Context, account common.Address, blockNumber *big.Int) (*assets.Eth, error) // Wrapped RPC methods Call(result interface{}, method string, args ...interface{}) error CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error BatchCallContext(ctx context.Context, b []rpc.BatchElem) error // BatchCallContextAll calls BatchCallContext for every single node including // sendonlys. // CAUTION: This should only be used for mass re-transmitting transactions, it // might have unexpected effects to use it for anything else. BatchCallContextAll(ctx context.Context, b []rpc.BatchElem) error // HeadByNumber is a reimplemented version of HeaderByNumber due to a // difference in how block header hashes are calculated by Parity nodes // running on Kovan. We have to return our own wrapper type to capture the // correct hash from the RPC response. HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error) SubscribeNewHead(ctx context.Context, ch chan<- *evmtypes.Head) (ethereum.Subscription, error) // Wrapped Geth client methods SendTransaction(ctx context.Context, tx *types.Transaction) error PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) SuggestGasPrice(ctx context.Context) (*big.Int, error) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) // bind.ContractBackend methods HeaderByNumber(context.Context, *big.Int) (*types.Header, error) SuggestGasTipCap(ctx context.Context) (*big.Int, error) }
Client is the interface used to interact with an ethereum node.
type ClientErrors ¶
type JsonError ¶
type JsonError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
go-ethereum@v1.10.0/rpc/json.go
func ExtractRPCError ¶
type Node ¶
type Node interface { Start(ctx context.Context) error Close() State() NodeState // Unique identifier for node ID() int32 ChainID() *big.Int CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error BatchCallContext(ctx context.Context, b []rpc.BatchElem) error SendTransaction(ctx context.Context, tx *types.Transaction) error PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) SuggestGasPrice(ctx context.Context) (*big.Int, error) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) HeaderByNumber(context.Context, *big.Int) (*types.Header, error) SuggestGasTipCap(ctx context.Context) (*big.Int, error) EthSubscribe(ctx context.Context, channel chan<- *evmtypes.Head, args ...interface{}) (ethereum.Subscription, error) String() string }
Node represents a client that connects to an ethereum-compatible RPC node
type NodeConfig ¶ added in v1.3.0
type NodeConfig interface { NodeNoNewHeadsThreshold() time.Duration NodePollFailureThreshold() uint32 NodePollInterval() time.Duration }
NodeConfig allows configuration of the node
type NodeState ¶
type NodeState int
NodeState represents the current state of the node Node is a FSM (finite state machine)
type NullClient ¶
type NullClient struct {
// contains filtered or unexported fields
}
NullClient satisfies the Client but has no side effects
func NewNullClient ¶
func NewNullClient(cid *big.Int, lggr logger.Logger) *NullClient
func (*NullClient) BatchCallContext ¶
func (*NullClient) BatchCallContextAll ¶ added in v1.3.0
BatchCallContextAll implements evmclient.Client interface
func (*NullClient) BlockByHash ¶ added in v1.4.0
func (*NullClient) BlockByNumber ¶
func (*NullClient) Call ¶
func (nc *NullClient) Call(result interface{}, method string, args ...interface{}) error
func (*NullClient) CallContext ¶
func (nc *NullClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
func (*NullClient) CallContract ¶
func (*NullClient) ChainID ¶
func (nc *NullClient) ChainID() *big.Int
func (*NullClient) Close ¶
func (nc *NullClient) Close()
func (*NullClient) EstimateGas ¶
func (nc *NullClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error)
func (*NullClient) FilterLogs ¶
func (*NullClient) GetERC20Balance ¶
func (*NullClient) GetEthBalance ¶
func (*NullClient) GetLINKBalance ¶
func (*NullClient) HeadByNumber ¶
func (*NullClient) HeaderByNumber ¶
func (*NullClient) NodeStates ¶ added in v1.3.0
func (nc *NullClient) NodeStates() map[int32]string
NodeStates implements evmclient.Client
func (*NullClient) PendingCodeAt ¶
func (*NullClient) PendingNonceAt ¶
func (*NullClient) SendTransaction ¶
func (nc *NullClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
func (*NullClient) SubscribeFilterLogs ¶
func (*NullClient) SubscribeNewHead ¶
func (*NullClient) SuggestGasPrice ¶
func (*NullClient) SuggestGasTipCap ¶
func (*NullClient) TransactionReceipt ¶
type Pool ¶
type Pool struct { utils.StartStopOnce // contains filtered or unexported fields }
Pool represents an abstraction over one or more primary nodes It is responsible for liveness checking and balancing queries across live nodes
func (*Pool) BatchCallContext ¶
func (*Pool) BatchCallContextAll ¶ added in v1.3.0
BatchCallContextAll calls BatchCallContext for every single node including sendonlys. CAUTION: This should only be used for mass re-transmitting transactions, it might have unexpected effects to use it for anything else.
func (*Pool) BlockByHash ¶ added in v1.4.0
func (*Pool) BlockByNumber ¶
func (*Pool) CallContext ¶
func (*Pool) CallContract ¶
func (*Pool) EstimateGas ¶
func (*Pool) EthSubscribe ¶
func (p *Pool) EthSubscribe(ctx context.Context, channel chan<- *evmtypes.Head, args ...interface{}) (ethereum.Subscription, error)
EthSubscribe implements evmclient.Client
func (*Pool) FilterLogs ¶
func (*Pool) HeaderByNumber ¶
bind.ContractBackend methods
func (*Pool) PendingCodeAt ¶
func (*Pool) PendingNonceAt ¶
func (*Pool) SendTransaction ¶
Wrapped Geth client methods
func (*Pool) SubscribeFilterLogs ¶
func (*Pool) SuggestGasPrice ¶
func (*Pool) SuggestGasTipCap ¶
type SendError ¶
type SendError struct {
// contains filtered or unexported fields
}
fatal means this transaction can never be accepted even with a different nonce or higher gas price
func NewFatalSendError ¶
func NewSendError ¶
func NewSendErrorS ¶
func (*SendError) Fatal ¶
Fatal indicates whether the error should be considered fatal or not Fatal errors mean that no matter how many times the send is retried, no node will ever accept it
func (*SendError) IsFeeTooHigh ¶
IsFeeTooHigh is an optimism-specific error returned when total fee is too high
func (*SendError) IsFeeTooLow ¶
IsFeeTooLow is an optimism-specific error returned when total fee is too low
func (*SendError) IsInsufficientEth ¶
func (*SendError) IsNonceTooLowError ¶
func (*SendError) IsReplacementUnderpriced ¶
IsReplacementUnderpriced indicates that a transaction already exists in the mempool with this nonce but a different gas price or payload
func (*SendError) IsTemporarilyUnderpriced ¶
func (*SendError) IsTerminallyUnderpriced ¶
IsTerminallyUnderpriced indicates that this transaction is so far underpriced the node won't even accept it in the first place
func (*SendError) IsTooExpensive ¶
IsTooExpensive returns true if the transaction and gas price are combined in some way that makes the total transaction too expensive for the eth node to accept at all. No amount of retrying at this or higher gas prices can ever succeed.
func (*SendError) IsTransactionAlreadyInMempool ¶
Geth/parity returns this error if the transaction is already in the node's mempool
func (*SendError) IsTransactionAlreadyMined ¶ added in v1.3.0
IsTransactionAlreadyMined - Harmony returns this error if the transaction has already been mined
type SendOnlyNode ¶
type SendOnlyNode interface { // Start may attempt to connect to the node, but should only return error for misconfiguration - never for temporary errors. Start(context.Context) error Close() ChainID() (chainID *big.Int) SendTransaction(ctx context.Context, tx *types.Transaction) error BatchCallContext(ctx context.Context, b []rpc.BatchElem) error String() string }
SendOnlyNode represents one ethereum node used as a sendonly
func NewSendOnlyNode ¶
func NewSendOnlyNode(lggr logger.Logger, httpuri url.URL, name string, chainID *big.Int) SendOnlyNode
NewSendOnlyNode returns a new sendonly node
type SimulatedBackendClient ¶
type SimulatedBackendClient struct {
// contains filtered or unexported fields
}
SimulatedBackendClient is an Client implementation using a simulated blockchain backend. Note that not all RPC methods are implemented here.
func NewSimulatedBackendClient ¶
func NewSimulatedBackendClient(t testing.TB, b *backends.SimulatedBackend, chainId *big.Int) *SimulatedBackendClient
NewSimulatedBackendClient creates an eth client backed by a simulated backend.
func (*SimulatedBackendClient) BalanceAt ¶
func (c *SimulatedBackendClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt gets balance as of a specified block.
func (*SimulatedBackendClient) BatchCallContext ¶
BatchCallContext makes a batch rpc call.
func (*SimulatedBackendClient) BatchCallContextAll ¶ added in v1.3.0
BatchCallContextAll makes a batch rpc call.
func (*SimulatedBackendClient) BlockByHash ¶ added in v1.4.0
func (c *SimulatedBackendClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
BlockByNumber returns a geth block type.
func (*SimulatedBackendClient) BlockByNumber ¶
func (c *SimulatedBackendClient) BlockByNumber(ctx context.Context, n *big.Int) (*types.Block, error)
BlockByNumber returns a geth block type.
func (*SimulatedBackendClient) Call ¶
func (c *SimulatedBackendClient) Call(result interface{}, method string, args ...interface{}) error
Call makes a call.
func (*SimulatedBackendClient) CallContext ¶
func (c *SimulatedBackendClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
CallContext mocks the ethereum client RPC calls used by chainlink, copying the return value into result.
func (*SimulatedBackendClient) CallContract ¶
func (c *SimulatedBackendClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract calls a contract.
func (*SimulatedBackendClient) ChainID ¶
func (c *SimulatedBackendClient) ChainID() *big.Int
ChainID returns the ethereum ChainID.
func (*SimulatedBackendClient) Close ¶
func (c *SimulatedBackendClient) Close()
Close does nothing. We ought not close the underlying backend here since other simulated clients might still be using it
func (*SimulatedBackendClient) CodeAt ¶
func (c *SimulatedBackendClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt gets the code associated with an account as of a specified block.
func (*SimulatedBackendClient) Dial ¶
func (c *SimulatedBackendClient) Dial(context.Context) error
Dial noop for the sim.
func (*SimulatedBackendClient) EstimateGas ¶
func (c *SimulatedBackendClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
EstimateGas estimates gas for a msg.
func (*SimulatedBackendClient) FilterLogs ¶
func (c *SimulatedBackendClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
FilterLogs returns all logs that respect the passed filter query.
func (*SimulatedBackendClient) GetERC20Balance ¶
func (c *SimulatedBackendClient) GetERC20Balance(address common.Address, contractAddress common.Address) (balance *big.Int, err error)
GetERC20Balance returns the balance of the given address for the token contract address.
func (*SimulatedBackendClient) GetEthBalance ¶
func (c *SimulatedBackendClient) GetEthBalance(ctx context.Context, account common.Address, blockNumber *big.Int) (*assets.Eth, error)
GetEthBalance helper to get eth balance
func (*SimulatedBackendClient) GetLINKBalance ¶
func (c *SimulatedBackendClient) GetLINKBalance(linkAddress common.Address, address common.Address) (*assets.Link, error)
GetLINKBalance get link balance.
func (*SimulatedBackendClient) HeadByNumber ¶
func (c *SimulatedBackendClient) HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error)
HeadByNumber returns our own header type.
func (*SimulatedBackendClient) HeaderByNumber ¶
func (c *SimulatedBackendClient) HeaderByNumber(ctx context.Context, n *big.Int) (*types.Header, error)
HeaderByNumber returns the geth header type.
func (*SimulatedBackendClient) NodeStates ¶ added in v1.3.0
func (c *SimulatedBackendClient) NodeStates() map[int32]string
NodeStates implements evmclient.Client
func (*SimulatedBackendClient) NonceAt ¶
func (c *SimulatedBackendClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt gets nonce as of a specified block.
func (*SimulatedBackendClient) PendingCodeAt ¶
func (c *SimulatedBackendClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
PendingCodeAt gets the latest code.
func (*SimulatedBackendClient) PendingNonceAt ¶
func (c *SimulatedBackendClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
PendingNonceAt gets pending nonce i.e. mempool nonce.
func (*SimulatedBackendClient) SendTransaction ¶
func (c *SimulatedBackendClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
SendTransaction sends a transaction.
func (*SimulatedBackendClient) SubscribeFilterLogs ¶
func (c *SimulatedBackendClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, channel chan<- types.Log) (ethereum.Subscription, error)
SubscribeFilterLogs registers a subscription for push notifications of logs from a given address.
func (*SimulatedBackendClient) SubscribeNewHead ¶
func (c *SimulatedBackendClient) SubscribeNewHead( ctx context.Context, channel chan<- *evmtypes.Head, ) (ethereum.Subscription, error)
SubscribeNewHead registers a subscription for push notifications of new blocks. Note the sim's API only accepts types.Head so we have this goroutine to convert those into evmtypes.Head.
func (*SimulatedBackendClient) SuggestGasPrice ¶
SuggestGasPrice recommends a gas price.
func (*SimulatedBackendClient) SuggestGasTipCap ¶
SuggestGasTipCap suggests a gas tip cap.
func (*SimulatedBackendClient) TransactionReceipt ¶
func (c *SimulatedBackendClient) TransactionReceipt(ctx context.Context, receipt common.Hash) (*types.Receipt, error)
TransactionReceipt returns the transaction receipt for the given transaction hash.
type Subscription ¶
type Subscription interface { Err() <-chan error Unsubscribe() }
This interface only exists so that we can generate a mock for it. It is identical to `ethereum.Subscription`.