Documentation ¶
Index ¶
- Constants
- Variables
- func GetPublicRPCURLs(chainID int) ([]string, error)
- type Client
- func (ec *Client) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (ec *Client) BlockNumber(ctx context.Context) (uint64, error)
- func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) ChainID(ctx context.Context) (*big.Int, error)
- func (ec *Client) Client() RPCClient
- func (ec *Client) Close()
- func (ec *Client) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (ec *Client) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (ec *Client) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (ec *Client) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type JSONError
- type RPCClient
- type RPCClientModifiable
- type RPCClientMultiple
- func (c *RPCClientMultiple) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *RPCClientMultiple) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *RPCClientMultiple) Close()
- func (c *RPCClientMultiple) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
- func (c *RPCClientMultiple) GetURLs() []string
- func (c *RPCClientMultiple) SetURLs(urls []string) error
- type RPCClientStoreEnv
- type RPCClientStoreKeychain
- type RPCEndpointsPersister
Constants ¶
const (
ETH_NODE_URL_KEY = "eth-node-url"
)
Variables ¶
var ErrEnvRPCSet = errors.New("cannot set rpc url when using env store, switch to keychain store by removing ETH_NODE_URL env var")
var ErrNotSupportedChain = fmt.Errorf("chain is not supported")
Functions ¶
func GetPublicRPCURLs ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines typed wrappers for the Ethereum RPC API.
func (*Client) BalanceAt ¶
func (ec *Client) 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 (*Client) BlockNumber ¶
BlockNumber returns the most recent block number
func (*Client) CallContract ¶
func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.
blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.
func (*Client) CodeAt ¶
func (ec *Client) CodeAt(ctx context.Context, account common.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 known block.
func (*Client) EstimateGas ¶
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 (*Client) FilterLogs ¶
FilterLogs executes a filter query.
func (*Client) HeaderByNumber ¶
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*Client) PendingCodeAt ¶
PendingCodeAt returns the contract code of the given account in the pending state.
func (*Client) PendingNonceAt ¶
PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.
func (*Client) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*Client) SubscribeFilterLogs ¶
func (ec *Client) 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 (*Client) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*Client) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to allow a timely execution of a transaction.
type RPCClientModifiable ¶
type RPCClientMultiple ¶
type RPCClientMultiple struct {
// contains filtered or unexported fields
}
Wrapper around multiple RPC clients, used to retry calls on multiple endpoints
func NewRPCClientMultiple ¶
func NewRPCClientMultiple(urls []string, log lib.ILogger) (*RPCClientMultiple, error)
func (*RPCClientMultiple) BatchCallContext ¶
func (*RPCClientMultiple) CallContext ¶
func (c *RPCClientMultiple) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
func (*RPCClientMultiple) Close ¶
func (c *RPCClientMultiple) Close()
func (*RPCClientMultiple) EthSubscribe ¶
func (c *RPCClientMultiple) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (*rpc.ClientSubscription, error)
func (*RPCClientMultiple) GetURLs ¶
func (c *RPCClientMultiple) GetURLs() []string
func (*RPCClientMultiple) SetURLs ¶
func (c *RPCClientMultiple) SetURLs(urls []string) error
type RPCClientStoreEnv ¶
type RPCClientStoreEnv struct {
// contains filtered or unexported fields
}
func (*RPCClientStoreEnv) GetClient ¶
func (p *RPCClientStoreEnv) GetClient() RPCClient
func (*RPCClientStoreEnv) GetURLs ¶
func (p *RPCClientStoreEnv) GetURLs() []string
func (*RPCClientStoreEnv) RemoveURLs ¶
func (p *RPCClientStoreEnv) RemoveURLs() error
func (*RPCClientStoreEnv) SetURLs ¶
func (p *RPCClientStoreEnv) SetURLs(urls []string) error
type RPCClientStoreKeychain ¶
type RPCClientStoreKeychain struct {
// contains filtered or unexported fields
}
func NewRPCClientStoreKeychain ¶
func NewRPCClientStoreKeychain(storage interfaces.KeyValueStorage, rpcClient RPCClientModifiable, log lib.ILogger) *RPCClientStoreKeychain
func (*RPCClientStoreKeychain) GetClient ¶
func (p *RPCClientStoreKeychain) GetClient() RPCClient
func (*RPCClientStoreKeychain) GetURLs ¶
func (p *RPCClientStoreKeychain) GetURLs() []string
func (*RPCClientStoreKeychain) RemoveURLs ¶
func (p *RPCClientStoreKeychain) RemoveURLs() error
func (*RPCClientStoreKeychain) SetURLs ¶
func (p *RPCClientStoreKeychain) SetURLs(urls []string) error
type RPCEndpointsPersister ¶
type RPCEndpointsPersister interface { GetURLs() []string SetURLs(urls []string) error RemoveURLs() error GetClient() RPCClient }
func ConfigureRPCClientStore ¶
func ConfigureRPCClientStore(storage interfaces.KeyValueStorage, envURLs []string, chainID int, log lib.ILogger) (RPCEndpointsPersister, error)