Documentation ¶
Index ¶
- func DefaultQueryCtx(ctxs ...context.Context) (ctx context.Context, cancel context.CancelFunc)
- func MustGetABI(json string) abi.ABI
- func NewClient(rpcUrl string, secondaryRPCURLs ...url.URL) (*client, error)
- func NewClientWith(rpcClient RPCClient, gethClient GethClient) *client
- type CallArgs
- type Client
- type GethClient
- type MaybeHeader
- 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) 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(ctx context.Context) (*big.Int, error)
- func (nc *NullClient) Close()
- func (nc *NullClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (nc *NullClient) Dial(ctx 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) HeaderByNumber(ctx context.Context, n *big.Int) (*models.Head, 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) RoundRobinBatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (nc *NullClient) SendRawTx(bytes []byte) (common.Hash, 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<- *models.Head) (ethereum.Subscription, error)
- func (nc *NullClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (nc *NullClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type RPCClient
- type SendError
- func (s *SendError) Error() string
- func (s *SendError) Fatal() 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) StrPtr() *string
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultQueryCtx ¶
DefaultQueryCtx returns a context with a sensible sanity limit timeout for queries to the eth node
func MustGetABI ¶
func NewClientWith ¶
func NewClientWith(rpcClient RPCClient, gethClient GethClient) *client
This alternate constructor exists for testing purposes.
Types ¶
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 { GethClient Dial(ctx context.Context) error Close() 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) SendRawTx(bytes []byte) (common.Hash, error) 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 RoundRobinBatchCallContext(ctx context.Context, b []rpc.BatchElem) error // These methods are reimplemented 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. HeaderByNumber(ctx context.Context, n *big.Int) (*models.Head, error) SubscribeNewHead(ctx context.Context, ch chan<- *models.Head) (ethereum.Subscription, error) }
Client is the interface used to interact with an ethereum node.
type GethClient ¶
type GethClient interface { ChainID(ctx context.Context) (*big.Int, 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) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) BlockByNumber(ctx context.Context, number *big.Int) (*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) }
GethClient is an interface that represents go-ethereum's own ethclient https://github.com/ethereum/go-ethereum/blob/master/ethclient/ethclient.go
type MaybeHeader ¶
type NullClient ¶
type NullClient struct{}
NullClient satisfies the Client but has no side effects
func (*NullClient) BatchCallContext ¶
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) Close ¶
func (nc *NullClient) Close()
func (*NullClient) EstimateGas ¶
func (*NullClient) FilterLogs ¶
func (nc *NullClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
func (*NullClient) GetERC20Balance ¶
func (*NullClient) GetEthBalance ¶
func (*NullClient) GetLINKBalance ¶
func (*NullClient) HeaderByNumber ¶
func (*NullClient) PendingCodeAt ¶
func (*NullClient) PendingNonceAt ¶
func (*NullClient) RoundRobinBatchCallContext ¶
func (*NullClient) SendTransaction ¶
func (nc *NullClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
func (*NullClient) SubscribeFilterLogs ¶
func (nc *NullClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
func (*NullClient) SubscribeNewHead ¶
func (nc *NullClient) SubscribeNewHead(ctx context.Context, ch chan<- *models.Head) (ethereum.Subscription, error)
func (*NullClient) SuggestGasPrice ¶
func (*NullClient) TransactionReceipt ¶
type RPCClient ¶
type RPCClient interface { 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 EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (ethereum.Subscription, error) Close() }
RPCClient is an interface that represents go-ethereum's own rpc.Client. https://github.com/ethereum/go-ethereum/blob/master/rpc/client.go
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 NewFatalSendErrorS ¶
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) 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
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`.