Documentation ¶
Overview ¶
Package gethclient provides an RPC client for geth-specific APIs.
Index ¶
- type AccountResult
- type BlockOverrides
- type Client
- func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int, ...) ([]byte, error)
- func (ec *Client) CallContractWithBlockOverrides(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int, ...) ([]byte, error)
- func (ec *Client) CreateAccessList(ctx context.Context, msg ethereum.CallMsg) (*types.AccessList, uint64, string, error)
- func (ec *Client) GCStats(ctx context.Context) (*debug.GCStats, error)
- func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []string, ...) (*AccountResult, error)
- func (ec *Client) MemStats(ctx context.Context) (*runtime.MemStats, error)
- func (ec *Client) SetHead(ctx context.Context, number *big.Int) error
- func (ec *Client) SubscribeFullPendingTransactions(ctx context.Context, ch chan<- *types.Transaction) (*rpc.ClientSubscription, error)
- func (ec *Client) SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error)
- type OverrideAccount
- type StorageResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountResult ¶
type AccountResult struct { Address common.Address `json:"address"` AccountProof []string `json:"accountProof"` Balance *big.Int `json:"balance"` CodeHash common.Hash `json:"codeHash"` Nonce uint64 `json:"nonce"` StorageHash common.Hash `json:"storageHash"` StorageProof []StorageResult `json:"storageProof"` }
AccountResult is the result of a GetProof operation.
type BlockOverrides ¶ added in v1.26.0
type BlockOverrides struct { // Number overrides the block number. Number *big.Int // Difficulty overrides the block difficulty. Difficulty *big.Int // Time overrides the block timestamp. Time is applied only when // it is non-zero. Time uint64 // GasLimit overrides the block gas limit. GasLimit is applied only when // it is non-zero. GasLimit uint64 // Coinbase overrides the block coinbase. Coinbase is applied only when // it is different from the zero address. Coinbase common.Address // Random overrides the block extra data which feeds into the RANDOM opcode. // Random is applied only when it is a non-zero hash. Random common.Hash // BaseFee overrides the block base fee. BaseFee *big.Int }
BlockOverrides specifies the set of header fields to override.
func (BlockOverrides) MarshalJSON ¶ added in v1.26.0
func (o BlockOverrides) MarshalJSON() ([]byte, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around rpc.Client that implements geth-specific functionality.
If you want to use the standardized Ethereum RPC functionality, use ethclient.Client instead.
func (*Client) CallContract ¶
func (ec *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int, overrides *map[common.Address]OverrideAccount) ([]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.
overrides specifies a map of contract states that should be overwritten before executing the message call. Please use ethclient.CallContract instead if you don't need the override functionality.
func (*Client) CallContractWithBlockOverrides ¶ added in v1.26.0
func (ec *Client) CallContractWithBlockOverrides(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int, overrides *map[common.Address]OverrideAccount, blockOverrides BlockOverrides) ([]byte, error)
CallContractWithBlockOverrides 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.
overrides specifies a map of contract states that should be overwritten before executing the message call.
blockOverrides specifies block fields exposed to the EVM that can be overridden for the call.
Please use ethclient.CallContract instead if you don't need the override functionality.
func (*Client) CreateAccessList ¶
func (ec *Client) CreateAccessList(ctx context.Context, msg ethereum.CallMsg) (*types.AccessList, uint64, string, error)
CreateAccessList tries to create an access list for a specific transaction based on the current pending state of the blockchain.
func (*Client) GetProof ¶
func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []string, blockNumber *big.Int) (*AccountResult, error)
GetProof returns the account and storage values of the specified account including the Merkle-proof. The block number can be nil, in which case the value is taken from the latest known block.
func (*Client) SetHead ¶
SetHead sets the current head of the local chain by block number. Note, this is a destructive action and may severely damage your chain. Use with extreme caution.
func (*Client) SubscribeFullPendingTransactions ¶ added in v1.26.0
func (ec *Client) SubscribeFullPendingTransactions(ctx context.Context, ch chan<- *types.Transaction) (*rpc.ClientSubscription, error)
SubscribeFullPendingTransactions subscribes to new pending transactions.
func (*Client) SubscribePendingTransactions ¶
func (ec *Client) SubscribePendingTransactions(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error)
SubscribePendingTransactions subscribes to new pending transaction hashes.
type OverrideAccount ¶
type OverrideAccount struct { // Nonce sets nonce of the account. Note: the nonce override will only // be applied when it is set to a non-zero value. Nonce uint64 // Code sets the contract code. The override will be applied // when the code is non-nil, i.e. setting empty code is possible // using an empty slice. Code []byte // Balance sets the account balance. Balance *big.Int // State sets the complete storage. The override will be applied // when the given map is non-nil. Using an empty map wipes the // entire contract storage during the call. State map[common.Hash]common.Hash // StateDiff allows overriding individual storage slots. StateDiff map[common.Hash]common.Hash }
OverrideAccount specifies the state of an account to be overridden.
func (OverrideAccount) MarshalJSON ¶ added in v1.26.0
func (a OverrideAccount) MarshalJSON() ([]byte, error)